mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 17:54:48 +01:00
Core/Spells: move m_preCastSpell logic to scripts
- Bad name because it was actaully executed after effects
This commit is contained in:
@@ -67,7 +67,8 @@ enum MageSpells
|
||||
SPELL_MAGE_T10_2P_BONUS_EFFECT = 70753,
|
||||
SPELL_MAGE_T8_4P_BONUS = 64869,
|
||||
SPELL_MAGE_MISSILE_BARRAGE = 44401,
|
||||
SPELL_MAGE_FINGERS_OF_FROST_AURASTATE_AURA = 44544
|
||||
SPELL_MAGE_FINGERS_OF_FROST_AURASTATE_AURA = 44544,
|
||||
SPELL_MAGE_PERMAFROST_AURA = 68391
|
||||
};
|
||||
|
||||
enum MageSpellIcons
|
||||
@@ -656,6 +657,34 @@ class spell_mage_fire_frost_ward : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// -44614 - Frostfire Bolt
|
||||
class spell_mage_frostfire_bolt : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_mage_frostfire_bolt);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo({ SPELL_MAGE_PERMAFROST_AURA });
|
||||
}
|
||||
|
||||
void ApplyPermafrost(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
if (Unit* caster = GetCaster())
|
||||
caster->CastSpell(GetTarget(), SPELL_MAGE_PERMAFROST_AURA, aurEff);
|
||||
}
|
||||
|
||||
void RemovePermafrost(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
GetTarget()->RemoveAurasDueToSpell(SPELL_MAGE_PERMAFROST_AURA);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_mage_frostfire_bolt::ApplyPermafrost, EFFECT_0, SPELL_AURA_MOD_DECREASE_SPEED, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_mage_frostfire_bolt::ApplyPermafrost, EFFECT_0, SPELL_AURA_MOD_DECREASE_SPEED, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
|
||||
// 54646 - Focus Magic
|
||||
class spell_mage_focus_magic : public SpellScriptLoader
|
||||
{
|
||||
@@ -966,6 +995,27 @@ class spell_mage_ice_barrier : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 45438 - Ice Block
|
||||
class spell_mage_ice_block : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_mage_ice_block);
|
||||
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return ValidateSpellInfo({ spellInfo->ExcludeTargetAuraSpell });
|
||||
}
|
||||
|
||||
void TriggerHypothermia()
|
||||
{
|
||||
GetCaster()->CastSpell(nullptr, GetSpellInfo()->ExcludeTargetAuraSpell, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterHit += SpellHitFn(spell_mage_ice_block::TriggerHypothermia);
|
||||
}
|
||||
};
|
||||
|
||||
// -11119 - Ignite
|
||||
class spell_mage_ignite : public SpellScriptLoader
|
||||
{
|
||||
@@ -1360,6 +1410,7 @@ void AddSC_mage_spell_scripts()
|
||||
new spell_mage_empowered_fire();
|
||||
new spell_mage_fingers_of_frost();
|
||||
new spell_mage_fire_frost_ward();
|
||||
RegisterAuraScript(spell_mage_frostfire_bolt);
|
||||
new spell_mage_focus_magic();
|
||||
new spell_mage_gen_extra_effects();
|
||||
new spell_mage_glyph_of_polymorph();
|
||||
@@ -1367,6 +1418,7 @@ void AddSC_mage_spell_scripts()
|
||||
new spell_mage_glyph_of_ice_block();
|
||||
new spell_mage_hot_streak();
|
||||
new spell_mage_ice_barrier();
|
||||
RegisterSpellScript(spell_mage_ice_block);
|
||||
new spell_mage_ignite();
|
||||
new spell_mage_living_bomb();
|
||||
new spell_mage_magic_absorption();
|
||||
|
||||
@@ -301,11 +301,13 @@ class spell_pal_avenging_wrath : public SpellScriptLoader
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_PALADIN_SANCTIFIED_WRATH,
|
||||
SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1
|
||||
SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1,
|
||||
SPELL_PALADIN_AVENGING_WRATH_MARKER,
|
||||
SPELL_PALADIN_IMMUNE_SHIELD_MARKER
|
||||
});
|
||||
}
|
||||
|
||||
void HandleApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
void HandleApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
|
||||
{
|
||||
Unit* target = GetTarget();
|
||||
if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(SPELL_PALADIN_SANCTIFIED_WRATH_TALENT_R1, EFFECT_2))
|
||||
@@ -315,6 +317,11 @@ class spell_pal_avenging_wrath : public SpellScriptLoader
|
||||
.AddSpellMod(SPELLVALUE_BASE_POINT1, aurEff->GetAmount());
|
||||
target->CastSpell(target, SPELL_PALADIN_SANCTIFIED_WRATH, args);
|
||||
}
|
||||
|
||||
target->CastSpell(nullptr, SPELL_PALADIN_AVENGING_WRATH_MARKER, aurEff);
|
||||
|
||||
// Blizz seems to just apply aura without bothering to cast
|
||||
target->AddAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER, target);
|
||||
}
|
||||
|
||||
void HandleRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
|
||||
@@ -324,7 +331,7 @@ class spell_pal_avenging_wrath : public SpellScriptLoader
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnEffectApply += AuraEffectApplyFn(spell_pal_avenging_wrath_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
|
||||
AfterEffectApply += AuraEffectApplyFn(spell_pal_avenging_wrath_AuraScript::HandleApply, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL_OR_REAPPLY_MASK);
|
||||
AfterEffectRemove += AuraEffectRemoveFn(spell_pal_avenging_wrath_AuraScript::HandleRemove, EFFECT_0, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE, AURA_EFFECT_HANDLE_REAL);
|
||||
}
|
||||
};
|
||||
@@ -1108,6 +1115,57 @@ public:
|
||||
}
|
||||
};
|
||||
|
||||
// 498 - Divine Protection
|
||||
// 642 - Divine Shield
|
||||
// -1022 - Hand of Protection
|
||||
class spell_pal_immunities : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pal_immunities);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) override
|
||||
{
|
||||
return ValidateSpellInfo(
|
||||
{
|
||||
SPELL_PALADIN_FORBEARANCE,
|
||||
SPELL_PALADIN_AVENGING_WRATH_MARKER,
|
||||
SPELL_PALADIN_IMMUNE_SHIELD_MARKER
|
||||
});
|
||||
}
|
||||
|
||||
SpellCastResult CheckCast()
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
|
||||
// for HoP
|
||||
Unit* target = GetExplTargetUnit();
|
||||
if (!target)
|
||||
target = caster;
|
||||
|
||||
// "Cannot be used within $61987d. of using Avenging Wrath."
|
||||
if (target->HasAura(SPELL_PALADIN_FORBEARANCE) || target->HasAura(SPELL_PALADIN_AVENGING_WRATH_MARKER))
|
||||
return SPELL_FAILED_TARGET_AURASTATE;
|
||||
|
||||
return SPELL_CAST_OK;
|
||||
}
|
||||
|
||||
void TriggerDebuffs()
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
{
|
||||
// Blizz seems to just apply aura without bothering to cast
|
||||
GetCaster()->AddAura(SPELL_PALADIN_FORBEARANCE, target);
|
||||
GetCaster()->AddAura(SPELL_PALADIN_AVENGING_WRATH_MARKER, target);
|
||||
GetCaster()->AddAura(SPELL_PALADIN_IMMUNE_SHIELD_MARKER, target);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
OnCheckCast += SpellCheckCastFn(spell_pal_immunities::CheckCast);
|
||||
AfterHit += SpellHitFn(spell_pal_immunities::TriggerDebuffs);
|
||||
}
|
||||
};
|
||||
|
||||
// Maybe this is incorrect
|
||||
// These spells should always be cast on login, regardless of whether the player has the talent or not
|
||||
|
||||
@@ -2377,6 +2435,7 @@ void AddSC_paladin_spell_scripts()
|
||||
new spell_pal_heart_of_the_crusader();
|
||||
new spell_pal_holy_shock();
|
||||
new spell_pal_illumination();
|
||||
RegisterSpellScript(spell_pal_immunities);
|
||||
new spell_pal_improved_aura("spell_pal_improved_concentraction_aura", SPELL_PALADIN_IMPROVED_CONCENTRACTION_AURA);
|
||||
new spell_pal_improved_aura("spell_pal_improved_devotion_aura", SPELL_PALADIN_IMPROVED_DEVOTION_AURA);
|
||||
new spell_pal_improved_aura("spell_pal_sanctified_retribution", SPELL_PALADIN_SANCTIFIED_RETRIBUTION_AURA);
|
||||
|
||||
@@ -954,6 +954,32 @@ class spell_pri_power_word_shield : public SpellScriptLoader
|
||||
public:
|
||||
spell_pri_power_word_shield() : SpellScriptLoader("spell_pri_power_word_shield") { }
|
||||
|
||||
class spell_pri_power_word_shield_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pri_power_word_shield_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* spellInfo) override
|
||||
{
|
||||
return ValidateSpellInfo({ spellInfo->ExcludeTargetAuraSpell });
|
||||
}
|
||||
|
||||
void WeakenSoul()
|
||||
{
|
||||
if (Unit* target = GetHitUnit())
|
||||
GetCaster()->CastSpell(target, GetSpellInfo()->ExcludeTargetAuraSpell, true);
|
||||
}
|
||||
|
||||
void Register() override
|
||||
{
|
||||
AfterHit += SpellHitFn(spell_pri_power_word_shield_SpellScript::WeakenSoul);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const override
|
||||
{
|
||||
return new spell_pri_power_word_shield_SpellScript();
|
||||
}
|
||||
|
||||
class spell_pri_power_word_shield_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_pri_power_word_shield_AuraScript);
|
||||
|
||||
Reference in New Issue
Block a user