mirror of
https://github.com/mod-playerbots/azerothcore-wotlk.git
synced 2026-01-23 05:36:23 +00:00
feat(Core/Scripting): Implement OnSpellHealingBonusTakenNegativeModifiers hook (#10318)
This commit is contained in:
@@ -11971,9 +11971,14 @@ uint32 Unit::SpellHealingBonusDone(Unit* victim, SpellInfo const* spellProto, ui
|
||||
uint32 Unit::SpellHealingBonusTaken(Unit* caster, SpellInfo const* spellProto, uint32 healamount, DamageEffectType damagetype, uint32 stack)
|
||||
{
|
||||
float TakenTotalMod = 1.0f;
|
||||
|
||||
float minval = 0.0f;
|
||||
// Healing taken percent
|
||||
float minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
|
||||
|
||||
if (!sScriptMgr->OnSpellHealingBonusTakenNegativeModifiers(this, caster, spellProto, minval))
|
||||
{
|
||||
minval = float(GetMaxNegativeAuraModifier(SPELL_AURA_MOD_HEALING_PCT));
|
||||
}
|
||||
|
||||
if (minval)
|
||||
AddPct(TakenTotalMod, minval);
|
||||
|
||||
|
||||
@@ -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;
|
||||
}
|
||||
|
||||
@@ -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; }
|
||||
|
||||
Reference in New Issue
Block a user