EQEmulator Forums

EQEmulator Forums (https://www.eqemulator.org/forums/index.php)
-   Development::Bug Reports (https://www.eqemulator.org/forums/forumdisplay.php?f=591)
-   -   Mob::AvoidDamage Math broken? (https://www.eqemulator.org/forums/showthread.php?t=37286)

NatedogEZ 09-13-2013 06:19 PM

Mob::AvoidDamage Math broken?
 
Code:

        /////////////////////////////////////////////////////////
        // riposte
        /////////////////////////////////////////////////////////
        float riposte_chance = 0.0f;
        if (CanRiposte && damage > 0 && CanThisClassRiposte() && !other->BehindMob(this, other->GetX(), other->GetY()))
        {
                riposte_chance = (100.0f + (float)defender->aabonuses.RiposteChance + (float)defender->spellbonuses.RiposteChance + (float)defender->itembonuses.RiposteChance) / 100.0f;
                skill = GetSkill(RIPOSTE);
                if (IsClient()) {
                        CastToClient()->CheckIncreaseSkill(RIPOSTE, other, -10);
                }

                if (!ghit) {        //if they are not using a garunteed hit discipline
                        bonus = 2.0 + skill/60.0 + (GetDEX()/200);
                        bonus *= riposte_chance;
                        bonus = mod_riposte_chance(bonus, attacker);
                        RollTable[0] = bonus + (itembonuses.HeroicDEX / 25); // 25 heroic = 1%, applies to ripo, parry, block
                }
        }

        ///////////////////////////////////////////////////////
        // block
        ///////////////////////////////////////////////////////

        bool bBlockFromRear = false;
        bool bShieldBlockFromRear = false;

        if (this->IsClient()) {
                int aaChance = 0;

                // a successful roll on this does not mean a successful block is forthcoming. only that a chance to block
                // from a direction other than the rear is granted.

                //Live AA - HightenedAwareness
                int BlockBehindChance = aabonuses.BlockBehind + spellbonuses.BlockBehind + itembonuses.BlockBehind;

                if (BlockBehindChance && (BlockBehindChance > MakeRandomInt(1, 100))){
                        bBlockFromRear = true;

                        if (spellbonuses.BlockBehind || itembonuses.BlockBehind)
                                bShieldBlockFromRear = true; //This bonus should allow a chance to Shield Block from behind.
                }
        }

        float block_chance = 0.0f;
        if (damage > 0 && CanThisClassBlock() && (!other->BehindMob(this, other->GetX(), other->GetY()) || bBlockFromRear)) {
                block_chance = (100.0f + (float)spellbonuses.IncreaseBlockChance + (float)itembonuses.IncreaseBlockChance) / 100.0f;
                skill = CastToClient()->GetSkill(BLOCKSKILL);
                if (IsClient()) {
                        CastToClient()->CheckIncreaseSkill(BLOCKSKILL, other, -10);
                }

                if (!ghit) {        //if they are not using a garunteed hit discipline
                        bonus = 2.0 + skill/35.0 + (GetDEX()/200);
                        bonus = mod_block_chance(bonus, attacker);
                        RollTable[1] = RollTable[0] + (bonus * block_chance);
                }
        }
        else{
                RollTable[1] = RollTable[0];
        }

        if(damage > 0 && (aabonuses.ShieldBlock || spellbonuses.ShieldBlock || itembonuses.ShieldBlock)
                && (!other->BehindMob(this, other->GetX(), other->GetY()) || bShieldBlockFromRear)) {
                bool equiped = CastToClient()->m_inv.GetItem(14);
                if(equiped) {
                        uint8 shield = CastToClient()->m_inv.GetItem(14)->GetItem()->ItemType;
                        float bonusShieldBlock = 0.0f;
                        if(shield == ItemTypeShield) {

                                //Live AA - Shield Block
                                bonusShieldBlock = aabonuses.ShieldBlock + spellbonuses.ShieldBlock + itembonuses.ShieldBlock;
                                RollTable[1] += bonusShieldBlock;
                        }
                }
        }

        if(damage > 0 && (aabonuses.TwoHandBluntBlock || spellbonuses.TwoHandBluntBlock || itembonuses.TwoHandBluntBlock)
                && (!other->BehindMob(this, other->GetX(), other->GetY()) || bShieldBlockFromRear)) {
                bool equiped2 = CastToClient()->m_inv.GetItem(13);
                if(equiped2) {
                        uint8 TwoHandBlunt = CastToClient()->m_inv.GetItem(13)->GetItem()->ItemType;
                        float bonusStaffBlock = 0.0f;
                        if(TwoHandBlunt == ItemType2HB) {

                                bonusStaffBlock = aabonuses.TwoHandBluntBlock + spellbonuses.TwoHandBluntBlock + itembonuses.TwoHandBluntBlock;
                                RollTable[1] += bonusStaffBlock;
                        }
                }
        }

        //////////////////////////////////////////////////////
        // parry
        //////////////////////////////////////////////////////
        float parry_chance = 0.0f;
        if (damage > 0 && CanThisClassParry() && !other->BehindMob(this, other->GetX(), other->GetY()))
        {
                parry_chance = (100.0f + (float)defender->spellbonuses.ParryChance + (float)defender->itembonuses.ParryChance) / 100.0f;
                skill = CastToClient()->GetSkill(PARRY);
                if (IsClient()) {
                        CastToClient()->CheckIncreaseSkill(PARRY, other, -10);
                }

                if (!ghit) {        //if they are not using a garunteed hit discipline
                        bonus = 2.0 + skill/60.0 + (GetDEX()/200);
                        bonus *= parry_chance;
                        bonus = mod_parry_chance(bonus, attacker);
                        RollTable[2] = RollTable[1] + bonus;
                }
        }
        else{
                RollTable[2] = RollTable[1];
        }

        ////////////////////////////////////////////////////////
        // dodge
        ////////////////////////////////////////////////////////
        float dodge_chance = 0.0f;
        if (damage > 0 && CanThisClassDodge() && !other->BehindMob(this, other->GetX(), other->GetY()))
        {
                dodge_chance = (100.0f + (float)defender->spellbonuses.DodgeChance + (float)defender->itembonuses.DodgeChance) / 100.0f;
                skill = CastToClient()->GetSkill(DODGE);
                if (IsClient()) {
                        CastToClient()->CheckIncreaseSkill(DODGE, other, -10);
                }

                if (!ghit) {        //if they are not using a garunteed hit discipline
                        bonus = 2.0 + skill/60.0 + (GetAGI()/200);
                        bonus *= dodge_chance;
                        //DCBOOMKAR
                        bonus = mod_dodge_chance(bonus, attacker);
                        RollTable[3] = RollTable[2] + bonus - (itembonuses.HeroicDEX / 25) + (itembonuses.HeroicAGI / 25);
                }
        }
        else{
                RollTable[3] = RollTable[2];
        }


At the TOP (red) if you CAN riposte ... heroic dexterity is added.

At the bottom (yellow) if you can dodge Heroic dexterity is removed.. even for classes that DID not get the bonus as they cannot riposte.

From testing I made a toon with pure Heroic Dexterity (necromancer) and it gave him NEGATIVE 46 percent chance to dodge!


2nd issue...
As a warrior they gain bonus to parry from Dexterity (MediumTurquoise)

That parry bonus from NORMAL dexterity is not removed for warriors when they calculate DODGE! (yellow)



Level 1 warrior with no gear... (base stats on Dark elf)
6% riposte
6% block
14% Parry
21% Dodge

Level 70 necromancer with uber stats... (also dark elf screenshot of stats)
0% riposte
0% block
0% parry
-46% dodge (Hell ya!)

http://i.imgur.com/GCv1a1J.png


I have noticed this issue before.. just never really looked into it till now.

Any way we could get a fix for this to make checks before actually removing heroic dexterity?

Kingly_Krab 09-13-2013 10:02 PM

Sexy broken code. <3 Hard minimum sounds like a good idea right about now.

KLS 09-22-2013 12:15 AM

Yeah I fixed a bunch of this kinda stuff a while back apparently didn't get it all. Someone when they went to add the heroic stats to the calcs totally screwed it all up. Will see if i can fix it when i get my next feature set it.

NatedogEZ 09-22-2013 12:56 AM

Thanks for the reply KLS I really appreciate it :)

I didn't want to try and fix this and make an ass of myself lol (since its a core mechanic)


All times are GMT -4. The time now is 06:59 PM.

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