aboutsummaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorNitair <peter.stein@de.ibm.com>2018-04-16 23:02:09 +0200
committerShauren <shauren.trinity@gmail.com>2021-09-25 22:45:56 +0200
commit4f0aa11c6e632583ca2908806a56a68b8c3d8802 (patch)
tree15c94c007a2611a8880314a2da57c761b10357a0
parenta9e7464e0d1f201b4a84d7fd955018e3a2c2cc59 (diff)
Scripts/Stratholme: Baroness Anastari rework (PR #21687)
(cherry picked from commit dc2888915127ae31fae641ba8e53d10a7aed6446)
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp173
-rw-r--r--src/server/scripts/EasternKingdoms/Stratholme/stratholme.h2
2 files changed, 97 insertions, 78 deletions
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
index 797f64224d5..0410172482b 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
+++ b/src/server/scripts/EasternKingdoms/Stratholme/boss_baroness_anastari.cpp
@@ -15,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
- {
- return GetStratholmeAI<boss_baroness_anastariAI>(creature);
- }
+struct boss_baroness_anastari : public BossAI
+{
+ boss_baroness_anastari(Creature* creature) : BossAI(creature, TYPE_BARONESS) { }
- struct boss_baroness_anastariAI : public ScriptedAI
+ ObjectGuid _possessedTargetGuid;
+
+ void Reset() override
{
- boss_baroness_anastariAI(Creature* creature) : ScriptedAI(creature)
- {
- Initialize();
- instance = me->GetInstanceScript();
- }
+ _possessedTargetGuid.Clear();
- void Initialize()
- {
- BansheeWail_Timer = 1000;
- BansheeCurse_Timer = 11000;
- Silence_Timer = 13000;
- //Possess_Timer = 35000;
- }
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POSSESS);
+ instance->DoRemoveAurasDueToSpellOnPlayers(SPELL_POSSESSED);
+ me->RemoveAurasDueToSpell(SPELL_POSSESS_INV);
- InstanceScript* instance;
+ events.Reset();
+ }
- uint32 BansheeWail_Timer;
- uint32 BansheeCurse_Timer;
- uint32 Silence_Timer;
- //uint32 Possess_Timer;
+ void JustEngagedWith(Unit* /*who*/) override
+ {
+ 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 Reset() override
- {
- Initialize();
- }
+ void JustDied(Unit* /*killer*/) override
+ {
+ // needed until crystals implemented,
+ // see line 305 instance_stratholme.cpp
+ instance->SetData(TYPE_BARONESS, IN_PROGRESS);
+ }
- void JustEngagedWith(Unit* /*who*/) override
- {
- }
+ void UpdateAI(uint32 diff) override
+ {
+ if (!UpdateVictim())
+ return;
- void JustDied(Unit* /*killer*/) override
- {
- instance->SetData(TYPE_BARONESS, IN_PROGRESS);
- }
+ events.Update(diff);
- void UpdateAI(uint32 diff) override
- {
- if (!UpdateVictim())
- return;
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
- //BansheeWail
- if (BansheeWail_Timer <= diff)
+ while (uint32 eventId = events.ExecuteEvent())
+ {
+ 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;
-
- DoMeleeAttackIfReady();
+ 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;
+ }
+
+ if (me->HasUnitState(UNIT_STATE_CASTING))
+ return;
}
- };
+ DoMeleeAttackIfReady();
+ }
};
void AddSC_boss_baroness_anastari()
{
- new boss_baroness_anastari();
+ RegisterStratholmeCreatureAI(boss_baroness_anastari);
}
diff --git a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
index 5beff555d20..93a07f13830 100644
--- a/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
+++ b/src/server/scripts/EasternKingdoms/Stratholme/stratholme.h
@@ -108,4 +108,6 @@ inline AI* GetStratholmeAI(T* obj)
return GetInstanceAI<AI>(obj, StratholmeScriptName);
}
+#define RegisterStratholmeCreatureAI(ai_name) RegisterCreatureAIWithFactory(ai_name, GetStratholmeAI)
+
#endif