Core/Spells: move Death Knights Presences into SpellScripts, fix possible issue after spec change, and fix some startup errors

Closes #10354
This commit is contained in:
joschiwald
2013-07-25 18:06:21 +02:00
parent c4a1ad2810
commit e9750a4b65
6 changed files with 238 additions and 101 deletions

View File

@@ -0,0 +1,22 @@
DELETE FROM `spell_script_names` WHERE `ScriptName` IN (
'spell_warl_banish',
'spell_dru_enrage',
'spell_pri_mana_burn',
'spell_pri_guardian_spirit',
'spell_dk_improved_blood_presence',
'spell_dk_improved_frost_presence',
'spell_dk_improved_unholy_presence',
'spell_dk_presence'
);
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES
(-710, 'spell_warl_banish'),
(5229, 'spell_dru_enrage'),
(8129, 'spell_pri_mana_burn'),
(47788, 'spell_pri_guardian_spirit'),
(-50365,'spell_dk_improved_blood_presence'),
(-50384,'spell_dk_improved_frost_presence'),
(-50391,'spell_dk_improved_unholy_presence'),
(48266, 'spell_dk_presence'),
(48263, 'spell_dk_presence'),
(48265, 'spell_dk_presence');

View File

@@ -1697,95 +1697,6 @@ void Aura::HandleAuraSpecificMods(AuraApplication const* aurApp, Unit* caster, b
}
}
break;
case SPELLFAMILY_DEATHKNIGHT:
if (GetSpellInfo()->GetSpellSpecific() == SPELL_SPECIFIC_PRESENCE)
{
AuraEffect* bloodPresenceAura=0; // healing by damage done
AuraEffect* frostPresenceAura=0; // increased health
AuraEffect* unholyPresenceAura=0; // increased movement speed, faster rune recovery
// Improved Presences
Unit::AuraEffectList const& vDummyAuras = target->GetAuraEffectsByType(SPELL_AURA_DUMMY);
for (Unit::AuraEffectList::const_iterator itr = vDummyAuras.begin(); itr != vDummyAuras.end(); ++itr)
{
switch ((*itr)->GetId())
{
// Improved Blood Presence
case 50365:
case 50371:
{
bloodPresenceAura = (*itr);
break;
}
// Improved Frost Presence
case 50384:
case 50385:
{
frostPresenceAura = (*itr);
break;
}
// Improved Unholy Presence
case 50391:
case 50392:
{
unholyPresenceAura = (*itr);
break;
}
}
}
uint32 presence = GetId();
if (apply)
{
// Blood Presence bonus
if (presence == 48266)
target->CastSpell(target, 63611, true);
else if (bloodPresenceAura)
{
int32 basePoints1 = bloodPresenceAura->GetAmount();
target->CastCustomSpell(target, 63611, NULL, &basePoints1, NULL, true, 0, bloodPresenceAura);
}
// Frost Presence bonus
if (presence == 48263)
target->CastSpell(target, 61261, true);
else if (frostPresenceAura)
{
int32 basePoints0 = frostPresenceAura->GetAmount();
target->CastCustomSpell(target, 61261, &basePoints0, NULL, NULL, true, 0, frostPresenceAura);
}
// Unholy Presence bonus
if (presence == 48265)
{
if (unholyPresenceAura)
{
// Not listed as any effect, only base points set
int32 basePoints0 = unholyPresenceAura->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
target->CastCustomSpell(target, 63622, &basePoints0, &basePoints0, &basePoints0, true, 0, unholyPresenceAura);
}
target->CastSpell(target, 49772, true);
}
else if (unholyPresenceAura)
{
int32 basePoints0 = unholyPresenceAura->GetAmount();
target->CastCustomSpell(target, 49772, &basePoints0, NULL, NULL, true, 0, unholyPresenceAura);
}
}
else
{
// Remove passive auras
if (presence == 48266 || bloodPresenceAura)
target->RemoveAurasDueToSpell(63611);
if (presence == 48263 || frostPresenceAura)
target->RemoveAurasDueToSpell(61261);
if (presence == 48265 || unholyPresenceAura)
{
if (presence == 48265 && unholyPresenceAura)
target->RemoveAurasDueToSpell(63622);
target->RemoveAurasDueToSpell(49772);
}
}
}
break;
case SPELLFAMILY_WARLOCK:
// Drain Soul - If the target is at or below 25% health, Drain Soul causes four times the normal damage
if (GetSpellInfo()->SpellFamilyFlags[0] & 0x00004000)

