fix(Scripts/Midsummer): Randomize ribbon pole beam color (#17380)

* fix(Scripts/Midsummer): Randomize ribbon pole beam color

* Update data/sql/updates/pending_db_world/rev_1695820418952974700.sql

Co-authored-by: Dan <83884799+elthehablo@users.noreply.github.com>

* Add Validate() to spell script spell_midsummer_ribbon_pole

---------

Co-authored-by: Dan <83884799+elthehablo@users.noreply.github.com>
This commit is contained in:
Ludwig
2023-10-01 09:26:18 +02:00
committed by GitHub
parent 3c9c985fc6
commit de50ce3305
2 changed files with 38 additions and 2 deletions

View File

@@ -211,6 +211,10 @@ class spell_gen_crab_disguise : public AuraScript
enum RibbonPole
{
SPELL_RIBBON_POLE_CHANNEL_VISUAL = 29172,
SPELL_RIBBON_POLE_CHANNEL_VISUAL_2 = 29531,
SPELL_TEST_RIBBON_POLE_CHANNEL_BLUE = 29705,
SPELL_TEST_RIBBON_POLE_CHANNEL_RED = 29726,
SPELL_TEST_RIBBON_POLE_CHANNEL_PINK = 29727,
SPELL_RIBBON_POLE_XP = 29175,
SPELL_RIBBON_POLE_FIREWORKS = 46971,
@@ -221,6 +225,17 @@ class spell_midsummer_ribbon_pole : public AuraScript
{
PrepareAuraScript(spell_midsummer_ribbon_pole)
bool Validate(SpellInfo const* /*spell*/) override
{
return ValidateSpellInfo(
{
SPELL_RIBBON_POLE_XP,
SPELL_TEST_RIBBON_POLE_CHANNEL_BLUE,
SPELL_TEST_RIBBON_POLE_CHANNEL_RED,
SPELL_TEST_RIBBON_POLE_CHANNEL_PINK
});
}
void HandleEffectPeriodic(AuraEffect const* /*aurEff*/)
{
PreventDefaultAction();
@@ -229,7 +244,9 @@ class spell_midsummer_ribbon_pole : public AuraScript
Creature* cr = target->FindNearestCreature(NPC_RIBBON_POLE_DEBUG_TARGET, 10.0f);
if (!cr)
{
target->RemoveAura(SPELL_RIBBON_POLE_CHANNEL_VISUAL);
target->RemoveAura(SPELL_TEST_RIBBON_POLE_CHANNEL_BLUE);
target->RemoveAura(SPELL_TEST_RIBBON_POLE_CHANNEL_RED);
target->RemoveAura(SPELL_TEST_RIBBON_POLE_CHANNEL_PINK);
SetDuration(1);
return;
}
@@ -254,7 +271,19 @@ class spell_midsummer_ribbon_pole : public AuraScript
void HandleEffectApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
{
Unit* ar = GetTarget();
ar->CastSpell(ar, SPELL_RIBBON_POLE_CHANNEL_VISUAL, true);
switch (urand(0, 2))
{
case 0:
ar->CastSpell(ar, SPELL_TEST_RIBBON_POLE_CHANNEL_BLUE, true);
break;
case 1:
ar->CastSpell(ar, SPELL_TEST_RIBBON_POLE_CHANNEL_RED, true);
break;
case 2:
default:
ar->CastSpell(ar, SPELL_TEST_RIBBON_POLE_CHANNEL_PINK, true);
break;
}
}
void Register() override