Spell/Script: Scourge Disguise and Haunting Phantoms (#22727)

This commit is contained in:
PolarCookie
2018-12-31 11:50:16 +01:00
committed by Aokromes
parent 1c4cdfd325
commit 66720e5fd9
3 changed files with 146 additions and 0 deletions

View File

@@ -0,0 +1,9 @@
DELETE FROM `spell_linked_spell` WHERE `spell_trigger` = 54089;
DELETE FROM `spell_script_names` WHERE `ScriptName` IN ('spell_stratholme_haunting_phantoms', 'spell_scourge_disguise', 'spell_scourge_disguise_instability', 'spell_scourge_disguise_expiring', 'spell_drop_disguise');
INSERT INTO `spell_script_names` (`spell_id`,`ScriptName`) VALUES
(16336, 'spell_stratholme_haunting_phantoms'),
(51966, 'spell_scourge_disguise'),
(51971, 'spell_scourge_disguise_instability'),
(52010, 'spell_scourge_disguise_expiring'),
(54089, 'spell_drop_disguise');

View File

@@ -41,6 +41,7 @@ EndContentData */
#include "ScriptedCreature.h"
#include "SpellInfo.h"
#include "SpellScript.h"
#include "SpellAuraEffects.h"
#include "stratholme.h"
/*######
@@ -332,10 +333,48 @@ class spell_ysida_saved_credit : public SpellScript
}
};
enum HauntingPhantoms
{
SPELL_SUMMON_SPITEFUL_PHANTOM = 16334,
SPELL_SUMMON_WRATH_PHANTOM = 16335
};
class spell_stratholme_haunting_phantoms : public AuraScript
{
PrepareAuraScript(spell_stratholme_haunting_phantoms);
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
isPeriodic = true;
amplitude = irand(30, 90) * IN_MILLISECONDS;
}
void HandleDummyTick(AuraEffect const* /*aurEff*/)
{
if (roll_chance_i(50))
GetTarget()->CastSpell(nullptr, SPELL_SUMMON_SPITEFUL_PHANTOM, true);
else
GetTarget()->CastSpell(nullptr, SPELL_SUMMON_WRATH_PHANTOM, true);
}
void HandleUpdatePeriodic(AuraEffect* aurEff)
{
aurEff->CalculatePeriodic(GetCaster());
}
void Register() override
{
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_stratholme_haunting_phantoms::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_stratholme_haunting_phantoms::HandleDummyTick, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_stratholme_haunting_phantoms::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_DUMMY);
}
};
void AddSC_stratholme()
{
new go_gauntlet_gate();
new npc_restless_soul();
new npc_spectral_ghostly_citizen();
RegisterSpellScript(spell_ysida_saved_credit);
RegisterAuraScript(spell_stratholme_haunting_phantoms);
}

View File

@@ -949,6 +949,100 @@ public:
}
};
enum ScourgeDisguise
{
SPELL_SCOURGE_DISGUISE = 51966,
SPELL_SCOURGE_DISGUISE_INSTABILITY = 51971,
SPELL_SCOURGE_DISGUISE_EXPIRING = 52010,
SPELL_DROP_DISGUISE = 54089,
TEXT_DISGUISE_WARNING = 28891
};
class spell_scourge_disguise : public AuraScript
{
PrepareAuraScript(spell_scourge_disguise);
void ApplyEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->CastSpell(target, SPELL_SCOURGE_DISGUISE_INSTABILITY, true);
}
void RemoveEffect(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* target = GetTarget();
target->RemoveAura(SPELL_SCOURGE_DISGUISE_INSTABILITY);
}
void Register() override
{
OnEffectRemove += AuraEffectRemoveFn(spell_scourge_disguise::RemoveEffect, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
OnEffectApply += AuraEffectApplyFn(spell_scourge_disguise::ApplyEffect, EFFECT_0, SPELL_AURA_TRANSFORM, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_scourge_disguise_instability : public AuraScript
{
PrepareAuraScript(spell_scourge_disguise_instability);
void CalcPeriodic(AuraEffect const* /*aurEff*/, bool& isPeriodic, int32& amplitude)
{
isPeriodic = true;
amplitude = irand(30, 240) * IN_MILLISECONDS;
}
void HandleDummyTick(AuraEffect const* /*aurEff*/)
{
GetTarget()->CastSpell(GetTarget(), SPELL_SCOURGE_DISGUISE_EXPIRING, true);
}
void HandleUpdatePeriodic(AuraEffect* aurEff)
{
aurEff->CalculatePeriodic(GetCaster());
}
void Register() override
{
DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_scourge_disguise_instability::CalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectPeriodic += AuraEffectPeriodicFn(spell_scourge_disguise_instability::HandleDummyTick, EFFECT_0, SPELL_AURA_DUMMY);
OnEffectUpdatePeriodic += AuraEffectUpdatePeriodicFn(spell_scourge_disguise_instability::HandleUpdatePeriodic, EFFECT_0, SPELL_AURA_DUMMY);
}
};
class spell_scourge_disguise_expiring : public AuraScript
{
PrepareAuraScript(spell_scourge_disguise_expiring);
void OnApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
if (Player* player = GetTarget()->ToPlayer())
if (Aura* aura = player->GetAura(SPELL_SCOURGE_DISGUISE))
player->Unit::Whisper(TEXT_DISGUISE_WARNING, player, true);
}
void Register() override
{
OnEffectApply += AuraEffectApplyFn(spell_scourge_disguise_expiring::OnApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
}
};
class spell_drop_disguise : public SpellScript
{
PrepareSpellScript(spell_drop_disguise);
void HandleHit()
{
if (Unit* target = GetHitUnit())
if (Aura* aura = target->GetAura(SPELL_SCOURGE_DISGUISE))
target->CastSpell(target, SPELL_SCOURGE_DISGUISE_EXPIRING, true);
}
void Register() override
{
AfterHit += SpellHitFn(spell_drop_disguise::HandleHit);
}
};
void AddSC_zuldrak()
{
new npc_drakuru_shackles();
@@ -963,4 +1057,8 @@ void AddSC_zuldrak()
new spell_pot_check();
new spell_fetch_ingredient_aura();
new npc_storm_cloud();
RegisterAuraScript(spell_scourge_disguise);
RegisterAuraScript(spell_scourge_disguise_instability);
RegisterAuraScript(spell_scourge_disguise_expiring);
RegisterSpellScript(spell_drop_disguise);
}