mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-19 17:05:44 +01:00
Core/ScriptSystem: Add OnEffectManaShield and AfterEffectManaShield hooks to AuraScript class. Usage of these is the same as similar Absorb hooks.
Scripts: Move Incanter's Absorbtion script from Unit::CalcAbsorbResist to AuraScript.
This commit is contained in:
@@ -268,10 +268,9 @@ class spell_ex_66244 : public SpellScriptLoader
|
||||
{
|
||||
return new spell_ex_66244AuraScript();
|
||||
}
|
||||
|
||||
|
||||
};
|
||||
|
||||
// example usage of OnEffectAbsorb and AfterEffectAbsorb hooks
|
||||
class spell_ex_absorb_aura : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
@@ -297,17 +296,11 @@ class spell_ex_absorb_aura : public SpellScriptLoader
|
||||
sLog->outString("Our aura has absorbed %u damage!", absorbAmount);
|
||||
}
|
||||
|
||||
/*void HandleAfterAbsorb(DamageInfo & dmgInfo)
|
||||
{
|
||||
sLog->outString("Our auras have just absorbed damage done to us!");
|
||||
}*/
|
||||
|
||||
// function registering
|
||||
void Register()
|
||||
{
|
||||
OnEffectAbsorb += AuraEffectAbsorbFn(spell_ex_absorb_auraAuraScript::HandleOnEffectAbsorb, EFFECT_0);
|
||||
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_ex_absorb_auraAuraScript::HandleAfterEffectAbsorb, EFFECT_0);
|
||||
//AfterAbsorb += AuraAbsorbFn(spell_ex_absorb_auraAuraScript::HandleAfterAbsorb);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -318,6 +311,8 @@ class spell_ex_absorb_aura : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// example usage of OnEffectManaShield and AfterEffectManaShield hooks
|
||||
// see spell_ex_absorb_aura, these hooks work the same as OnEffectAbsorb and AfterEffectAbsorb
|
||||
|
||||
// this function has to be added to function set in ScriptLoader.cpp
|
||||
void AddSC_example_spell_scripts()
|
||||
|
||||
@@ -170,7 +170,7 @@ public:
|
||||
amount = SpellMgr::CalculateSpellEffectAmount(talentSpell, EFFECT_0, GetCaster());
|
||||
// assume caster is a player here
|
||||
if (Unit * caster = GetCaster())
|
||||
amount += 2 * caster->ToPlayer()->GetTotalAttackPowerValue(BASE_ATTACK);
|
||||
amount += int32(2 * caster->ToPlayer()->GetTotalAttackPowerValue(BASE_ATTACK));
|
||||
}
|
||||
|
||||
void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
|
||||
@@ -209,7 +209,7 @@ class spell_mage_summon_water_elemental : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// Frost Ward and Fire Ward
|
||||
// Frost Warding
|
||||
class spell_mage_frost_warding_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
@@ -259,11 +259,103 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// Incanter's Absorption
|
||||
class spell_mage_incanters_absorbtion_absorb : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_mage_incanters_absorbtion_absorb() : SpellScriptLoader("spell_mage_incanters_absorbtion_absorb") { }
|
||||
|
||||
class spell_mage_incanters_absorbtion_absorb_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_mage_incanters_absorbtion_absorb_AuraScript);
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413,
|
||||
SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394,
|
||||
};
|
||||
|
||||
bool Validate(SpellEntry const * /*spellEntry*/)
|
||||
{
|
||||
return sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
|
||||
&& sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit * target = GetTarget();
|
||||
|
||||
if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectAbsorb += AuraEffectAbsorbFn(spell_mage_incanters_absorbtion_absorb_AuraScript::Trigger, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript *GetAuraScript() const
|
||||
{
|
||||
return new spell_mage_incanters_absorbtion_absorb_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// Incanter's Absorption
|
||||
class spell_mage_incanters_absorbtion_manashield : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_mage_incanters_absorbtion_manashield() : SpellScriptLoader("spell_mage_incanters_absorbtion_manashield") { }
|
||||
|
||||
class spell_mage_incanters_absorbtion_manashield_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_mage_incanters_absorbtion_manashield_AuraScript);
|
||||
|
||||
enum Spells
|
||||
{
|
||||
SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED = 44413,
|
||||
SPELL_MAGE_INCANTERS_ABSORBTION_R1 = 44394,
|
||||
};
|
||||
|
||||
bool Validate(SpellEntry const * /*spellEntry*/)
|
||||
{
|
||||
return sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED)
|
||||
&& sSpellStore.LookupEntry(SPELL_MAGE_INCANTERS_ABSORBTION_R1);
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
{
|
||||
Unit * target = GetTarget();
|
||||
|
||||
if (AuraEffect * talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_MAGE_INCANTERS_ABSORBTION_R1, EFFECT_0))
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(target, SPELL_MAGE_INCANTERS_ABSORBTION_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
AfterEffectManaShield += AuraEffectManaShieldFn(spell_mage_incanters_absorbtion_manashield_AuraScript::Trigger, EFFECT_0);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript *GetAuraScript() const
|
||||
{
|
||||
return new spell_mage_incanters_absorbtion_manashield_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_mage_spell_scripts()
|
||||
{
|
||||
new spell_mage_blast_wave;
|
||||
new spell_mage_cold_snap;
|
||||
new spell_mage_frost_warding_trigger();
|
||||
new spell_mage_incanters_absorbtion_absorb();
|
||||
new spell_mage_incanters_absorbtion_manashield();
|
||||
new spell_mage_polymorph_cast_visual;
|
||||
new spell_mage_summon_water_elemental;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user