diff options
-rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 720 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_hunter.cpp | 441 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_priest.cpp | 223 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_rogue.cpp | 329 |
4 files changed, 864 insertions, 849 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 4bd619155ac..afb9a625761 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -28,21 +28,30 @@ enum DeathKnightSpells { - DK_SPELL_RUNIC_POWER_ENERGIZE = 49088, - DK_SPELL_ANTI_MAGIC_SHELL_TALENT = 51052, - DK_SPELL_CORPSE_EXPLOSION_TRIGGERED = 43999, - DK_SPELL_CORPSE_EXPLOSION_VISUAL = 51270, - DK_SPELL_GHOUL_EXPLODE = 47496, - DK_SPELL_SCOURGE_STRIKE_TRIGGERED = 70890, - DK_SPELL_BLOOD_BOIL_TRIGGERED = 65658, - DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189, - DK_SPELL_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284, - DK_SPELL_BLOOD_PRESENCE = 48266, - DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, - DK_SPELL_UNHOLY_PRESENCE = 48265, - DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622, + SPELL_DK_ANTI_MAGIC_SHELL_TALENT = 51052, + SPELL_DK_BLACK_ICE_R1 = 49140, + SPELL_DK_BLOOD_BOIL_TRIGGERED = 65658, + SPELL_DK_CORPSE_EXPLOSION_TRIGGERED = 43999, + SPELL_DK_CORPSE_EXPLOSION_VISUAL = 51270, + SPELL_DK_DEATH_COIL_DAMAGE = 47632, + SPELL_DK_DEATH_COIL_HEAL = 47633, + SPELL_DK_DEATH_STRIKE_HEAL = 45470, + SPELL_DK_GHOUL_EXPLODE = 47496, + SPELL_DK_RUNIC_POWER_ENERGIZE = 49088, + SPELL_DK_SCOURGE_STRIKE_TRIGGERED = 70890, + SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189, + SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284, + SPELL_DK_BLOOD_PRESENCE = 48266, + SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611, + SPELL_DK_UNHOLY_PRESENCE = 48265, + SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622, + SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART = 64962, SPELL_DK_ITEM_T8_MELEE_4P_BONUS = 64736, - DK_SPELL_BLACK_ICE_R1 = 49140, +}; + +enum DeathKnightSpellIcons +{ + DK_ICON_ID_IMPROVED_DEATH_STRIKE = 2751, }; // 50462 - Anti-Magic Shell (on raid member) @@ -71,13 +80,13 @@ class spell_dk_anti_magic_shell_raid : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_raid_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_raid_AuraScript::Absorb, EFFECT_0); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_raid_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_raid_AuraScript::Absorb, EFFECT_0); } }; @@ -105,9 +114,9 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader return true; } - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_RUNIC_POWER_ENERGIZE)) + if (!sSpellMgr->GetSpellInfo(SPELL_DK_RUNIC_POWER_ENERGIZE)) return false; return true; } @@ -128,14 +137,14 @@ class spell_dk_anti_magic_shell_self : public SpellScriptLoader // damage absorbed by Anti-Magic Shell energizes the DK with additional runic power. // This, if I'm not mistaken, shows that we get back ~20% of the absorbed damage as runic power. int32 bp = absorbAmount * 2 / 10; - target->CastCustomSpell(target, DK_SPELL_RUNIC_POWER_ENERGIZE, &bp, NULL, NULL, true, NULL, aurEff); + target->CastCustomSpell(target, SPELL_DK_RUNIC_POWER_ENERGIZE, &bp, NULL, NULL, true, NULL, aurEff); } void Register() { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_self_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Absorb, EFFECT_0); - AfterEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Trigger, EFFECT_0); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_anti_magic_shell_self_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Absorb, EFFECT_0); + AfterEffectAbsorb += AuraEffectAbsorbFn(spell_dk_anti_magic_shell_self_AuraScript::Trigger, EFFECT_0); } }; @@ -165,14 +174,14 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT)) + if (!sSpellMgr->GetSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT)) return false; return true; } void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) { - SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(DK_SPELL_ANTI_MAGIC_SHELL_TALENT); + SpellInfo const* talentSpell = sSpellMgr->GetSpellInfo(SPELL_DK_ANTI_MAGIC_SHELL_TALENT); amount = talentSpell->Effects[EFFECT_0].CalcValue(GetCaster()); if (Player* player = GetCaster()->ToPlayer()) amount += int32(2 * player->GetTotalAttackPowerValue(BASE_ATTACK)); @@ -196,7 +205,53 @@ class spell_dk_anti_magic_zone : public SpellScriptLoader } }; -// 49158 Corpse Explosion (51325, 51326, 51327, 51328) +// 48721 - Blood Boil +class spell_dk_blood_boil : public SpellScriptLoader +{ + public: + spell_dk_blood_boil() : SpellScriptLoader("spell_dk_blood_boil") { } + + class spell_dk_blood_boil_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dk_blood_boil_SpellScript); + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_BOIL_TRIGGERED)) + return false; + return true; + } + + bool Load() + { + _executed = false; + return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCaster()->getClass() == CLASS_DEATH_KNIGHT; + } + + void HandleAfterHit() + { + if (_executed || !GetHitUnit()) + return; + + _executed = true; + GetCaster()->CastSpell(GetCaster(), SPELL_DK_BLOOD_BOIL_TRIGGERED, true); + } + + void Register() + { + AfterHit += SpellHitFn(spell_dk_blood_boil_SpellScript::HandleAfterHit); + } + + bool _executed; + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_blood_boil_SpellScript(); + } +}; + +// 49158 - Corpse Explosion (51325, 51326, 51327, 51328) class spell_dk_corpse_explosion : public SpellScriptLoader { public: @@ -206,11 +261,11 @@ class spell_dk_corpse_explosion : public SpellScriptLoader { PrepareSpellScript(spell_dk_corpse_explosion_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED) || !sSpellMgr->GetSpellInfo(DK_SPELL_GHOUL_EXPLODE)) + if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_DK_GHOUL_EXPLODE)) return false; - if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_VISUAL)) + if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_VISUAL)) return false; return true; } @@ -223,17 +278,17 @@ class spell_dk_corpse_explosion : public SpellScriptLoader if (unitTarget->isAlive()) // Living ghoul as a target { bp = int32(unitTarget->CountPctFromMaxHealth(25)); - unitTarget->CastCustomSpell(unitTarget, DK_SPELL_GHOUL_EXPLODE, &bp, NULL, NULL, false); + unitTarget->CastCustomSpell(unitTarget, SPELL_DK_GHOUL_EXPLODE, &bp, NULL, NULL, false); } else // Some corpse { bp = GetEffectValue(); GetCaster()->CastCustomSpell(unitTarget, GetSpellInfo()->Effects[EFFECT_1].CalcValue(), &bp, NULL, NULL, true); // Corpse Explosion (Suicide) - unitTarget->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, true); + unitTarget->CastSpell(unitTarget, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED, true); } // Set corpse look - GetCaster()->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_VISUAL, true); + GetCaster()->CastSpell(unitTarget, SPELL_DK_CORPSE_EXPLOSION_VISUAL, true); } } @@ -249,44 +304,74 @@ class spell_dk_corpse_explosion : public SpellScriptLoader } }; -// 47496 - Explode, Ghoul spell for Corpse Explosion -class spell_dk_ghoul_explode : public SpellScriptLoader +// -47541, 52375, 59134, -62900 - Death Coil +class spell_dk_death_coil : public SpellScriptLoader { public: - spell_dk_ghoul_explode() : SpellScriptLoader("spell_dk_ghoul_explode") { } + spell_dk_death_coil() : SpellScriptLoader("spell_dk_death_coil") { } - class spell_dk_ghoul_explode_SpellScript : public SpellScript + class spell_dk_death_coil_SpellScript : public SpellScript { - PrepareSpellScript(spell_dk_ghoul_explode_SpellScript); + PrepareSpellScript(spell_dk_death_coil_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spell*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_COIL_HEAL)) return false; return true; } - void Suicide(SpellEffIndex /*effIndex*/) + void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* unitTarget = GetHitUnit()) + int32 damage = GetEffectValue(); + Unit* caster = GetCaster(); + if (Unit* target = GetHitUnit()) { - // Corpse Explosion (Suicide) - unitTarget->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, true); + if (caster->IsFriendlyTo(target)) + { + int32 bp = int32(damage * 1.5f); + caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_HEAL, &bp, NULL, NULL, true); + } + else + { + if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART, EFFECT_1)) + damage += auraEffect->GetBaseAmount(); + caster->CastCustomSpell(target, SPELL_DK_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true); + } + } + } + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (Unit* target = GetExplTargetUnit()) + { + if (!caster->IsFriendlyTo(target) && !caster->isInFront(target)) + return SPELL_FAILED_UNIT_NOT_INFRONT; + + if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD) + return SPELL_FAILED_BAD_TARGETS; } + else + return SPELL_FAILED_BAD_TARGETS; + + return SPELL_CAST_OK; } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_dk_ghoul_explode_SpellScript::Suicide, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE); + OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast); + OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_dk_ghoul_explode_SpellScript(); + return new spell_dk_death_coil_SpellScript(); } }; +// 52751 - Death Gate class spell_dk_death_gate : public SpellScriptLoader { public: @@ -327,6 +412,41 @@ class spell_dk_death_gate : public SpellScriptLoader } }; +// 49560 - Death Grip +class spell_dk_death_grip : public SpellScriptLoader +{ + public: + spell_dk_death_grip() : SpellScriptLoader("spell_dk_death_grip") { } + + class spell_dk_death_grip_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dk_death_grip_SpellScript); + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + int32 damage = GetEffectValue(); + Position const* pos = GetExplTargetDest(); + if (Unit* target = GetHitUnit()) + { + if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence + target->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), damage, true); + } + } + + void Register() + { + OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_death_grip_SpellScript(); + } +}; + +// 48743 - Death Pact class spell_dk_death_pact : public SpellScriptLoader { public: @@ -351,22 +471,22 @@ class spell_dk_death_pact : public SpellScriptLoader return SPELL_FAILED_NO_PET; } - void FilterTargets(std::list<WorldObject*>& unitList) + void FilterTargets(std::list<WorldObject*>& targetList) { - Unit* unit_to_add = NULL; - for (std::list<WorldObject*>::iterator itr = unitList.begin(); itr != unitList.end(); ++itr) + Unit* target = NULL; + for (std::list<WorldObject*>::iterator itr = targetList.begin(); itr != targetList.end(); ++itr) { if (Unit* unit = (*itr)->ToUnit()) - if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD) - { - unit_to_add = unit; - break; - } + if (unit->GetOwnerGUID() == GetCaster()->GetGUID() && unit->GetCreatureType() == CREATURE_TYPE_UNDEAD) + { + target = unit; + break; + } } - unitList.clear(); - if (unit_to_add) - unitList.push_back(unit_to_add); + targetList.clear(); + if (target) + targetList.push_back(target); } void Register() @@ -382,26 +502,19 @@ class spell_dk_death_pact : public SpellScriptLoader } }; -// 55090 Scourge Strike (55265, 55270, 55271) -class spell_dk_scourge_strike : public SpellScriptLoader +// -49998 - Death Strike +class spell_dk_death_strike : public SpellScriptLoader { public: - spell_dk_scourge_strike() : SpellScriptLoader("spell_dk_scourge_strike") { } + spell_dk_death_strike() : SpellScriptLoader("spell_dk_death_strike") { } - class spell_dk_scourge_strike_SpellScript : public SpellScript + class spell_dk_death_strike_SpellScript : public SpellScript { - PrepareSpellScript(spell_dk_scourge_strike_SpellScript); - float multiplier; - - bool Load() - { - multiplier = 1.0f; - return true; - } + PrepareSpellScript(spell_dk_death_strike_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_SCOURGE_STRIKE_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_STRIKE_HEAL)) return false; return true; } @@ -409,442 +522,329 @@ class spell_dk_scourge_strike : public SpellScriptLoader void HandleDummy(SpellEffIndex /*effIndex*/) { Unit* caster = GetCaster(); - if (Unit* unitTarget = GetHitUnit()) - { - multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f); - // Death Knight T8 Melee 4P Bonus - if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0)) - AddPct(multiplier, aurEff->GetAmount()); - } - } - - void HandleAfterHit() - { - Unit* caster = GetCaster(); - if (Unit* unitTarget = GetHitUnit()) + if (Unit* target = GetHitUnit()) { - int32 bp = GetHitDamage() * multiplier; - - if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0)) - AddPct(bp, aurEff->GetAmount()); - - caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true); + uint32 count = target->GetDiseasesByCaster(caster->GetGUID()); + int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier))); + // Improved Death Strike + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, DK_ICON_ID_IMPROVED_DEATH_STRIKE, 0)) + AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2)); + caster->CastCustomSpell(caster, SPELL_DK_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false); } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); - AfterHit += SpellHitFn(spell_dk_scourge_strike_SpellScript::HandleAfterHit); + OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); } + }; SpellScript* GetSpellScript() const { - return new spell_dk_scourge_strike_SpellScript(); + return new spell_dk_death_strike_SpellScript(); } }; -// 49145 - Spell Deflection -class spell_dk_spell_deflection : public SpellScriptLoader +// 47496 - Explode, Ghoul spell for Corpse Explosion +class spell_dk_ghoul_explode : public SpellScriptLoader { public: - spell_dk_spell_deflection() : SpellScriptLoader("spell_dk_spell_deflection") { } + spell_dk_ghoul_explode() : SpellScriptLoader("spell_dk_ghoul_explode") { } - class spell_dk_spell_deflection_AuraScript : public AuraScript + class spell_dk_ghoul_explode_SpellScript : public SpellScript { - PrepareAuraScript(spell_dk_spell_deflection_AuraScript); - - uint32 absorbPct; + PrepareSpellScript(spell_dk_ghoul_explode_SpellScript); - bool Load() + bool Validate(SpellInfo const* /*spellInfo*/) { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED)) + return false; return true; } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) - { - // Set absorbtion amount to unlimited - amount = -1; - } - - void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + void Suicide(SpellEffIndex /*effIndex*/) { - // You have a chance equal to your Parry chance - if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance())) - absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); + if (Unit* unitTarget = GetHitUnit()) + { + // Corpse Explosion (Suicide) + unitTarget->CastSpell(unitTarget, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED, true); + } } 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); + OnEffectHitTarget += SpellEffectFn(spell_dk_ghoul_explode_SpellScript::Suicide, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE); } }; - AuraScript* GetAuraScript() const + SpellScript* GetSpellScript() const { - return new spell_dk_spell_deflection_AuraScript(); + return new spell_dk_ghoul_explode_SpellScript(); } }; -// 48721 Blood Boil -class spell_dk_blood_boil : public SpellScriptLoader +// 50365, 50371 - Improved Blood Presence +class spell_dk_improved_blood_presence : public SpellScriptLoader { public: - spell_dk_blood_boil() : SpellScriptLoader("spell_dk_blood_boil") { } + spell_dk_improved_blood_presence() : SpellScriptLoader("spell_dk_improved_blood_presence") { } - class spell_dk_blood_boil_SpellScript : public SpellScript + class spell_dk_improved_blood_presence_AuraScript : public AuraScript { - PrepareSpellScript(spell_dk_blood_boil_SpellScript); + PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_BOIL_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) return false; return true; } - bool Load() + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - _executed = false; - return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCaster()->getClass() == CLASS_DEATH_KNIGHT; + Unit* target = GetTarget(); + if (!target->HasAura(SPELL_DK_BLOOD_PRESENCE) && !target->HasAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) + { + int32 basePoints1 = aurEff->GetAmount(); + target->CastCustomSpell(target, SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, 0, aurEff); + } } - void HandleAfterHit() + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - if (_executed || !GetHitUnit()) - return; - - _executed = true; - GetCaster()->CastSpell(GetCaster(), DK_SPELL_BLOOD_BOIL_TRIGGERED, true); + Unit* target = GetTarget(); + if (!target->HasAura(SPELL_DK_BLOOD_PRESENCE)) + target->RemoveAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED); } void Register() { - AfterHit += SpellHitFn(spell_dk_blood_boil_SpellScript::HandleAfterHit); + AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } - - bool _executed; }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_dk_blood_boil_SpellScript(); + return new spell_dk_improved_blood_presence_AuraScript(); } }; -// 52284 - Will of the Necropolis -class spell_dk_will_of_the_necropolis : public SpellScriptLoader +// 50391, 50392 - Improved Unholy Presence +class spell_dk_improved_unholy_presence : public SpellScriptLoader { public: - spell_dk_will_of_the_necropolis() : SpellScriptLoader("spell_dk_will_of_the_necropolis") { } + spell_dk_improved_unholy_presence() : SpellScriptLoader("spell_dk_improved_unholy_presence") { } - class spell_dk_will_of_the_necropolis_AuraScript : public AuraScript + class spell_dk_improved_unholy_presence_AuraScript : public AuraScript { - PrepareAuraScript(spell_dk_will_of_the_necropolis_AuraScript); + PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript); - bool Validate(SpellInfo const* spellEntry) + bool Validate(SpellInfo const* /*spellInfo*/) { - // can't use other spell than will of the necropolis due to spell_ranks dependency - if (sSpellMgr->GetFirstSpellInChain(DK_SPELL_WILL_OF_THE_NECROPOLIS_AURA_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) - return false; - - uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id); - if (!sSpellMgr->GetSpellWithRank(DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank, true)) + if (!sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE) || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)) return false; - return true; } - uint32 absorbPct; - - bool Load() + void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) { - absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); - return true; + Unit* target = GetTarget(); + if (target->HasAura(SPELL_DK_UNHOLY_PRESENCE) && !target->HasAura(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)) + { + // Not listed as any effect, only base points set in dbc + int32 basePoints0 = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); + target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0, &basePoints0, &basePoints0, true, 0, aurEff); + } } - void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - // Set absorbtion amount to unlimited - amount = -1; - } - - void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) - { - // min pct of hp is stored in effect 0 of talent spell - uint32 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); - SpellInfo const* talentProto = sSpellMgr->GetSpellInfo(sSpellMgr->GetSpellWithRank(DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank)); - - int32 remainingHp = int32(GetTarget()->GetHealth() - dmgInfo.GetDamage()); - int32 minHp = int32(GetTarget()->CountPctFromMaxHealth(talentProto->Effects[EFFECT_0].CalcValue(GetCaster()))); - - // Damage that would take you below [effect0] health or taken while you are at [effect0] - if (remainingHp < minHp) - absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); + GetTarget()->RemoveAura(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED); } void Register() { - DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_will_of_the_necropolis_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); - OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_will_of_the_necropolis_AuraScript::Absorb, EFFECT_0); + AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; AuraScript* GetAuraScript() const { - return new spell_dk_will_of_the_necropolis_AuraScript(); + return new spell_dk_improved_unholy_presence_AuraScript(); } }; -// 50365, 50371 Improved Blood Presence -class spell_dk_improved_blood_presence : public SpellScriptLoader +// 55090 - Scourge Strike (55265, 55270, 55271) +class spell_dk_scourge_strike : public SpellScriptLoader { -public: - spell_dk_improved_blood_presence() : SpellScriptLoader("spell_dk_improved_blood_presence") { } - - class spell_dk_improved_blood_presence_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dk_improved_blood_presence_AuraScript); + public: + spell_dk_scourge_strike() : SpellScriptLoader("spell_dk_scourge_strike") { } - bool Validate(SpellInfo const* /*entry*/) + class spell_dk_scourge_strike_SpellScript : public SpellScript { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) - return false; - return true; - } + PrepareSpellScript(spell_dk_scourge_strike_SpellScript); + float multiplier; - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED)) + bool Load() { - int32 basePoints1 = aurEff->GetAmount(); - target->CastCustomSpell(target, DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, 0, aurEff); + multiplier = 1.0f; + return true; } - } - - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (!target->HasAura(DK_SPELL_BLOOD_PRESENCE)) - target->RemoveAura(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED); - } - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_blood_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_dk_improved_blood_presence_AuraScript(); - } -}; - -// 50391, 50392 Improved Unholy Presence -class spell_dk_improved_unholy_presence : public SpellScriptLoader -{ -public: - spell_dk_improved_unholy_presence() : SpellScriptLoader("spell_dk_improved_unholy_presence") { } - - class spell_dk_improved_unholy_presence_AuraScript : public AuraScript - { - PrepareAuraScript(spell_dk_improved_unholy_presence_AuraScript); - - bool Validate(SpellInfo const* /*entry*/) - { - if (!sSpellMgr->GetSpellInfo(DK_SPELL_UNHOLY_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)) - return false; - return true; - } - - void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/) - { - Unit* target = GetTarget(); - if (target->HasAura(DK_SPELL_UNHOLY_PRESENCE) && !target->HasAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)) + bool Validate(SpellInfo const* /*spellInfo*/) { - // Not listed as any effect, only base points set in dbc - int32 basePoints0 = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue(); - target->CastCustomSpell(target, DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0, &basePoints0, &basePoints0, true, 0, aurEff); + if (!sSpellMgr->GetSpellInfo(SPELL_DK_SCOURGE_STRIKE_TRIGGERED)) + return false; + return true; } - } - - void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) - { - GetTarget()->RemoveAura(DK_SPELL_IMPROVED_UNHOLY_PRESENCE_TRIGGERED); - } - - void Register() - { - AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_unholy_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_dk_improved_unholy_presence_AuraScript(); - } -}; - -enum DeathStrike -{ - ICON_ID_IMPROVED_DEATH_STRIKE = 2751, - SPELL_DEATH_STRIKE_HEAL = 45470, -}; - -class spell_dk_death_strike : public SpellScriptLoader -{ - public: - spell_dk_death_strike() : SpellScriptLoader("spell_dk_death_strike") { } - - class spell_dk_death_strike_SpellScript : public SpellScript - { - PrepareSpellScript(spell_dk_death_strike_SpellScript); - bool Validate(SpellInfo const* /*SpellEntry*/) + void HandleDummy(SpellEffIndex /*effIndex*/) { - if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_STRIKE_HEAL)) - return false; - return true; + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + { + multiplier = (GetEffectValue() * unitTarget->GetDiseasesByCaster(caster->GetGUID()) / 100.f); + // Death Knight T8 Melee 4P Bonus + if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_DK_ITEM_T8_MELEE_4P_BONUS, EFFECT_0)) + AddPct(multiplier, aurEff->GetAmount()); + } } - void HandleDummy(SpellEffIndex /* effIndex */) + void HandleAfterHit() { Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) + if (Unit* unitTarget = GetHitUnit()) { - uint32 count = target->GetDiseasesByCaster(caster->GetGUID()); - int32 bp = int32(count * caster->CountPctFromMaxHealth(int32(GetSpellInfo()->Effects[EFFECT_0].DamageMultiplier))); - // Improved Death Strike - if (AuraEffect const* aurEff = caster->GetAuraEffect(SPELL_AURA_ADD_PCT_MODIFIER, SPELLFAMILY_DEATHKNIGHT, ICON_ID_IMPROVED_DEATH_STRIKE, 0)) - AddPct(bp, caster->CalculateSpellDamage(caster, aurEff->GetSpellInfo(), 2)); - caster->CastCustomSpell(caster, SPELL_DEATH_STRIKE_HEAL, &bp, NULL, NULL, false); + int32 bp = GetHitDamage() * multiplier; + + if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(SPELL_DK_BLACK_ICE_R1, EFFECT_0)) + AddPct(bp, aurEff->GetAmount()); + + caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true); } } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); + OnEffectHitTarget += SpellEffectFn(spell_dk_scourge_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY); + AfterHit += SpellHitFn(spell_dk_scourge_strike_SpellScript::HandleAfterHit); } - }; SpellScript* GetSpellScript() const { - return new spell_dk_death_strike_SpellScript(); + return new spell_dk_scourge_strike_SpellScript(); } }; -enum DeathCoil -{ - SPELL_DEATH_COIL_DAMAGE = 47632, - SPELL_DEATH_COIL_HEAL = 47633, - SPELL_SIGIL_VENGEFUL_HEART = 64962, -}; - -class spell_dk_death_coil : public SpellScriptLoader +// 49145 - Spell Deflection +class spell_dk_spell_deflection : public SpellScriptLoader { public: - spell_dk_death_coil() : SpellScriptLoader("spell_dk_death_coil") { } + spell_dk_spell_deflection() : SpellScriptLoader("spell_dk_spell_deflection") { } - class spell_dk_death_coil_SpellScript : public SpellScript + class spell_dk_spell_deflection_AuraScript : public AuraScript { - PrepareSpellScript(spell_dk_death_coil_SpellScript); + PrepareAuraScript(spell_dk_spell_deflection_AuraScript); - bool Validate(SpellInfo const* /*spell*/) + uint32 absorbPct; + + bool Load() { - if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL)) - return false; + absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); return true; } - void HandleDummy(SpellEffIndex /*effIndex*/) + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) { - int32 damage = GetEffectValue(); - Unit* caster = GetCaster(); - if (Unit* target = GetHitUnit()) - { - if (caster->IsFriendlyTo(target)) - { - int32 bp = int32(damage * 1.5f); - caster->CastCustomSpell(target, SPELL_DEATH_COIL_HEAL, &bp, NULL, NULL, true); - } - else - { - if (AuraEffect const* auraEffect = caster->GetAuraEffect(SPELL_SIGIL_VENGEFUL_HEART, EFFECT_1)) - damage += auraEffect->GetBaseAmount(); - caster->CastCustomSpell(target, SPELL_DEATH_COIL_DAMAGE, &damage, NULL, NULL, true); - } - } + // Set absorbtion amount to unlimited + amount = -1; } - SpellCastResult CheckCast() + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { - Unit* caster = GetCaster(); - if (Unit* target = GetExplTargetUnit()) - { - if (!caster->IsFriendlyTo(target) && !caster->isInFront(target)) - return SPELL_FAILED_UNIT_NOT_INFRONT; - - if (target->IsFriendlyTo(caster) && target->GetCreatureType() != CREATURE_TYPE_UNDEAD) - return SPELL_FAILED_BAD_TARGETS; - } - else - return SPELL_FAILED_BAD_TARGETS; - - return SPELL_CAST_OK; + // You have a chance equal to your Parry chance + if ((dmgInfo.GetDamageType() == SPELL_DIRECT_DAMAGE) && roll_chance_f(GetTarget()->GetUnitParryChance())) + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } void Register() { - OnCheckCast += SpellCheckCastFn(spell_dk_death_coil_SpellScript::CheckCast); - OnEffectHitTarget += SpellEffectFn(spell_dk_death_coil_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_spell_deflection_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_spell_deflection_AuraScript::Absorb, EFFECT_0); } - }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_dk_death_coil_SpellScript(); + return new spell_dk_spell_deflection_AuraScript(); } }; -class spell_dk_death_grip : public SpellScriptLoader +// 52284 - Will of the Necropolis +class spell_dk_will_of_the_necropolis : public SpellScriptLoader { public: - spell_dk_death_grip() : SpellScriptLoader("spell_dk_death_grip") { } + spell_dk_will_of_the_necropolis() : SpellScriptLoader("spell_dk_will_of_the_necropolis") { } - class spell_dk_death_grip_SpellScript : public SpellScript + class spell_dk_will_of_the_necropolis_AuraScript : public AuraScript { - PrepareSpellScript(spell_dk_death_grip_SpellScript); + PrepareAuraScript(spell_dk_will_of_the_necropolis_AuraScript); - void HandleDummy(SpellEffIndex /*effIndex*/) + bool Validate(SpellInfo const* spellInfo) { - int32 damage = GetEffectValue(); - Position const* pos = GetExplTargetDest(); - if (Unit* target = GetHitUnit()) - { - if (!target->HasAuraType(SPELL_AURA_DEFLECT_SPELLS)) // Deterrence - target->CastSpell(pos->GetPositionX(), pos->GetPositionY(), pos->GetPositionZ(), damage, true); - } + // can't use other spell than will of the necropolis due to spell_ranks dependency + if (sSpellMgr->GetFirstSpellInChain(SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id)) + return false; + + uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id); + if (!sSpellMgr->GetSpellWithRank(SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank, true)) + return false; + + return true; } - void Register() + uint32 absorbPct; + + bool Load() { - OnEffectHitTarget += SpellEffectFn(spell_dk_death_grip_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + absorbPct = GetSpellInfo()->Effects[EFFECT_0].CalcValue(GetCaster()); + return true; + } + + void CalculateAmount(AuraEffect const* /*aurEff*/, int32 & amount, bool & /*canBeRecalculated*/) + { + // Set absorbtion amount to unlimited + amount = -1; + } + + void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) + { + // min pct of hp is stored in effect 0 of talent spell + uint32 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); + SpellInfo const* talentProto = sSpellMgr->GetSpellInfo(sSpellMgr->GetSpellWithRank(SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank)); + + int32 remainingHp = int32(GetTarget()->GetHealth() - dmgInfo.GetDamage()); + int32 minHp = int32(GetTarget()->CountPctFromMaxHealth(talentProto->Effects[EFFECT_0].CalcValue(GetCaster()))); + + // Damage that would take you below [effect0] health or taken while you are at [effect0] + if (remainingHp < minHp) + absorbAmount = CalculatePct(dmgInfo.GetDamage(), absorbPct); } + void Register() + { + DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_will_of_the_necropolis_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB); + OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_will_of_the_necropolis_AuraScript::Absorb, EFFECT_0); + } }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_dk_death_grip_SpellScript(); + return new spell_dk_will_of_the_necropolis_AuraScript(); } }; @@ -853,17 +853,17 @@ void AddSC_deathknight_spell_scripts() new spell_dk_anti_magic_shell_raid(); new spell_dk_anti_magic_shell_self(); new spell_dk_anti_magic_zone(); + new spell_dk_blood_boil(); new spell_dk_corpse_explosion(); - new spell_dk_ghoul_explode(); + new spell_dk_death_coil(); new spell_dk_death_gate(); + new spell_dk_death_grip(); new spell_dk_death_pact(); + new spell_dk_death_strike(); + new spell_dk_ghoul_explode(); + new spell_dk_improved_blood_presence(); + new spell_dk_improved_unholy_presence(); new spell_dk_scourge_strike(); new spell_dk_spell_deflection(); - new spell_dk_blood_boil(); new spell_dk_will_of_the_necropolis(); - new spell_dk_improved_blood_presence(); - new spell_dk_improved_unholy_presence(); - new spell_dk_death_strike(); - new spell_dk_death_coil(); - new spell_dk_death_grip(); } diff --git a/src/server/scripts/Spells/spell_hunter.cpp b/src/server/scripts/Spells/spell_hunter.cpp index 18326a8f059..36194a596ce 100644 --- a/src/server/scripts/Spells/spell_hunter.cpp +++ b/src/server/scripts/Spells/spell_hunter.cpp @@ -32,23 +32,25 @@ enum HunterSpells { - HUNTER_SPELL_READINESS = 23989, - DRAENEI_SPELL_GIFT_OF_THE_NAARU = 59543, - HUNTER_SPELL_BESTIAL_WRATH = 19574, - HUNTER_PET_SPELL_LAST_STAND_TRIGGERED = 53479, - HUNTER_PET_HEART_OF_THE_PHOENIX = 55709, - HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED = 54114, - HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF = 55711, - HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED = 54045, - HUNTER_SPELL_INVIGORATION_TRIGGERED = 53398, - HUNTER_SPELL_MASTERS_CALL_TRIGGERED = 62305, - HUNTER_SPELL_CHIMERA_SHOT_SERPENT = 53353, - HUNTER_SPELL_CHIMERA_SHOT_VIPER = 53358, - HUNTER_SPELL_CHIMERA_SHOT_SCORPID = 53359, - HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET = 61669, + SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET = 61669, + SPELL_HUNTER_BESTIAL_WRATH = 19574, + SPELL_HUNTER_CHIMERA_SHOT_SERPENT = 53353, + SPELL_HUNTER_CHIMERA_SHOT_VIPER = 53358, + SPELL_HUNTER_CHIMERA_SHOT_SCORPID = 53359, + SPELL_HUNTER_INVIGORATION_TRIGGERED = 53398, + SPELL_HUNTER_MASTERS_CALL_TRIGGERED = 62305, + SPELL_HUNTER_PET_LAST_STAND_TRIGGERED = 53479, + SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX = 55709, + SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED = 54114, + SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF = 55711, + SPELL_HUNTER_PET_CARRION_FEEDER_TRIGGERED = 54045, + SPELL_HUNTER_READINESS = 23989, + SPELL_HUNTER_SNIPER_TRAINING_R1 = 53302, + SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 = 64418, + SPELL_DRAENEI_GIFT_OF_THE_NAARU = 59543, }; -// 13161 Aspect of the Beast +// 13161 - Aspect of the Beast class spell_hun_aspect_of_the_beast : public SpellScriptLoader { public: @@ -63,9 +65,9 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - bool Validate(SpellInfo const* /*entry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET)) + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET)) return false; return true; } @@ -74,14 +76,14 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader { if (Player* caster = GetCaster()->ToPlayer()) if (Pet* pet = caster->GetPet()) - pet->RemoveAurasDueToSpell(HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET); + pet->RemoveAurasDueToSpell(SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET); } void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { if (Player* caster = GetCaster()->ToPlayer()) if (caster->GetPet()) - caster->CastSpell(caster, HUNTER_SPELL_ASPECT_OF_THE_BEAST_PET, true); + caster->CastSpell(caster, SPELL_HUNTER_ASPECT_OF_THE_BEAST_PET, true); } void Register() @@ -97,7 +99,7 @@ class spell_hun_aspect_of_the_beast : public SpellScriptLoader } }; -// 53209 Chimera Shot +// 53209 - Chimera Shot class spell_hun_chimera_shot : public SpellScriptLoader { public: @@ -107,9 +109,9 @@ class spell_hun_chimera_shot : public SpellScriptLoader { PrepareSpellScript(spell_hun_chimera_shot_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SERPENT) || !sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_VIPER) || !sSpellMgr->GetSpellInfo(HUNTER_SPELL_CHIMERA_SHOT_SCORPID)) + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_SERPENT) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_VIPER) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_CHIMERA_SHOT_SCORPID)) return false; return true; } @@ -138,7 +140,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader if (familyFlag[0] & 0x4000) { int32 TickCount = aurEff->GetTotalTicks(); - spellId = HUNTER_SPELL_CHIMERA_SHOT_SERPENT; + spellId = SPELL_HUNTER_CHIMERA_SHOT_SERPENT; basePoint = caster->SpellDamageBonusDone(unitTarget, aura->GetSpellInfo(), aurEff->GetAmount(), DOT, aura->GetStackAmount()); ApplyPct(basePoint, TickCount * 40); basePoint = unitTarget->SpellDamageBonusTaken(caster, aura->GetSpellInfo(), basePoint, DOT, aura->GetStackAmount()); @@ -147,7 +149,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader else if (familyFlag[1] & 0x00000080) { int32 TickCount = aura->GetEffect(0)->GetTotalTicks(); - spellId = HUNTER_SPELL_CHIMERA_SHOT_VIPER; + spellId = SPELL_HUNTER_CHIMERA_SHOT_VIPER; // Amount of one aura tick basePoint = int32(CalculatePct(unitTarget->GetMaxPower(POWER_MANA), aurEff->GetAmount())); @@ -158,7 +160,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader } // Scorpid Sting - Attempts to Disarm the target for 10 sec. This effect cannot occur more than once per 1 minute. else if (familyFlag[0] & 0x00008000) - spellId = HUNTER_SPELL_CHIMERA_SHOT_SCORPID; + spellId = SPELL_HUNTER_CHIMERA_SHOT_SCORPID; // ?? nothing say in spell desc (possibly need addition check) //if (familyFlag & 0x0000010000000000LL || // dot // familyFlag & 0x0000100000000000LL) // stun @@ -173,7 +175,7 @@ class spell_hun_chimera_shot : public SpellScriptLoader } if (spellId) caster->CastCustomSpell(unitTarget, spellId, &basePoint, 0, 0, true); - if (spellId == HUNTER_SPELL_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown + if (spellId == SPELL_HUNTER_CHIMERA_SHOT_SCORPID && caster->ToPlayer()) // Scorpid Sting - Add 1 minute cooldown caster->ToPlayer()->AddSpellCooldown(spellId, 0, uint32(time(NULL) + 60)); } } @@ -190,7 +192,38 @@ class spell_hun_chimera_shot : public SpellScriptLoader } }; -// 53412 Invigoration +// 781 - Disengage +class spell_hun_disengage : public SpellScriptLoader +{ + public: + spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { } + + class spell_hun_disengage_SpellScript : public SpellScript + { + PrepareSpellScript(spell_hun_disengage_SpellScript); + + SpellCastResult CheckCast() + { + Unit* caster = GetCaster(); + if (caster->GetTypeId() == TYPEID_PLAYER && !caster->isInCombat()) + return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_hun_disengage_SpellScript(); + } +}; + +// 53412 - Invigoration class spell_hun_invigoration : public SpellScriptLoader { public: @@ -200,9 +233,9 @@ class spell_hun_invigoration : public SpellScriptLoader { PrepareSpellScript(spell_hun_invigoration_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_INVIGORATION_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_INVIGORATION_TRIGGERED)) return false; return true; } @@ -212,7 +245,7 @@ class spell_hun_invigoration : public SpellScriptLoader if (Unit* unitTarget = GetHitUnit()) if (AuraEffect* aurEff = unitTarget->GetDummyAuraEffect(SPELLFAMILY_HUNTER, 3487, 0)) if (roll_chance_i(aurEff->GetAmount())) - unitTarget->CastSpell(unitTarget, HUNTER_SPELL_INVIGORATION_TRIGGERED, true); + unitTarget->CastSpell(unitTarget, SPELL_HUNTER_INVIGORATION_TRIGGERED, true); } void Register() @@ -227,6 +260,7 @@ class spell_hun_invigoration : public SpellScriptLoader } }; +// 53478 - Last Stand Pet class spell_hun_last_stand_pet : public SpellScriptLoader { public: @@ -236,9 +270,9 @@ class spell_hun_last_stand_pet : public SpellScriptLoader { PrepareSpellScript(spell_hun_last_stand_pet_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_LAST_STAND_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_LAST_STAND_TRIGGERED)) return false; return true; } @@ -247,7 +281,7 @@ class spell_hun_last_stand_pet : public SpellScriptLoader { Unit* caster = GetCaster(); int32 healthModSpellBasePoints0 = int32(caster->CountPctFromMaxHealth(30)); - caster->CastCustomSpell(caster, HUNTER_PET_SPELL_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); + caster->CastCustomSpell(caster, SPELL_HUNTER_PET_LAST_STAND_TRIGGERED, &healthModSpellBasePoints0, NULL, NULL, true, NULL); } void Register() @@ -263,6 +297,7 @@ class spell_hun_last_stand_pet : public SpellScriptLoader } }; +// 53271 - Masters Call class spell_hun_masters_call : public SpellScriptLoader { public: @@ -272,9 +307,9 @@ class spell_hun_masters_call : public SpellScriptLoader { PrepareSpellScript(spell_hun_masters_call_SpellScript); - bool Validate(SpellInfo const* spellEntry) + bool Validate(SpellInfo const* spellInfo) { - if (!sSpellMgr->GetSpellInfo(HUNTER_SPELL_MASTERS_CALL_TRIGGERED) || !sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_0].CalcValue()) || !sSpellMgr->GetSpellInfo(spellEntry->Effects[EFFECT_1].CalcValue())) + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_MASTERS_CALL_TRIGGERED) || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_0].CalcValue()) || !sSpellMgr->GetSpellInfo(spellInfo->Effects[EFFECT_1].CalcValue())) return false; return true; } @@ -297,7 +332,7 @@ class spell_hun_masters_call : public SpellScriptLoader { // Cannot be processed while pet is dead TriggerCastFlags castMask = TriggerCastFlags(TRIGGERED_FULL_MASK & ~TRIGGERED_IGNORE_CASTER_AURASTATE); - target->CastSpell(target, HUNTER_SPELL_MASTERS_CALL_TRIGGERED, castMask); + target->CastSpell(target, SPELL_HUNTER_MASTERS_CALL_TRIGGERED, castMask); } } @@ -314,156 +349,122 @@ class spell_hun_masters_call : public SpellScriptLoader } }; -class spell_hun_readiness : public SpellScriptLoader +// 34477 - Misdirection +class spell_hun_misdirection : public SpellScriptLoader { public: - spell_hun_readiness() : SpellScriptLoader("spell_hun_readiness") { } + spell_hun_misdirection() : SpellScriptLoader("spell_hun_misdirection") { } - class spell_hun_readiness_SpellScript : public SpellScript + class spell_hun_misdirection_AuraScript : public AuraScript { - PrepareSpellScript(spell_hun_readiness_SpellScript); - - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + PrepareAuraScript(spell_hun_misdirection_AuraScript); - void HandleDummy(SpellEffIndex /*effIndex*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Player* caster = GetCaster()->ToPlayer(); - // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath - const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); - for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) - { - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); - - ///! If spellId in cooldown map isn't valid, the above will return a null pointer. - if (spellInfo && - spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && - spellInfo->Id != HUNTER_SPELL_READINESS && - spellInfo->Id != HUNTER_SPELL_BESTIAL_WRATH && - spellInfo->Id != DRAENEI_SPELL_GIFT_OF_THE_NAARU && - spellInfo->GetRecoveryTime() > 0) - caster->RemoveSpellCooldown((itr++)->first, true); - else - ++itr; - } + if (Unit* caster = GetCaster()) + if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT) + caster->SetReducedThreatPercent(0, 0); } void Register() { - // add dummy effect spell handler to Readiness - OnEffectHitTarget += SpellEffectFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_hun_readiness_SpellScript(); + return new spell_hun_misdirection_AuraScript(); } }; -// 37506 Scatter Shot -class spell_hun_scatter_shot : public SpellScriptLoader +// 35079 - Misdirection proc +class spell_hun_misdirection_proc : public SpellScriptLoader { public: - spell_hun_scatter_shot() : SpellScriptLoader("spell_hun_scatter_shot") { } + spell_hun_misdirection_proc() : SpellScriptLoader("spell_hun_misdirection_proc") { } - class spell_hun_scatter_shot_SpellScript : public SpellScript + class spell_hun_misdirection_proc_AuraScript : public AuraScript { - PrepareSpellScript(spell_hun_scatter_shot_SpellScript); - - bool Load() - { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } + PrepareAuraScript(spell_hun_misdirection_proc_AuraScript); - void HandleDummy(SpellEffIndex /*effIndex*/) + void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) { - Player* caster = GetCaster()->ToPlayer(); - // break Auto Shot and autohit - caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); - caster->AttackStop(); - caster->SendAttackSwingCancelAttack(); + if (GetCaster()) + GetCaster()->SetReducedThreatPercent(0, 0); } void Register() { - OnEffectHitTarget += SpellEffectFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_proc_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); } }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_hun_scatter_shot_SpellScript(); + return new spell_hun_misdirection_proc_AuraScript(); } }; -// 53302, 53303, 53304 Sniper Training -enum eSniperTrainingSpells -{ - SPELL_SNIPER_TRAINING_R1 = 53302, - SPELL_SNIPER_TRAINING_BUFF_R1 = 64418, -}; - -class spell_hun_sniper_training : public SpellScriptLoader +// 54044 - Pet Carrion Feeder +class spell_hun_pet_carrion_feeder : public SpellScriptLoader { public: - spell_hun_sniper_training() : SpellScriptLoader("spell_hun_sniper_training") { } + spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { } - class spell_hun_sniper_training_AuraScript : public AuraScript + class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript { - PrepareAuraScript(spell_hun_sniper_training_AuraScript); + PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript); - bool Validate(SpellInfo const* /*entry*/) + bool Load() { - if (!sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_R1) || !sSpellMgr->GetSpellInfo(SPELL_SNIPER_TRAINING_BUFF_R1)) + if (!GetCaster()->isPet()) return false; return true; } - void HandlePeriodic(AuraEffect const* aurEff) + bool Validate(SpellInfo const* /*spellInfo*/) { - PreventDefaultAction(); - if (aurEff->GetAmount() <= 0) - { - Unit* caster = GetCaster(); - uint32 spellId = SPELL_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_SNIPER_TRAINING_R1; - if (Unit* target = GetTarget()) - if (!target->HasAura(spellId)) - { - SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId); - Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target; - triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff); - } - } + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_CARRION_FEEDER_TRIGGERED)) + return false; + return true; } - void HandleUpdatePeriodic(AuraEffect* aurEff) + SpellCastResult CheckIfCorpseNear() { - if (Player* playerTarget = GetUnitOwner()->ToPlayer()) - { - int32 baseAmount = aurEff->GetBaseAmount(); - int32 amount = playerTarget->isMoving() ? - playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) : - aurEff->GetAmount() - 1; - aurEff->SetAmount(amount); - } + Unit* caster = GetCaster(); + float max_range = GetSpellInfo()->GetMaxRange(false); + WorldObject* result = NULL; + // search for nearby enemy corpse in range + Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY); + Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check); + caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher); + if (!result) + return SPELL_FAILED_NO_EDIBLE_CORPSES; + return SPELL_CAST_OK; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + caster->CastSpell(caster, SPELL_HUNTER_PET_CARRION_FEEDER_TRIGGERED, false); } void Register() { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_sniper_training_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); - OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hun_sniper_training_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + // add dummy effect spell handler to pet's Last Stand + OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear); } }; - AuraScript* GetAuraScript() const + SpellScript* GetSpellScript() const { - return new spell_hun_sniper_training_AuraScript(); + return new spell_hun_pet_carrion_feeder_SpellScript(); } }; +// 55709 - Pet Heart of the Phoenix class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader { public: @@ -480,9 +481,9 @@ class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader return true; } - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED) || !sSpellMgr->GetSpellInfo(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) return false; return true; } @@ -491,10 +492,10 @@ class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader { Unit* caster = GetCaster(); if (Unit* owner = caster->GetOwner()) - if (!caster->HasAura(HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) + if (!caster->HasAura(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF)) { - owner->CastCustomSpell(HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true); - caster->CastSpell(caster, HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true); + owner->CastCustomSpell(SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_TRIGGERED, SPELLVALUE_BASE_POINT0, 100, caster, true); + caster->CastSpell(caster, SPELL_HUNTER_PET_HEART_OF_THE_PHOENIX_DEBUFF, true); } } @@ -511,150 +512,152 @@ class spell_hun_pet_heart_of_the_phoenix : public SpellScriptLoader } }; -class spell_hun_pet_carrion_feeder : public SpellScriptLoader +// 23989 - Readiness +class spell_hun_readiness : public SpellScriptLoader { public: - spell_hun_pet_carrion_feeder() : SpellScriptLoader("spell_hun_pet_carrion_feeder") { } + spell_hun_readiness() : SpellScriptLoader("spell_hun_readiness") { } - class spell_hun_pet_carrion_feeder_SpellScript : public SpellScript + class spell_hun_readiness_SpellScript : public SpellScript { - PrepareSpellScript(spell_hun_pet_carrion_feeder_SpellScript); + PrepareSpellScript(spell_hun_readiness_SpellScript); bool Load() { - if (!GetCaster()->isPet()) - return false; - return true; - } - - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED)) - return false; - return true; - } - - SpellCastResult CheckIfCorpseNear() - { - Unit* caster = GetCaster(); - float max_range = GetSpellInfo()->GetMaxRange(false); - WorldObject* result = NULL; - // search for nearby enemy corpse in range - Trinity::AnyDeadUnitSpellTargetInRangeCheck check(caster, max_range, GetSpellInfo(), TARGET_CHECK_ENEMY); - Trinity::WorldObjectSearcher<Trinity::AnyDeadUnitSpellTargetInRangeCheck> searcher(caster, result, check); - caster->GetMap()->VisitFirstFound(caster->m_positionX, caster->m_positionY, max_range, searcher); - if (!result) - return SPELL_FAILED_NO_EDIBLE_CORPSES; - return SPELL_CAST_OK; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; } void HandleDummy(SpellEffIndex /*effIndex*/) { - Unit* caster = GetCaster(); - caster->CastSpell(caster, HUNTER_PET_SPELL_CARRION_FEEDER_TRIGGERED, false); + Player* caster = GetCaster()->ToPlayer(); + // immediately finishes the cooldown on your other Hunter abilities except Bestial Wrath + const SpellCooldowns& cm = caster->ToPlayer()->GetSpellCooldownMap(); + for (SpellCooldowns::const_iterator itr = cm.begin(); itr != cm.end();) + { + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(itr->first); + + ///! If spellId in cooldown map isn't valid, the above will return a null pointer. + if (spellInfo && + spellInfo->SpellFamilyName == SPELLFAMILY_HUNTER && + spellInfo->Id != SPELL_HUNTER_READINESS && + spellInfo->Id != SPELL_HUNTER_BESTIAL_WRATH && + spellInfo->Id != SPELL_DRAENEI_GIFT_OF_THE_NAARU && + spellInfo->GetRecoveryTime() > 0) + caster->RemoveSpellCooldown((itr++)->first, true); + else + ++itr; + } } void Register() { - // add dummy effect spell handler to pet's Last Stand - OnEffectHit += SpellEffectFn(spell_hun_pet_carrion_feeder_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); - OnCheckCast += SpellCheckCastFn(spell_hun_pet_carrion_feeder_SpellScript::CheckIfCorpseNear); + // add dummy effect spell handler to Readiness + OnEffectHitTarget += SpellEffectFn(spell_hun_readiness_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_hun_pet_carrion_feeder_SpellScript(); + return new spell_hun_readiness_SpellScript(); } }; -// 34477 Misdirection -class spell_hun_misdirection : public SpellScriptLoader +// 37506 - Scatter Shot +class spell_hun_scatter_shot : public SpellScriptLoader { public: - spell_hun_misdirection() : SpellScriptLoader("spell_hun_misdirection") { } + spell_hun_scatter_shot() : SpellScriptLoader("spell_hun_scatter_shot") { } - class spell_hun_misdirection_AuraScript : public AuraScript + class spell_hun_scatter_shot_SpellScript : public SpellScript { - PrepareAuraScript(spell_hun_misdirection_AuraScript); + PrepareSpellScript(spell_hun_scatter_shot_SpellScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + bool Load() { - if (Unit* caster = GetCaster()) - if (GetTargetApplication()->GetRemoveMode() != AURA_REMOVE_BY_DEFAULT) - caster->SetReducedThreatPercent(0, 0); + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Player* caster = GetCaster()->ToPlayer(); + // break Auto Shot and autohit + caster->InterruptSpell(CURRENT_AUTOREPEAT_SPELL); + caster->AttackStop(); + caster->SendAttackSwingCancelAttack(); } void Register() { - AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_AuraScript::OnRemove, EFFECT_1, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + OnEffectHitTarget += SpellEffectFn(spell_hun_scatter_shot_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; - AuraScript* GetAuraScript() const + SpellScript* GetSpellScript() const { - return new spell_hun_misdirection_AuraScript(); + return new spell_hun_scatter_shot_SpellScript(); } }; -// 35079 Misdirection proc -class spell_hun_misdirection_proc : public SpellScriptLoader +// -53302 - Sniper Training +class spell_hun_sniper_training : public SpellScriptLoader { public: - spell_hun_misdirection_proc() : SpellScriptLoader("spell_hun_misdirection_proc") { } + spell_hun_sniper_training() : SpellScriptLoader("spell_hun_sniper_training") { } - class spell_hun_misdirection_proc_AuraScript : public AuraScript + class spell_hun_sniper_training_AuraScript : public AuraScript { - PrepareAuraScript(spell_hun_misdirection_proc_AuraScript); + PrepareAuraScript(spell_hun_sniper_training_AuraScript); - void OnRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (GetCaster()) - GetCaster()->SetReducedThreatPercent(0, 0); + if (!sSpellMgr->GetSpellInfo(SPELL_HUNTER_SNIPER_TRAINING_R1) || !sSpellMgr->GetSpellInfo(SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1)) + return false; + return true; } - void Register() + void HandlePeriodic(AuraEffect const* aurEff) { - AfterEffectRemove += AuraEffectRemoveFn(spell_hun_misdirection_proc_AuraScript::OnRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL); + PreventDefaultAction(); + if (aurEff->GetAmount() <= 0) + { + Unit* caster = GetCaster(); + uint32 spellId = SPELL_HUNTER_SNIPER_TRAINING_BUFF_R1 + GetId() - SPELL_HUNTER_SNIPER_TRAINING_R1; + if (Unit* target = GetTarget()) + if (!target->HasAura(spellId)) + { + SpellInfo const* triggeredSpellInfo = sSpellMgr->GetSpellInfo(spellId); + Unit* triggerCaster = triggeredSpellInfo->NeedsToBeTriggeredByCaster() ? caster : target; + triggerCaster->CastSpell(target, triggeredSpellInfo, true, 0, aurEff); + } + } } - }; - - AuraScript* GetAuraScript() const - { - return new spell_hun_misdirection_proc_AuraScript(); - } -}; -class spell_hun_disengage : public SpellScriptLoader -{ - public: - spell_hun_disengage() : SpellScriptLoader("spell_hun_disengage") { } - - class spell_hun_disengage_SpellScript : public SpellScript - { - PrepareSpellScript(spell_hun_disengage_SpellScript); - - SpellCastResult CheckCast() + void HandleUpdatePeriodic(AuraEffect* aurEff) { - Unit* caster = GetCaster(); - if (caster->GetTypeId() == TYPEID_PLAYER && !caster->isInCombat()) - return SPELL_FAILED_CANT_DO_THAT_RIGHT_NOW; - - return SPELL_CAST_OK; + if (Player* playerTarget = GetUnitOwner()->ToPlayer()) + { + int32 baseAmount = aurEff->GetBaseAmount(); + int32 amount = playerTarget->isMoving() ? + playerTarget->CalculateSpellDamage(playerTarget, GetSpellInfo(), aurEff->GetEffIndex(), &baseAmount) : + aurEff->GetAmount() - 1; + aurEff->SetAmount(amount); + } } void Register() { - OnCheckCast += SpellCheckCastFn(spell_hun_disengage_SpellScript::CheckCast); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_hun_sniper_training_AuraScript::HandlePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); + OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_hun_sniper_training_AuraScript::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_PERIODIC_TRIGGER_SPELL); } }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_hun_disengage_SpellScript(); + return new spell_hun_sniper_training_AuraScript(); } }; +// 1515 - Tame Beast class spell_hun_tame_beast : public SpellScriptLoader { public: @@ -706,6 +709,8 @@ class spell_hun_tame_beast : public SpellScriptLoader } }; +// -24604 - Furious Howl +// 53434 - Call of the Wild class spell_hun_target_only_pet_and_owner : public SpellScriptLoader { public: @@ -740,17 +745,17 @@ void AddSC_hunter_spell_scripts() { new spell_hun_aspect_of_the_beast(); new spell_hun_chimera_shot(); + new spell_hun_disengage(); new spell_hun_invigoration(); new spell_hun_last_stand_pet(); new spell_hun_masters_call(); + new spell_hun_misdirection(); + new spell_hun_misdirection_proc(); + new spell_hun_pet_carrion_feeder(); + new spell_hun_pet_heart_of_the_phoenix(); new spell_hun_readiness(); new spell_hun_scatter_shot(); new spell_hun_sniper_training(); - new spell_hun_pet_heart_of_the_phoenix(); - new spell_hun_pet_carrion_feeder(); - new spell_hun_misdirection(); - new spell_hun_misdirection_proc(); - new spell_hun_disengage(); new spell_hun_tame_beast(); new spell_hun_target_only_pet_and_owner(); } diff --git a/src/server/scripts/Spells/spell_priest.cpp b/src/server/scripts/Spells/spell_priest.cpp index 045df640090..68a9337f8ea 100644 --- a/src/server/scripts/Spells/spell_priest.cpp +++ b/src/server/scripts/Spells/spell_priest.cpp @@ -29,20 +29,25 @@ enum PriestSpells { - PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL = 48153, - PRIEST_SPELL_PENANCE_R1 = 47540, - PRIEST_SPELL_PENANCE_R1_DAMAGE = 47758, - PRIEST_SPELL_PENANCE_R1_HEAL = 47757, - PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619, - PRIEST_SPELL_REFLECTIVE_SHIELD_R1 = 33201, - PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL = 64085, - PRIEST_SPELL_EMPOWERED_RENEW = 63544, + SPELL_PRIEST_EMPOWERED_RENEW = 63544, + SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL = 48153, + SPELL_PRIEST_PENANCE_R1 = 47540, + SPELL_PRIEST_PENANCE_R1_DAMAGE = 47758, + SPELL_PRIEST_PENANCE_R1_HEAL = 47757, + SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED = 33619, + SPELL_PRIEST_REFLECTIVE_SHIELD_R1 = 33201, + SPELL_PRIEST_SHADOW_WORD_DEATH = 32409, + SPELL_PRIEST_T9_HEALING_2P = 67201, + SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL = 64085, +}; + +enum PriestSpellIcons +{ PRIEST_ICON_ID_EMPOWERED_RENEW_TALENT = 3021, PRIEST_ICON_ID_PAIN_AND_SUFFERING = 2874, - PRIEST_SHADOW_WORD_DEATH = 32409, }; -// Guardian Spirit +// -47788 - Guardian Spirit class spell_pri_guardian_spirit : public SpellScriptLoader { public: @@ -54,9 +59,9 @@ class spell_pri_guardian_spirit : public SpellScriptLoader uint32 healPct; - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL)) + if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL)) return false; return true; } @@ -82,7 +87,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader int32 healAmount = int32(target->CountPctFromMaxHealth(healPct)); // remove the aura now, we don't want 40% healing bonus Remove(AURA_REMOVE_BY_ENEMY_SPELL); - target->CastCustomSpell(target, PRIEST_SPELL_GUARDIAN_SPIRIT_HEAL, &healAmount, NULL, NULL, true); + target->CastCustomSpell(target, SPELL_PRIEST_GUARDIAN_SPIRIT_HEAL, &healAmount, NULL, NULL, true); absorbAmount = dmgInfo.GetDamage(); } @@ -99,6 +104,7 @@ class spell_pri_guardian_spirit : public SpellScriptLoader } }; +// -8129 - Mana Burn class spell_pri_mana_burn : public SpellScriptLoader { public: @@ -126,6 +132,7 @@ class spell_pri_mana_burn : public SpellScriptLoader } }; +// -49821 - Mind Sear class spell_pri_mind_sear : public SpellScriptLoader { public: @@ -152,12 +159,12 @@ class spell_pri_mind_sear : public SpellScriptLoader } }; +// 47948 - Pain and Suffering (Proc) class spell_pri_pain_and_suffering_proc : public SpellScriptLoader { public: spell_pri_pain_and_suffering_proc() : SpellScriptLoader("spell_pri_pain_and_suffering_proc") { } - // 47948 Pain and Suffering (proc) class spell_pri_pain_and_suffering_proc_SpellScript : public SpellScript { PrepareSpellScript(spell_pri_pain_and_suffering_proc_SpellScript); @@ -182,6 +189,7 @@ class spell_pri_pain_and_suffering_proc : public SpellScriptLoader } }; +// -47540 - Penance class spell_pri_penance : public SpellScriptLoader { public: @@ -196,18 +204,18 @@ class spell_pri_penance : public SpellScriptLoader return GetCaster()->GetTypeId() == TYPEID_PLAYER; } - bool Validate(SpellInfo const* spellEntry) + bool Validate(SpellInfo const* spellInfo) { - if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_PENANCE_R1)) + if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_PENANCE_R1)) return false; // can't use other spell than this penance due to spell_ranks dependency - if (sSpellMgr->GetFirstSpellInChain(PRIEST_SPELL_PENANCE_R1) != sSpellMgr->GetFirstSpellInChain(spellEntry->Id)) + if (sSpellMgr->GetFirstSpellInChain(SPELL_PRIEST_PENANCE_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id)) return false; - uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id); - if (!sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank, true)) + uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id); + if (!sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_DAMAGE, rank, true)) return false; - if (!sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank, true)) + if (!sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_HEAL, rank, true)) return false; return true; @@ -224,9 +232,9 @@ class spell_pri_penance : public SpellScriptLoader uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); if (caster->IsFriendlyTo(unitTarget)) - caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_HEAL, rank), false, 0); + caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_HEAL, rank), false, 0); else - caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(PRIEST_SPELL_PENANCE_R1_DAMAGE, rank), false, 0); + caster->CastSpell(unitTarget, sSpellMgr->GetSpellWithRank(SPELL_PRIEST_PENANCE_R1_DAMAGE, rank), false, 0); } } @@ -253,129 +261,86 @@ class spell_pri_penance : public SpellScriptLoader } }; -// Reflective Shield -class spell_pri_reflective_shield_trigger : public SpellScriptLoader +// 33110 - Prayer of Mending Heal +class spell_pri_prayer_of_mending_heal : public SpellScriptLoader { public: - spell_pri_reflective_shield_trigger() : SpellScriptLoader("spell_pri_reflective_shield_trigger") { } + spell_pri_prayer_of_mending_heal() : SpellScriptLoader("spell_pri_prayer_of_mending_heal") { } - class spell_pri_reflective_shield_trigger_AuraScript : public AuraScript + class spell_pri_prayer_of_mending_heal_SpellScript : public SpellScript { - PrepareAuraScript(spell_pri_reflective_shield_trigger_AuraScript); + PrepareSpellScript(spell_pri_prayer_of_mending_heal_SpellScript); - bool Validate(SpellInfo const* /*spellEntry*/) + void HandleHeal(SpellEffIndex /*effIndex*/) { - if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(PRIEST_SPELL_REFLECTIVE_SHIELD_R1)) - return false; - return true; - } - - void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) - { - Unit* target = GetTarget(); - if (dmgInfo.GetAttacker() == target) - return; - - if (GetCaster()) - if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(PRIEST_SPELL_REFLECTIVE_SHIELD_R1, EFFECT_0)) + if (Unit* caster = GetOriginalCaster()) + { + if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_PRIEST_T9_HEALING_2P, EFFECT_0)) { - int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); - target->CastCustomSpell(dmgInfo.GetAttacker(), PRIEST_SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + int32 heal = GetHitHeal(); + AddPct(heal, aurEff->GetAmount()); + SetHitHeal(heal); } + } + } void Register() { - AfterEffectAbsorb += AuraEffectAbsorbFn(spell_pri_reflective_shield_trigger_AuraScript::Trigger, EFFECT_0); + OnEffectHitTarget += SpellEffectFn(spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); } }; - AuraScript* GetAuraScript() const - { - return new spell_pri_reflective_shield_trigger_AuraScript(); - } -}; - -enum PrayerOfMending -{ - SPELL_T9_HEALING_2_PIECE = 67201, -}; -// Prayer of Mending Heal -class spell_pri_prayer_of_mending_heal : public SpellScriptLoader -{ -public: - spell_pri_prayer_of_mending_heal() : SpellScriptLoader("spell_pri_prayer_of_mending_heal") { } - - class spell_pri_prayer_of_mending_heal_SpellScript : public SpellScript - { - PrepareSpellScript(spell_pri_prayer_of_mending_heal_SpellScript); - - void HandleHeal(SpellEffIndex /*effIndex*/) - { - if (Unit* caster = GetOriginalCaster()) - { - if (AuraEffect* aurEff = caster->GetAuraEffect(SPELL_T9_HEALING_2_PIECE, EFFECT_0)) - { - int32 heal = GetHitHeal(); - AddPct(heal, aurEff->GetAmount()); - SetHitHeal(heal); - } - } - - } - - void Register() + SpellScript* GetSpellScript() const { - OnEffectHitTarget += SpellEffectFn(spell_pri_prayer_of_mending_heal_SpellScript::HandleHeal, EFFECT_0, SPELL_EFFECT_HEAL); + return new spell_pri_prayer_of_mending_heal_SpellScript(); } - }; - - SpellScript* GetSpellScript() const - { - return new spell_pri_prayer_of_mending_heal_SpellScript(); - } }; -class spell_pri_vampiric_touch : public SpellScriptLoader +// -17 - Reflective Shield +class spell_pri_reflective_shield_trigger : public SpellScriptLoader { public: - spell_pri_vampiric_touch() : SpellScriptLoader("spell_pri_vampiric_touch") { } + spell_pri_reflective_shield_trigger() : SpellScriptLoader("spell_pri_reflective_shield_trigger") { } - class spell_pri_vampiric_touch_AuraScript : public AuraScript + class spell_pri_reflective_shield_trigger_AuraScript : public AuraScript { - PrepareAuraScript(spell_pri_vampiric_touch_AuraScript); + PrepareAuraScript(spell_pri_reflective_shield_trigger_AuraScript); - bool Validate(SpellInfo const* /*spell*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL)) + if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED) || !sSpellMgr->GetSpellInfo(SPELL_PRIEST_REFLECTIVE_SHIELD_R1)) return false; return true; } - void HandleDispel(DispelInfo* /*dispelInfo*/) + void Trigger(AuraEffect* aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) { - if (Unit* caster = GetCaster()) - if (Unit* target = GetUnitOwner()) - if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) - { - int32 damage = aurEff->GetAmount() * 8; - // backfire damage - caster->CastCustomSpell(target, PRIEST_SPELL_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); - } + Unit* target = GetTarget(); + if (dmgInfo.GetAttacker() == target) + return; + + if (GetCaster()) + if (AuraEffect* talentAurEff = target->GetAuraEffectOfRankedSpell(SPELL_PRIEST_REFLECTIVE_SHIELD_R1, EFFECT_0)) + { + int32 bp = CalculatePct(absorbAmount, talentAurEff->GetAmount()); + target->CastCustomSpell(dmgInfo.GetAttacker(), SPELL_PRIEST_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); + } } void Register() { - AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel); + AfterEffectAbsorb += AuraEffectAbsorbFn(spell_pri_reflective_shield_trigger_AuraScript::Trigger, EFFECT_0); } }; AuraScript* GetAuraScript() const { - return new spell_pri_vampiric_touch_AuraScript(); + return new spell_pri_reflective_shield_trigger_AuraScript(); } }; +// -139 - Renew class spell_pri_renew : public SpellScriptLoader { public: @@ -401,7 +366,7 @@ class spell_pri_renew : public SpellScriptLoader heal = GetTarget()->SpellHealingBonusTaken(caster, GetSpellInfo(), heal, DOT); int32 basepoints0 = empoweredRenewAurEff->GetAmount() * GetEffect(EFFECT_0)->GetTotalTicks() * int32(heal) / 100; - caster->CastCustomSpell(GetTarget(), PRIEST_SPELL_EMPOWERED_RENEW, &basepoints0, NULL, NULL, true, NULL, aurEff); + caster->CastCustomSpell(GetTarget(), SPELL_PRIEST_EMPOWERED_RENEW, &basepoints0, NULL, NULL, true, NULL, aurEff); } } } @@ -418,6 +383,7 @@ class spell_pri_renew : public SpellScriptLoader } }; +// -32379 - Shadow Word Death class spell_pri_shadow_word_death : public SpellScriptLoader { public: @@ -435,7 +401,7 @@ class spell_pri_shadow_word_death : public SpellScriptLoader if (AuraEffect* aurEff = GetCaster()->GetDummyAuraEffect(SPELLFAMILY_PRIEST, PRIEST_ICON_ID_PAIN_AND_SUFFERING, EFFECT_1)) AddPct(damage, aurEff->GetAmount()); - GetCaster()->CastCustomSpell(GetCaster(), PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true); + GetCaster()->CastCustomSpell(GetCaster(), SPELL_PRIEST_SHADOW_WORD_DEATH, &damage, 0, 0, true); } void Register() @@ -450,16 +416,57 @@ class spell_pri_shadow_word_death : public SpellScriptLoader } }; +// -34914 - Vampiric Touch +class spell_pri_vampiric_touch : public SpellScriptLoader +{ + public: + spell_pri_vampiric_touch() : SpellScriptLoader("spell_pri_vampiric_touch") { } + + class spell_pri_vampiric_touch_AuraScript : public AuraScript + { + PrepareAuraScript(spell_pri_vampiric_touch_AuraScript); + + bool Validate(SpellInfo const* /*spell*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL)) + return false; + return true; + } + + void HandleDispel(DispelInfo* /*dispelInfo*/) + { + if (Unit* caster = GetCaster()) + if (Unit* target = GetUnitOwner()) + if (AuraEffect const* aurEff = GetEffect(EFFECT_1)) + { + int32 damage = aurEff->GetAmount() * 8; + // backfire damage + caster->CastCustomSpell(target, SPELL_PRIEST_VAMPIRIC_TOUCH_DISPEL, &damage, NULL, NULL, true, NULL, aurEff); + } + } + + void Register() + { + AfterDispel += AuraDispelFn(spell_pri_vampiric_touch_AuraScript::HandleDispel); + } + }; + + AuraScript* GetAuraScript() const + { + return new spell_pri_vampiric_touch_AuraScript(); + } +}; + void AddSC_priest_spell_scripts() { new spell_pri_guardian_spirit(); new spell_pri_mana_burn(); + new spell_pri_mind_sear(); new spell_pri_pain_and_suffering_proc(); new spell_pri_penance(); - new spell_pri_reflective_shield_trigger(); - new spell_pri_mind_sear(); new spell_pri_prayer_of_mending_heal(); - new spell_pri_vampiric_touch(); + new spell_pri_reflective_shield_trigger(); new spell_pri_renew(); new spell_pri_shadow_word_death(); + new spell_pri_vampiric_touch(); } diff --git a/src/server/scripts/Spells/spell_rogue.cpp b/src/server/scripts/Spells/spell_rogue.cpp index ad69b4b1026..01a4225cc00 100644 --- a/src/server/scripts/Spells/spell_rogue.cpp +++ b/src/server/scripts/Spells/spell_rogue.cpp @@ -28,13 +28,13 @@ enum RogueSpells { - ROGUE_SPELL_SHIV_TRIGGERED = 5940, - ROGUE_SPELL_GLYPH_OF_PREPARATION = 56819, - ROGUE_SPELL_PREY_ON_THE_WEAK = 58670, - ROGUE_SPELL_CHEAT_DEATH_COOLDOWN = 31231, + SPELL_ROGUE_CHEAT_DEATH_COOLDOWN = 31231, + SPELL_ROGUE_GLYPH_OF_PREPARATION = 56819, + SPELL_ROGUE_PREY_ON_THE_WEAK = 58670, + SPELL_ROGUE_SHIV_TRIGGERED = 5940, }; -// Cheat Death +// -31228 - Cheat Death class spell_rog_cheat_death : public SpellScriptLoader { public: @@ -46,9 +46,9 @@ class spell_rog_cheat_death : public SpellScriptLoader uint32 absorbChance; - bool Validate(SpellInfo const* /*spellEntry*/) + bool Validate(SpellInfo const* /*spellInfo*/) { - if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN)) + if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN)) return false; return true; } @@ -68,11 +68,11 @@ class spell_rog_cheat_death : public SpellScriptLoader void Absorb(AuraEffect* /*aurEff*/, DamageInfo & dmgInfo, uint32 & absorbAmount) { Player* target = GetTarget()->ToPlayer(); - if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance)) + if (dmgInfo.GetDamage() < target->GetHealth() || target->HasSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN) || !roll_chance_i(absorbChance)) return; - target->CastSpell(target, ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, true); - target->AddSpellCooldown(ROGUE_SPELL_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60); + target->CastSpell(target, SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, true); + target->AddSpellCooldown(SPELL_ROGUE_CHEAT_DEATH_COOLDOWN, 0, time(NULL) + 60); uint32 health10 = target->CountPctFromMaxHealth(10); @@ -97,7 +97,101 @@ class spell_rog_cheat_death : public SpellScriptLoader } }; -// 31130 - Nerves of Steel +// -2818 - Deadly Poison +class spell_rog_deadly_poison : public SpellScriptLoader +{ + public: + spell_rog_deadly_poison() : SpellScriptLoader("spell_rog_deadly_poison") { } + + class spell_rog_deadly_poison_SpellScript : public SpellScript + { + PrepareSpellScript(spell_rog_deadly_poison_SpellScript); + + bool Load() + { + _stackAmount = 0; + // at this point CastItem must already be initialized + return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem(); + } + + void HandleBeforeHit() + { + if (Unit* target = GetHitUnit()) + // Deadly Poison + if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID())) + _stackAmount = aurEff->GetBase()->GetStackAmount(); + } + + void HandleAfterHit() + { + if (_stackAmount < 5) + return; + + Player* player = GetCaster()->ToPlayer(); + + if (Unit* target = GetHitUnit()) + { + + Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); + + if (item == GetCastItem()) + item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); + + if (!item) + return; + + // item combat enchantments + for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot) + { + SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot))); + if (!enchant) + continue; + + for (uint8 s = 0; s < 3; ++s) + { + if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) + continue; + + SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]); + if (!spellInfo) + { + sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); + continue; + } + + // Proc only rogue poisons + if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON) + continue; + + // Do not reproc deadly + if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0)) + continue; + + if (spellInfo->IsPositive()) + player->CastSpell(player, enchant->spellid[s], true, item); + else + player->CastSpell(target, enchant->spellid[s], true, item); + } + } + } + } + + void Register() + { + BeforeHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleBeforeHit); + AfterHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleAfterHit); + } + + uint8 _stackAmount; + }; + + SpellScript* GetSpellScript() const + { + return new spell_rog_deadly_poison_SpellScript(); + } +}; + +// -31130 - Nerves of Steel class spell_rog_nerves_of_steel : public SpellScriptLoader { public: @@ -141,6 +235,7 @@ class spell_rog_nerves_of_steel : public SpellScriptLoader } }; +// 14185 - Preparation class spell_rog_preparation : public SpellScriptLoader { public: @@ -157,7 +252,7 @@ class spell_rog_preparation : public SpellScriptLoader bool Validate(SpellInfo const* /*spellEntry*/) { - if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_GLYPH_OF_PREPARATION)) + if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_GLYPH_OF_PREPARATION)) return false; return true; } @@ -177,7 +272,7 @@ class spell_rog_preparation : public SpellScriptLoader if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_COLDB_SHADOWSTEP || // Cold Blood, Shadowstep spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_VAN_EVAS_SPRINT) // Vanish, Evasion, Sprint caster->RemoveSpellCooldown((itr++)->first, true); - else if (caster->HasAura(ROGUE_SPELL_GLYPH_OF_PREPARATION)) + else if (caster->HasAura(SPELL_ROGUE_GLYPH_OF_PREPARATION)) { if (spellInfo->SpellFamilyFlags[1] & SPELLFAMILYFLAG1_ROGUE_DISMANTLE || // Dismantle spellInfo->SpellFamilyFlags[0] & SPELLFAMILYFLAG_ROGUE_KICK || // Kick @@ -208,220 +303,128 @@ class spell_rog_preparation : public SpellScriptLoader } }; -// 51685-51689 Prey on the Weak +// -51685 - Prey on the Weak class spell_rog_prey_on_the_weak : public SpellScriptLoader { -public: - spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { } - - class spell_rog_prey_on_the_weak_AuraScript : public AuraScript - { - PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript); - - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_PREY_ON_THE_WEAK)) - return false; - return true; - } - - void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) - { - Unit* target = GetTarget(); - Unit* victim = target->getVictim(); - if (victim && (target->GetHealthPct() > victim->GetHealthPct())) - { - if (!target->HasAura(ROGUE_SPELL_PREY_ON_THE_WEAK)) - { - int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); - target->CastCustomSpell(target, ROGUE_SPELL_PREY_ON_THE_WEAK, &bp, 0, 0, true); - } - } - else - target->RemoveAurasDueToSpell(ROGUE_SPELL_PREY_ON_THE_WEAK); - } - - void Register() - { - OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); - } - }; - - AuraScript* GetAuraScript() const - { - return new spell_rog_prey_on_the_weak_AuraScript(); - } -}; - -class spell_rog_shiv : public SpellScriptLoader -{ public: - spell_rog_shiv() : SpellScriptLoader("spell_rog_shiv") { } + spell_rog_prey_on_the_weak() : SpellScriptLoader("spell_rog_prey_on_the_weak") { } - class spell_rog_shiv_SpellScript : public SpellScript + class spell_rog_prey_on_the_weak_AuraScript : public AuraScript { - PrepareSpellScript(spell_rog_shiv_SpellScript); + PrepareAuraScript(spell_rog_prey_on_the_weak_AuraScript); - bool Load() + bool Validate(SpellInfo const* /*spellInfo*/) { - return GetCaster()->GetTypeId() == TYPEID_PLAYER; - } - - bool Validate(SpellInfo const* /*spellEntry*/) - { - if (!sSpellMgr->GetSpellInfo(ROGUE_SPELL_SHIV_TRIGGERED)) + if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_PREY_ON_THE_WEAK)) return false; return true; } - void HandleDummy(SpellEffIndex /*effIndex*/) + void HandleEffectPeriodic(AuraEffect const* /*aurEff*/) { - Unit* caster = GetCaster(); - if (Unit* unitTarget = GetHitUnit()) - caster->CastSpell(unitTarget, ROGUE_SPELL_SHIV_TRIGGERED, true); + Unit* target = GetTarget(); + Unit* victim = target->getVictim(); + if (victim && (target->GetHealthPct() > victim->GetHealthPct())) + { + if (!target->HasAura(SPELL_ROGUE_PREY_ON_THE_WEAK)) + { + int32 bp = GetSpellInfo()->Effects[EFFECT_0].CalcValue(); + target->CastCustomSpell(target, SPELL_ROGUE_PREY_ON_THE_WEAK, &bp, 0, 0, true); + } + } + else + target->RemoveAurasDueToSpell(SPELL_ROGUE_PREY_ON_THE_WEAK); } void Register() { - // add dummy effect spell handler to Shiv - OnEffectHitTarget += SpellEffectFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffectPeriodic += AuraEffectPeriodicFn(spell_rog_prey_on_the_weak_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_PERIODIC_DUMMY); } }; - SpellScript* GetSpellScript() const + AuraScript* GetAuraScript() const { - return new spell_rog_shiv_SpellScript(); + return new spell_rog_prey_on_the_weak_AuraScript(); } }; -class spell_rog_deadly_poison : public SpellScriptLoader +// 36554 - Shadowstep +class spell_rog_shadowstep : public SpellScriptLoader { public: - spell_rog_deadly_poison() : SpellScriptLoader("spell_rog_deadly_poison") { } + spell_rog_shadowstep() : SpellScriptLoader("spell_rog_shadowstep") { } - class spell_rog_deadly_poison_SpellScript : public SpellScript + class spell_rog_shadowstep_SpellScript : public SpellScript { - PrepareSpellScript(spell_rog_deadly_poison_SpellScript); - - bool Load() - { - _stackAmount = 0; - // at this point CastItem must already be initialized - return GetCaster()->GetTypeId() == TYPEID_PLAYER && GetCastItem(); - } - - void HandleBeforeHit() - { - if (Unit* target = GetHitUnit()) - // Deadly Poison - if (AuraEffect const* aurEff = target->GetAuraEffect(SPELL_AURA_PERIODIC_DAMAGE, SPELLFAMILY_ROGUE, 0x10000, 0x80000, 0, GetCaster()->GetGUID())) - _stackAmount = aurEff->GetBase()->GetStackAmount(); - } + PrepareSpellScript(spell_rog_shadowstep_SpellScript); - void HandleAfterHit() + SpellCastResult CheckCast() { - if (_stackAmount < 5) - return; - - Player* player = GetCaster()->ToPlayer(); - - if (Unit* target = GetHitUnit()) - { - - Item* item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_MAINHAND); - - if (item == GetCastItem()) - item = player->GetItemByPos(INVENTORY_SLOT_BAG_0, EQUIPMENT_SLOT_OFFHAND); - - if (!item) - return; - - // item combat enchantments - for (uint8 slot = 0; slot < MAX_ENCHANTMENT_SLOT; ++slot) - { - SpellItemEnchantmentEntry const* enchant = sSpellItemEnchantmentStore.LookupEntry(item->GetEnchantmentId(EnchantmentSlot(slot))); - if (!enchant) - continue; - - for (uint8 s = 0; s < 3; ++s) - { - if (enchant->type[s] != ITEM_ENCHANTMENT_TYPE_COMBAT_SPELL) - continue; - - SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(enchant->spellid[s]); - if (!spellInfo) - { - sLog->outError(LOG_FILTER_SPELLS_AURAS, "Player::CastItemCombatSpell Enchant %i, player (Name: %s, GUID: %u) cast unknown spell %i", enchant->ID, player->GetName().c_str(), player->GetGUIDLow(), enchant->spellid[s]); - continue; - } - - // Proc only rogue poisons - if (spellInfo->SpellFamilyName != SPELLFAMILY_ROGUE || spellInfo->Dispel != DISPEL_POISON) - continue; - - // Do not reproc deadly - if (spellInfo->SpellFamilyFlags.IsEqual(0x10000, 0x80000, 0)) - continue; - - if (spellInfo->IsPositive()) - player->CastSpell(player, enchant->spellid[s], true, item); - else - player->CastSpell(target, enchant->spellid[s], true, item); - } - } - } + if (GetCaster()->HasUnitState(UNIT_STATE_ROOT)) + return SPELL_FAILED_ROOTED; + return SPELL_CAST_OK; } void Register() { - BeforeHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleBeforeHit); - AfterHit += SpellHitFn(spell_rog_deadly_poison_SpellScript::HandleAfterHit); + OnCheckCast += SpellCheckCastFn(spell_rog_shadowstep_SpellScript::CheckCast); } - - uint8 _stackAmount; }; SpellScript* GetSpellScript() const { - return new spell_rog_deadly_poison_SpellScript(); + return new spell_rog_shadowstep_SpellScript(); } }; -class spell_rog_shadowstep : public SpellScriptLoader +// 5938 - Shiv +class spell_rog_shiv : public SpellScriptLoader { public: - spell_rog_shadowstep() : SpellScriptLoader("spell_rog_shadowstep") { } + spell_rog_shiv() : SpellScriptLoader("spell_rog_shiv") { } - class spell_rog_shadowstep_SpellScript : public SpellScript + class spell_rog_shiv_SpellScript : public SpellScript { - PrepareSpellScript(spell_rog_shadowstep_SpellScript); + PrepareSpellScript(spell_rog_shiv_SpellScript); - SpellCastResult CheckCast() + bool Load() { - if (GetCaster()->HasUnitState(UNIT_STATE_ROOT)) - return SPELL_FAILED_ROOTED; - return SPELL_CAST_OK; + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + bool Validate(SpellInfo const* /*spellInfo*/) + { + if (!sSpellMgr->GetSpellInfo(SPELL_ROGUE_SHIV_TRIGGERED)) + return false; + return true; + } + + void HandleDummy(SpellEffIndex /*effIndex*/) + { + Unit* caster = GetCaster(); + if (Unit* unitTarget = GetHitUnit()) + caster->CastSpell(unitTarget, SPELL_ROGUE_SHIV_TRIGGERED, true); } void Register() { - OnCheckCast += SpellCheckCastFn(spell_rog_shadowstep_SpellScript::CheckCast); + OnEffectHitTarget += SpellEffectFn(spell_rog_shiv_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; SpellScript* GetSpellScript() const { - return new spell_rog_shadowstep_SpellScript(); + return new spell_rog_shiv_SpellScript(); } }; void AddSC_rogue_spell_scripts() { new spell_rog_cheat_death(); + new spell_rog_deadly_poison(); new spell_rog_nerves_of_steel(); new spell_rog_preparation(); new spell_rog_prey_on_the_weak(); - new spell_rog_shiv(); - new spell_rog_deadly_poison(); new spell_rog_shadowstep(); + new spell_rog_shiv(); } |