Rework quiver haste

This commit is contained in:
Michael Cook (mackal)
2016-01-03 01:58:37 -05:00
parent 28848fa913
commit 05de206ace
4 changed files with 28 additions and 27 deletions
+16 -13
View File
@@ -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<int>(speed + ((hhe / 1000.0f) * speed));
else
speed = static_cast<int>(speed + ((hhe / 100.0f) * delay));
}
if (RuleB(Spells, Jun182014HundredHandsRevamp))
speed = static_cast<int>(((delay / haste_mod) + ((hhe / 1000.0f) * (delay / haste_mod))) * 100);
else
speed = static_cast<int>(((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);
}
}
+10 -12
View File
@@ -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<float>(quiver_haste) / 100.0f);
return quiver_haste;
return (pi->GetItem()->BagWR * 0.0025f * delay) + 1;
}
void Client::SendColoredText(uint32 color, std::string message)
+1 -1
View File
@@ -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();