Skip to content

Commit

Permalink
[Fix] Fix Spell Cast Time reduction issues (#1369)
Browse files Browse the repository at this point in the history
Remove the overloads that don't make sense (bots probably doesn't make
sense either, but too lazy)

Fix the formulas

Removed the Spells:MaxCastTimeReduction rule since this is HARDCODED in
the client so it doesn't really make sense to have it as a customization
point. If you want to hack the client, change the hardcode as well I
guess.
  • Loading branch information
mackal authored May 25, 2021
1 parent 93329b4 commit e5b9d72
Show file tree
Hide file tree
Showing 7 changed files with 17 additions and 65 deletions.
1 change: 0 additions & 1 deletion common/ruletypes.h
Original file line number Diff line number Diff line change
Expand Up @@ -326,7 +326,6 @@ RULE_INT(Spells, CharismaEffectivenessCap, 255, "Determines how much resist modi
RULE_BOOL(Spells, CharismaCharmDuration, false, "Allow CHA resist mod to extend charm duration")
RULE_INT(Spells, CharmBreakCheckChance, 25, "Determines chance for a charm break check to occur each buff tick")
RULE_BOOL(Spells, CharmDisablesSpecialAbilities, false, "When charm is cast on an NPC, strip their special abilities")
RULE_INT(Spells, MaxCastTimeReduction, 50, "Maximum percent your spell cast time can be reduced by spell haste")
RULE_INT(Spells, RootBreakFromSpells, 55, "Chance for root to break when cast on")
RULE_INT(Spells, DeathSaveCharismaMod, 3, "Determines how much charisma effects chance of death save firing")
RULE_INT(Spells, DivineInterventionHeal, 8000, "Divine intervention heal amount")
Expand Down
17 changes: 8 additions & 9 deletions zone/bot.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -7101,12 +7101,14 @@ int32 Bot::GetActSpellHealing(uint16 spell_id, int32 value, Mob* target) {
}

int32 Bot::GetActSpellCasttime(uint16 spell_id, int32 casttime) {
int32 cast_reducer = 0;
cast_reducer += GetBotFocusEffect(focusSpellHaste, spell_id);
int32 cast_reducer = GetBotFocusEffect(focusSpellHaste, spell_id);
uint8 botlevel = GetLevel();
uint8 botclass = GetClass();
if (botlevel >= 51 && casttime >= 3000 && !BeneficialSpell(spell_id) && (botclass == SHADOWKNIGHT || botclass == RANGER || botclass == PALADIN || botclass == BEASTLORD ))
cast_reducer += ((GetLevel() - 50) * 3);
if (botlevel >= 51 && casttime >= 3000 && !spells[spell_id].goodEffect &&
(botclass == SHADOWKNIGHT || botclass == RANGER || botclass == PALADIN || botclass == BEASTLORD)) {
int level_mod = std::min(15, botlevel - 50);
cast_reducer += level_mod * 3;
}

if((casttime >= 4000) && BeneficialSpell(spell_id) && IsBuffSpell(spell_id)) {
switch (GetAA(aaSpellCastingDeftness)) {
Expand Down Expand Up @@ -7176,11 +7178,8 @@ int32 Bot::GetActSpellCasttime(uint16 spell_id, int32 casttime) {
}
}

if (cast_reducer > RuleI(Spells, MaxCastTimeReduction))
cast_reducer = RuleI(Spells, MaxCastTimeReduction);

casttime = (casttime * (100 - cast_reducer) / 100);
return casttime;
casttime = casttime * (100 - cast_reducer) / 100;
return std::max(casttime, casttime / 2);
}

int32 Bot::GetActSpellCost(uint16 spell_id, int32 cost) {
Expand Down
1 change: 0 additions & 1 deletion zone/client.h
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,6 @@ class Client : public Mob
inline virtual int32 GetDelayDeath() const { return aabonuses.DelayDeath + spellbonuses.DelayDeath + itembonuses.DelayDeath + 11; }

int32 GetActSpellCost(uint16 spell_id, int32);
int32 GetActSpellCasttime(uint16 spell_id, int32);
virtual bool CheckFizzle(uint16 spell_id);
virtual bool CheckSpellLevelRestriction(uint16 spell_id);
virtual int GetCurrentBuffSlots() const;
Expand Down
23 changes: 0 additions & 23 deletions zone/effects.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -407,29 +407,6 @@ int32 Mob::GetActSpellDuration(uint16 spell_id, int32 duration)
return ifocused + 1;
}

int32 Client::GetActSpellCasttime(uint16 spell_id, int32 casttime)
{
int32 cast_reducer = 0;
cast_reducer += GetFocusEffect(focusSpellHaste, spell_id);

//this function loops through the effects of spell_id many times
//could easily be consolidated.

if (GetLevel() >= 51 && casttime >= 3000 && !BeneficialSpell(spell_id)
&& (GetClass() == SHADOWKNIGHT || GetClass() == RANGER
|| GetClass() == PALADIN || GetClass() == BEASTLORD ))
cast_reducer += (GetLevel()-50)*3;

//LIVE AA SpellCastingDeftness, QuickBuff, QuickSummoning, QuickEvacuation, QuickDamage

if (cast_reducer > RuleI(Spells, MaxCastTimeReduction))
cast_reducer = RuleI(Spells, MaxCastTimeReduction);

casttime = (casttime*(100 - cast_reducer)/100);

return casttime;
}

bool Client::TrainDiscipline(uint32 itemid) {

//get the item info
Expand Down
13 changes: 0 additions & 13 deletions zone/merc.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -2756,19 +2756,6 @@ int32 Merc::GetActSpellCost(uint16 spell_id, int32 cost)
return cost;
}

int32 Merc::GetActSpellCasttime(uint16 spell_id, int32 casttime)
{
int32 cast_reducer = 0;
cast_reducer += GetFocusEffect(focusSpellHaste, spell_id);

if (cast_reducer > RuleI(Spells, MaxCastTimeReduction))
cast_reducer = RuleI(Spells, MaxCastTimeReduction);

casttime = (casttime*(100 - cast_reducer)/100);

return casttime;
}

int8 Merc::GetChanceToCastBySpellType(uint32 spellType) {
int mercStance = (int)GetStance();
int8 mercClass = GetClass();
Expand Down
1 change: 0 additions & 1 deletion zone/merc.h
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ class Merc : public NPC {
Corpse* GetGroupMemberCorpse();

// Merc Spell Casting Methods
virtual int32 GetActSpellCasttime(uint16 spell_id, int32 casttime);
virtual int32 GetActSpellCost(uint16 spell_id, int32 cost);
int8 GetChanceToCastBySpellType(uint32 spellType);
void SetSpellRecastTimer(uint16 timer_id, uint16 spellid, uint32 recast_delay);
Expand Down
26 changes: 9 additions & 17 deletions zone/mob.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3112,26 +3112,18 @@ uint32 Mob::GetLevelHP(uint8 tlevel)
return multiplier;
}

int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime) {

int32 cast_reducer = 0;
cast_reducer += GetFocusEffect(focusSpellHaste, spell_id);
int32 Mob::GetActSpellCasttime(uint16 spell_id, int32 casttime)
{
int32 cast_reducer = GetFocusEffect(focusSpellHaste, spell_id);

if (level >= 60 && casttime > 1000)
{
casttime = casttime / 2;
if (casttime < 1000)
casttime = 1000;
} else if (level >= 50 && casttime > 1000) {
int32 cast_deduction = (casttime*(level - 49))/5;
if (cast_deduction > casttime/2)
casttime /= 2;
else
casttime -= cast_deduction;
if (level > 50 && casttime >= 3000 && !spells[spell_id].goodEffect &&
(GetClass() == RANGER || GetClass() == SHADOWKNIGHT || GetClass() == PALADIN || GetClass() == BEASTLORD)) {
int level_mod = std::min(15, GetLevel() - 50);
cast_reducer += level_mod * 3;
}

casttime = (casttime*(100 - cast_reducer)/100);
return casttime;
casttime = casttime * (100 - cast_reducer) / 100;
return std::max(casttime, casttime / 2);
}

void Mob::ExecWeaponProc(const EQ::ItemInstance *inst, uint16 spell_id, Mob *on, int level_override) {
Expand Down

0 comments on commit e5b9d72

Please sign in to comment.