View File

@@ -38,8 +38,13 @@ enum DeathKnightSpells
SPELL_DK_DEATH_COIL_DAMAGE = 47632,
SPELL_DK_DEATH_COIL_HEAL = 47633,
SPELL_DK_DEATH_STRIKE_HEAL = 45470,
SPELL_DK_FROST_PRESENCE = 48263,
SPELL_DK_FROST_PRESENCE_TRIGGERED = 61261,
SPELL_DK_GHOUL_EXPLODE = 47496,
SPELL_DK_GLYPH_OF_ICEBOUND_FORTITUDE = 58625,
SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1 = 50365,
SPELL_DK_IMPROVED_FROST_PRESENCE_R1 = 50384,
SPELL_DK_IMPROVED_UNHOLY_PRESENCE_R1 = 50391,
SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED = 63611,
SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED = 63622,
SPELL_DK_ITEM_SIGIL_VENGEFUL_HEART = 64962,
@@ -48,6 +53,7 @@ enum DeathKnightSpells
SPELL_DK_SCENT_OF_BLOOD = 50422,
SPELL_DK_SCOURGE_STRIKE_TRIGGERED = 70890,
SPELL_DK_UNHOLY_PRESENCE = 48265,
SPELL_DK_UNHOLY_PRESENCE_TRIGGERED = 49772,
SPELL_DK_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189,
SPELL_DK_WILL_OF_THE_NECROPOLIS_AURA_R1 = 52284
};
@@ -688,7 +694,7 @@ class spell_dk_icebound_fortitude : public SpellScriptLoader
}
};
// 50365, 50371 - Improved Blood Presence
// -50365 - Improved Blood Presence
class spell_dk_improved_blood_presence : public SpellScriptLoader
{
public:
@@ -700,7 +706,10 @@ class spell_dk_improved_blood_presence : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE) || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
return false;
return true;
}
@@ -708,10 +717,10 @@ class spell_dk_improved_blood_presence : public SpellScriptLoader
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))
if ((target->HasAura(SPELL_DK_FROST_PRESENCE) || target->HasAura(SPELL_DK_UNHOLY_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);
target->CastCustomSpell(target, SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, NULL, &basePoints1, NULL, true, NULL, aurEff);
}
}
@@ -735,7 +744,54 @@ class spell_dk_improved_blood_presence : public SpellScriptLoader
}
};
// 50391, 50392 - Improved Unholy Presence
// -50384 - Improved Frost Presence
class spell_dk_improved_frost_presence : public SpellScriptLoader
{
public:
spell_dk_improved_frost_presence() : SpellScriptLoader("spell_dk_improved_frost_presence") { }
class spell_dk_improved_frost_presence_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_improved_frost_presence_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_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_UNHOLY_PRESENCE)) && !target->HasAura(SPELL_DK_FROST_PRESENCE_TRIGGERED))
target->CastCustomSpell(SPELL_DK_FROST_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, NULL, aurEff);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
if (!target->HasAura(SPELL_DK_FROST_PRESENCE))
target->RemoveAura(SPELL_DK_FROST_PRESENCE_TRIGGERED);
}
void Register() OVERRIDE
{
AfterEffectApply += AuraEffectApplyFn(spell_dk_improved_frost_presence_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dk_improved_frost_presence_AuraScript::HandleEffectRemove, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const OVERRIDE
{
return new spell_dk_improved_frost_presence_AuraScript();
}
};
// -50391 - Improved Unholy Presence
class spell_dk_improved_unholy_presence : public SpellScriptLoader
{
public:
@@ -747,7 +803,11 @@ class spell_dk_improved_unholy_presence : public SpellScriptLoader
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE) || !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED))
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
return false;
return true;
}
@@ -759,13 +819,21 @@ class spell_dk_improved_unholy_presence : public SpellScriptLoader
{
// 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);
target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &basePoints0, &basePoints0, &basePoints0, true, NULL, aurEff);
}
if ((target->HasAura(SPELL_DK_BLOOD_PRESENCE) || target->HasAura(SPELL_DK_FROST_PRESENCE)) && !target->HasAura(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
target->CastCustomSpell(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, NULL, aurEff);
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
GetTarget()->RemoveAura(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED);
Unit* target = GetTarget();
target->RemoveAura(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED);
if (!target->HasAura(SPELL_DK_UNHOLY_PRESENCE))
target->RemoveAura(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED);
}
void Register() OVERRIDE
@@ -781,6 +849,132 @@ class spell_dk_improved_unholy_presence : public SpellScriptLoader
}
};
// 48266 - Blood Presence
// 48263 - Frost Presence
// 48265 - Unholy Presence
class spell_dk_presence : public SpellScriptLoader
{
public:
spell_dk_presence() : SpellScriptLoader("spell_dk_presence") { }
class spell_dk_presence_AuraScript : public AuraScript
{
PrepareAuraScript(spell_dk_presence_AuraScript);
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_DK_BLOOD_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_FROST_PRESENCE_R1)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_R1)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_FROST_PRESENCE_TRIGGERED)
|| !sSpellMgr->GetSpellInfo(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
return false;
return true;
}
void CheckImprovedBloodPresence()
{
Unit* target = GetTarget();
if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(SPELL_DK_IMPROVED_BLOOD_PRESENCE_R1, EFFECT_0))
if (!target->HasAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED))
target->CastCustomSpell(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT1, aurEff->GetAmount(), target, true, NULL, aurEff);
}
void CheckImprovedFrostPresence()
{
Unit* target = GetTarget();
if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(SPELL_DK_IMPROVED_FROST_PRESENCE_R1, EFFECT_0))
if (!target->HasAura(SPELL_DK_FROST_PRESENCE_TRIGGERED))
target->CastCustomSpell(SPELL_DK_FROST_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, NULL, aurEff);
}
void CheckImprovedUnholyPresence(bool inUnholy = false)
{
Unit* target = GetTarget();
if (AuraEffect const* aurEff = target->GetAuraEffectOfRankedSpell(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_R1, EFFECT_0))
{
if (inUnholy)
{
// Not listed as any effect, only base points set
int32 bp = aurEff->GetSpellInfo()->Effects[EFFECT_1].CalcValue();
target->CastCustomSpell(target, SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED, &bp, &bp, &bp, true, 0, aurEff);
}
else if (!target->HasAura(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED))
target->CastCustomSpell(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED, SPELLVALUE_BASE_POINT0, aurEff->GetAmount(), target, true, NULL, aurEff);
}
}
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
switch (GetSpellInfo()->Id)
{
case SPELL_DK_BLOOD_PRESENCE:
target->CastSpell(target, SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED, true);
CheckImprovedFrostPresence();
CheckImprovedUnholyPresence();
break;
case SPELL_DK_FROST_PRESENCE:
target->CastSpell(target, SPELL_DK_FROST_PRESENCE_TRIGGERED, true);
CheckImprovedBloodPresence();
CheckImprovedUnholyPresence();
break;
case SPELL_DK_UNHOLY_PRESENCE:
target->CastSpell(target, SPELL_DK_UNHOLY_PRESENCE_TRIGGERED, true);
CheckImprovedBloodPresence();
CheckImprovedFrostPresence();
CheckImprovedUnholyPresence(true);
break;
default:
return;
}
}
void HandleEffectRemove(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->RemoveAura(SPELL_DK_IMPROVED_BLOOD_PRESENCE_TRIGGERED);
target->RemoveAura(SPELL_DK_IMPROVED_UNHOLY_PRESENCE_TRIGGERED);
target->RemoveAura(SPELL_DK_FROST_PRESENCE_TRIGGERED);
target->RemoveAura(SPELL_DK_UNHOLY_PRESENCE_TRIGGERED);
}
void Register() OVERRIDE
{
uint32 auraType = 0;
switch (m_scriptSpellId)
{
case SPELL_DK_BLOOD_PRESENCE:
auraType = SPELL_AURA_MOD_DAMAGE_PERCENT_DONE;
break;
case SPELL_DK_FROST_PRESENCE:
auraType = SPELL_AURA_MOD_BASE_RESISTANCE_PCT;
break;
case SPELL_DK_UNHOLY_PRESENCE:
auraType = SPELL_AURA_MOD_MELEE_HASTE;
break;
default:
return;
}
AfterEffectApply += AuraEffectApplyFn(spell_dk_presence_AuraScript::HandleEffectApply, EFFECT_0, auraType, AURA_EFFECT_HANDLE_REAL);
AfterEffectRemove += AuraEffectRemoveFn(spell_dk_presence_AuraScript::HandleEffectRemove, EFFECT_0, auraType, AURA_EFFECT_HANDLE_REAL);
}
};
AuraScript* GetAuraScript() const OVERRIDE
{
return new spell_dk_presence_AuraScript();
}
};
// 59754 Rune Tap - Party
class spell_dk_rune_tap_party : public SpellScriptLoader
{
@@ -1062,7 +1256,9 @@ void AddSC_deathknight_spell_scripts()
new spell_dk_ghoul_explode();
new spell_dk_icebound_fortitude();
new spell_dk_improved_blood_presence();
new spell_dk_improved_frost_presence();
new spell_dk_improved_unholy_presence();
new spell_dk_presence();
new spell_dk_rune_tap_party();
new spell_dk_scent_of_blood();
new spell_dk_scourge_strike();

View File

@@ -75,7 +75,7 @@ class spell_dru_dash : public SpellScriptLoader
}
};
// -5229 - Enrage
// 5229 - Enrage
class spell_dru_enrage : public SpellScriptLoader
{
public:
@@ -85,6 +85,14 @@ class spell_dru_enrage : public SpellScriptLoader
{
PrepareSpellScript(spell_dru_enrage_SpellScript);
bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE
{
if (!sSpellMgr->GetSpellInfo(SPELL_DRUID_KING_OF_THE_JUNGLE)
|| !sSpellMgr->GetSpellInfo(SPELL_DRUID_ENRAGE_MOD_DAMAGE))
return false;
return true;
}
void OnHit()
{
if (AuraEffect const* aurEff = GetHitUnit()->GetAuraEffectOfRankedSpell(SPELL_DRUID_KING_OF_THE_JUNGLE, EFFECT_0))

View File

@@ -141,7 +141,7 @@ class spell_pri_glyph_of_prayer_of_healing : public SpellScriptLoader
}
};
// -47788 - Guardian Spirit
// 47788 - Guardian Spirit
class spell_pri_guardian_spirit : public SpellScriptLoader
{
public:
@@ -265,7 +265,7 @@ class spell_pri_lightwell_renew : public SpellScriptLoader
}
};
// -8129 - Mana Burn
// 8129 - Mana Burn
class spell_pri_mana_burn : public SpellScriptLoader
{
public:

View File

@@ -61,7 +61,7 @@ enum WarlockSpellIcons
WARLOCK_ICON_ID_MANA_FEED = 1982
};
// 710, 18647 - Banish
// -710 - Banish
class spell_warl_banish : public SpellScriptLoader
{
public: