From 22efe33f9b22aceaa8a2083adb80195ad51f86fd Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 5 Jul 2015 02:05:50 -0400 Subject: [PATCH] Correct the definition of "quading" If you would like your NPCs to use the old rules, turn Combat:UseLiveCombatRounds to false. --- common/ruletypes.h | 1 + zone/attack.cpp | 52 ++++++++++++++++++++++++++-------------------- 2 files changed, 30 insertions(+), 23 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 6a52b1e78..8613eeebe 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -448,6 +448,7 @@ RULE_BOOL(Combat, OneProcPerWeapon, true) //If enabled, One proc per weapon per RULE_BOOL(Combat, ProjectileDmgOnImpact, true) //If enabled, projectiles (ie arrows) will hit on impact, instead of instantly. RULE_BOOL(Combat, MeleePush, true) // enable melee push RULE_INT(Combat, MeleePushChance, 50) // (NPCs) chance the target will be pushed. Made up, 100 actually isn't that bad +RULE_BOOL(Combat, UseLiveCombatRounds, true) // turn this false if you don't want to worry about fixing up combat rounds for NPCs RULE_CATEGORY_END() RULE_CATEGORY(NPC) diff --git a/zone/attack.cpp b/zone/attack.cpp index 1ca596016..4f8ca4a53 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -5120,6 +5120,18 @@ bool Client::CheckDualWield() void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts) { + if (!target) + return; + + if (RuleB(Combat, UseLiveCombatRounds)) { + // A "quad" on live really is just a successful dual wield where both double attack + // The mobs that could triple lost the ability to when the triple attack skill was added in + Attack(target, MainPrimary, false, false, false, opts); + if (CanThisClassDoubleAttack() && CheckDoubleAttack()) + Attack(target, MainPrimary, false, false, false, opts); + return; + } + if (IsNPC()) { int16 n_atk = CastToNPC()->GetNumberOfAttacks(); if (n_atk <= 1) { @@ -5133,26 +5145,23 @@ void Mob::DoMainHandAttackRounds(Mob *target, ExtraAttackOptions *opts) Attack(target, MainPrimary, false, false, false, opts); } - if (target) { - // we use this random value in three comparisons with different - // thresholds, and if its truely random, then this should work - // out reasonably and will save us compute resources. - int32 RandRoll = zone->random.Int(0, 99); - if ((CanThisClassDoubleAttack() || GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD)) - // check double attack, this is NOT the same rules that clients use... - && - RandRoll < (GetLevel() + NPCDualAttackModifier)) { + // we use this random value in three comparisons with different + // thresholds, and if its truely random, then this should work + // out reasonably and will save us compute resources. + int32 RandRoll = zone->random.Int(0, 99); + if ((CanThisClassDoubleAttack() || GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD)) + // check double attack, this is NOT the same rules that clients use... + && + RandRoll < (GetLevel() + NPCDualAttackModifier)) { + Attack(target, MainPrimary, false, false, false, opts); + // lets see if we can do a triple attack with the main hand + // pets are excluded from triple and quads... + if ((GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD)) && !IsPet() && + RandRoll < (GetLevel() + NPCTripleAttackModifier)) { Attack(target, MainPrimary, false, false, false, opts); - // lets see if we can do a triple attack with the main hand - // pets are excluded from triple and quads... - if ((GetSpecialAbility(SPECATK_TRIPLE) || GetSpecialAbility(SPECATK_QUAD)) && !IsPet() && - RandRoll < (GetLevel() + NPCTripleAttackModifier)) { + // now lets check the quad attack + if (GetSpecialAbility(SPECATK_QUAD) && RandRoll < (GetLevel() + NPCQuadAttackModifier)) { Attack(target, MainPrimary, false, false, false, opts); - // now lets check the quad attack - if (GetSpecialAbility(SPECATK_QUAD) && - RandRoll < (GetLevel() + NPCQuadAttackModifier)) { - Attack(target, MainPrimary, false, false, false, opts); - } } } } @@ -5166,11 +5175,8 @@ void Mob::DoOffHandAttackRounds(Mob *target, ExtraAttackOptions *opts) if (GetSpecialAbility(SPECATK_INNATE_DW) || GetEquipment(MaterialSecondary) != 0) { if (CheckDualWield()) { Attack(target, MainSecondary, false, false, false, opts); - if (CanThisClassDoubleAttack() && GetLevel() > 35) { - if (CheckDoubleAttack()) { - Attack(target, MainSecondary, false, false, false, opts); - } - } + if (CanThisClassDoubleAttack() && GetLevel() > 35 && CheckDoubleAttack()) + Attack(target, MainSecondary, false, false, false, opts); } } }