diff options
-rw-r--r-- | sql/updates/world/2011_05_06_06_world_spell_script_names.sql | 2 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 56 |
2 files changed, 50 insertions, 8 deletions
diff --git a/sql/updates/world/2011_05_06_06_world_spell_script_names.sql b/sql/updates/world/2011_05_06_06_world_spell_script_names.sql new file mode 100644 index 00000000000..c592e2a6203 --- /dev/null +++ b/sql/updates/world/2011_05_06_06_world_spell_script_names.sql @@ -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');
\ No newline at end of file diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 8e4e9517e94..258506557fe 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -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,15 +210,51 @@ 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); + 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)); + } + } + } + + void Register() + { + OnEffect += SpellEffectFn(spell_dk_corpse_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_corpse_explosion_SpellScript(); + } +}; + +// 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->CastCustomSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, &bp, NULL, NULL, true); + unitTarget->CastSpell(unitTarget, DK_SPELL_CORPSE_EXPLOSION_TRIGGERED, true); // Set corpse look unitTarget->SetDisplayId(DISPLAY_GHOUL_CORPSE + urand(0, 3)); } @@ -223,13 +262,13 @@ class spell_dk_corpse_explosion : public SpellScriptLoader void Register() { - OnEffect += SpellEffectFn(spell_dk_corpse_explosion_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); + OnEffect += SpellEffectFn(spell_dk_gnoul_explode_SpellScript::Suicide, EFFECT_1, SPELL_EFFECT_SCHOOL_DAMAGE); } }; SpellScript* GetSpellScript() const { - return new spell_dk_corpse_explosion_SpellScript(); + return new spell_dk_gnoul_explode_SpellScript(); } }; @@ -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(); |