diff options
| author | Shauren <shauren.trinity@gmail.com> | 2011-03-04 23:53:11 +0100 |
|---|---|---|
| committer | Shauren <shauren.trinity@gmail.com> | 2011-03-04 23:53:11 +0100 |
| commit | 36f848a4c222828cafb50f87790219da14245a03 (patch) | |
| tree | 82b99d3949a3a38761aee9b2a51a825441ee2a2a /src/server/scripts/Spells | |
| parent | 22cd262e6ced18d7b98c4ef0635aff5d8a7155b2 (diff) | |
Scripts/Icecrown Citadel: Only one Mutated Abomination can exist during Professor Putricide encounter
Scripts/Spells: Added blizzlike error messages for certain spells
Scripts/Items: Removed obsolete scripts
Diffstat (limited to 'src/server/scripts/Spells')
| -rw-r--r-- | src/server/scripts/Spells/spell_dk.cpp | 42 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 41 | ||||
| -rw-r--r-- | src/server/scripts/Spells/spell_shaman.cpp | 29 |
3 files changed, 102 insertions, 10 deletions
diff --git a/src/server/scripts/Spells/spell_dk.cpp b/src/server/scripts/Spells/spell_dk.cpp index 6e50ae1b9b6..969a236d19f 100644 --- a/src/server/scripts/Spells/spell_dk.cpp +++ b/src/server/scripts/Spells/spell_dk.cpp @@ -233,6 +233,47 @@ class spell_dk_corpse_explosion : public SpellScriptLoader } }; +class spell_dk_death_gate : public SpellScriptLoader +{ + public: + spell_dk_death_gate() : SpellScriptLoader("spell_dk_death_gate") {} + + class spell_dk_death_gate_SpellScript : public SpellScript + { + PrepareSpellScript(spell_dk_death_gate_SpellScript); + + SpellCastResult CheckClass() + { + if (GetCaster()->getClass() != CLASS_DEATH_KNIGHT) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_BE_DEATH_KNIGHT); + return SPELL_FAILED_CUSTOM_ERROR; + } + + return SPELL_CAST_OK; + } + + void HandleScript(SpellEffIndex effIndex) + { + PreventHitDefaultEffect(effIndex); + if (!GetHitUnit()) + return; + GetHitUnit()->CastSpell(GetHitUnit(), GetEffectValue(), false); + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_dk_death_gate_SpellScript::CheckClass); + OnEffect += SpellEffectFn(spell_dk_death_gate_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_dk_death_gate_SpellScript(); + } +}; + class spell_dk_death_pact : public SpellScriptLoader { public: @@ -474,6 +515,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_death_gate(); new spell_dk_death_pact(); new spell_dk_runic_power_feed(); new spell_dk_scourge_strike(); diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index 4cffbdf4437..dbe89f49c65 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -882,6 +882,46 @@ class spell_item_book_of_glyph_mastery : public SpellScriptLoader } }; +enum GiftOfTheHarvester +{ + NPC_GHOUL = 28845, + MAX_GHOULS = 5, +}; + +class spell_item_gift_of_the_harvester : public SpellScriptLoader +{ + public: + spell_item_gift_of_the_harvester() : SpellScriptLoader("spell_item_gift_of_the_harvester") {} + + class spell_item_gift_of_the_harvester_SpellScript : public SpellScript + { + PrepareSpellScript(spell_item_gift_of_the_harvester_SpellScript); + + SpellCastResult CheckRequirement() + { + std::list<Creature*> ghouls; + GetCaster()->GetAllMinionsByEntry(ghouls, NPC_GHOUL); + if (ghouls.size() >= MAX_GHOULS) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_TOO_MANY_GHOULS); + return SPELL_FAILED_CUSTOM_ERROR; + } + + return SPELL_CAST_OK; + } + + void Register() + { + OnCheckCast += SpellCheckCastFn(spell_item_gift_of_the_harvester_SpellScript::CheckRequirement); + } + }; + + SpellScript* GetSpellScript() const + { + return new spell_item_gift_of_the_harvester_SpellScript(); + } +}; + void AddSC_item_spell_scripts() { // 23074 Arcanite Dragonling @@ -908,4 +948,5 @@ void AddSC_item_spell_scripts() new spell_item_create_heart_candy(); new spell_item_book_of_glyph_mastery(); + new spell_item_gift_of_the_harvester(); } diff --git a/src/server/scripts/Spells/spell_shaman.cpp b/src/server/scripts/Spells/spell_shaman.cpp index 363988bbe92..4806457435d 100644 --- a/src/server/scripts/Spells/spell_shaman.cpp +++ b/src/server/scripts/Spells/spell_shaman.cpp @@ -102,24 +102,33 @@ public: return true; } + SpellCastResult CheckFireTotem() + { + // fire totem + if (!GetCaster()->m_SummonSlot[1]) + { + SetCustomCastResultMessage(SPELL_CUSTOM_ERROR_MUST_HAVE_FIRE_TOTEM); + return SPELL_FAILED_CUSTOM_ERROR; + } + + return SPELL_CAST_OK; + } + void HandleDummy(SpellEffIndex /*effIndex*/) { - if (Unit* caster = GetCaster()) + Unit* caster = GetCaster(); + uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); + if (uint32 spellId = sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank)) { - uint8 rank = sSpellMgr->GetSpellRank(GetSpellInfo()->Id); - uint32 spellId = sSpellMgr->GetSpellWithRank(SHAMAN_SPELL_FIRE_NOVA_TRIGGERED_R1, rank); - // fire slot - if (spellId && caster->m_SummonSlot[1]) - { - Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]); - if (totem && totem->isTotem()) - totem->CastSpell(totem, spellId, true); - } + Creature* totem = caster->GetMap()->GetCreature(caster->m_SummonSlot[1]); + if (totem && totem->isTotem()) + totem->CastSpell(totem, spellId, true); } } void Register() { + OnCheckCast += SpellCheckCastFn(spell_sha_fire_nova_SpellScript::CheckFireTotem); OnEffect += SpellEffectFn(spell_sha_fire_nova_SpellScript::HandleDummy, EFFECT_0, SPELL_EFFECT_DUMMY); } }; |
