From 66c171b61bc8319e2e6f9aced76274cca5e9fef4 Mon Sep 17 00:00:00 2001 From: "Michael Cook (mackal)" Date: Sun, 28 Sep 2014 13:27:38 -0400 Subject: [PATCH] Add support for post June 18, 2014 Hundred Hands effects Set Spells:Jun182014HundredHandsRevamp to true if your spell file is newer --- changelog.txt | 4 ++++ common/ruletypes.h | 1 + .../2014_09_28_NewHundredHandsEffect.sql | 1 + zone/attack.cpp | 16 +++++++++++----- zone/bot.cpp | 7 +++++-- 5 files changed, 22 insertions(+), 7 deletions(-) create mode 100644 utils/sql/git/optional/2014_09_28_NewHundredHandsEffect.sql diff --git a/changelog.txt b/changelog.txt index 5b8d0cf9b..4657226a2 100644 --- a/changelog.txt +++ b/changelog.txt @@ -1,5 +1,9 @@ EQEMu Changelog (Started on Sept 24, 2003 15:50) ------------------------------------------------------- +== 09/28/2014 == +demonstar55: Add support for post June 18, 2014 Hundred Hands Effect spells (they changed the formula and stuff) +set Spells:Jun182014HundredHandsRevamp to true if you're using a spell file from June 18, 2014+ + == 09/27/2014 == Kayen: Implemented perl function $mob->GetSpellStat(spell_id, identifier, slot); Note: identifier is the stat field in spells_new, slot is used for certain effects like effectid, base,base2, max ect. diff --git a/common/ruletypes.h b/common/ruletypes.h index 058d5ce6f..c5004ffd1 100644 --- a/common/ruletypes.h +++ b/common/ruletypes.h @@ -322,6 +322,7 @@ RULE_INT ( Spells, AI_IdleNoSpellMinRecast, 500) // AI spell recast time(MS) che RULE_INT ( Spells, AI_IdleNoSpellMaxRecast, 2000) // AI spell recast time(MS) check when no spell is cast while chasing target. (max time in random) RULE_INT ( Spells, AI_IdleBeneficialChance, 100) // Chance while idle to do a beneficial spell on self or others. RULE_BOOL ( Spells, SHDProcIDOffByOne, true) // pre June 2009 SHD spell procs were off by 1, they stopped doing this in June 2009 (so UF+ spell files need this false) +RULE_BOOL ( Spells, Jun182014HundredHandsRevamp, false) // this should be true for if you import a spell file newer than June 18, 2014 RULE_CATEGORY_END() diff --git a/utils/sql/git/optional/2014_09_28_NewHundredHandsEffect.sql b/utils/sql/git/optional/2014_09_28_NewHundredHandsEffect.sql new file mode 100644 index 000000000..2c5acb205 --- /dev/null +++ b/utils/sql/git/optional/2014_09_28_NewHundredHandsEffect.sql @@ -0,0 +1 @@ +INSERT INTO `rule_values` (`ruleset_id`, `rule_name`, `rule_value`, `notes`) VALUES (1, 'Spells:Jun182014HundredHandsRevamp', 'false', 'Set this to true if your spell file is from after June 18, 2014.'); diff --git a/zone/attack.cpp b/zone/attack.cpp index 076eedf89..feb10369f 100644 --- a/zone/attack.cpp +++ b/zone/attack.cpp @@ -4825,7 +4825,6 @@ void Mob::CommonBreakInvisible() * Difference -0.004444444 -0.005555556 -0.006666667 -0.008222222 * * These times are in 10th of a second - * New formula currently unsupported */ void Mob::SetAttackTimer() @@ -4900,7 +4899,7 @@ void Client::SetAttackTimer() } } - int hhe = std::max(itembonuses.HundredHands + spellbonuses.HundredHands, -99); + int hhe = itembonuses.HundredHands + spellbonuses.HundredHands; int speed = 0; int delay = 36; float quiver_haste = 0.0f; @@ -4917,7 +4916,10 @@ void Client::SetAttackTimer() if (ItemToUse->ItemType == ItemTypeBow || ItemToUse->ItemType == ItemTypeLargeThrowing) quiver_haste = GetQuiverHaste(); } - speed = static_cast(((delay / haste_mod) + ((hhe / 100.0f) * delay)) * 100); + 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; @@ -4937,13 +4939,17 @@ void NPC::SetAttackTimer() attack_timer.SetAtTrigger(4000, true); Timer *TimerToUse = nullptr; - int hhe = std::max(itembonuses.HundredHands + spellbonuses.HundredHands, -99); + int hhe = itembonuses.HundredHands + spellbonuses.HundredHands; // Technically NPCs should do some logic for weapons, but the effect is minimal // What they do is take the lower of their set delay and the weapon's // ex. Mob's delay set to 20, weapon set to 19, delay 19 // Mob's delay set to 20, weapon set to 21, delay 20 - int speed = static_cast(((attack_delay / haste_mod) + ((hhe / 100.0f) * attack_delay)) * 100); + int speed = 0; + if (RuleB(Spells, Jun182014HundredHandsRevamp)) + speed = static_cast(((attack_delay / haste_mod) + ((hhe / 1000.0f) * (attack_delay / haste_mod))) * 100); + else + speed = static_cast(((attack_delay / haste_mod) + ((hhe / 100.0f) * attack_delay)) * 100); for (int i = MainRange; i <= MainSecondary; i++) { //pick a timer diff --git a/zone/bot.cpp b/zone/bot.cpp index 2d91be28e..4102a2af6 100644 --- a/zone/bot.cpp +++ b/zone/bot.cpp @@ -9035,7 +9035,7 @@ void Bot::SetAttackTimer() { } } - int hhe = std::max(itembonuses.HundredHands + spellbonuses.HundredHands, -99); + int hhe = itembonuses.HundredHands + spellbonuses.HundredHands; int speed = 0; int delay = 36; @@ -9049,7 +9049,10 @@ void Bot::SetAttackTimer() { //we have a weapon, use its delay delay = ItemToUse->Delay; } - speed = static_cast(((delay / haste_mod) + ((hhe / 100.0f) * delay)) * 100); + 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); TimerToUse->SetAtTrigger(std::max(RuleI(Combat, MinHastedDelay), speed), true); if(i == MainPrimary)