feat(Core/Spells): Move Spell item dimensional ripper area52 to spell scripts (#11099)

This commit is contained in:
IntelligentQuantum
2022-03-27 09:28:58 +04:30
committed by GitHub
parent 17f9b66255
commit d1ecdc8f61
3 changed files with 60 additions and 33 deletions

View File

@@ -0,0 +1,4 @@
INSERT INTO `version_db_world` (`sql_rev`) VALUES ('1647861814144531389');
DELETE FROM `spell_script_names` WHERE `ScriptName`='spell_item_dimensional_ripper_area52';
INSERT INTO `spell_script_names` (`spell_id`, `ScriptName`) VALUES (36890,'spell_item_dimensional_ripper_area52');

View File

@@ -1287,39 +1287,6 @@ void Spell::EffectTeleportUnits(SpellEffIndex /*effIndex*/)
}
return;
}
// Dimensional Ripper - Area 52
case 36890:
{
if (roll_chance_i(50)) // 50% success
{
int32 rand_eff = urand(1, 4);
switch (rand_eff)
{
case 1:
// soul split - evil
m_caster->CastSpell(m_caster, 36900, true);
break;
case 2:
// soul split - good
m_caster->CastSpell(m_caster, 36901, true);
break;
case 3:
// Increase the size
m_caster->CastSpell(m_caster, 36895, true);
break;
case 4:
// Transform
{
if (m_caster->ToPlayer()->GetTeamId() == TEAM_ALLIANCE)
m_caster->CastSpell(m_caster, 36897, true);
else
m_caster->CastSpell(m_caster, 36899, true);
break;
}
}
}
return;
}
}
}

View File

@@ -2101,6 +2101,61 @@ class spell_item_scroll_of_recall : public SpellScript
}
};
// 36890 - Dimensional Ripper - Area 52
enum DimensionalRipperArea52
{
SPELL_TRANSPORTER_MALFUNCTION = 36895,
SPELL_TRANSFORM_HORDE = 36897,
SPELL_TRANSFORM_ALLIANCE = 36899,
SPELL_SOUL_SPLIT_EVIL = 36900,
SPELL_SOUL_SPLIT_GOOD = 36901
};
class spell_item_dimensional_ripper_area52 : public SpellScript
{
PrepareSpellScript(spell_item_dimensional_ripper_area52);
bool Load() override
{
return GetCaster()->GetTypeId() == TYPEID_PLAYER;
}
void HandleScript(SpellEffIndex /* effIndex */)
{
if (!roll_chance_i(50)) // 50% success
return;
Unit* caster = GetCaster();
uint32 spellId = 0;
switch (urand(0, 3))
{
case 0:
spellId = SPELL_TRANSPORTER_MALFUNCTION;
break;
case 1:
spellId = SPELL_SOUL_SPLIT_EVIL;
break;
case 2:
spellId = SPELL_SOUL_SPLIT_GOOD;
break;
case 3:
if (caster->ToPlayer()->GetTeamId() == TEAM_ALLIANCE)
spellId = SPELL_TRANSFORM_HORDE;
else
spellId = SPELL_TRANSFORM_ALLIANCE;
break;
}
caster->CastSpell(caster, spellId, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_item_dimensional_ripper_area52::HandleScript, EFFECT_0, SPELL_EFFECT_TELEPORT_UNITS);
}
};
// 71169 - Shadow's Fate (Shadowmourne questline)
enum ShadowsFate
{
@@ -3607,6 +3662,7 @@ void AddSC_item_spell_scripts()
RegisterSpellScript(spell_item_piccolo_of_the_flaming_fire);
RegisterSpellScript(spell_item_savory_deviate_delight);
RegisterSpellScript(spell_item_scroll_of_recall);
RegisterSpellScript(spell_item_dimensional_ripper_area52);
RegisterSpellScript(spell_item_unsated_craving);
RegisterSpellScript(spell_item_shadows_fate);
RegisterSpellScript(spell_item_shadowmourne);