diff options
author | Sorikoff <46191832+Sorikoff@users.noreply.github.com> | 2019-07-01 18:55:30 +0000 |
---|---|---|
committer | ccrs <ccrs@users.noreply.github.com> | 2019-07-01 20:55:30 +0200 |
commit | 5c09ff51f7015b775def8d5cc1f678eaef37200f (patch) | |
tree | 4a292b3db56cad803562cb06a0344b3c6e573d35 /src | |
parent | 5a9516cd9c27fc9f4f444d8658d9bd6ac3afc027 (diff) |
Scripts/Spells: Dimensional Ripper - Everlook (#23547)
Diffstat (limited to 'src')
-rw-r--r-- | src/server/game/Spells/SpellEffects.cpp | 19 | ||||
-rw-r--r-- | src/server/scripts/Spells/spell_item.cpp | 37 |
2 files changed, 37 insertions, 19 deletions
diff --git a/src/server/game/Spells/SpellEffects.cpp b/src/server/game/Spells/SpellEffects.cpp index cef576371d1..fe4af438bc0 100644 --- a/src/server/game/Spells/SpellEffects.cpp +++ b/src/server/game/Spells/SpellEffects.cpp @@ -1062,25 +1062,6 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/) TC_LOG_ERROR("spells", "Spell::EffectTeleportUnits - spellId %u attempted to teleport creature to a different map.", m_spellInfo->Id); return; } - - // post effects for TARGET_DEST_DB - /// @todo: awful hacks, move this to spellscripts - switch (m_spellInfo->Id) - { - // Dimensional Ripper - Everlook - case 23442: - { - int32 r = irand(0, 119); - if (r >= 70) // 7/12 success - { - if (r < 100) // 4/12 evil twin - m_caster->CastSpell(m_caster, 23445, true); - else // 1/12 fire - m_caster->CastSpell(m_caster, 23449, true); - } - return; - } - } } void Spell::EffectApplyAura(SpellEffIndex effIndex) diff --git a/src/server/scripts/Spells/spell_item.cpp b/src/server/scripts/Spells/spell_item.cpp index fb8e481dc42..7864dd84586 100644 --- a/src/server/scripts/Spells/spell_item.cpp +++ b/src/server/scripts/Spells/spell_item.cpp @@ -1724,6 +1724,7 @@ class spell_item_scroll_of_recall : public SpellScript enum TransporterSpells { SPELL_EVIL_TWIN = 23445, + SPELL_TRANSPORTER_MALFUNCTION_FIRE = 23449, SPELL_TRANSPORTER_MALFUNCTION_SMALLER = 36893, SPELL_TRANSPORTER_MALFUNCTION_BIGGER = 36895, SPELL_TRANSPORTER_MALFUNCTION_CHICKEN = 36940, @@ -1733,6 +1734,41 @@ enum TransporterSpells SPELL_SOUL_SPLIT_GOOD = 36901 }; +// 23442 - Dimensional Ripper - Everlook +class spell_item_dimensional_ripper_everlook : public SpellScript +{ + PrepareSpellScript(spell_item_dimensional_ripper_everlook); + + bool Validate(SpellInfo const* /*spellInfo*/) override + { + return ValidateSpellInfo({ SPELL_TRANSPORTER_MALFUNCTION_FIRE, SPELL_EVIL_TWIN }); + } + + bool Load() override + { + return GetCaster()->GetTypeId() == TYPEID_PLAYER; + } + + void HandleScript(SpellEffIndex /* effIndex */) + { + int32 r = irand(0, 119); + if (r <= 70) // 7/12 success + return; + + Unit* caster = GetCaster(); + + if (r < 100) // 4/12 evil twin + caster->CastSpell(caster, SPELL_EVIL_TWIN, true); + else // 1/12 fire + caster->CastSpell(caster, SPELL_TRANSPORTER_MALFUNCTION_FIRE, true); + } + + void Register() override + { + OnEffectHitTarget += SpellEffectFn(spell_item_dimensional_ripper_everlook::HandleScript, EFFECT_0, SPELL_EFFECT_TELEPORT_UNITS); + } +}; + // 36941 - Ultrasafe Transporter: Toshley's Station class spell_item_ultrasafe_transporter : public SpellScript { @@ -4214,6 +4250,7 @@ void AddSC_item_spell_scripts() RegisterAuraScript(spell_item_power_circle); RegisterSpellScript(spell_item_savory_deviate_delight); RegisterSpellScript(spell_item_scroll_of_recall); + RegisterSpellScript(spell_item_dimensional_ripper_everlook); RegisterSpellScript(spell_item_ultrasafe_transporter); RegisterSpellScript(spell_item_dimensional_ripper_area52); RegisterAuraScript(spell_item_unsated_craving); |