TrinityCore
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#include "ScriptMgr.h"
19#include "ScriptedCreature.h"
20#include "SpellInfo.h"
21#include "SpellScript.h"
22#include "the_botanica.h"
23
25{
31 SAY_DEATH = 5
32};
33
35{
38
44};
45
47{
50};
51
53{
55};
56
58{
60
61 void Reset() override
62 {
63 _Reset();
64 _summoned = false;
65 }
66
67 void JustEngagedWith(Unit* who) override
68 {
71
72 // This is definitely just timed, not scheduled instantly when victim has specific amount of stacks of Arcane Resonance
73 events.ScheduleEvent(EVENT_ARCANE_DEVASTATION, RAND(10s, 15s, 20s, 25s, 30s, 35s));
74 // Timed in heroic (repeatable), on HP PTC in normal (not repeatable)
75 if (IsHeroic())
77 }
78
79 void KilledUnit(Unit* /*victim*/) override
80 {
82 }
83
84 void JustDied(Unit* /*killer*/) override
85 {
86 _JustDied();
88 }
89
90 void DamageTaken(Unit* /*killer*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
91 {
92 if (!_summoned && me->HealthBelowPctDamaged(55, damage) && !IsHeroic())
93 {
94 _summoned = true;
96 }
97 }
98
99 void OnSpellCast(SpellInfo const* spell) override
100 {
101 if (spell->Id == SPELL_SUMMON_REINFORCEMENTS)
103 }
104
105 // Do not despawn them
106 void JustSummoned(Creature* summon) override
107 {
108 if (me->IsEngaged())
109 DoZoneInCombat(summon);
110 }
111
112 void UpdateAI(uint32 diff) override
113 {
114 if (!UpdateVictim())
115 return;
116
117 events.Update(diff);
118
120 return;
121
122 while (uint32 eventId = events.ExecuteEvent())
123 {
124 switch (eventId)
125 {
127 // Not always?
129 // She can cast it if victim has only one stack of Arcane Resonance but can she cast it if victim has no stacks?
131 events.Repeat(RAND(10s, 15s, 20s, 25s, 30s, 35s));
132 break;
136 if (IsHeroic())
137 events.Repeat(1min);
138 break;
139 default:
140 break;
141 }
142
144 return;
145 }
146 }
147
148private:
150};
151
152// 34799 - Arcane Devastation
154{
155 bool Validate(SpellInfo const* /*spell*/) override
156 {
158 }
159
160 void AfterApply(AuraEffect const* /*aurEff*/, AuraEffectHandleModes /*mode*/)
161 {
163 }
164
165 void Register() override
166 {
168 }
169};
170
171// 34803 - Summon Reinforcements
173{
174 bool Validate(SpellInfo const* /*spellInfo*/) override
175 {
177 }
178
179 void HandleDummy(SpellEffIndex /*effIndex*/)
180 {
181 Unit* caster = GetCaster();
183 caster->CastSpell(caster, spells, true);
184 }
185
186 void Register() override
187 {
189 }
190};
191
193{
197}
Texts
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
#define RegisterSpellScript(spell_script)
Definition: ScriptMgr.h:1369
SpellEffIndex
Definition: SharedDefines.h:29
@ EFFECT_0
Definition: SharedDefines.h:30
@ EFFECT_2
Definition: SharedDefines.h:32
@ SPELL_EFFECT_DUMMY
AuraEffectHandleModes
@ AURA_EFFECT_HANDLE_REAL
@ SPELL_AURA_DUMMY
#define SpellEffectFn(F, I, N)
Definition: SpellScript.h:842
#define AuraEffectApplyFn(F, I, N, M)
Definition: SpellScript.h:2029
DamageEffectType
Definition: UnitDefines.h:131
@ UNIT_STATE_CASTING
Definition: Unit.h:270
@ 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
uint32 const SummonReinforcementsSpells[]
@ EVENT_SUMMON_REINFORCEMENTS
@ EVENT_ARCANE_DEVASTATION
HookList< EffectApplyHandler > AfterEffectApply
Definition: SpellScript.h:2028
Unit * GetTarget() const
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void DoZoneInCombat()
Definition: CreatureAI.h:161
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
bool UpdateVictim()
Definition: CreatureAI.cpp:245
Creature *const me
Definition: CreatureAI.h:61
bool IsEngaged() const override
Definition: Creature.cpp:3601
uint32 ExecuteEvent()
Definition: EventMap.cpp:73
void Update(uint32 time)
Definition: EventMap.h:56
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
uint32 const Id
Definition: SpellInfo.h:325
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Definition: SpellScript.h:162
Unit * GetCaster() const
HookList< EffectHandler > OnEffectHit
Definition: SpellScript.h:839
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
Definition: Unit.h:627
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint32 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:3831
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition: Object.cpp:2896
void AfterApply(AuraEffect const *, AuraEffectHandleModes)
bool IsHeroic() const
void JustSummoned(Creature *summon) override
void UpdateAI(uint32 diff) override
void JustEngagedWith(Unit *who) override
void JustDied(Unit *) override
void KilledUnit(Unit *) override
void OnSpellCast(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
boss_commander_sarannis(Creature *creature)
@ DATA_COMMANDER_SARANNIS
Definition: the_botanica.h:30
#define RegisterBotanicaCreatureAI(ai_name)
Definition: the_botanica.h:52