Scripts/Spells: Convert code from Spell::EffectDummy to spell scripts.
This commit is contained in:
1 parent
d55c8c7cc4
commit
c517806a23
24 files changed
+4446
-2965
No files matched your search
@@ -21,7 +21,6 @@
|
||||
* Scriptnames of files in this file should be prefixed with "spell_pri_".
|
||||
*/
|
||||
|
||||
#include "ScriptPCH.h"
|
||||
#include "SpellAuraEffects.h"
|
||||
#include "GridNotifiers.h"
|
||||
|
||||
@@ -49,7 +48,9 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL) != NULL;
|
||||
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load()
|
||||
@@ -101,11 +102,8 @@ class spell_pri_mana_burn : public SpellScriptLoader
|
||||
|
||||
void HandleAfterHit()
|
||||
{
|
||||
Unit* unitTarget = GetHitUnit();
|
||||
if (!unitTarget)
|
||||
return;
|
||||
|
||||
unitTarget->RemoveAurasWithMechanic((1 << MECHANIC_FEAR) | (1 << MECHANIC_POLYMORPH));
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
unitTarget->RemoveAurasWithMechanic((1 << MECHANIC_FEAR) | (1 << MECHANIC_POLYMORPH));
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -204,18 +202,19 @@ class spell_pri_penance : public SpellScriptLoader
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
Unit* unitTarget = GetHitUnit();
|
||||
if (!unitTarget || !unitTarget->isAlive())
|
||||
return;
|
||||
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
if(!unitTarget->isAlive())
|
||||
return;
|
||||
|
||||
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id);
|
||||
|
||||
if (caster->IsFriendlyTo(unitTarget))
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0);
|
||||
else
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0);
|
||||
if (caster->IsFriendlyTo(unitTarget))
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0);
|
||||
else
|
||||
caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
@@ -243,7 +242,9 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
|
||||
|
||||
bool Validate(SpellInfo const* /*spellEntry*/)
|
||||
{
|
||||
return sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) && sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1);
|
||||
if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount)
|
||||
@@ -251,14 +252,13 @@ class spell_pri_reflective_shield_trigger : public SpellScriptLoader
|
||||
Unit* target = GetTarget();
|
||||
if (dmgInfo.GetAttacker() == target)
|
||||
return;
|
||||
Unit* caster = GetCaster();
|
||||
if (!caster)
|
||||
return;
|
||||
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
|
||||
if (Unit* caster = GetCaster())
|
||||
if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0))
|
||||
{
|
||||
int32 bp = CalculatePctN(absorbAmount, talentAurEff->GetAmount());
|
||||
target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff);
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
|
||||
Reference in new issue
Block a user