TrinityCore
Loading...
Searching...
No Matches
boss_warp_splinter.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 "the_botanica.h"
26
34
36{
37 // Warp Splinter - Combat
39 SPELL_STOMP = 34716,
41
42 // Warp Splinter - Combat - Misc
49
50 // Sapling
53};
54
61
67
68// 17977 - Warp Splinter
70{
72
73 void JustEngagedWith(Unit* who) override
74 {
76
78
82 }
83
84 void OnSpellCast(SpellInfo const* spellInfo) override
85 {
86 if (spellInfo->Id == SPELL_SUMMON_SAPLINGS)
87 {
88 for (uint32 spell : SummonSaplingsSpells)
89 DoCastSelf(spell, true);
91 }
92 }
93
94 // Do not despawn them
95 void JustSummoned(Creature* summon) override
96 {
97 if (me->IsEngaged())
98 DoZoneInCombat(summon);
99
100 if (me->GetVictim())
101 summon->AI()->AttackStart(me->GetVictim());
102 }
103
104 void KilledUnit(Unit* /*victim*/) override
105 {
106 Talk(SAY_SLAY);
107 }
108
109 void JustDied(Unit* /*killer*/) override
110 {
111 _JustDied();
113 }
114
115 void UpdateAI(uint32 diff) override
116 {
117 if (!UpdateVictim())
118 return;
119
120 events.Update(diff);
121
123 return;
124
125 while (uint32 eventId = events.ExecuteEvent())
126 {
127 switch (eventId)
128 {
129 case EVENT_SUMMON:
130 // Ignore shared cooldown because otherwise both spells will be not used in too many cases
131 // It looks like both spells indeed should have shared cooldown but it doesn't really blocks spell
132 // cast but delays it. Maybe not in all cases. Really long sniff can tell more
134 events.Repeat(40s, 50s);
135 break;
136 case EVENT_STOMP:
138 events.Repeat(20s, 30s);
139 break;
142 events.Repeat(20s, 35s);
143 break;
144 default:
145 break;
146 }
147
149 return;
150 }
151
153 }
154};
155
156// 19949 - Sapling
158{
160
161 void InitializeAI() override
162 {
163 me->SetCorpseDelay(2, true);
164 }
165
166 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
167 {
168 // This spell currently can miss, maybe it's fine, maybe not
169 if (spellInfo->Id == SPELL_ANCESTRAL_LIFE)
170 {
174 }
175 }
176
177 void UpdateAI(uint32 /*diff*/) override
178 {
179 if (!UpdateVictim())
180 return;
181
183 }
184};
185
uint32_t uint32
Definition Define.h:133
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore GCD.
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:249
void AddSC_boss_warp_splinter()
static constexpr std::array< uint32, 6 > SummonSaplingsSpells
WarpSplinterSpells
@ SPELL_STOMP
@ SPELL_ANCESTRAL_LIFE
@ SPELL_SUMMON_SAPLING_6
@ SPELL_ARCANE_VOLLEY
@ SPELL_SUMMON_SAPLING_1
@ SPELL_SUMMON_SAPLING_3
@ SPELL_SUMMON_SAPLING_5
@ SPELL_MOONFIRE_VISUAL
@ SPELL_SUMMON_SAPLING_2
@ SPELL_SUMMON_SAPLING_4
@ SPELL_SUMMON_SAPLINGS
WarpSplinterEvents
@ EVENT_ARCANE_VOLLEY
@ EVENT_STOMP
@ EVENT_SUMMON
WarpSplinterTexts
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 SetReactState(ReactStates st)
Definition Creature.h:128
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:98
CreatureAI * AI() const
Definition Creature.h:163
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
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:30
Definition Unit.h:783
Unit * GetVictim() const
Definition Unit.h:873
bool HasUnitState(const uint32 f) const
Definition Unit.h:890
ScriptedAI(Creature *creature)
void JustEngagedWith(Unit *who) override
boss_warp_splinter(Creature *creature)
void JustSummoned(Creature *summon) override
void JustDied(Unit *) override
void KilledUnit(Unit *) override
void OnSpellCast(SpellInfo const *spellInfo) override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32) override
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
@ DATA_WARP_SPLINTER
#define RegisterBotanicaCreatureAI(ai_name)