diff options
Diffstat (limited to 'src/server/scripts')
20 files changed, 413 insertions, 109 deletions
diff --git a/src/server/scripts/Examples/example_spell.cpp b/src/server/scripts/Examples/example_spell.cpp index 42f10329afd..8d44cb92a4d 100644 --- a/src/server/scripts/Examples/example_spell.cpp +++ b/src/server/scripts/Examples/example_spell.cpp @@ -144,7 +144,7 @@ class spell_ex_66244 : public SpellScriptLoader // checks if script has data required for it to work bool Validate(SpellEntry const * /*spellEntry*/) { - // check if spellid 70522 exists in dbc, we will trigger it later + // check if spellid exists in dbc, we will trigger it later if (!sSpellStore.LookupEntry(SPELL_TRIGGERED)) return false; return true; @@ -161,18 +161,18 @@ class spell_ex_66244 : public SpellScriptLoader return false; } - void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { sLog->outString("Aura Effect is about to be applied on target!"); - Unit * target = aurApp->GetTarget(); + Unit * target = GetTarget(); // cast spell on target on aura apply target->CastSpell(target, SPELL_TRIGGERED, true); } - void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { sLog->outString("Aura Effect is just removed on target!"); - Unit * target = aurApp->GetTarget(); + Unit * target = GetTarget(); Unit * caster = GetCaster(); // caster may be not avalible (logged out for example) if (!caster) @@ -181,10 +181,10 @@ class spell_ex_66244 : public SpellScriptLoader target->CastSpell(caster, SPELL_TRIGGERED, true); } - void HandleEffectPeriodic(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp) + void HandleEffectPeriodic(AuraEffect const * /*aurEff*/) { sLog->outString("Perioidic Aura Effect is does a tick on target!"); - Unit * target = aurApp->GetTarget(); + Unit * target = GetTarget(); // aura targets damage self on tick target->DealDamage(target, 100); } @@ -199,7 +199,7 @@ class spell_ex_66244 : public SpellScriptLoader void HandleEffectCalcAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated) { sLog->outString("Amount of Aura Effect is being calculated now!"); - // we're setting amount to 0 + // we're setting amount to 100 amount = 100; // amount will be never recalculated due to applying passive aura canBeRecalculated = false; @@ -213,7 +213,7 @@ class spell_ex_66244 : public SpellScriptLoader amplitude = 2 * IN_MILLISECONDS; } - void HandleEffectCalcSpellMod(AuraEffect * const /*aurEff*/, SpellModifier *& spellMod) + void HandleEffectCalcSpellMod(AuraEffect const * /*aurEff*/, SpellModifier *& spellMod) { sLog->outString("SpellMod data of Aura Effect is being calculated now!"); // we don't want spellmod for example @@ -242,10 +242,25 @@ class spell_ex_66244 : public SpellScriptLoader OnEffectRemove += AuraEffectRemoveFn(spell_ex_66244AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_66244AuraScript::HandleEffectPeriodic,EFFECT_0, SPELL_AURA_DUMMY); OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_ex_66244AuraScript::HandleEffectPeriodicUpdate, EFFECT_0, SPELL_AURA_DUMMY); - OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_66244AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_DUMMY); - OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_66244AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); - OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_66244AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_66244AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_DUMMY); + DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_66244AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY); + DoEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_66244AuraScript::HandleEffectCalcSpellMod, EFFECT_0, SPELL_AURA_DUMMY); + /*OnApply += AuraEffectApplyFn(); + OnRemove += AuraEffectRemoveFn(); + DoCheckAreaTarget += AuraCheckAreaTargetFn();*/ + } + /* + void OnApply() + { + } + + void OnRemove() + { } + + bool DoCheckAreaTarget(Unit * proposedTarget) + { + }*/ }; // function which creates AuraScript @@ -253,6 +268,56 @@ class spell_ex_66244 : public SpellScriptLoader { return new spell_ex_66244AuraScript(); } + + +}; + +class spell_ex_absorb_aura : public SpellScriptLoader +{ + public: + spell_ex_absorb_aura() : SpellScriptLoader("spell_ex_absorb_aura") { } + + class spell_ex_absorb_auraAuraScript : public AuraScript + { + PrepareAuraScript(spell_ex_absorb_auraAuraScript) + enum Spells + { + SPELL_TRIGGERED = 18282 + }; + + bool Validate(SpellEntry const * /*spellEntry*/) + { + // check if spellid exists in dbc, we will trigger it later + if (!sSpellStore.LookupEntry(SPELL_TRIGGERED)) + return false; + return true; + } + + void HandleOnEffectAbsorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + sLog->outString("Our aura is now absorbing damage done to us!"); + // absorb whole damage done to us + absorbAmount = dmgInfo.GetDamage(); + } + + /*void HandleAfterAbsorb(DamageInfo & dmgInfo) + { + sLog->outString("Our auras have just absorbed damage done to us!"); + }*/ + + // function registering + void Register() + { + OnEffectAbsorb += AuraEffectAbsorbFn(spell_ex_absorb_auraAuraScript::HandleOnEffectAbsorb, EFFECT_0); + //AfterAbsorb += AuraAbsorbFn(spell_ex_absorb_auraAuraScript::HandleAfterAbsorb); + } + }; + + // function which creates AuraScript + AuraScript *GetAuraScript() const + { + return new spell_ex_absorb_auraAuraScript(); + } }; @@ -261,6 +326,7 @@ void AddSC_example_spell_scripts() { new spell_ex_5581; new spell_ex_66244; + new spell_ex_absorb_aura; } /* empty script for copypasting @@ -303,13 +369,13 @@ class spell_ex : public SpellScriptLoader //bool Load(){return true;} //void Unload(){} - //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode) //OnEffectApply += AuraEffectApplyFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); - //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp, AuraEffectHandleModes mode) //OnEffectRemove += AuraEffectRemoveFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); - //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraApplication const * aurApp) //OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY); + //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraEffectHandleModes mode) //OnEffectApply += AuraEffectApplyFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, AuraEffectHandleModes mode) //OnEffectRemove += AuraEffectRemoveFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY, AURA_EFFECT_HANDLE_REAL); + //void spell_ex_SpellScript::Function(AuraEffect const * aurEff) //OnEffectPeriodic += AuraEffectPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY); //void spell_ex_SpellScript::Function(AuraEffect * aurEff) //OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY); - //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated) //OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY); + //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, int32 & amount, bool & canBeRecalculated) //DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY); //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, bool & isPeriodic, int32 & amplitude) //OnEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY); - //void spell_ex_SpellScript::Function(AuraEffect * const aurEff, SpellModifier *& spellMod) //OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY); + //void spell_ex_SpellScript::Function(AuraEffect const * aurEff, SpellModifier *& spellMod) //OnEffectCalcSpellMod += AuraEffectCalcSpellModFn(spell_ex_SpellScript::Function, EFFECT_ANY, SPELL_AURA_ANY); void Register() { } diff --git a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp index 511f2350670..4daa0a354df 100644 --- a/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/ForgeOfSouls/boss_bronjahm.cpp @@ -302,11 +302,11 @@ class spell_bronjahm_soulstorm_channel : public SpellScriptLoader { PrepareAuraScript(spell_bronjahm_soulstorm_channel_AuraScript); - void HandlePeriodicTick(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp) + void HandlePeriodicTick(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); for (uint32 i = 68904; i <= 68907; ++i) - aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), i, true); + GetTarget()->CastSpell(GetTarget(), i, true); } void Register() @@ -330,14 +330,14 @@ class spell_bronjahm_soulstorm_visual : public SpellScriptLoader { PrepareAuraScript(spell_bronjahm_soulstorm_visual_AuraScript); - void HandlePeriodicTick(AuraEffect const* aurEff, AuraApplication const* aurApp) + void HandlePeriodicTick(AuraEffect const* aurEff) { PreventDefaultAction(); if (aurEff->GetTickNumber()%5) return; - aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), 68886, true); + GetTarget()->CastSpell(GetTarget(), 68886, true); for (uint32 i = 68896; i <= 68898; ++i) - aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), i, true); + GetTarget()->CastSpell(GetTarget(), i, true); } void Register() diff --git a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp index dc838462f7f..6a7e49bdad8 100644 --- a/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp +++ b/src/server/scripts/Northrend/FrozenHalls/PitOfSaron/boss_scourgelord_tyrannus.cpp @@ -314,26 +314,26 @@ class spell_tyrannus_overlord_brand : public SpellScriptLoader { PrepareAuraScript(spell_tyrannus_overlord_brand_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - oldAI = aurApp->GetTarget()->GetAI(); - aurApp->GetTarget()->SetAI(new player_overlord_brandAI(aurApp->GetTarget()->ToPlayer())); - aurApp->GetTarget()->GetAI()->SetGUID(GetCasterGUID()); - oldAIState = aurApp->GetTarget()->IsAIEnabled; - aurApp->GetTarget()->IsAIEnabled = true; + oldAI = GetTarget()->GetAI(); + GetTarget()->SetAI(new player_overlord_brandAI(GetTarget()->ToPlayer())); + GetTarget()->GetAI()->SetGUID(GetCasterGUID()); + oldAIState = GetTarget()->IsAIEnabled; + GetTarget()->IsAIEnabled = true; } - void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (aurApp->GetTarget()->GetTypeId() != TYPEID_PLAYER) + if (GetTarget()->GetTypeId() != TYPEID_PLAYER) return; - delete aurApp->GetTarget()->GetAI(); - aurApp->GetTarget()->SetAI(oldAI); - aurApp->GetTarget()->IsAIEnabled = oldAIState; + delete GetTarget()->GetAI(); + GetTarget()->SetAI(oldAI); + GetTarget()->IsAIEnabled = oldAIState; } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp index 7e679f0a0ca..6ec53f412f1 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_prince_council.cpp @@ -1353,9 +1353,9 @@ class spell_taldaram_flame_ball_visual : public SpellScriptLoader return false; } - void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Creature* target = aurApp->GetTarget()->ToCreature(); + Creature* target = GetTarget()->ToCreature(); if (!target) return; @@ -1439,9 +1439,9 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader { PrepareAuraScript(spell_valanar_kinetic_bomb_AuraScript); - void HandleDummyTick(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp) + void HandleDummyTick(AuraEffect const* /*aurEff*/) { - Unit* target = aurApp->GetTarget(); + Unit* target = GetTarget(); if (target->GetTypeId() != TYPEID_UNIT) return; @@ -1449,7 +1449,7 @@ class spell_valanar_kinetic_bomb : public SpellScriptLoader { bomb->CastSpell(bomb, SPELL_KINETIC_BOMB_EXPLOSION, true); bomb->RemoveAurasDueToSpell(SPELL_KINETIC_BOMB_VISUAL); - target->RemoveAura(const_cast<AuraApplication*>(aurApp)); + target->RemoveAura(GetAura()); bomb->AI()->DoAction(SPELL_KINETIC_BOMB_EXPLOSION); } } @@ -1507,10 +1507,10 @@ class spell_blood_council_shadow_prison : public SpellScriptLoader { PrepareAuraScript(spell_blood_council_shadow_prison_AuraScript); - void HandleDummyTick(AuraEffect const* aurEff, AuraApplication const* aurApp) + void HandleDummyTick(AuraEffect const* aurEff) { - if (aurApp->GetTarget()->isMoving()) - aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, NULL, aurEff); + if (GetTarget()->isMoving()) + GetTarget()->CastSpell(GetTarget(), SPELL_SHADOW_PRISON_DAMAGE, true, NULL, aurEff); } void Register() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp index 6c032d58bc2..60cd356a9ee 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_blood_queen_lana_thel.cpp @@ -479,17 +479,17 @@ class spell_blood_queen_frenzied_bloodthirst : public SpellScriptLoader { PrepareAuraScript(spell_blood_queen_frenzied_bloodthirst_AuraScript); - void OnApply(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (InstanceScript* instance = aurApp->GetTarget()->GetInstanceScript()) - if (Creature* bloodQueen = ObjectAccessor::GetCreature(*aurApp->GetTarget(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) + if (InstanceScript* instance = GetTarget()->GetInstanceScript()) + if (Creature* bloodQueen = ObjectAccessor::GetCreature(*GetTarget(), instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) bloodQueen->AI()->Talk(EMOTE_BLOODTHIRST); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = aurApp->GetTarget(); - if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) + Unit* target = GetTarget(); + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_EXPIRE) if (InstanceScript* instance = target->GetInstanceScript()) if (Creature* bloodQueen = ObjectAccessor::GetCreature(*target, instance->GetData64(DATA_BLOOD_QUEEN_LANA_THEL))) { diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp index b922c95c511..67b5d3ccd14 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_deathbringer_saurfang.cpp @@ -969,7 +969,7 @@ class spell_deathbringer_blood_link_aura : public SpellScriptLoader return true; } - void HandlePeriodicTick(AuraEffect const* /*aurEff*/, AuraApplication const* /*aurApp*/) + void HandlePeriodicTick(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); if (GetUnitOwner()->getPowerType() == POWER_ENERGY && GetUnitOwner()->GetPower(POWER_ENERGY) == GetUnitOwner()->GetMaxPower(POWER_ENERGY)) @@ -1022,8 +1022,8 @@ class spell_deathbringer_blood_power : public SpellScriptLoader void Register() { - OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_SCALE); - OnEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_0, SPELL_AURA_MOD_SCALE); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_deathbringer_blood_power_AuraScript::RecalculateHook, EFFECT_1, SPELL_AURA_MOD_DAMAGE_PERCENT_DONE); } bool Load() diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp index a8fc9405285..f221d8d2495 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_festergut.cpp @@ -430,17 +430,17 @@ class spell_festergut_blighted_spores : public SpellScriptLoader { PrepareAuraScript(spell_festergut_blighted_spores_AuraScript); - void ExtraEffect(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void ExtraEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (!GetCaster()->IsAIEnabled || GetCaster()->GetTypeId() != TYPEID_UNIT) return; uint32 inoculateId = CAST_AI(ScriptedAI, GetCaster()->ToCreature()->AI())->INOCULATED_HELPER; uint32 currStack = 0; - if (Aura const* inoculate = aurApp->GetTarget()->GetAura(inoculateId)) + if (Aura const* inoculate = GetTarget()->GetAura(inoculateId)) currStack = inoculate->GetStackAmount(); - aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), SPELL_INOCULATED, true); + GetTarget()->CastSpell(GetTarget(), SPELL_INOCULATED, true); ++currStack; GetCaster()->ToCreature()->AI()->SetData(DATA_INOCULATED_STACK, currStack); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp index 29c772f9a10..cb0f61c79a7 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_lady_deathwhisper.cpp @@ -766,7 +766,7 @@ class spell_deathwhisper_mana_barrier : public SpellScriptLoader { PrepareAuraScript(spell_deathwhisper_mana_barrier_AuraScript); - void HandlePeriodicTick(AuraEffect const* /*aurEff*/, AuraApplication const* /*aurApp*/) + void HandlePeriodicTick(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); Unit* caster = GetCaster(); diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp index 28d6a58b935..09513b98603 100755 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_professor_putricide.cpp @@ -755,9 +755,9 @@ class spell_putricide_gaseous_bloat : public SpellScriptLoader { PrepareAuraScript(spell_putricide_gaseous_bloat_AuraScript); - void HandleExtraEffect(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp) + void HandleExtraEffect(AuraEffect const* /*aurEff*/) { - aurApp->GetTarget()->RemoveAuraFromStack(GetSpellProto()->Id, aurApp->GetBase()->GetCasterGUID()); + GetTarget()->RemoveAuraFromStack(GetSpellProto()->Id, GetCasterGUID()); } void Register() @@ -837,10 +837,10 @@ class spell_putricide_slime_puddle : public SpellScriptLoader { PrepareAuraScript(spell_putricide_slime_puddle_AuraScript); - void HandleTriggerSpell(AuraEffect const* aurEff, AuraApplication const* aurApp) + void HandleTriggerSpell(AuraEffect const* aurEff) { PreventDefaultAction(); - if (Unit* caster = aurApp->GetBase()->GetCaster()) + if (Unit* caster = GetCaster()) { int32 radiusMod = 4; if (Aura* size = caster->GetAura(70347)) @@ -916,15 +916,15 @@ class spell_putricide_ooze_summon : public SpellScriptLoader { PrepareAuraScript(spell_putricide_ooze_summon_AuraScript); - void HandleTriggerSpell(AuraEffect const* aurEff, AuraApplication const* aurApp) + void HandleTriggerSpell(AuraEffect const* aurEff) { PreventDefaultAction(); if (Unit* caster = GetCaster()) { uint32 triggerSpellId = GetSpellProto()->EffectTriggerSpell[aurEff->GetEffIndex()]; float x, y, z; - aurApp->GetTarget()->GetPosition(x, y, z); - z = aurApp->GetTarget()->GetMap()->GetHeight(x, y, z, true, 25.0f); + GetTarget()->GetPosition(x, y, z); + z = GetTarget()->GetMap()->GetHeight(x, y, z, true, 25.0f); x += 10.0f * cosf(caster->GetOrientation()); y += 10.0f * sinf(caster->GetOrientation()); caster->CastSpell(x, y, z, triggerSpellId, true, NULL, NULL, GetCasterGUID(), caster); @@ -1116,7 +1116,7 @@ class spell_putricide_mutated_plague : public SpellScriptLoader { PrepareAuraScript(spell_putricide_mutated_plague_AuraScript); - void HandleTriggerSpell(AuraEffect const* aurEff, AuraApplication const* aurApp) + void HandleTriggerSpell(AuraEffect const* aurEff) { PreventDefaultAction(); Unit* caster = GetCaster(); @@ -1129,21 +1129,21 @@ class spell_putricide_mutated_plague : public SpellScriptLoader int32 damage = SpellMgr::CalculateSpellEffectAmount(spell, 0, caster); float multiplier = 2.0f; - if (aurApp->GetTarget()->GetMap()->GetSpawnMode() & 1) + if (GetTarget()->GetMap()->GetSpawnMode() & 1) multiplier = 3.0f; - damage *= int32(pow(multiplier, aurApp->GetBase()->GetStackAmount())); + damage *= int32(pow(multiplier, GetStackAmount())); damage = int32(damage * 1.5f); - aurApp->GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, aurApp->GetTarget(), true, NULL, aurEff, GetCasterGUID()); + GetTarget()->CastCustomSpell(triggerSpell, SPELLVALUE_BASE_POINT0, damage, GetTarget(), true, NULL, aurEff, GetCasterGUID()); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_STACK) + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_STACK) return; uint32 healSpell = uint32(SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), 0)); - aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), healSpell, true, NULL, NULL, GetCasterGUID()); + GetTarget()->CastSpell(GetTarget(), healSpell, true, NULL, NULL, GetCasterGUID()); } void Register() @@ -1168,13 +1168,13 @@ class spell_putricide_mutation_init : public SpellScriptLoader { PrepareAuraScript(spell_putricide_mutation_init_AuraScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { uint32 spellId = 70311; - if (aurApp->GetTarget()->GetMap()->GetSpawnMode() & 1) + if (GetTarget()->GetMap()->GetSpawnMode() & 1) spellId = 71503; - aurApp->GetTarget()->CastSpell(aurApp->GetTarget(), spellId, true); + GetTarget()->CastSpell(GetTarget(), spellId, true); } void Register() @@ -1198,9 +1198,9 @@ class spell_putricide_mutated_transformation_dismiss : public SpellScriptLoader { PrepareAuraScript(spell_putricide_mutated_transformation_dismiss_AuraScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (Vehicle* veh = aurApp->GetTarget()->GetVehicleKit()) + if (Vehicle* veh = GetTarget()->GetVehicleKit()) veh->RemoveAllPassengers(); } diff --git a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp index a2f7b3b3a21..d2dab0cdeee 100644 --- a/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp +++ b/src/server/scripts/Northrend/IcecrownCitadel/boss_rotface.cpp @@ -708,10 +708,10 @@ class spell_rotface_unstable_ooze_explosion_suicide : public SpellScriptLoader { PrepareAuraScript(spell_rotface_unstable_ooze_explosion_suicide_AuraScript); - void DespawnSelf(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp) + void DespawnSelf(AuraEffect const* /*aurEff*/) { PreventDefaultAction(); - Unit* target = aurApp->GetTarget(); + Unit* target = GetTarget(); if (target->GetTypeId() != TYPEID_UNIT) return; diff --git a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp index 6b6ca975e72..1d6479d1ce0 100644 --- a/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp +++ b/src/server/scripts/Northrend/Ulduar/ulduar/boss_ignis.cpp @@ -443,13 +443,13 @@ class spell_ignis_slag_pot : public SpellScriptLoader return true; } - void HandleEffectPeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp) + void HandleEffectPeriodic(AuraEffect const * aurEff) { Unit* aurEffCaster = aurEff->GetCaster(); if (!aurEffCaster) return; - Unit * target = aurApp->GetTarget(); + Unit * target = GetTarget(); aurEffCaster->CastSpell(target, SPELL_SLAG_POT_DAMAGE, true); if (target->isAlive() && !GetDuration()) target->CastSpell(target, SPELL_SLAG_IMBUED, true); diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 907f1789d95..706853db0ae 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -157,9 +157,49 @@ public: } }; +// 49145 - Spell Deflection +class spell_dk_spell_deflection : public SpellScriptLoader +{ +public: + spell_dk_spell_deflection() : SpellScriptLoader("spell_dk_spell_deflection") { } + + class spell_dk_spell_deflection_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dk_spell_deflection_AuraScript); + + uint32 absorbPct; + void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated) + { + absorbPct = amount; + // Set absorbtion amount to unlimited + amount = -1; + } + + void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + // You have a chance equal to your Parry chance + if ((dmgInfo.GetDamageType() == DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance())) + absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_spell_deflection_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_spell_deflection_AuraScript::Absorb, EFFECT_0); + } + }; + + AuraScript *GetAuraScript() const + { + return new spell_dk_spell_deflection_AuraScript(); + } +}; + + void AddSC_deathknight_spell_scripts() { new spell_dk_corpse_explosion(); new spell_dk_runic_power_feed(); new spell_dk_scourge_strike(); + new spell_dk_spell_deflection(); } diff --git a/src/server/scripts/Spells/spell_druid.cpp b/src/server/scripts/Spells/spell_druid.cpp index 717bf093349..6fb2da82346 100644 --- a/src/server/scripts/Spells/spell_druid.cpp +++ b/src/server/scripts/Spells/spell_druid.cpp @@ -83,7 +83,126 @@ public: } }; +// 69366 - Moonkin Form passive +class spell_dru_moonkin_form_passive : public SpellScriptLoader +{ +public: + spell_dru_moonkin_form_passive() : SpellScriptLoader("spell_dru_moonkin_form_passive") { } + + class spell_dru_moonkin_form_passive_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_moonkin_form_passive_AuraScript); + + uint32 absorbPct; + void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated) + { + absorbPct = amount; + // Set absorbtion amount to unlimited + amount = -1; + } + + void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + // reduces all damage taken while Stunned in Cat Form + if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED)) + absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_moonkin_form_passive_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_dru_moonkin_form_passive_AuraScript::Absorb, EFFECT_1); + } + }; + + AuraScript *GetAuraScript() const + { + return new spell_dru_moonkin_form_passive_AuraScript(); + } +}; + +// 33851 - Primal Tenacity +class spell_dru_primal_tenacity : public SpellScriptLoader +{ +public: + spell_dru_primal_tenacity() : SpellScriptLoader("spell_dru_primal_tenacity") { } + + class spell_dru_primal_tenacity_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_primal_tenacity_AuraScript); + + uint32 absorbPct; + void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated) + { + absorbPct = amount; + // Set absorbtion amount to unlimited + amount = -1; + } + + void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + // reduces all damage taken while Stunned in Cat Form + if ((GetTarget()->GetShapeshiftForm() == FORM_CAT) && (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED))) + absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_primal_tenacity_AuraScript::CalculateAmount, EFFECT_1, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_dru_primal_tenacity_AuraScript::Absorb, EFFECT_1); + } + }; + + AuraScript *GetAuraScript() const + { + return new spell_dru_primal_tenacity_AuraScript(); + } +}; + +// 62606 - Savage Defense +class spell_dru_savage_defense : public SpellScriptLoader +{ +public: + spell_dru_savage_defense() : SpellScriptLoader("spell_dru_savage_defense") { } + + class spell_dru_savage_defense_AuraScript : public AuraScript + { + PrepareAuraScript(spell_dru_savage_defense_AuraScript); + + uint32 absorbPct; + void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated) + { + absorbPct = amount; + // Set absorbtion amount to unlimited + amount = -1; + } + + void Absorb(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + // don't waste charge when no dmg + if (!dmgInfo.GetDamage()) + return; + absorbAmount = CalculatePctN(GetTarget()->GetTotalAttackPowerValue(BASE_ATTACK), absorbPct); + aurEff->SetAmount(0); + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dru_savage_defense_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_dru_savage_defense_AuraScript::Absorb, EFFECT_0); + } + }; + + AuraScript *GetAuraScript() const + { + return new spell_dru_savage_defense_AuraScript(); + } +}; + void AddSC_druid_spell_scripts() { new spell_dru_glyph_of_starfire(); + new spell_dru_moonkin_form_passive(); + new spell_dru_primal_tenacity(); + new spell_dru_savage_defense(); } diff --git a/src/server/scripts/Spells/spell_generic.cpp b/src/server/scripts/Spells/spell_generic.cpp index 45b98438a2c..e99d1e44548 100644 --- a/src/server/scripts/Spells/spell_generic.cpp +++ b/src/server/scripts/Spells/spell_generic.cpp @@ -104,9 +104,9 @@ public: return true; } - void HandleEffectPeriodic(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp) + void HandleEffectPeriodic(AuraEffect const * /*aurEff*/) { - Unit* pTarget = aurApp->GetTarget(); + Unit* pTarget = GetTarget(); if (Player* pPlayerTarget = pTarget->ToPlayer()) if (pPlayerTarget->IsFalling()) { @@ -244,9 +244,9 @@ public: return true; } - void HandleEffectPeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp) + void HandleEffectPeriodic(AuraEffect const * aurEff) { - Unit* pTarget = aurApp->GetTarget(); + Unit* pTarget = GetTarget(); if (Unit* pCaster = GetCaster()) { int32 lifeLeeched = pTarget->CountPctFromMaxHealth(aurEff->GetAmount()); @@ -405,9 +405,9 @@ class spell_creature_permanent_feign_death : public SpellScriptLoader class spell_creature_permanent_feign_deathAuraScript : public AuraScript { PrepareAuraScript(spell_creature_permanent_feign_deathAuraScript) - void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* pTarget = aurApp->GetTarget(); + Unit* pTarget = GetTarget(); pTarget->SetFlag(UNIT_DYNAMIC_FLAGS, UNIT_DYNFLAG_DEAD); pTarget->SetFlag(UNIT_FIELD_FLAGS_2, UNIT_FLAG2_FEIGN_DEATH); @@ -498,14 +498,14 @@ class spell_gen_animal_blood : public SpellScriptLoader return true; } - void OnApply(AuraEffect const* /*aurEff*/, AuraApplication const* /*aurApp*/, AuraEffectHandleModes /*mode*/) + void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { // Remove all auras with spell id 46221, except the one currently being applied while (Aura* aur = GetUnitOwner()->GetOwnedAura(SPELL_ANIMAL_BLOOD, 0, 0, 0, GetAura())) GetUnitOwner()->RemoveOwnedAura(aur); } - void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* /*aurApp*/, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (GetUnitOwner()->IsInWater()) GetUnitOwner()->CastSpell(GetUnitOwner(), SPELL_SPAWN_BLOOD_POOL, true); @@ -533,16 +533,16 @@ class spell_gen_shroud_of_death : public SpellScriptLoader { PrepareAuraScript(spell_gen_shroud_of_deathAuraScript) - void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = aurApp->GetTarget(); + Unit* target = GetTarget(); target->m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); target->m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_GHOST); } - void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = aurApp->GetTarget(); + Unit* target = GetTarget(); target->m_serverSideVisibility.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); target->m_serverSideVisibilityDetect.SetValue(SERVERSIDE_VISIBILITY_GHOST, GHOST_VISIBILITY_ALIVE); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 98a7619c82c..47723e74598 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -357,14 +357,14 @@ public: return true; } - void HandlePeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp) + void HandlePeriodic(AuraEffect const * aurEff) { PreventDefaultAction(); if (aurEff->GetAmount() > 0) return; uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1; - Unit * pTarget = aurApp->GetTarget(); + Unit * pTarget = GetTarget(); if (!pTarget->HasAura(spellId)) { SpellEntry const * triggeredSpellInfo = sSpellStore.LookupEntry(spellId); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index db095f048a8..95b40a2cc17 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -698,9 +698,9 @@ public: return true; } - void OnStackChange(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnStackChange(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = aurApp->GetTarget(); + Unit* target = GetTarget(); switch (GetStackAmount()) { @@ -718,11 +718,11 @@ public: } } - void OnRemove(AuraEffect const* /*aurEff*/, AuraApplication const* aurApp, AuraEffectHandleModes /*mode*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* target = aurApp->GetTarget(); + Unit* target = GetTarget(); - if (aurApp->GetRemoveMode() == AURA_REMOVE_BY_STACK) + if (GetTargetApplication()->GetRemoveMode() == AURA_REMOVE_BY_STACK) return; target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_LOW); target->RemoveAurasDueToSpell(SPELL_SHADOWMOURNE_VISUAL_HIGH); diff --git a/src/server/scripts/Spells/spell_paladin.cpp b/src/server/scripts/Spells/spell_paladin.cpp index b237ead269d..b53f172bfdf 100644 --- a/src/server/scripts/Spells/spell_paladin.cpp +++ b/src/server/scripts/Spells/spell_paladin.cpp @@ -108,16 +108,16 @@ public: return true; } - void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* pTarget = aurApp->GetTarget(); + Unit* pTarget = GetTarget(); if (Unit* pCaster = GetCaster()) pCaster->CastSpell(pTarget, PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, true); } - void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* pTarget = aurApp->GetTarget(); + Unit* pTarget = GetTarget(); pTarget->RemoveAura(PALADIN_SPELL_BLESSING_OF_SANCTUARY_BUFF, GetCasterGUID()); } diff --git a/src/server/scripts/Spells/spell_quest.cpp b/src/server/scripts/Spells/spell_quest.cpp index 834c32d0528..dbd4f574bcc 100644 --- a/src/server/scripts/Spells/spell_quest.cpp +++ b/src/server/scripts/Spells/spell_quest.cpp @@ -219,16 +219,16 @@ public: class spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript : public AuraScript { PrepareAuraScript(spell_q11396_11399_force_shield_arcane_purple_x3_AuraScript) - void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Unit* pTarget = aurApp->GetTarget(); + Unit* pTarget = GetTarget(); pTarget->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); pTarget->AddUnitState(UNIT_STAT_ROOT); } - void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp, AuraEffectHandleModes /*mode*/) + void HandleEffectRemove(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/) { - aurApp->GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); + GetTarget()->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_OOC_NOT_ATTACKABLE); } void Register() diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index ed31db2d264..ffae231839c 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -30,6 +30,44 @@ enum RogueSpells ROGUE_SPELL_PREY_ON_THE_WEAK = 58670, }; +// 31130 - Nerves of Steel +class spell_rog_nerves_of_steel : public SpellScriptLoader +{ +public: + spell_rog_nerves_of_steel() : SpellScriptLoader("spell_rog_nerves_of_steel") { } + + class spell_rog_nerves_of_steel_AuraScript : public AuraScript + { + PrepareAuraScript(spell_rog_nerves_of_steel_AuraScript); + + uint32 absorbPct; + void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated) + { + absorbPct = amount; + // Set absorbtion amount to unlimited + amount = -1; + } + + void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + // reduces all damage taken while stun or fear + if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED | UNIT_FLAG_FLEEING)) + absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_rog_nerves_of_steel_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_rog_nerves_of_steel_AuraScript::Absorb, EFFECT_0); + } + }; + + AuraScript *GetAuraScript() const + { + return new spell_rog_nerves_of_steel_AuraScript(); + } +}; + class spell_rog_preparation : public SpellScriptLoader { public: @@ -109,9 +147,9 @@ public: return true; } - void HandleEffectPeriodic(AuraEffect const * /*aurEff*/, AuraApplication const * aurApp) + void HandleEffectPeriodic(AuraEffect const * /*aurEff*/) { - Unit* pTarget = aurApp->GetTarget(); + Unit* pTarget = GetTarget(); Unit* pVictim = pTarget->getVictim(); if (pVictim && (pTarget->GetHealthPct() > pVictim->GetHealthPct())) { @@ -178,6 +216,7 @@ class spell_rog_shiv : public SpellScriptLoader void AddSC_rogue_spell_scripts() { + new spell_rog_nerves_of_steel(); new spell_rog_preparation(); new spell_rog_prey_on_the_weak(); new spell_rog_shiv(); diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 640faaad64f..bf8e179a438 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -36,6 +36,44 @@ enum ShamanSpells SHAMAN_TOTEM_SPELL_EARTHEN_POWER = 59566,//Spell witch remove snare effect }; +// 51474 - Astral shift +class spell_sha_astral_shift : public SpellScriptLoader +{ +public: + spell_sha_astral_shift() : SpellScriptLoader("spell_sha_astral_shift") { } + + class spell_sha_astral_shift_AuraScript : public AuraScript + { + PrepareAuraScript(spell_sha_astral_shift_AuraScript); + + uint32 absorbPct; + void CalculateAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated) + { + absorbPct = amount; + // Set absorbtion amount to unlimited + amount = -1; + } + + void Absorb(AuraEffect * /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + // reduces all damage taken while stun, fear or silence + if (GetTarget()->GetUInt32Value(UNIT_FIELD_FLAGS) & (UNIT_FLAG_STUNNED | UNIT_FLAG_FLEEING | UNIT_FLAG_SILENCED)) + absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct); + } + + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_sha_astral_shift_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_sha_astral_shift_AuraScript::Absorb, EFFECT_0); + } + }; + + AuraScript *GetAuraScript() const + { + return new spell_sha_astral_shift_AuraScript(); + } +}; + // 1535 Fire Nova class spell_sha_fire_nova : public SpellScriptLoader { @@ -154,9 +192,9 @@ public: return true; } - void HandleEffectPeriodic(AuraEffect const * aurEff, AuraApplication const * aurApp) + void HandleEffectPeriodic(AuraEffect const * aurEff) { - Unit* target = aurApp->GetTarget(); + Unit* target = GetTarget(); if (Unit *caster = aurEff->GetBase()->GetCaster()) if (AuraEffect* aur = caster->GetDummyAuraEffect(SPELLFAMILY_SHAMAN, 2289, 0)) if (roll_chance_i(aur->GetBaseAmount())) @@ -174,8 +212,10 @@ public: return new spell_sha_earthbind_totem_AuraScript(); } }; + void AddSC_shaman_spell_scripts() { + new spell_sha_astral_shift(); new spell_sha_fire_nova(); new spell_sha_mana_tide_totem(); new spell_sha_earthbind_totem(); |