Scripts/Spells: Rework Fire Bomb (Halaa) (#28025)

(cherry picked from commit b5194a1527)
This commit is contained in:
offl
2022-06-12 23:27:05 +03:00
committed by Shauren
parent eafc5214b2
commit ab7010dae1
2 changed files with 101 additions and 0 deletions

View File

@@ -33,6 +33,7 @@ EndContentData */
#include "Player.h"
#include "ScriptedEscortAI.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "TemporarySummon.h"
/*######
@@ -702,10 +703,88 @@ public:
}
};
enum FireBomb
{
SPELL_FIRE_BOMB_TARGET_SUMMON_EFFECT = 31960,
SPELL_FIRE_BOMB_DAMAGE_MISSILE = 31961,
SPELL_FIRE_BOMB_SUMMON_CATAPULT_BLAZE = 31963,
SPELL_FIRE_BOMB_FLAMES = 34658
};
// 31959 - Fire Bomb Target Summon Trigger
class spell_nagrand_fire_bomb_target_summon_trigger : public SpellScript
{
PrepareSpellScript(spell_nagrand_fire_bomb_target_summon_trigger);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FIRE_BOMB_TARGET_SUMMON_EFFECT });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
if (TempSummon* casterSummon = GetCaster()->ToTempSummon())
if (Unit* summoner = casterSummon->GetSummonerUnit())
casterSummon->CastSpell(summoner, SPELL_FIRE_BOMB_TARGET_SUMMON_EFFECT);
}
void Register() override
{
OnEffectHit += SpellEffectFn(spell_nagrand_fire_bomb_target_summon_trigger::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
// 31960 - Fire Bomb Target Summon Effect
class spell_nagrand_fire_bomb_target_summon_effect : public SpellScript
{
PrepareSpellScript(spell_nagrand_fire_bomb_target_summon_effect);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FIRE_BOMB_DAMAGE_MISSILE });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
GetHitUnit()->CastSpell(GetCaster(), SPELL_FIRE_BOMB_DAMAGE_MISSILE);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_nagrand_fire_bomb_target_summon_effect::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
// 31961 - Fire Bomb
class spell_nagrand_fire_bomb_damage_missile : public SpellScript
{
PrepareSpellScript(spell_nagrand_fire_bomb_damage_missile);
bool Validate(SpellInfo const* /*spellInfo*/) override
{
return ValidateSpellInfo({ SPELL_FIRE_BOMB_SUMMON_CATAPULT_BLAZE, SPELL_FIRE_BOMB_FLAMES });
}
void HandleScript(SpellEffIndex /*effIndex*/)
{
Unit* target = GetHitUnit();
target->CastSpell(target, SPELL_FIRE_BOMB_SUMMON_CATAPULT_BLAZE);
target->CastSpell(target, SPELL_FIRE_BOMB_FLAMES);
}
void Register() override
{
OnEffectHitTarget += SpellEffectFn(spell_nagrand_fire_bomb_damage_missile::HandleScript, EFFECT_2, SPELL_EFFECT_SCRIPT_EFFECT);
}
};
void AddSC_nagrand()
{
new npc_maghar_captive();
new npc_kurenai_captive();
new npc_nagrand_banner();
new condition_nagrand_banner();
RegisterSpellScript(spell_nagrand_fire_bomb_target_summon_trigger);
RegisterSpellScript(spell_nagrand_fire_bomb_target_summon_effect);
RegisterSpellScript(spell_nagrand_fire_bomb_damage_missile);
}