Core/Auras: periodics refactor part 5: ported periodic trigger spell auras to scripts

(cherry picked from commit a36e804ae4)
This commit is contained in:
ariel-
2017-12-15 00:14:55 -03:00
committed by funjoker
parent d9b145615d
commit 44c8ccadd7
12 changed files with 458 additions and 266 deletions
@@ -1791,6 +1791,29 @@ class spell_gen_moss_covered_feet : public AuraScript
}
};
// 46284 - Negative Energy Periodic
class spell_gen_negative_energy_periodic : public AuraScript
{
PrepareAuraScript(spell_gen_negative_energy_periodic);
bool Validate(SpellInfo const* spellInfo) override
{
return ValidateSpellInfo({ spellInfo->GetEffect(EFFECT_0)->TriggerSpell });
}
void PeriodicTick(AuraEffect const* aurEff)
{
PreventDefaultAction();
GetTarget()->CastCustomSpell(GetSpellInfo()->GetEffect(aurEff->GetEffIndex())->TriggerSpell, SPELLVALUE_MAX_TARGETS, aurEff->GetTickNumber() / 10 + 1, nullptr, true, nullptr, aurEff);
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_negative_energy_periodic::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
enum Netherbloom : uint32
{
SPELL_NETHERBLOOM_POLLEN_1 = 28703
@@ -1872,6 +1895,27 @@ class spell_gen_nightmare_vine : public SpellScript
}
};
// 27746 - Nitrous Boost
class spell_gen_nitrous_boost : public AuraScript
{
PrepareAuraScript(spell_gen_nitrous_boost);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
if (GetCaster() && GetTarget()->GetPower(POWER_MANA) >= 10)
GetTarget()->ModifyPower(POWER_MANA, -10);
else
Remove();
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_nitrous_boost::PeriodicTick, EFFECT_1, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
enum ObsidianArmor
{
SPELL_GEN_OBSIDIAN_ARMOR_HOLY = 27536,
@@ -2264,6 +2308,38 @@ class spell_gen_remove_flight_auras : public SpellScript
}
};
// 23493 - Restoration
// 24379 - Restoration
class spell_gen_restoration : public AuraScript
{
PrepareAuraScript(spell_gen_restoration);
void PeriodicTick(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
Unit* caster = GetCaster();
if (!caster)
return;
int32 heal = caster->CountPctFromMaxHealth(10);
HealInfo healInfo(caster, GetTarget(), heal, GetSpellInfo(), GetSpellInfo()->GetSchoolMask());
caster->HealBySpell(healInfo);
/// @todo: should proc other auras?
if (int32 mana = caster->GetMaxPower(POWER_MANA))
{
mana /= 10;
caster->EnergizeBySpell(caster, GetId(), mana, POWER_MANA);
}
}
void Register() override
{
OnEffectPeriodic += AuraEffectPeriodicFn(spell_gen_restoration::PeriodicTick, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL);
}
};
// 38772 Grievous Wound
// 43937 Grievous Wound
// 62331 Impale
@@ -3819,8 +3895,10 @@ void AddSC_generic_spell_scripts()
new spell_gen_lifebloom("spell_faction_champion_dru_lifebloom", SPELL_FACTION_CHAMPIONS_DRU_LIFEBLOOM_FINAL_HEAL);
RegisterSpellScript(spell_gen_mounted_charge);
RegisterAuraScript(spell_gen_moss_covered_feet);
RegisterAuraScript(spell_gen_negative_energy_periodic);
RegisterSpellScript(spell_gen_netherbloom);
RegisterSpellScript(spell_gen_nightmare_vine);
RegisterAuraScript(spell_gen_nitrous_boost);
RegisterAuraScript(spell_gen_obsidian_armor);
RegisterSpellScript(spell_gen_oracle_wolvar_reputation);
RegisterSpellScript(spell_gen_orc_disguise);
@@ -3836,6 +3914,7 @@ void AddSC_generic_spell_scripts()
RegisterSpellScript(spell_gen_profession_research);
RegisterSpellScript(spell_gen_pvp_trinket);
RegisterSpellScript(spell_gen_remove_flight_auras);
RegisterAuraScript(spell_gen_restoration);
RegisterSpellAndAuraScriptPair(spell_gen_replenishment, spell_gen_replenishment_aura);
// Running Wild
RegisterSpellAndAuraScriptPair(spell_gen_running_wild, spell_gen_running_wild_aura);