Core/Spells: move more spells to spellscripts
This commit is contained in:
1 parent
5c36a50ed4
commit
fbddda52e7
7 files changed
+250
-112
No files matched your search
@@ -349,6 +349,40 @@ class spell_item_deviate_fish : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 71610, 71641 - Echoes of Light (Althor's Abacus)
|
||||
class spell_item_echoes_of_light : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_item_echoes_of_light() : SpellScriptLoader("spell_item_echoes_of_light") { }
|
||||
|
||||
class spell_item_echoes_of_light_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_item_echoes_of_light_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targets.size() < 2)
|
||||
return;
|
||||
|
||||
targets.sort(Trinity::HealthPctOrderPred());
|
||||
|
||||
WorldObject* target = targets.front();
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_item_echoes_of_light_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const OVERRIDE
|
||||
{
|
||||
return new spell_item_echoes_of_light_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// http://www.wowhead.com/item=47499 Flask of the North
|
||||
// 67019 Flask of the North
|
||||
enum FlaskOfTheNorthSpells
|
||||
@@ -2571,6 +2605,7 @@ void AddSC_item_spell_scripts()
|
||||
new spell_item_defibrillate("spell_item_gnomish_army_knife", 33);
|
||||
new spell_item_desperate_defense();
|
||||
new spell_item_deviate_fish();
|
||||
new spell_item_echoes_of_light();
|
||||
new spell_item_flask_of_the_north();
|
||||
new spell_item_gnomish_death_ray();
|
||||
new spell_item_make_a_wish();
|
||||
|
||||
@@ -564,6 +564,39 @@ class spell_pal_eye_for_an_eye : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 54968 - Glyph of Holy Light
|
||||
class spell_pal_glyph_of_holy_light : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pal_glyph_of_holy_light() : SpellScriptLoader("spell_pal_glyph_of_holy_light") { }
|
||||
|
||||
class spell_pal_glyph_of_holy_light_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pal_glyph_of_holy_light_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
uint32 const maxTargets = GetSpellInfo()->MaxAffectedTargets;
|
||||
|
||||
if (targets.size() > maxTargets)
|
||||
{
|
||||
targets.sort(Trinity::HealthPctOrderPred());
|
||||
targets.resize(maxTargets);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pal_glyph_of_holy_light_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const OVERRIDE
|
||||
{
|
||||
return new spell_pal_glyph_of_holy_light_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 63521 - Guarded by The Light
|
||||
class spell_pal_guarded_by_the_light : public SpellScriptLoader
|
||||
{
|
||||
@@ -1142,6 +1175,7 @@ void AddSC_paladin_spell_scripts()
|
||||
new spell_pal_divine_storm_dummy();
|
||||
new spell_pal_exorcism_and_holy_wrath_damage();
|
||||
new spell_pal_eye_for_an_eye();
|
||||
new spell_pal_glyph_of_holy_light();
|
||||
new spell_pal_guarded_by_the_light();
|
||||
new spell_pal_hand_of_sacrifice();
|
||||
new spell_pal_hand_of_salvation();
|
||||
|
||||
@@ -31,6 +31,7 @@ enum PriestSpells
|
||||
{
|
||||
SPELL_PRIEST_DIVINE_AEGIS = 47753,
|
||||
SPELL_PRIEST_EMPOWERED_RENEW = 63544,
|
||||
SPELL_PRIEST_GLYPH_OF_CIRCLE_OF_HEALING = 55675,
|
||||
SPELL_PRIEST_GLYPH_OF_LIGHTWELL = 55673,
|
||||
SPELL_PRIEST_GLYPH_OF_PRAYER_OF_HEALING_HEAL = 56161,
|
||||
SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL = 48153,
|
||||
@@ -53,6 +54,82 @@ enum PriestSpellIcons
|
||||
PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874,
|
||||
};
|
||||
|
||||
class PowerCheck
|
||||
{
|
||||
public:
|
||||
explicit PowerCheck(Powers power) : _power(power) { }
|
||||
|
||||
bool operator()(WorldObject* obj) const
|
||||
{
|
||||
if (Unit* target = obj->ToUnit())
|
||||
return target->getPowerType() != _power;
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Powers _power;
|
||||
};
|
||||
|
||||
class RaidCheck
|
||||
{
|
||||
public:
|
||||
explicit RaidCheck(Unit const* caster) : _caster(caster) { }
|
||||
|
||||
bool operator()(WorldObject* obj) const
|
||||
{
|
||||
if (Unit* target = obj->ToUnit())
|
||||
return !_caster->IsInRaidWith(target);
|
||||
|
||||
return true;
|
||||
}
|
||||
|
||||
private:
|
||||
Unit const* _caster;
|
||||
};
|
||||
|
||||
// -34861 - Circle of Healing
|
||||
class spell_pri_circle_of_healing : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pri_circle_of_healing() : SpellScriptLoader("spell_pri_circle_of_healing") { }
|
||||
|
||||
class spell_pri_circle_of_healing_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pri_circle_of_healing_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GLYPH_OF_CIRCLE_OF_HEALING))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(RaidCheck(GetCaster()));
|
||||
|
||||
uint32 const maxTargets = GetCaster()->HasAura(SPELL_PRIEST_GLYPH_OF_CIRCLE_OF_HEALING) ? 6 : 5; // Glyph of Circle of Healing
|
||||
|
||||
if (targets.size() > maxTargets)
|
||||
{
|
||||
targets.sort(Trinity::HealthPctOrderPred());
|
||||
targets.resize(maxTargets);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_circle_of_healing_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const OVERRIDE
|
||||
{
|
||||
return new spell_pri_circle_of_healing_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// -47509 - Divine Aegis
|
||||
class spell_pri_divine_aegis : public SpellScriptLoader
|
||||
{
|
||||
@@ -103,6 +180,41 @@ class spell_pri_divine_aegis : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 64844 - Divine Hymn
|
||||
class spell_pri_divine_hymn : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pri_divine_hymn() : SpellScriptLoader("spell_pri_divine_hymn") { }
|
||||
|
||||
class spell_pri_divine_hymn_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pri_divine_hymn_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(RaidCheck(GetCaster()));
|
||||
|
||||
uint32 const maxTargets = 3;
|
||||
|
||||
if (targets.size() > maxTargets)
|
||||
{
|
||||
targets.sort(Trinity::HealthPctOrderPred());
|
||||
targets.resize(maxTargets);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_divine_hymn_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const OVERRIDE
|
||||
{
|
||||
return new spell_pri_divine_hymn_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 55680 - Glyph of Prayer of Healing
|
||||
class spell_pri_glyph_of_prayer_of_healing : public SpellScriptLoader
|
||||
{
|
||||
@@ -198,6 +310,42 @@ class spell_pri_guardian_spirit : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 64904 - Hymn of Hope
|
||||
class spell_pri_hymn_of_hope : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_pri_hymn_of_hope() : SpellScriptLoader("spell_pri_hymn_of_hope") { }
|
||||
|
||||
class spell_pri_hymn_of_hope_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_pri_hymn_of_hope_SpellScript);
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(PowerCheck(POWER_MANA));
|
||||
targets.remove_if(RaidCheck(GetCaster()));
|
||||
|
||||
uint32 const maxTargets = 3;
|
||||
|
||||
if (targets.size() > maxTargets)
|
||||
{
|
||||
targets.sort(Trinity::PowerPctOrderPred(POWER_MANA));
|
||||
targets.resize(maxTargets);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_pri_hymn_of_hope_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const OVERRIDE
|
||||
{
|
||||
return new spell_pri_hymn_of_hope_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 37594 - Greater Heal Refund
|
||||
class spell_pri_item_greater_heal_refund : public SpellScriptLoader
|
||||
{
|
||||
@@ -703,9 +851,12 @@ class spell_pri_vampiric_touch : public SpellScriptLoader
|
||||
|
||||
void AddSC_priest_spell_scripts()
|
||||
{
|
||||
new spell_pri_circle_of_healing();
|
||||
new spell_pri_divine_aegis();
|
||||
new spell_pri_divine_hymn();
|
||||
new spell_pri_glyph_of_prayer_of_healing();
|
||||
new spell_pri_guardian_spirit();
|
||||
new spell_pri_hymn_of_hope();
|
||||
new spell_pri_item_greater_heal_refund();
|
||||
new spell_pri_lightwell_renew();
|
||||
new spell_pri_mana_burn();
|
||||
|
||||
@@ -79,6 +79,18 @@ class spell_sha_ancestral_awakening_proc : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
if (targets.size() < 2)
|
||||
return;
|
||||
|
||||
targets.sort(Trinity::HealthPctOrderPred());
|
||||
|
||||
WorldObject* target = targets.front();
|
||||
targets.clear();
|
||||
targets.push_back(target);
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
int32 damage = GetEffectValue();
|
||||
@@ -88,6 +100,7 @@ class spell_sha_ancestral_awakening_proc : public SpellScriptLoader
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_sha_ancestral_awakening_proc_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_CASTER_AREA_RAID);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_sha_ancestral_awakening_proc_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
Reference in new issue
Block a user