Scripts/Stratholme: Baroness Anastari rework (PR #21687)

This commit is contained in:
Nitair
2018-04-16 23:02:09 +02:00
committed by Treeston
parent 743980a625
commit dc28889151
2 changed files with 101 additions and 84 deletions

View File

@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -16,112 +15,129 @@
* with this program. If not, see <http://www.gnu.org/licenses/>.
*/
/* ScriptData
SDName: Boss_Baroness_Anastari
SD%Complete: 90
SDComment: MC disabled
SDCategory: Stratholme
EndScriptData */
#include "ScriptMgr.h"
#include "InstanceScript.h"
#include "ObjectAccessor.h"
#include "Player.h"
#include "ScriptMgr.h"
#include "ScriptedCreature.h"
#include "stratholme.h"
enum Spells
{
SPELL_BANSHEEWAIL = 16565,
SPELL_BANSHEECURSE = 16867,
SPELL_SILENCE = 18327
//SPELL_POSSESS = 17244
SPELL_BANSHEEWAIL = 16565,
SPELL_BANSHEECURSE = 16867,
SPELL_SILENCE = 18327,
SPELL_POSSESS = 17244, // the charm on player
SPELL_POSSESSED = 17246, // the damage debuff on player
SPELL_POSSESS_INV = 17250 // baroness becomes invisible while possessing a target
};
class boss_baroness_anastari : public CreatureScript
enum BaronessAnastariEvents
{
public:
boss_baroness_anastari() : CreatureScript("boss_baroness_anastari") { }
EVENT_SPELL_BANSHEEWAIL = 1,
EVENT_SPELL_BANSHEECURSE = 2,
EVENT_SPELL_SILENCE = 3,
EVENT_SPELL_POSSESS = 4,
EVENT_CHECK_POSSESSED = 5
};
CreatureAI* GetAI(Creature* creature) const override
struct boss_baroness_anastari : public BossAI
{
boss_baroness_anastari(Creature* creature) : BossAI(creature, TYPE_BARONESS) { }
ObjectGuid _possessedTargetGuid;
void Reset() override
{
return GetStratholmeAI<boss_baroness_anastariAI>(creature);
_possessedTargetGuid.Clear();
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POSSESS);
instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POSSESSED);
me->RemoveAurasDueToSpell(SPELL_POSSESS_INV);
events.Reset();
}
struct boss_baroness_anastariAI : public ScriptedAI
void JustEngagedWith(Unit* /*who*/) override
{
boss_baroness_anastariAI(Creature* creature) : ScriptedAI(creature)
events.ScheduleEvent(EVENT_SPELL_BANSHEEWAIL, 1s);
events.ScheduleEvent(EVENT_SPELL_BANSHEECURSE, 11s);
events.ScheduleEvent(EVENT_SPELL_SILENCE, 13s);
events.ScheduleEvent(EVENT_SPELL_POSSESS, 20s, 30s);
}
void JustDied(Unit* /*killer*/) override
{
// needed until crystals implemented,
// see line 305 instance_stratholme.cpp
instance->SetData(TYPE_BARONESS, IN_PROGRESS);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
events.Update(diff);
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
while (uint32 eventId = events.ExecuteEvent())
{
Initialize();
instance = me->GetInstanceScript();
}
void Initialize()
{
BansheeWail_Timer = 1000;
BansheeCurse_Timer = 11000;
Silence_Timer = 13000;
//Possess_Timer = 35000;
}
InstanceScript* instance;
uint32 BansheeWail_Timer;
uint32 BansheeCurse_Timer;
uint32 Silence_Timer;
//uint32 Possess_Timer;
void Reset() override
{
Initialize();
}
void JustEngagedWith(Unit* /*who*/) override
{
}
void JustDied(Unit* /*killer*/) override
{
instance->SetData(TYPE_BARONESS, IN_PROGRESS);
}
void UpdateAI(uint32 diff) override
{
if (!UpdateVictim())
return;
//BansheeWail
if (BansheeWail_Timer <= diff)
switch (eventId)
{
if (rand32() % 100 < 95)
case EVENT_SPELL_BANSHEEWAIL:
DoCastVictim(SPELL_BANSHEEWAIL);
//4 seconds until we should cast this again
BansheeWail_Timer = 4000;
} else BansheeWail_Timer -= diff;
//BansheeCurse
if (BansheeCurse_Timer <= diff)
{
if (rand32() % 100 < 75)
events.Repeat(4s);
break;
case EVENT_SPELL_BANSHEECURSE:
DoCastVictim(SPELL_BANSHEECURSE);
//18 seconds until we should cast this again
BansheeCurse_Timer = 18000;
} else BansheeCurse_Timer -= diff;
//Silence
if (Silence_Timer <= diff)
{
if (rand32() % 100 < 80)
events.Repeat(18s);
break;
case EVENT_SPELL_SILENCE:
DoCastVictim(SPELL_SILENCE);
//13 seconds until we should cast this again
Silence_Timer = 13000;
} else Silence_Timer -= diff;
events.Repeat(13s);
break;
case EVENT_SPELL_POSSESS:
if (Unit* possessTarget = SelectTarget(SELECT_TARGET_RANDOM, 1, 0, true, false))
{
DoCast(possessTarget, SPELL_POSSESS, true);
DoCast(possessTarget, SPELL_POSSESSED, true);
DoCastSelf(SPELL_POSSESS_INV, true);
_possessedTargetGuid = possessTarget->GetGUID();
events.ScheduleEvent(EVENT_CHECK_POSSESSED, 0s);
}
else
events.Repeat(20s, 30s);
break;
case EVENT_CHECK_POSSESSED:
if (Player* possessedTarget = ObjectAccessor::GetPlayer(*me, _possessedTargetGuid))
{
if (!possessedTarget->HasAura(SPELL_POSSESSED) || possessedTarget->HealthBelowPct(50))
{
possessedTarget->RemoveAurasDueToSpell(SPELL_POSSESS);
possessedTarget->RemoveAurasDueToSpell(SPELL_POSSESSED);
me->RemoveAurasDueToSpell(SPELL_POSSESS_INV);
_possessedTargetGuid.Clear();
events.ScheduleEvent(EVENT_SPELL_POSSESS, 20s, 30s);
events.CancelEvent(EVENT_CHECK_POSSESSED);
}
else
events.Repeat(1s);
}
break;
}
DoMeleeAttackIfReady();
if (me->HasUnitState(UNIT_STATE_CASTING))
return;
}
};
DoMeleeAttackIfReady();
}
};
void AddSC_boss_baroness_anastari()
{
new boss_baroness_anastari();
RegisterStratholmeCreatureAI(boss_baroness_anastari);
}

View File

@@ -1,6 +1,5 @@
/*
* Copyright (C) 2008-2018 TrinityCore <https://www.trinitycore.org/>
* Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
*
* This program is free software; you can redistribute it and/or modify it
* under the terms of the GNU General Public License as published by the
@@ -109,4 +108,6 @@ inline AI* GetStratholmeAI(T* obj)
return GetInstanceAI<AI>(obj, StratholmeScriptName);
}
#define RegisterStratholmeCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetStratholmeAI)
#endif