From 05de206aceb51ebbbf9a9b2232bd7ac74e0747c0 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 3 Jan 2016 01:58:37 -0500 Subject: [PATCH] Rework quiver haste --- common/ruletypes.h | 2 +- zone/attack.cpp | 29 ++++++++++++++++------------- zone/client.cpp | 22 ++++++++++------------ zone/client.h | 2 +- 4 files changed, 28 insertions(+), 27 deletions(-) diff --git a/common/ruletypes.h b/common/ruletypes.h index 41e4e22a4..493bb8ca6 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -450,7 +450,7 @@ RULE_REAL (Combat,TauntSkillFalloff, 0.33)//For every taunt skill point that's n RULE_BOOL (Combat,EXPFromDmgShield, false) //Determine if damage from a damage shield counts for EXP gain. RULE_INT(Combat, MonkACBonusWeight, 15) RULE_INT(Combat, ClientStunLevel, 55) //This is the level where client kicks and bashes can stun the target -RULE_INT(Combat, QuiverWRHasteDiv, 3) //Weight Reduction is divided by this to get haste contribution for quivers +RULE_INT(Combat, QuiverHasteCap, 1000) //Quiver haste cap 1000 on live for a while, currently 700 on live RULE_BOOL(Combat, UseArcheryBonusRoll, false) //Make the 51+ archery bonus require an actual roll RULE_INT(Combat, ArcheryBonusChance, 50) RULE_INT(Combat, BerserkerFrenzyStart, 35) diff --git a/zone/attack.cpp b/zone/attack.cpp index ad5be845a..accb7beff 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4649,28 +4649,31 @@ void Client::SetAttackTimer() int hhe = itembonuses.HundredHands + spellbonuses.HundredHands; int speed = 0; - int delay = 36; - float quiver_haste = 0.0f; + int delay = 3600; //if we have no weapon.. if (ItemToUse == nullptr) { //above checks ensure ranged weapons do not fall into here // Work out if we're a monk if (GetClass() == MONK || GetClass() == BEASTLORD) - delay = GetMonkHandToHandDelay(); + delay = 100 * GetMonkHandToHandDelay(); } else { //we have a weapon, use its delay - delay = ItemToUse->Delay; - if (ItemToUse->ItemType == ItemTypeBow || ItemToUse->ItemType == ItemTypeLargeThrowing) - quiver_haste = GetQuiverHaste(); + delay = 100 * ItemToUse->Delay; + } + + speed = delay / haste_mod; + + if (ItemToUse && ItemToUse->ItemType == ItemTypeBow) { + // Live actually had a bug here where they would return the non-modified attack speed + // rather than the cap ... + speed = std::max(speed - GetQuiverHaste(speed), RuleI(Combat, QuiverHasteCap)); + } else { + if (RuleB(Spells, Jun182014HundredHandsRevamp)) + speed = static_cast(speed + ((hhe / 1000.0f) * speed)); + else + speed = static_cast(speed + ((hhe / 100.0f) * delay)); } - if (RuleB(Spells, Jun182014HundredHandsRevamp)) - speed = static_cast(((delay / haste_mod) + ((hhe / 1000.0f) * (delay / haste_mod))) * 100); - else - speed = static_cast(((delay / haste_mod) + ((hhe / 100.0f) * delay)) * 100); - // this is probably wrong - if (quiver_haste > 0) - speed *= quiver_haste; TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true, true); } } diff --git a/zone/client.cpp b/zone/client.cpp index ccf561306..ceedf19d7 100644 --- a/zone/client.cpp +++ b/zone/client.cpp @@ -8356,21 +8356,19 @@ void Client::ShowNumHits() return; } -float Client::GetQuiverHaste() +int Client::GetQuiverHaste(int delay) { - float quiver_haste = 0; + const ItemInst *pi = nullptr; for (int r = EmuConstants::GENERAL_BEGIN; r <= EmuConstants::GENERAL_END; r++) { - const ItemInst *pi = GetInv().GetItem(r); - if (!pi) - continue; - if (pi->IsType(ItemClassContainer) && pi->GetItem()->BagType == BagTypeQuiver) { - float temp_wr = (pi->GetItem()->BagWR / RuleI(Combat, QuiverWRHasteDiv)); - quiver_haste = std::max(temp_wr, quiver_haste); - } + pi = GetInv().GetItem(r); + if (pi && pi->IsType(ItemClassContainer) && pi->GetItem()->BagType == BagTypeQuiver && + pi->GetItem()->BagWR > 0) + break; + if (r == EmuConstants::GENERAL_END) + // we will get here if we don't find a valid quiver + return 0; } - if (quiver_haste > 0) - quiver_haste = 1.0f / (1.0f + static_cast(quiver_haste) / 100.0f); - return quiver_haste; + return (pi->GetItem()->BagWR * 0.0025f * delay) + 1; } void Client::SendColoredText(uint32 color, std::string message) diff --git a/zone/client.h b/zone/client.h index 6db22c5b0..bc2f89b87 100644 --- a/zone/client.h +++ b/zone/client.h @@ -226,7 +226,7 @@ public: virtual inline bool IsBerserk() { return berserk; } virtual int32 GetMeleeMitDmg(Mob *attacker, int32 damage, int32 minhit, float mit_rating, float atk_rating); virtual void SetAttackTimer(); - float GetQuiverHaste(); + int GetQuiverHaste(int delay); void DoAttackRounds(Mob *target, int hand, bool IsFromSpell = false); void AI_Init();