Misc: Reorder scripts in some script files and some cosmetic stuff

This commit is contained in:
joschiwald committed 2013-01-11 04:18:02 +01:00
1 parent ddea01290c
commit 0c16b95905
4 files changed
+957 -942

No files matched your search

+373 -373
View File
@@ -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,7 +502,182 @@ class spell_dk_death_pact : public SpellScriptLoader
}
};
// 55090 Scourge Strike (55265, 55270, 55271)
// -49998 - Death Strike
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* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_DEATH_STRIKE_HEAL))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
Unit* caster = GetCaster();
if (Unit* target = 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, 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_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_death_strike_SpellScript();
}
};
// 47496 - Explode, Ghoul spell for Corpse Explosion
class spell_dk_ghoul_explode : public SpellScriptLoader
{
public:
spell_dk_ghoul_explode() : SpellScriptLoader("spell_dk_ghoul_explode") { }
class spell_dk_ghoul_explode_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_ghoul_explode_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_CORPSE_EXPLOSION_TRIGGERED))
return false;
return true;
}
void Suicide(SpellEffIndex /*effIndex*/)
{
if (Unit* unitTarget = GetHitUnit())
{
// Corpse Explosion (Suicide)
unitTarget->CastSpell(unitTarget, SPELL_DK_CORPSE_EXPLOSION_TRIGGERED, true);
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_ghoul_explode_SpellScript::Suicide, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_ghoul_explode_SpellScript();
}
};
// 50365, 50371 - Improved Blood Presence
class spell_dk_improved_blood_presence : 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);
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
return false;
return true;
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
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 HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_DK_BLOOD_PRESENCE))
target->RemoveAura(SPELL_DK_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* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE) || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
return false;
return true;
}
void HandleEffectApply(AuraEffect const* aurEff, AuraEffectHandleModes /*mode*/)
{
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 HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAura(SPELL_DK_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();
}
};
// 55090 - Scourge Strike (55265, 55270, 55271)
class spell_dk_scourge_strike : public SpellScriptLoader
{
public:
@@ -399,9 +694,9 @@ class spell_dk_scourge_strike : public SpellScriptLoader
return true;
}
bool Validate(SpellInfo const* /*spellEntry*/)
bool Validate(SpellInfo const* /*spellInfo*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_SCOURGE_STRIKE_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_SCOURGE_STRIKE_TRIGGERED))
return false;
return true;
}
@@ -425,10 +720,10 @@ class spell_dk_scourge_strike : public SpellScriptLoader
{
int32 bp = GetHitDamage() * multiplier;
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(DK_SPELL_BLACK_ICE_R1, EFFECT_0))
if (AuraEffect* aurEff = caster->GetAuraEffectOfRankedSpell(SPELL_DK_BLACK_ICE_R1, EFFECT_0))
AddPct(bp, aurEff->GetAmount());
caster->CastCustomSpell(unitTarget, DK_SPELL_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
caster->CastCustomSpell(unitTarget, SPELL_DK_SCOURGE_STRIKE_TRIGGERED, &bp, NULL, NULL, true);
}
}
@@ -478,8 +773,8 @@ class spell_dk_spell_deflection : public SpellScriptLoader
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);
DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_dk_spell_deflection_AuraScript::CalculateAmount, EFFECT_0, SPELL_AURA_SCHOOL_ABSORB);
OnEffectAbsorb += AuraEffectAbsorbFn(spell_dk_spell_deflection_AuraScript::Absorb, EFFECT_0);
}
};
@@ -489,52 +784,6 @@ class spell_dk_spell_deflection : public SpellScriptLoader
}
};
// 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* /*spellEntry*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_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(), DK_SPELL_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();
}
};
// 52284 - Will of the Necropolis
class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
@@ -545,14 +794,14 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
PrepareAuraScript(spell_dk_will_of_the_necropolis_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))
if (sSpellMgr->GetFirstSpellInChain(SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1) != sSpellMgr->GetFirstSpellInChain(spellInfo->Id))
return false;
uint8 rank = sSpellMgr->GetSpellRank(spellEntry->Id);
if (!sSpellMgr->GetSpellWithRank(DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank, true))
uint8 rank = sSpellMgr->GetSpellRank(spellInfo->Id);
if (!sSpellMgr->GetSpellWithRank(SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1, rank, true))
return false;
return true;
@@ -576,7 +825,7 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
{
// 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));
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())));
@@ -599,271 +848,22 @@ class spell_dk_will_of_the_necropolis : public SpellScriptLoader
}
};
// 50365, 50371 Improved Blood Presence
class spell_dk_improved_blood_presence : 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);
bool Validate(SpellInfo const* /*entry*/)
{
if (!sSpellMgr->GetSpellInfo(DK_SPELL_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
return false;
return true;
}
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))
{
int32 basePoints1 = aurEff->GetAmount();
target->CastCustomSpell(target, DK_SPELL_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, 0, aurEff);
}
}
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))
{
// 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);
}
}
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*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_STRIKE_HEAL))
return false;
return true;
}
void HandleDummy(SpellEffIndex /* effIndex */)
{
Unit* caster = GetCaster();
if (Unit* target = 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);
}
}
void Register()
{
OnEffectHitTarget += SpellEffectFn(spell_dk_death_strike_SpellScript::HandleDummy, EFFECT_2, SPELL_EFFECT_DUMMY);
}
};
SpellScript* GetSpellScript() const
{
return new spell_dk_death_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
{
public:
spell_dk_death_coil() : SpellScriptLoader("spell_dk_death_coil") { }
class spell_dk_death_coil_SpellScript : public SpellScript
{
PrepareSpellScript(spell_dk_death_coil_SpellScript);
bool Validate(SpellInfo const* /*spell*/)
{
if (!sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_DAMAGE) || !sSpellMgr->GetSpellInfo(SPELL_DEATH_COIL_HEAL))
return false;
return true;
}
void HandleDummy(SpellEffIndex /*effIndex*/)
{
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);
}
}
}
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()
{
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_death_coil_SpellScript();
}
};
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();
}
};
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_corpse_explosion();
new spell_dk_ghoul_explode();
new spell_dk_death_gate();
new spell_dk_death_pact();
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_corpse_explosion();
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_death_strike();
new spell_dk_death_coil();
new spell_dk_death_grip();
new spell_dk_scourge_strike();
new spell_dk_spell_deflection();
new spell_dk_will_of_the_necropolis();
}