EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Server Code Submissions (https://www.eqemulator.org/forums/forumdisplay.php?f=669)
-   -   Critical Affliction AA (https://www.eqemulator.org/forums/showthread.php?t=26501)

seveianrex 10-12-2008 09:39 PM

Critical Affliction AA
 
{spell_effects.cpp}

~ line 2671, in Mob::DoBuffTic, there should be this set of code:

Code:

                        //TODO: account for AAs and stuff

                        //dont know what the signon this should be... - makes sense
                        if (caster && caster->IsClient() &&
                                IsDetrimentalSpell(spell_id) &&
                                effect_value < 0) {

                                sint32 modifier = 100;
                                modifier += caster->CastToClient()->GetFocusEffect(focusImprovedDamage, spell_id);

                                if(caster){
                                        if(caster->IsClient() && !caster->CastToClient()->GetFeigned()){
                                                AddToHateList(caster, -effect_value);
                                        }
                                        else if(!caster->IsClient())
                                                AddToHateList(caster, -effect_value);
                                }

                                effect_value = effect_value * modifier / 100;

Insert directly underneath the last line:

Code:

// 2008-10-12 seveian
                                float critChance = 0.00f;

                                switch(GetAA(aaCriticalAffliction))
                                {
                                        case 1:
                                                critChance += 0.03f;
                                                break;
                                        case 2:
                                                critChance += 0.06f;
                                                break;
                                        case 3:
                                                critChance += 0.10f;
                                                break;
                                        default:
                                                break;
                                }

                                switch (GetAA(aaImprovedCriticalAffliction))
                                {
                                        case 1:
                                                critChance += 0.03f;
                                                break;
                                        case 2:
                                                critChance += 0.06f;
                                                break;
                                        case 3:
                                                critChance += 0.10f;
                                                break;
                                        default:
                                                break;
                                }

                                // since DOTs are the Necromancer forte, give an innate bonus
                                // however, no chance to crit unless they've trained atleast one level in the AA first
                                if (GetClass() == NECROMANCER && critChance > 0.0f){
                                        critChance += 0.05f;
                                }

                                if (critChance > 0.0f){
                                        if (MakeRandomFloat(0, 1) <= critChance)
                                        {
                                                effect_value = (effect_value * 2);
                                        }
                                }


KLS 10-12-2008 10:58 PM

Would make this section a little messy, might be a good candidate for it's own function.

seveianrex 10-12-2008 11:02 PM

Okay. I'll do up a TryCriticalDOT function then. Stand by.

seveianrex 10-12-2008 11:17 PM

Revised Version
 
{mob.h}
line 591, currently reads:
Code:

void        WakeTheDead(int16 spell_id, Mob *target, uint32 duration);
add directly below:
Code:

bool        TryCriticalDOT(int16 spell_id);
{spell_effects.cpp}
@~ line 2671, there should be the following code:
Code:

                        //TODO: account for AAs and stuff

                        //dont know what the signon this should be... - makes sense
                        if (caster && caster->IsClient() &&
                                IsDetrimentalSpell(spell_id) &&
                                effect_value < 0) {

                                sint32 modifier = 100;
                                modifier += caster->CastToClient()->GetFocusEffect(focusImprovedDamage, spell_id);

                                if(caster){
                                        if(caster->IsClient() && !caster->CastToClient()->GetFeigned()){
                                                AddToHateList(caster, -effect_value);
                                        }
                                        else if(!caster->IsClient())
                                                AddToHateList(caster, -effect_value);
                                }

                                effect_value = effect_value * modifier / 100;

add directly beneath it:
Code:

                                // 2008-10-12 seveian
                                if (TryCriticalDOT(spell_id))
                                {
                                        effect_value = (effect_value * 2);
                                }



can be placed anywhere in the same file:
Code:

// 2008-10-12 seveian
bool Mob::TryCriticalDOT(int16 spell_id)
{
        float critChance = 0.00f;

        switch(GetAA(aaCriticalAffliction))
        {
                case 1:
                        critChance += 0.03f;
                        break;
                case 2:
                        critChance += 0.06f;
                        break;
                case 3:
                        critChance += 0.10f;
                        break;
                default:
                        break;
        }

        switch (GetAA(aaImprovedCriticalAffliction))
        {
                case 1:
                        critChance += 0.03f;
                        break;
                case 2:
                        critChance += 0.06f;
                        break;
                case 3:
                        critChance += 0.10f;
                        break;
                default:
                        break;
        }

        // since DOTs are the Necromancer forte, give an innate bonus
        // however, no chance to crit unless they've trained atleast one level in the AA first
        if (GetClass() == NECROMANCER && critChance > 0.0f){
                critChance += 0.05f;
        }

        if (critChance > 0.0f){
                if (MakeRandomFloat(0, 1) <= critChance)
                {
                        return true;
                }
        }

        return false;
}


paaco 10-12-2008 11:20 PM

Man you work quick, and that's definitely a nice addition. Critical Affliction is a pretty huge skill for Dot casters in EQ. Great job man, hope to see more stuff like this.

janusd 10-22-2008 03:05 PM

Getting reports from PEQ that this isn't working. Personally, I have yet to see a critical DoT happen.

AndMetal 10-22-2008 07:20 PM

I just tried this myself and had the same issue. Test conditions:

70 Shaman with 3 points of Critical Affliction & 3 points of Improved Critical Affliction (20% chance).
Cast Sicken.

I cast it 6 times, and out of the 8 time I cast it (15 ticks over time), not once did I get anything more than the standard 5 damage.

I'd dig deeper, but I guess Tallon/Vallon Zek is down or something, so there's several people on my server atm, so I can't insert some code & compile to debug it, lol.

AndMetal 10-22-2008 07:33 PM

Actually, after taking a 10th look at the code, I think I know what went wrong:
Code:

void Mob::TryDotCritical(int16 spell_id, Mob *caster, int &damage)
{
        if(!caster)
                return;

        float critChance = 0.00f;

        switch(GetAA(aaCriticalAffliction))
        {
                case 1:
                        critChance += 0.03f;
                        break;
                case 2:
                        critChance += 0.06f;
                        break;
                case 3:
                        critChance += 0.10f;
                        break;
                default:
                        break;
        }

        switch (GetAA(aaImprovedCriticalAffliction))
        {
                case 1:
                        critChance += 0.03f;
                        break;
                case 2:
                        critChance += 0.06f;
                        break;
                case 3:
                        critChance += 0.10f;
                        break;
                default:
                        break;
        }

        // since DOTs are the Necromancer forte, give an innate bonus
        // however, no chance to crit unless they've trained atleast one level in the AA first
        if (GetClass() == NECROMANCER && critChance > 0.0f){
                critChance += 0.05f;
        }

        if (critChance > 0.0f){
                if (MakeRandomFloat(0, 1) <= critChance)
                {
                        damage *= 2;
                }
        }
}

We're basically looking at this, which is going the be the Mob affected by the spell, not the caster. Should just have to add caster-> to the beginnings of those, and they should look at the right Mob.

I just compiled & tested, and DoTs now crit.

KLS 10-22-2008 09:02 PM

Yeah I already found the problem yesterday just haven't committed it cause I wanted to do some other stuff first. Anyone else is free to~

AndMetal 10-22-2008 09:12 PM

I'll probably get it in addition to a few other tweaks (including shared bank plat, woohoo!) here in a few minutes.

cavedude 10-22-2008 09:22 PM

Quote:

Originally Posted by AndMetal (Post 158881)
including shared bank plat

A lot of people are going to want to kiss you, men too. Fair warning.

AndMetal 10-22-2008 09:53 PM

Don't thank me, thank Theeper :-)


All times are GMT -4. The time now is 02:04 AM.

Powered by vBulletin®, Copyright ©2000 - 2025, Jelsoft Enterprises Ltd.