diff --git a/zone/attack.cpp b/zone/attack.cpp index 8a120b896..86f8b8d65 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -5075,3 +5075,31 @@ void Client::DoAttackRounds(Mob *target, int hand, bool IsFromSpell) } } } + +bool Mob::CheckDualWield() +{ + // Pets /might/ follow a slightly different progression + // although it could all be from pets having different skills than most mobs + int chance = GetSkill(SkillDualWield); + if (GetLevel() > 35) + chance += GetLevel(); + + chance += aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; + int per_inc = spellbonuses.DualWieldChance + aabonuses.DualWieldChance + itembonuses.DualWieldChance; + if (per_inc) + chance += chance * per_inc / 100; + + return zone->random.Int(1, 375) <= chance; +} + +bool Client::CheckDualWield() +{ + int chance = GetSkill(SkillDualWield) + GetLevel(); + + chance += aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; + int per_inc = spellbonuses.DualWieldChance + aabonuses.DualWieldChance + itembonuses.DualWieldChance; + if (per_inc) + chance += chance * per_inc / 100; + + return zone->random.Int(1, 375) <= chance; +} diff --git a/zone/client.h b/zone/client.h index 375006536..7558d9bb6 100644 --- a/zone/client.h +++ b/zone/client.h @@ -890,6 +890,7 @@ public: void Insight(uint32 t_id); bool CheckDoubleAttack(bool tripleAttack = false); bool CheckDoubleRangedAttack(); + bool CheckDualWield(); //remove charges/multiple objects from inventory: //bool DecreaseByType(uint32 type, uint8 amt); diff --git a/zone/client_process.cpp b/zone/client_process.cpp index 7cc3f9917..70899e2d6 100644 --- a/zone/client_process.cpp +++ b/zone/client_process.cpp @@ -428,16 +428,8 @@ bool Client::Process() { //you can't see your target } else if(auto_attack_target->GetHP() > -10) { - float DualWieldProbability = 0.0f; - - int16 Ambidexterity = aabonuses.Ambidexterity + spellbonuses.Ambidexterity + itembonuses.Ambidexterity; - DualWieldProbability = (GetSkill(SkillDualWield) + GetLevel() + Ambidexterity) / 400.0f; // 78.0 max - int16 DWBonus = spellbonuses.DualWieldChance + itembonuses.DualWieldChance; - DualWieldProbability += DualWieldProbability*float(DWBonus)/ 100.0f; - - float random = zone->random.Real(0, 1); CheckIncreaseSkill(SkillDualWield, auto_attack_target, -10); - if (random < DualWieldProbability) { // Max 78% of DW + if (CheckDualWield()) { ItemInst *wpn = GetInv().GetItem(MainSecondary); TryWeaponProc(wpn, auto_attack_target, MainSecondary); diff --git a/zone/mob.h b/zone/mob.h index 6a696256f..e329128a9 100644 --- a/zone/mob.h +++ b/zone/mob.h @@ -166,6 +166,7 @@ public: void CommonOutgoingHitSuccess(Mob* defender, int32 &damage, SkillUseTypes skillInUse); void CommonBreakInvisible(); bool HasDied(); + virtual bool CheckDualWield(); //Appearance void SendLevelAppearance();