TrinityCore
Loading...
Searching...
No Matches
boss_commander_sarannis.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/*
19 * Timers requires to be revisited
20 */
21
22#include "ScriptMgr.h"
23#include "ScriptedCreature.h"
24#include "SpellInfo.h"
25#include "SpellScript.h"
26#include "the_botanica.h"
27
37
50
56
61
62// 17976 - Commander Sarannis
64{
66
67 void Reset() override
68 {
69 _Reset();
70 _summoned = false;
71 }
72
73 void JustEngagedWith(Unit* who) override
74 {
76
78
79 // This is definitely just timed, not scheduled instantly when victim has specific amount of stacks of Arcane Resonance
81 // Timed in heroic (repeatable), on HP PTC in normal (not repeatable)
82 if (IsHeroic())
84 }
85
86 void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
87 {
88 if (!_summoned && me->HealthBelowPctDamaged(55, damage) && !IsHeroic())
89 {
90 _summoned = true;
92 }
93 }
94
95 void OnSpellStart(SpellInfo const* spellInfo) override
96 {
97 if (spellInfo->Id == SPELL_SUMMON_REINFORCEMENTS)
99 }
100
101 void OnSpellCast(SpellInfo const* spellInfo) override
102 {
103 switch (spellInfo->Id)
104 {
106 // Not always?
108 break;
111 break;
112 default:
113 break;
114 }
115 }
116
117 // Do not despawn them
118 void JustSummoned(Creature* summon) override
119 {
120 if (me->IsEngaged())
121 DoZoneInCombat(summon);
122 }
123
124 void KilledUnit(Unit* /*victim*/) override
125 {
126 Talk(SAY_SLAY);
127 }
128
129 void JustDied(Unit* /*killer*/) override
130 {
131 _JustDied();
133 }
134
135 void UpdateAI(uint32 diff) override
136 {
137 if (!UpdateVictim())
138 return;
139
140 events.Update(diff);
141
143 return;
144
145 while (uint32 eventId = events.ExecuteEvent())
146 {
147 switch (eventId)
148 {
150 // She can cast it if victim has only one stack of Arcane Resonance but can she cast it if victim has no stacks?
152 events.Repeat(10s, 20s);
153 break;
156 if (IsHeroic())
157 events.Repeat(1min);
158 break;
159 default:
160 break;
161 }
162
164 return;
165 }
166
168 }
169
170private:
172};
173
174// 34799 - Arcane Devastation
194
195// 34803 - Summon Reinforcements
217
uint32_t uint32
Definition Define.h:133
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ EFFECT_2
@ SPELL_EFFECT_DUMMY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
#define SpellEffectFn(F, I, N)
#define AuraEffectApplyFn(F, I, N, M)
@ UNIT_STATE_CASTING
Definition Unit.h:249
DamageEffectType
Definition Unit.h:366
static constexpr std::array< uint32, 4 > SummonReinforcementsSpells
@ SPELL_SUMMON_MENDER_1
@ SPELL_SUMMON_RESERVIST_2
@ SPELL_SUMMON_REINFORCEMENTS
@ SPELL_SUMMON_RESERVIST_1
@ SPELL_ARCANE_DEVASTATION
@ SPELL_ARCANE_RESONANCE
@ SPELL_SUMMON_RESERVIST_3
void AddSC_boss_commander_sarannis()
@ SAY_ARCANE_DEVASTATION
@ EVENT_SUMMON_REINFORCEMENTS
@ EVENT_ARCANE_DEVASTATION
HookList< EffectApplyHandler > AfterEffectApply
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
EventMap events
void DoZoneInCombat(Creature *creature=nullptr)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
bool IsEngaged() const override
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
uint32 Id
Definition SpellInfo.h:289
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
Definition Unit.h:783
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:3807
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:932
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2833
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
PrepareAuraScript(spell_commander_sarannis_arcane_devastation)
PrepareSpellScript(spell_commander_sarannis_summon_reinforcements)
bool IsHeroic() const
void JustSummoned(Creature *summon) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void OnSpellStart(SpellInfo const *spellInfo) override
void OnSpellCast(SpellInfo const *spellInfo) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_commander_sarannis(Creature *creature)
@ DATA_COMMANDER_SARANNIS
#define RegisterBotanicaCreatureAI(ai_name)