mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-21 09:44:45 +01:00
Core/Spells: move some spells so spellscripts
This commit is contained in:
@@ -993,6 +993,65 @@ class spell_dru_t10_restoration_4p_bonus : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
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;
|
||||
};
|
||||
|
||||
// -48438 - Wild Growth
|
||||
class spell_dru_wild_growth : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dru_wild_growth() : SpellScriptLoader("spell_dru_wild_growth") { }
|
||||
|
||||
class spell_dru_wild_growth_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dru_wild_growth_SpellScript);
|
||||
|
||||
bool Validate(SpellInfo const* spellInfo) OVERRIDE
|
||||
{
|
||||
if (spellInfo->Effects[EFFECT_2].IsEffect() || !spellInfo->Effects[EFFECT_2].CalcValue())
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
void FilterTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
targets.remove_if(RaidCheck(GetCaster()));
|
||||
|
||||
int32 const maxTargets = GetSpellInfo()->Effects[EFFECT_2].CalcValue(GetCaster());
|
||||
|
||||
if (targets.size() > maxTargets)
|
||||
{
|
||||
targets.sort(Trinity::HealthPctOrderPred());
|
||||
targets.resize(maxTargets);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_dru_wild_growth_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_DEST_AREA_ALLY);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const OVERRIDE
|
||||
{
|
||||
return new spell_dru_wild_growth_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
void AddSC_druid_spell_scripts()
|
||||
{
|
||||
new spell_dru_dash();
|
||||
@@ -1018,4 +1077,5 @@ void AddSC_druid_spell_scripts()
|
||||
new spell_dru_tiger_s_fury();
|
||||
new spell_dru_typhoon();
|
||||
new spell_dru_t10_restoration_4p_bonus();
|
||||
new spell_dru_wild_growth();
|
||||
}
|
||||
|
||||
@@ -2963,23 +2963,66 @@ enum Replenishment
|
||||
SPELL_INFINITE_REPLENISHMENT = 61782
|
||||
};
|
||||
|
||||
class ReplenishmentCheck
|
||||
{
|
||||
public:
|
||||
bool operator()(WorldObject* obj) const
|
||||
{
|
||||
if (Unit* target = obj->ToUnit())
|
||||
return target->getPowerType() != POWER_MANA;
|
||||
|
||||
return true;
|
||||
}
|
||||
};
|
||||
|
||||
class spell_gen_replenishment : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_gen_replenishment() : SpellScriptLoader("spell_gen_replenishment") { }
|
||||
|
||||
class spell_gen_replenishment_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_gen_replenishment_SpellScript);
|
||||
|
||||
void RemoveInvalidTargets(std::list<WorldObject*>& targets)
|
||||
{
|
||||
// In arenas Replenishment may only affect the caster
|
||||
if (Player* caster = GetCaster()->ToPlayer())
|
||||
{
|
||||
if (caster->InArena())
|
||||
{
|
||||
targets.clear();
|
||||
targets.push_back(caster);
|
||||
return;
|
||||
}
|
||||
}
|
||||
|
||||
targets.remove_if(ReplenishmentCheck());
|
||||
|
||||
uint8 const maxTargets = 10;
|
||||
|
||||
if (targets.size() > maxTargets)
|
||||
{
|
||||
targets.sort(Trinity::PowerPctOrderPred(POWER_MANA));
|
||||
targets.resize(maxTargets);
|
||||
}
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_gen_replenishment_SpellScript::RemoveInvalidTargets, EFFECT_ALL, TARGET_UNIT_CASTER_AREA_RAID);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const OVERRIDE
|
||||
{
|
||||
return new spell_gen_replenishment_SpellScript();
|
||||
}
|
||||
|
||||
class spell_gen_replenishment_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_gen_replenishment_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_REPLENISHMENT) ||
|
||||
!sSpellMgr->GetSpellInfo(SPELL_INFINITE_REPLENISHMENT))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool Load() OVERRIDE
|
||||
{
|
||||
return GetUnitOwner()->GetPower(POWER_MANA);
|
||||
|
||||
@@ -255,10 +255,11 @@ class spell_rog_deadly_poison : public SpellScriptLoader
|
||||
};
|
||||
|
||||
// 51690 - Killing Spree
|
||||
#define KillingSpreeScriptName "spell_rog_killing_spree"
|
||||
class spell_rog_killing_spree : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_rog_killing_spree() : SpellScriptLoader("spell_rog_killing_spree") { }
|
||||
spell_rog_killing_spree() : SpellScriptLoader(KillingSpreeScriptName) { }
|
||||
|
||||
class spell_rog_killing_spree_SpellScript : public SpellScript
|
||||
{
|
||||
@@ -274,7 +275,7 @@ class spell_rog_killing_spree : public SpellScriptLoader
|
||||
{
|
||||
if (Aura* aura = GetCaster()->GetAura(SPELL_ROGUE_KILLING_SPREE))
|
||||
{
|
||||
if (spell_rog_killing_spree_AuraScript* script = dynamic_cast<spell_rog_killing_spree_AuraScript*>(aura->GetScriptByName("spell_rog_killing_spree")))
|
||||
if (spell_rog_killing_spree_AuraScript* script = dynamic_cast<spell_rog_killing_spree_AuraScript*>(aura->GetScriptByName(KillingSpreeScriptName)))
|
||||
script->AddTarget(GetHitUnit());
|
||||
}
|
||||
}
|
||||
|
||||
@@ -42,7 +42,9 @@ enum WarriorSpells
|
||||
SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_BUFF = 65156,
|
||||
SPELL_WARRIOR_JUGGERNAUT_CRIT_BONUS_TALENT = 64976,
|
||||
SPELL_WARRIOR_LAST_STAND_TRIGGERED = 12976,
|
||||
SPELL_WARRIOR_RETALIATION_DAMAGE = 22858,
|
||||
SPELL_WARRIOR_SLAM = 50783,
|
||||
SPELL_WARRIOR_SUNDER_ARMOR = 58567,
|
||||
SPELL_WARRIOR_SWEEPING_STRIKES_EXTRA_ATTACK = 26654,
|
||||
SPELL_WARRIOR_TAUNT = 355,
|
||||
SPELL_WARRIOR_UNRELENTING_ASSAULT_RANK_1 = 46859,
|
||||
@@ -53,6 +55,11 @@ enum WarriorSpells
|
||||
SPELL_WARRIOR_VIGILANCE_REDIRECT_THREAT = 59665
|
||||
};
|
||||
|
||||
enum WarriorSpellIcons
|
||||
{
|
||||
WARRIOR_ICON_ID_SUDDEN_DEATH = 1989
|
||||
};
|
||||
|
||||
enum MiscSpells
|
||||
{
|
||||
SPELL_PALADIN_BLESSING_OF_SANCTUARY = 20911,
|
||||
@@ -61,11 +68,6 @@ enum MiscSpells
|
||||
SPELL_GEN_DAMAGE_REDUCTION_AURA = 68066,
|
||||
};
|
||||
|
||||
enum WarriorSpellIcons
|
||||
{
|
||||
WARRIOR_ICON_ID_SUDDEN_DEATH = 1989
|
||||
};
|
||||
|
||||
// 23881 - Bloodthirst
|
||||
class spell_warr_bloodthirst : public SpellScriptLoader
|
||||
{
|
||||
@@ -313,7 +315,7 @@ class spell_warr_execute : public SpellScriptLoader
|
||||
return true;
|
||||
}
|
||||
|
||||
void HandleDummy(SpellEffIndex effIndex)
|
||||
void HandleEffect(SpellEffIndex effIndex)
|
||||
{
|
||||
Unit* caster = GetCaster();
|
||||
if (Unit* target = GetHitUnit())
|
||||
@@ -342,7 +344,7 @@ class spell_warr_execute : public SpellScriptLoader
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_execute_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
OnEffectHitTarget += SpellEffectFn(spell_warr_execute_SpellScript::HandleEffect, EFFECT_0, SPELL_EFFECT_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
@@ -352,6 +354,42 @@ class spell_warr_execute : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 58387 - Glyph of Sunder Armor
|
||||
class spell_warr_glyph_of_sunder_armor : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_glyph_of_sunder_armor() : SpellScriptLoader("spell_warr_glyph_of_sunder_armor") { }
|
||||
|
||||
class spell_warr_glyph_of_sunder_armor_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_glyph_of_sunder_armor_AuraScript);
|
||||
|
||||
void HandleEffectCalcSpellMod(AuraEffect const* aurEff, SpellModifier*& spellMod)
|
||||
{
|
||||
if (!spellMod)
|
||||
{
|
||||
spellMod = new SpellModifier(aurEff->GetBase());
|
||||
spellMod->op = SpellModOp(aurEff->GetMiscValue());
|
||||
spellMod->type = SPELLMOD_FLAT;
|
||||
spellMod->spellId = GetId();
|
||||
spellMod->mask = GetSpellInfo()->Effects[aurEff->GetEffIndex()].SpellClassMask;
|
||||
}
|
||||
|
||||
spellMod->value = aurEff->GetAmount();
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_warr_glyph_of_sunder_armor_AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const OVERRIDE
|
||||
{
|
||||
return new spell_warr_glyph_of_sunder_armor_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 59725 - Improved Spell Reflection
|
||||
class spell_warr_improved_spell_reflection : public SpellScriptLoader
|
||||
{
|
||||
@@ -528,6 +566,48 @@ class spell_warr_rend : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 20230 - Retaliation
|
||||
class spell_warr_retaliation : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_warr_retaliation() : SpellScriptLoader("spell_warr_retaliation") { }
|
||||
|
||||
class spell_warr_retaliation_AuraScript : public AuraScript
|
||||
{
|
||||
PrepareAuraScript(spell_warr_retaliation_AuraScript);
|
||||
|
||||
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
|
||||
{
|
||||
if (!sSpellMgr->GetSpellInfo(SPELL_WARRIOR_RETALIATION_DAMAGE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
bool CheckProc(ProcEventInfo& eventInfo)
|
||||
{
|
||||
// check attack comes not from behind and warrior is not stunned
|
||||
return GetTarget()->isInFront(eventInfo.GetActor(), M_PI) && !GetTarget()->HasUnitState(UNIT_STATE_STUNNED);
|
||||
}
|
||||
|
||||
void HandleEffectProc(AuraEffect const* aurEff, ProcEventInfo& eventInfo)
|
||||
{
|
||||
PreventDefaultAction();
|
||||
GetTarget()->CastSpell(eventInfo.GetProcTarget(), SPELL_WARRIOR_RETALIATION_DAMAGE, true, NULL, aurEff);
|
||||
}
|
||||
|
||||
void Register() OVERRIDE
|
||||
{
|
||||
DoCheckProc += AuraCheckProcFn(spell_warr_retaliation_AuraScript::CheckProc);
|
||||
OnEffectProc += AuraEffectProcFn(spell_warr_retaliation_AuraScript::HandleEffectProc, EFFECT_0, SPELL_AURA_DUMMY);
|
||||
}
|
||||
};
|
||||
|
||||
AuraScript* GetAuraScript() const OVERRIDE
|
||||
{
|
||||
return new spell_warr_retaliation_AuraScript();
|
||||
}
|
||||
};
|
||||
|
||||
// 64380, 65941 - Shattering Throw
|
||||
class spell_warr_shattering_throw : public SpellScriptLoader
|
||||
{
|
||||
@@ -739,7 +819,7 @@ class spell_warr_vigilance : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 50725 Vigilance
|
||||
// 50725 - Vigilance
|
||||
class spell_warr_vigilance_trigger : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
@@ -779,11 +859,13 @@ void AddSC_warrior_spell_scripts()
|
||||
new spell_warr_damage_shield();
|
||||
new spell_warr_deep_wounds();
|
||||
new spell_warr_execute();
|
||||
new spell_warr_glyph_of_sunder_armor();
|
||||
new spell_warr_improved_spell_reflection();
|
||||
new spell_warr_intimidating_shout();
|
||||
new spell_warr_last_stand();
|
||||
new spell_warr_overpower();
|
||||
new spell_warr_rend();
|
||||
new spell_warr_retaliation();
|
||||
new spell_warr_shattering_throw();
|
||||
new spell_warr_slam();
|
||||
new spell_warr_sweeping_strikes();
|
||||
|
||||
Reference in New Issue
Block a user