Scripts/Spells: Migrate Some Scripted Spells to Scripts (#23185)

* Migrate spells to scripts

* Simplify code

* I need to sleep

* Update chapter1.cpp

* Use actual damage

* No need in null check here
This commit is contained in:
Sorikoff
2019-04-16 07:49:39 +00:00
committed by Giacomo Pozzoni
parent 50d32fe493
commit 2cfaeb1400
8 changed files with 283 additions and 168 deletions

View File

@@ -87,6 +87,33 @@ class spell_q55_sacred_cleansing : public SpellScriptLoader
}
};
enum BendingShinbone
{
SPELL_BENDING_SHINBONE1 = 8854,
SPELL_BENDING_SHINBONE2 = 8855
};
class spell_q1846_bending_shinbone : public SpellScript
{
PrepareSpellScript(spell_q1846_bending_shinbone);
void HandleScriptEffect(SpellEffIndex /* effIndex */)
{
Item* target = GetHitItem();
Unit* caster = GetCaster();
if (!target && caster->GetTypeId() != TYPEID_PLAYER)
return;
uint32 const spellId = roll_chance_i(20) ? SPELL_BENDING_SHINBONE1 : SPELL_BENDING_SHINBONE2;
caster->CastSpell(caster, spellId, true);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_q1846_bending_shinbone::HandleScriptEffect, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
// 9712 - Thaumaturgy Channel
enum ThaumaturgyChannel
{
@@ -2869,6 +2896,7 @@ public:
void AddSC_quest_spell_scripts()
{
new spell_q55_sacred_cleansing();
RegisterSpellScript(spell_q1846_bending_shinbone);
new spell_q2203_thaumaturgy_channel();
new spell_q5206_test_fetid_skull();
new spell_q6124_6129_apply_salve();