mirror of
https://github.com/TrinityCore/TrinityCore.git
synced 2026-01-22 18:15:31 +01:00
Core/Spell: Fix DK spell Corpse Explosion.
Thanks tehmarto. Closes #1254.
This commit is contained in:
@@ -0,0 +1,2 @@
|
||||
DELETE FROM `spell_script_names` WHERE `spell_id`=47496 AND `ScriptName`='spell_dk_gnoul_explode';
|
||||
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES (47496, 'spell_dk_gnoul_explode');
|
||||
@@ -30,6 +30,7 @@ enum DeathKnightSpells
|
||||
DK_SPELL_ANTI_MAGIC_SHELL_TALENT = 51052,
|
||||
DK_SPELL_SUMMON_GARGOYLE = 50514,
|
||||
DK_SPELL_CORPSE_EXPLOSION_TRIGGERED = 43999,
|
||||
DK_SPELL_GHOUL_EXPLODE = 47496,
|
||||
DISPLAY_GHOUL_CORPSE = 25537,
|
||||
DK_SPELL_SCOURGE_STRIKE_TRIGGERED = 70890,
|
||||
DK_SPELL_WILL_OF_THE_NECROPOLIS_TALENT_R1 = 49189,
|
||||
@@ -199,6 +200,8 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
|
||||
{
|
||||
if (!sSpellStore.LookupEntry(DK_SPELL_CORPSE_EXPLOSION_TRIGGERED))
|
||||
return false;
|
||||
if (!sSpellStore.LookupEntry(DK_SPELL_GHOUL_EXPLODE))
|
||||
return false;
|
||||
return true;
|
||||
}
|
||||
|
||||
@@ -207,17 +210,20 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
int32 bp = 0;
|
||||
// Living ghoul as a target
|
||||
if (unitTarget->isAlive())
|
||||
if (unitTarget->isAlive()) // Living ghoul as a target
|
||||
{
|
||||
bp = int32(unitTarget->CountPctFromMaxHealth(25));
|
||||
// Some corpse
|
||||
else
|
||||
unitTarget->CastCustomSpell(unitTarget, DK_SPELL_GHOUL_EXPLODE, &bp, NULL, NULL, false);
|
||||
}
|
||||
else // Some corpse
|
||||
{
|
||||
bp = GetEffectValue();
|
||||
GetCaster()->CastCustomSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 1), &bp, NULL, NULL, true);
|
||||
// Corpse Explosion (Suicide)
|
||||
unitTarget->CastCustomSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, &bp, NULL, NULL, true);
|
||||
// Set corpse look
|
||||
unitTarget->SetDisplayId(DISPLAY_GHOUL_CORPSE + urand(0, 3));
|
||||
GetCaster()->CastCustomSpell(unitTarget, SpellMgr::CalculateSpellEffectAmount(GetSpellInfo(), 1), &bp, NULL, NULL, true);
|
||||
// Corpse Explosion (Suicide)
|
||||
unitTarget->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, true);
|
||||
// Set corpse look
|
||||
unitTarget->SetDisplayId(DISPLAY_GHOUL_CORPSE + urand(0, 3));
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
@@ -233,6 +239,39 @@ class spell_dk_corpse_explosion : public SpellScriptLoader
|
||||
}
|
||||
};
|
||||
|
||||
// 47496 - Explode, Gnoul spell for Corpse Explosion
|
||||
class spell_dk_gnoul_explode : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
spell_dk_gnoul_explode() : SpellScriptLoader("spell_dk_gnoul_explode") { }
|
||||
|
||||
class spell_dk_gnoul_explode_SpellScript : public SpellScript
|
||||
{
|
||||
PrepareSpellScript(spell_dk_gnoul_explode_SpellScript);
|
||||
|
||||
void Suicide(SpellEffIndex /*effIndex*/)
|
||||
{
|
||||
if (Unit* unitTarget = GetHitUnit())
|
||||
{
|
||||
// Corpse Explosion (Suicide)
|
||||
unitTarget->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, true);
|
||||
// Set corpse look
|
||||
unitTarget->SetDisplayId(DISPLAY_GHOUL_CORPSE + urand(0, 3));
|
||||
}
|
||||
}
|
||||
|
||||
void Register()
|
||||
{
|
||||
OnEffect += SpellEffectFn(spell_dk_gnoul_explode_SpellScript::Suicide, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE);
|
||||
}
|
||||
};
|
||||
|
||||
SpellScript* GetSpellScript() const
|
||||
{
|
||||
return new spell_dk_gnoul_explode_SpellScript();
|
||||
}
|
||||
};
|
||||
|
||||
class spell_dk_death_gate : public SpellScriptLoader
|
||||
{
|
||||
public:
|
||||
@@ -515,6 +554,7 @@ void AddSC_deathknight_spell_scripts()
|
||||
new spell_dk_anti_magic_shell_self();
|
||||
new spell_dk_anti_magic_zone();
|
||||
new spell_dk_corpse_explosion();
|
||||
new spell_dk_gnoul_explode();
|
||||
new spell_dk_death_gate();
|
||||
new spell_dk_death_pact();
|
||||
new spell_dk_runic_power_feed();
|
||||
|
||||
Reference in New Issue
Block a user