From a73bf221ed9f97f58fd0d175a1364222be0de49b Mon Sep 17 00:00:00 2001 From: hg <4683435+hgtw@users.noreply.github.com> Date: Thu, 13 Sep 2018 19:25:05 -0400 Subject: [PATCH] Make SPA 112 affect fizzle rate not effective caster level Per dev quote, SPA 112 "Modifies casting skills of the affected entity by BaseEffect for the purposes of determining whether or not a fizzle occurs when casting spells." Fixes issues caused by having a spell with this effect on caster such as wrong target debuff durations and buff refreshes not taking hold. --- zone/bonuses.cpp | 20 +++++++++++++++++--- zone/common.h | 1 + zone/lua_stat_bonuses.cpp | 6 ++++++ zone/lua_stat_bonuses.h | 1 + zone/spells.cpp | 2 ++ 5 files changed, 27 insertions(+), 3 deletions(-) diff --git a/zone/bonuses.cpp b/zone/bonuses.cpp index b6de679d1..7965e016e 100644 --- a/zone/bonuses.cpp +++ b/zone/bonuses.cpp @@ -1217,8 +1217,12 @@ void Mob::ApplyAABonuses(const AA::Rank &rank, StatBonuses *newbon) break; } - case SE_CastingLevel2: case SE_CastingLevel: { + newbon->adjusted_casting_skill += base1; + break; + } + + case SE_CastingLevel2: { newbon->effective_casting_level += base1; break; } @@ -1917,8 +1921,13 @@ void Mob::ApplySpellsBonuses(uint16 spell_id, uint8 casterlevel, StatBonuses *ne break; } - case SE_CastingLevel2: case SE_CastingLevel: // Brilliance of Ro + { + new_bonus->adjusted_casting_skill += effect_value; + break; + } + + case SE_CastingLevel2: { new_bonus->effective_casting_level += effect_value; break; @@ -3867,8 +3876,13 @@ void Mob::NegateSpellsBonuses(uint16 spell_id) aabonuses.Corrup = effect_value; break; - case SE_CastingLevel2: case SE_CastingLevel: // Brilliance of Ro + spellbonuses.adjusted_casting_skill = effect_value; + aabonuses.adjusted_casting_skill = effect_value; + itembonuses.adjusted_casting_skill = effect_value; + break; + + case SE_CastingLevel2: spellbonuses.effective_casting_level = effect_value; aabonuses.effective_casting_level = effect_value; itembonuses.effective_casting_level = effect_value; diff --git a/zone/common.h b/zone/common.h index df6b22637..9db776e4b 100644 --- a/zone/common.h +++ b/zone/common.h @@ -354,6 +354,7 @@ struct StatBonuses { int32 skillmod[EQEmu::skills::HIGHEST_SKILL + 1]; int32 skillmodmax[EQEmu::skills::HIGHEST_SKILL + 1]; int effective_casting_level; + int adjusted_casting_skill; // SPA 112 for fizzles int reflect_chance; // chance to reflect incoming spell uint32 singingMod; uint32 Amplification; // stacks with singingMod diff --git a/zone/lua_stat_bonuses.cpp b/zone/lua_stat_bonuses.cpp index e1fb329cc..282aaad38 100644 --- a/zone/lua_stat_bonuses.cpp +++ b/zone/lua_stat_bonuses.cpp @@ -333,6 +333,11 @@ int Lua_StatBonuses::Geteffective_casting_level() const { return self->effective_casting_level; } +int Lua_StatBonuses::Getadjusted_casting_skill() const { + Lua_Safe_Call_Int(); + return self->adjusted_casting_skill; +} + int Lua_StatBonuses::Getreflect_chance() const { Lua_Safe_Call_Int(); return self->reflect_chance; @@ -1347,6 +1352,7 @@ luabind::scope lua_register_stat_bonuses() { .def("skillmod", &Lua_StatBonuses::Getskillmod) .def("skillmodmax", &Lua_StatBonuses::Getskillmodmax) .def("effective_casting_level", &Lua_StatBonuses::Geteffective_casting_level) + .def("adjusted_casting_skill", &Lua_StatBonuses::Getadjusted_casting_skill) .def("reflect_chance", &Lua_StatBonuses::Getreflect_chance) .def("singingMod", &Lua_StatBonuses::GetsingingMod) .def("Amplification", &Lua_StatBonuses::GetAmplification) diff --git a/zone/lua_stat_bonuses.h b/zone/lua_stat_bonuses.h index 9ad04d681..c65c589a4 100644 --- a/zone/lua_stat_bonuses.h +++ b/zone/lua_stat_bonuses.h @@ -91,6 +91,7 @@ public: int32 Getskillmod(int idx) const; int32 Getskillmodmax(int idx) const; int Geteffective_casting_level() const; + int Getadjusted_casting_skill() const; int Getreflect_chance() const; uint32 GetsingingMod() const; uint32 GetAmplification() const; diff --git a/zone/spells.cpp b/zone/spells.cpp index 60591b7b1..990b26d60 100644 --- a/zone/spells.cpp +++ b/zone/spells.cpp @@ -752,6 +752,8 @@ bool Client::CheckFizzle(uint16 spell_id) act_skill = GetSkill(spells[spell_id].skill); act_skill += GetLevel(); // maximum of whatever the client can cheat + act_skill += itembonuses.adjusted_casting_skill + spellbonuses.adjusted_casting_skill + aabonuses.adjusted_casting_skill; + Log(Logs::Detail, Logs::Spells, "Adjusted casting skill: %d+%d+%d+%d+%d=%d", GetSkill(spells[spell_id].skill), GetLevel(), itembonuses.adjusted_casting_skill, spellbonuses.adjusted_casting_skill, aabonuses.adjusted_casting_skill, act_skill); //spell specialization float specialize = GetSpecializeSkillValue(spell_id);