Guest User

SpellDk

a guest
Feb 11th, 2013
57
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
C++ 23.92 KB | None | 0 0
  1. /*
  2.  * Copyright (C) 2011 - 2013 ArkCORE <http://www.arkania.net/>
  3.  * Copyright (C) 2010 - 2013 ProjectSkyfire <http://www.projectskyfire.org/>
  4.  * Copyright (C) 2008 - 2013 TrinityCore <http://www.trinitycore.org/>
  5.  * Copyright (C) 2005 - 2013 MaNGOS <http://getmangos.com/>
  6.  *
  7.  * This program is free software; you can redistribute it and/or modify it
  8.  * under the terms of the GNU General Public License as published by the
  9.  * Free Software Foundation; either version 2 of the License, or (at your
  10.  * option) any later version.
  11.  *
  12.  * This program is distributed in the hope that it will be useful, but WITHOUT
  13.  * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14.  * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15.  * more details.
  16.  *
  17.  * You should have received a copy of the GNU General Public License along
  18.  * with this program. If not, see <http://www.gnu.org/licenses/>.
  19.  */
  20.  
  21. /*
  22.  * Scripts for spells with SPELLFAMILY_DEATHKNIGHT and SPELLFAMILY_GENERIC spells used by deathknight players.
  23.  * Ordered alphabetically using scriptname.
  24.  * Scriptnames of files in this file should be prefixed with "spell_dk_".
  25.  */
  26.  
  27. #include "ScriptPCH.h"
  28. #include "Spell.h"
  29.  
  30. enum DeathKnightSpells
  31. {
  32.     DK_SPELL_RUNIC_POWER_ENERGIZE               = 49088,
  33.     DK_SPELL_ANTI_MAGIC_SHELL_TALENT            = 51052,
  34.     DK_SPELL_SCOURGE_STRIKE_TRIGGERED           = 70890,
  35.     DK_SPELL_BLOOD_BOIL_TRIGGERED               = 65658,
  36.     DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1   = 49189,
  37.     DK_SPELL_WILL_OF_THE_NECROPOLIS_AURA_R1     = 52284,
  38.     DK_SPELL_BLOOD_PRESENCE                     = 48263,
  39.     DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED  = 63611,
  40.     DK_SPELL_UNHOLY_PRESENCE                    = 48265,
  41.     DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622,
  42.     DK_SPELL_FROST_PRESENCE                     = 48266,
  43.     DK_SPELL_IMPROVED_FROST_PRESENCE_TRIGGERED  = 63621,
  44. };
  45.  
  46. class spell_dk_necrotic_strike: public SpellScriptLoader
  47. {
  48. public:
  49.     spell_dk_necrotic_strike () : SpellScriptLoader("spell_dk_necrotic_strike") { }
  50.  
  51.     class spell_dk_necrotic_strike_SpellScript: public SpellScript
  52.     {
  53.         PrepareSpellScript(spell_dk_necrotic_strike_SpellScript)
  54.         ;
  55.  
  56.         enum Spells
  57.         {
  58.             DK_SPELL_NECROTIC_STRIKE = 73975,
  59.         };
  60.  
  61.         bool Validate (SpellEntry const * /*spellEntry*/)
  62.         {
  63.             return sSpellStore.LookupEntry(DK_SPELL_NECROTIC_STRIKE);
  64.         }
  65.  
  66.         void HandleAfterHit ()
  67.         {
  68.             Unit* caster = GetCaster();
  69.  
  70.             if (Unit* target = GetHitUnit())
  71.             {
  72.                 if (!target)          //
  73.                     return;
  74.                 int32 nsbp = caster->GetTotalAttackPowerValue(BASE_ATTACK) * 0.75f;          //initial scale
  75.                 int32 getheal = target->GetAbsorbHeal();          //Get current absorb value if any
  76.                 int32 heal = nsbp + getheal;          //define &| combine values
  77.  
  78.                 if (Aura* NS = target->GetAura(73975))
  79.                 {
  80.                     target->SetAbsorbHeal(heal);          //set absorb value
  81.                 }
  82.             }
  83.         }
  84.  
  85.         void Register ()
  86.         {
  87.             AfterHit += SpellHitFn(spell_dk_necrotic_strike_SpellScript::HandleAfterHit);
  88.         }
  89.     };
  90.  
  91.     SpellScript *GetSpellScript () const
  92.     {
  93.         return new spell_dk_necrotic_strike_SpellScript();
  94.     }
  95. };
  96.  
  97. // 50462 - Anti-Magic Shell (on raid member)
  98. class spell_dk_anti_magic_shell_raid: public SpellScriptLoader
  99. {
  100. public:
  101.     spell_dk_anti_magic_shell_raid () : SpellScriptLoader("spell_dk_anti_magic_shell_raid") { }
  102.  
  103.     class spell_dk_anti_magic_shell_raid_AuraScript: public AuraScript
  104.     {
  105.         PrepareAuraScript(spell_dk_anti_magic_shell_raid_AuraScript)
  106.         ;
  107.  
  108.         uint32 absorbPct;
  109.  
  110.         bool Load ()
  111.         {
  112.             absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
  113.             return true;
  114.         }
  115.  
  116.         void CalculateAmount (AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
  117.         {
  118.             // TODO: this should absorb limited amount of damage, but no info on calculation formula
  119.             amount = -75;
  120.         }
  121.  
  122.         void Absorb (AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
  123.         {
  124.             absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
  125.         }
  126.  
  127.         void Register ()
  128.         {
  129.             DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_raid_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
  130.             OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_raid_AuraScript::Absorb, EFFECT_0);
  131.         }
  132.     };
  133.  
  134.     AuraScript* GetAuraScript () const
  135.     {
  136.         return new spell_dk_anti_magic_shell_raid_AuraScript();
  137.     }
  138. };
  139.  
  140. // 48707 - Anti-Magic Shell (on self)
  141. class spell_dk_anti_magic_shell_self: public SpellScriptLoader
  142. {
  143. public:
  144.     spell_dk_anti_magic_shell_self () : SpellScriptLoader("spell_dk_anti_magic_shell_self") { }
  145.  
  146.     class spell_dk_anti_magic_shell_self_AuraScript: public AuraScript
  147.     {
  148.         PrepareAuraScript(spell_dk_anti_magic_shell_self_AuraScript)
  149.         ;
  150.  
  151.         uint32 absorbPct, hpPct;
  152.         bool Load ()
  153.         {
  154.             absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
  155.             if (GetCaster()->HasSpell(49224))
  156.                 absorbPct += 8;
  157.             if (GetCaster()->HasSpell(49610))
  158.                 absorbPct += 16;
  159.             if (GetCaster()->HasSpell(49611))
  160.                 absorbPct += 25;
  161.             hpPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_1, GetCaster());
  162.             return true;
  163.         }
  164.  
  165.         bool Validate (SpellEntry const* /*spellEntry*/)
  166.         {
  167.             return sSpellStore.LookupEntry(DK_SPELL_RUNIC_POWER_ENERGIZE);
  168.         }
  169.  
  170.         void CalculateAmount (AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
  171.         {
  172.             // Set absorbtion amount to unlimited
  173.             amount = -75;
  174.         }
  175.  
  176.         void Absorb (AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
  177.         {
  178.             absorbAmount = std::min(CalculatePctN(dmgInfo.GetDamage(), absorbPct), GetTarget()->CountPctFromMaxHealth(hpPct));
  179.         }
  180.  
  181.         void Trigger (AuraEffect* aurEff, DamageInfo & /*dmgInfo*/, uint32 & absorbAmount)
  182.         {
  183.             Unit* target = GetTarget();
  184.             // damage absorbed by Anti-Magic Shell energizes the DK with additional runic power.
  185.             // This, if I'm not mistaken, shows that we get back ~20% of the absorbed damage as runic power.
  186.             int32 bp = absorbAmount * 2 / 10;
  187.             target->CastCustomSpell(target, DK_SPELL_RUNIC_POWER_ENERGIZE, &bp, NULL, NULL, true, NULL, aurEff);
  188.         }
  189.  
  190.         void Register ()
  191.         {
  192.             DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_self_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
  193.             OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Absorb, EFFECT_0);
  194.             AfterEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Trigger, EFFECT_0);
  195.         }
  196.     };
  197.  
  198.     AuraScript* GetAuraScript () const
  199.     {
  200.         return new spell_dk_anti_magic_shell_self_AuraScript();
  201.     }
  202. };
  203.  
  204. // 50461 - Anti-Magic Zone
  205. class spell_dk_anti_magic_zone: public SpellScriptLoader
  206. {
  207. public:
  208.     spell_dk_anti_magic_zone () : SpellScriptLoader("spell_dk_anti_magic_zone") { }
  209.  
  210.     class spell_dk_anti_magic_zone_AuraScript: public AuraScript
  211.     {
  212.         PrepareAuraScript(spell_dk_anti_magic_zone_AuraScript)
  213.         ;
  214.  
  215.         uint32 absorbPct;
  216.  
  217.         bool Load ()
  218.         {
  219.             absorbPct = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
  220.             return true;
  221.         }
  222.  
  223.         bool Validate (SpellEntry const* /*spellEntry*/)
  224.         {
  225.             return sSpellStore.LookupEntry(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
  226.         }
  227.  
  228.         void CalculateAmount (AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/)
  229.         {
  230.             SpellEntry const* talentSpell = sSpellStore.LookupEntry(DK_SPELL_ANTI_MAGIC_SHELL_TALENT);
  231.             amount = SpellMgr::CalculateSpellEffectAmount(talentSpell, EFFECT_0, GetCaster());
  232.             Unit* caster = GetCaster();
  233.             if (!caster)
  234.                 return;
  235.             if (Player* player = caster->ToPlayer())
  236.                 amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK));
  237.         }
  238.  
  239.         void Absorb (AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount)
  240.         {
  241.             absorbAmount = CalculatePctN(dmgInfo.GetDamage(), absorbPct);
  242.         }
  243.  
  244.         void Register ()
  245.         {
  246.             DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_zone_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
  247.             OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_zone_AuraScript::Absorb, EFFECT_0);
  248.         }
  249.     };
  250.  
  251.     AuraScript* GetAuraScript () const
  252.     {
  253.         return new spell_dk_anti_magic_zone_AuraScript();
  254.     }
  255. };
  256.  
  257. class spell_dk_death_gate: public SpellScriptLoader
  258. {
  259. public:
  260.     spell_dk_death_gate () : SpellScriptLoader("spell_dk_death_gate") { }
  261.  
  262.     class spell_dk_death_gate_SpellScript: public SpellScript
  263.     {
  264.         PrepareSpellScript(spell_dk_death_gate_SpellScript)
  265.         ;
  266.  
  267.         SpellCastResult CheckClass ()
  268.         {
  269.             if (GetCaster()->getClass() != CLASS_DEATH_KNIGHT)
  270.             {
  271.                 SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_BE_DEATH_KNIGHT);
  272.                 return SPELL_FAILED_CUSTOM_ERROR;
  273.             }
  274.  
  275.             return SPELL_CAST_OK;
  276.         }
  277.  
  278.         void HandleScript (SpellEffIndex effIndex)
  279.         {
  280.             PreventHitDefaultEffect(effIndex);
  281.             if (!GetHitUnit())
  282.                 return;
  283.             GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false);
  284.         }
  285.  
  286.         void Register ()
  287.         {
  288.             OnCheckCast += SpellCheckCastFn(spell_dk_death_gate_SpellScript::CheckClass);
  289.             OnEffectHitTarget += SpellEffectFn(spell_dk_death_gate_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
  290.         }
  291.     };
  292.  
  293.     SpellScript* GetSpellScript () const
  294.     {
  295.         return new spell_dk_death_gate_SpellScript();
  296.     }
  297. };
  298.  
  299. class spell_dk_death_pact: public SpellScriptLoader
  300. {
  301. public:
  302.     spell_dk_death_pact () : SpellScriptLoader("spell_dk_death_pact") { }
  303.  
  304.     class spell_dk_death_pact_SpellScript: public SpellScript
  305.     {
  306.         PrepareSpellScript(spell_dk_death_pact_SpellScript)
  307.         ;
  308.  
  309.         void FilterTargets (std::list<Unit*>& unitList)
  310.         {
  311.             Unit* unit_to_add = NULL;
  312.             for (std::list<Unit*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr)
  313.             {
  314.                 if ((*itr)->GetTypeId() == TYPEID_UNIT && (*itr)->GetOwnerGUID() == GetCaster()->GetGUID() && (*itr)->ToCreature()->GetCreatureInfo()->type == CREATURE_TYPE_UNDEAD)
  315.                 {
  316.                     unit_to_add = (*itr);
  317.                     break;
  318.                 }
  319.             }
  320.  
  321.             unitList.clear();
  322.             if (unit_to_add)
  323.                 unitList.push_back(unit_to_add);
  324.             else
  325.             {
  326.                 // Pet not found - remove cooldown
  327.                 if (Player* modOwner = GetCaster()->GetSpellModOwner())
  328.                     modOwner->RemoveSpellCooldown(GetSpellInfo()->Id, true);
  329.                 FinishCast(SPELL_FAILED_NO_PET);
  330.             }
  331.         }
  332.  
  333.         void Register ()
  334.         {
  335.             OnUnitTargetSelect += SpellUnitTargetFn(spell_dk_death_pact_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_AREA_ALLY_DST);
  336.         }
  337.     };
  338.  
  339.     SpellScript* GetSpellScript () const
  340.     {
  341.         return new spell_dk_death_pact_SpellScript();
  342.     }
  343. };
  344.  
  345. // 55090 Scourge Strike (55265, 55270, 55271)
  346. class spell_dk_scourge_strike: public SpellScriptLoader
  347. {
  348. public:
  349.     spell_dk_scourge_strike () : SpellScriptLoader("spell_dk_scourge_strike") { }
  350.  
  351.     class spell_dk_scourge_strike_SpellScript: public SpellScript
  352.     {
  353.         PrepareSpellScript(spell_dk_scourge_strike_SpellScript)
  354.         ;
  355.  
  356.         bool Validate (SpellEntry const* /*spellEntry*/)
  357.         {
  358.             if (!sSpellStore.LookupEntry(DK_SPELL_SCOURGE_STRIKE_TRIGGERED))
  359.                 return false;
  360.             return true;
  361.         }
  362.  
  363.         void HandleDummy (SpellEffIndex /*effIndex*/)
  364.         {
  365.             Unit* caster = GetCaster();
  366.             if (Unit* unitTarget = GetHitUnit())
  367.             {
  368.                 int32 bp = CalculatePctN(GetHitDamage(), GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()));
  369.                 caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
  370.             }
  371.         }
  372.  
  373.         void Register ()
  374.         {
  375.             OnEffectHitTarget += SpellEffectFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
  376.         }
  377.     };
  378.  
  379.     SpellScript* GetSpellScript () const
  380.     {
  381.         return new spell_dk_scourge_strike_SpellScript();
  382.     }
  383. };
  384.  
  385. // 48721 Blood Boil
  386. class spell_dk_blood_boil: public SpellScriptLoader
  387. {
  388. public:
  389.     spell_dk_blood_boil () : SpellScriptLoader("spell_dk_blood_boil") { }
  390.  
  391.     class spell_dk_blood_boil_SpellScript: public SpellScript
  392.     {
  393.         PrepareSpellScript(spell_dk_blood_boil_SpellScript)
  394.         ;
  395.  
  396.         bool Validate (SpellEntry const* /*spellEntry*/)
  397.         {
  398.             if (!sSpellStore.LookupEntry(DK_SPELL_BLOOD_BOIL_TRIGGERED))
  399.                 return false;
  400.             return true;
  401.         }
  402.  
  403.         bool Load ()
  404.         {
  405.             _executed = false;
  406.             return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCaster()->getClass() == CLASS_DEATH_KNIGHT;
  407.         }
  408.  
  409.         void HandleAfterHit ()
  410.         {
  411.             if (_executed || !GetHitUnit())
  412.                 return;
  413.  
  414.             _executed = true;
  415.             GetCaster()->CastSpell(GetCaster(), DK_SPELL_BLOOD_BOIL_TRIGGERED, true);
  416.         }
  417.  
  418.         void Register ()
  419.         {
  420.             AfterHit += SpellHitFn(spell_dk_blood_boil_SpellScript::HandleAfterHit);
  421.         }
  422.  
  423.         bool _executed;
  424.     };
  425.  
  426.     SpellScript* GetSpellScript () const
  427.     {
  428.         return new spell_dk_blood_boil_SpellScript();
  429.     }
  430. };
  431.  
  432. // 50365, 50371 Improved Blood Presence
  433. class spell_dk_improved_blood_presence: public SpellScriptLoader
  434. {
  435. public:
  436.     spell_dk_improved_blood_presence () : SpellScriptLoader("spell_dk_improved_blood_presence") { }
  437.  
  438.     class spell_dk_improved_blood_presence_AuraScript: public AuraScript
  439.     {
  440.         PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript)
  441.         bool Validate (SpellEntry const* /*entry*/)
  442.         {
  443.             if (!sSpellStore.LookupEntry(DK_SPELL_BLOOD_PRESENCE))
  444.                 return false;
  445.             if (!sSpellStore.LookupEntry(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
  446.                 return false;
  447.             return true;
  448.         }
  449.  
  450.         void HandleEffectApply (AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
  451.         {
  452.             Unit* target = GetTarget();
  453.             if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
  454.             {
  455.                 int32 basePoints1 = aurEff->GetAmount();
  456.                 target->CastCustomSpell(target, 63611, NULL, &basePoints1, NULL, true, 0, aurEff);
  457.             }
  458.         }
  459.  
  460.         void HandleEffectRemove (AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
  461.         {
  462.             Unit* target = GetTarget();
  463.             if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE))
  464.                 target->RemoveAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED);
  465.         }
  466.  
  467.         void Register ()
  468.         {
  469.             AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  470.             AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  471.         }
  472.     };
  473.  
  474.     AuraScript* GetAuraScript () const
  475.     {
  476.         return new spell_dk_improved_blood_presence_AuraScript();
  477.     }
  478. };
  479.  
  480. // 50391, 50392 Improved Unholy Presence
  481. class spell_dk_improved_unholy_presence: public SpellScriptLoader
  482. {
  483. public:
  484.     spell_dk_improved_unholy_presence () : SpellScriptLoader("spell_dk_improved_unholy_presence") { }
  485.  
  486.     class spell_dk_improved_unholy_presence_AuraScript: public AuraScript
  487.     {
  488.         PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript)
  489.         bool Validate (SpellEntry const* /*entry*/)
  490.         {
  491.             if (!sSpellStore.LookupEntry(DK_SPELL_UNHOLY_PRESENCE))
  492.                 return false;
  493.             if (!sSpellStore.LookupEntry(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
  494.                 return false;
  495.             return true;
  496.         }
  497.  
  498.         void HandleEffectApply (AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
  499.         {
  500.             Unit* target = GetTarget();
  501.             if (target->HasAura(DK_SPELL_UNHOLY_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
  502.             {
  503.                 // Not listed as any effect, only base points set in dbc
  504.                 int32 basePoints0 = SpellMgr::CalculateSpellEffectAmount(GetSpellProto(), EFFECT_0, GetCaster());
  505.                 target->CastCustomSpell(target, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0, &basePoints0, &basePoints0, true, 0, aurEff);
  506.             }
  507.         }
  508.  
  509.         void HandleEffectRemove (AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
  510.         {
  511.             Unit* target = GetTarget();
  512.             if (target->HasAura(DK_SPELL_UNHOLY_PRESENCE))
  513.                 target->RemoveAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED);
  514.         }
  515.  
  516.         void Register ()
  517.         {
  518.             AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  519.             AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  520.         }
  521.     };
  522.  
  523.     AuraScript* GetAuraScript () const
  524.     {
  525.         return new spell_dk_improved_unholy_presence_AuraScript();
  526.     }
  527. };
  528.  
  529. //63621 Improved Frost Presence
  530. class spell_dk_improved_frost_presence : public SpellScriptLoader
  531. {
  532. public:
  533.         spell_dk_improved_frost_presence() : SpellScriptLoader("spell_dk_improved_frost_presence") { }
  534.  
  535.         class spell_dk_improved_frost_presence_AuraScript : public AuraScript
  536.         {
  537.                 PrepareAuraScript(spell_dk_improved_frost_presence_AuraScript)
  538.                 bool Validate(SpellEntry const* /*entry*/)
  539.                 {
  540.                         if (!sSpellStore.LookupEntry(DK_SPELL_FROST_PRESENCE))
  541.                                 return false;
  542.                         if (!sSpellStore.LookupEntry(DK_SPELL_IMPROVED_FROST_PRESENCE_TRIGGERED))
  543.                                 return false;
  544.                           return true;
  545.                 }
  546.  
  547.                 void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
  548.                 {
  549.                         Unit* target = GetTarget();
  550.                         if (!target->HasAura(DK_SPELL_FROST_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_FROST_PRESENCE_TRIGGERED))
  551.                         {
  552.                                 int32 basePoints1 = aurEff->GetAmount();
  553.                                 target->CastCustomSpell(target, 63621, NULL, &basePoints1, NULL, true, 0, aurEff);
  554.                         }
  555.                 }
  556.  
  557.                 void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
  558.                 {
  559.                         Unit* target = GetTarget();
  560.                         if (!target->HasAura(DK_SPELL_FROST_PRESENCE))
  561.                                 target->RemoveAura(DK_SPELL_IMPROVED_FROST_PRESENCE_TRIGGERED);
  562.                 }
  563.  
  564.                 void Register()
  565.                 {
  566.                         AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_frost_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  567.                         AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_frost_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  568.                 }
  569.         };
  570.  
  571.         AuraScript* GetAuraScript() const
  572.         {
  573.                 return new spell_dk_improved_frost_presence_AuraScript();
  574.         }
  575. };
  576.  
  577. // Festering Strike
  578. // Spell Id: 85948
  579. class spell_dk_festering_strike: public SpellScriptLoader
  580. {
  581. public:
  582.     spell_dk_festering_strike () : SpellScriptLoader("spell_dk_festering_strike") { }
  583.  
  584.     class spell_dk_festering_strike_SpellScript: public SpellScript
  585.     {
  586.         PrepareSpellScript(spell_dk_festering_strike_SpellScript)
  587.         ;
  588.  
  589.         void HandleScript (SpellEffIndex /*eff*/)
  590.         {
  591.             if (Unit* target = GetHitUnit())
  592.             {
  593.                 uint32 addDuration = urand(2, 6);
  594.                 if (target->HasAura(45524))          // Chains of Ice
  595.                     target->GetAura(45524)->SetDuration(target->GetAura(45524)->GetDuration() + (addDuration * 1000), true);
  596.                 if (target->HasAura(55095))          // Frost Fever
  597.                     target->GetAura(55095)->SetDuration(target->GetAura(55095)->GetDuration() + (addDuration * 1000), true);
  598.                 if (target->HasAura(55078))          // Blood Plague
  599.                     target->GetAura(55078)->SetDuration(target->GetAura(55078)->GetDuration() + (addDuration * 1000), true);
  600.             }
  601.         }
  602.  
  603.         void Register ()
  604.         {
  605.             OnEffectHitTarget += SpellEffectFn(spell_dk_festering_strike_SpellScript::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
  606.         }
  607.     };
  608.  
  609.     SpellScript* GetSpellScript () const
  610.     {
  611.         return new spell_dk_festering_strike_SpellScript();
  612.     }
  613. };
  614.  
  615. // Chains Of Ice
  616. // Spell Id: 45524
  617. class spell_dk_chains_of_ice: public SpellScriptLoader
  618. {
  619. public:
  620.     spell_dk_chains_of_ice () : SpellScriptLoader("spell_dk_chains_of_ice") { }
  621.  
  622.     class spell_dk_chains_of_ice_SpellScript: public SpellScript
  623.     {
  624.         PrepareSpellScript(spell_dk_chains_of_ice_SpellScript)
  625.         ;
  626.  
  627.         void HandleEffect (SpellEffIndex /*eff*/)
  628.         {
  629.             if (Unit* target = GetHitUnit())
  630.             {
  631.                 if (GetCaster()->HasAura(50041))          // Chilblains Rank 2
  632.                     GetCaster()->CastSpell(target, 96294, true);
  633.                 else if (GetCaster()->HasAura(50040))          // Chilblains Rank 1
  634.                     GetCaster()->CastSpell(target, 96293, true);
  635.             }
  636.         }
  637.  
  638.         void Register ()
  639.         {
  640.             OnEffectHitTarget += SpellEffectFn(spell_dk_chains_of_ice_SpellScript::HandleEffect, EFFECT_2, SPELL_EFFECT_SCHOOL_DAMAGE);
  641.         }
  642.     };
  643.  
  644.     SpellScript* GetSpellScript () const
  645.     {
  646.         return new spell_dk_chains_of_ice_SpellScript();
  647.     }
  648. };
  649.  
  650. void AddSC_deathknight_spell_scripts ()
  651. {
  652.     new spell_dk_necrotic_strike();
  653.     new spell_dk_anti_magic_shell_raid();
  654.     new spell_dk_anti_magic_shell_self();
  655.     new spell_dk_anti_magic_zone();
  656.     new spell_dk_death_gate();
  657.     new spell_dk_death_pact();
  658.     new spell_dk_scourge_strike();
  659.     new spell_dk_blood_boil();
  660.     new spell_dk_improved_blood_presence();
  661.     new spell_dk_improved_unholy_presence();
  662.     new spell_dk_improved_frost_presence();
  663.     new spell_dk_festering_strike();
  664.     new spell_dk_chains_of_ice();
  665. }
Advertisement
Add Comment
Please, Sign In to add comment