feat(Core/Scripting): Implement OnSpellHealingBonusTakenNegativeModifiers hook (#10318)

This commit is contained in:
Skjalf
2022-01-23 17:56:41 -03:00
committed by GitHub
parent d97c95c3fa
commit 22ec66566c
3 changed files with 27 additions and 3 deletions

View File

@@ -138,3 +138,18 @@ bool ScriptMgr::OnIsAffectedBySpellModCheck(SpellInfo const* affectSpell, SpellI
return true;
}
bool ScriptMgr::OnSpellHealingBonusTakenNegativeModifiers(Unit const* target, Unit const* caster, SpellInfo const* spellInfo, float& val)
{
auto ret = IsValidBoolScript<GlobalScript>([&](GlobalScript* script)
{
return !script->OnSpellHealingBonusTakenNegativeModifiers(target, caster, spellInfo, val);
});
if (ret && *ret)
{
return false;
}
return true;
}

View File

@@ -1526,8 +1526,11 @@ public:
// Called before the phase for a WorldObject is set
virtual void OnBeforeWorldObjectSetPhaseMask(WorldObject const* /*worldObject*/, uint32& /*oldPhaseMask*/, uint32& /*newPhaseMask*/, bool& /*useCombinedPhases*/, bool& /*update*/) { }
// Called when checking if a spell is affected by a mod
// Called when checking if an aura spell is affected by a mod
virtual bool OnIsAffectedBySpellModCheck(SpellInfo const* /*affectSpell*/, SpellInfo const* /*checkSpell*/, SpellModifier const* /*mod*/) { return true; };
// Called when checking for spell negative healing modifiers
virtual bool OnSpellHealingBonusTakenNegativeModifiers(Unit const* /*target*/, Unit const* /*caster*/, SpellInfo const* /*spellInfo*/, float& /*val*/) { return true; };
};
class BGScript : public ScriptObject
@@ -2346,6 +2349,7 @@ public: /* GlobalScript */
void OnAfterUpdateEncounterState(Map* map, EncounterCreditType type, uint32 creditEntry, Unit* source, Difficulty difficulty_fixed, DungeonEncounterList const* encounters, uint32 dungeonCompleted, bool updated);
void OnBeforeWorldObjectSetPhaseMask(WorldObject const* worldObject, uint32& oldPhaseMask, uint32& newPhaseMask, bool& useCombinedPhases, bool& update);
bool OnIsAffectedBySpellModCheck(SpellInfo const* affectSpell, SpellInfo const* checkSpell, SpellModifier const* mod);
bool OnSpellHealingBonusTakenNegativeModifiers(Unit const* target, Unit const* caster, SpellInfo const* spellInfo, float& val);
public: /* Scheduled scripts */
uint32 IncreaseScheduledScriptsCount() { return ++_scheduledScripts; }