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#include "ScriptMgr.h"
19#include "ScriptedCreature.h"
20#include "SpellInfo.h"
21#include "the_botanica.h"
22
30
47
54
60
61// 17977 - Warp Splinter
63{
65
74
75 void OnSpellCast(SpellInfo const* spell) override
76 {
77 if (spell->Id == SPELL_SUMMON_SAPLINGS)
78 {
79 for (uint32 summonSpells : SummonSaplingsSpells)
80 DoCastSelf(summonSpells, true);
82 }
83 }
84
85 // Do not despawn them
86 void JustSummoned(Creature* summon) override
87 {
88 if (me->IsEngaged())
89 DoZoneInCombat(summon);
90
91 if (me->GetVictim())
92 summon->AI()->AttackStart(me->GetVictim());
93 }
94
95 void KilledUnit(Unit* /*victim*/) override
96 {
98 }
99
100 void JustDied(Unit* /*killer*/) override
101 {
102 _JustDied();
104 }
105
106 void UpdateAI(uint32 diff) override
107 {
108 if (!UpdateVictim())
109 return;
110
111 events.Update(diff);
112
114 return;
115
116 while (uint32 eventId = events.ExecuteEvent())
117 {
118 switch (eventId)
119 {
120 case EVENT_SUMMON:
121 // Ignore shared cooldown because otherwise both spells will be not used in too many cases
122 // It looks like both spells indeed should have shared cooldown but it doesn't really blocks spell
123 // cast but delays it. Maybe not in all cases. Really long sniff can tell more
125 events.Repeat(40s, 50s);
126 break;
127 case EVENT_STOMP:
129 events.Repeat(20s, 30s);
130 break;
133 events.Repeat(20s, 35s);
134 break;
135 default:
136 break;
137 }
138
140 return;
141 }
142
144 }
145};
146
147// 19949 - Sapling
149{
151
152 void InitializeAI() override
153 {
154 me->SetCorpseDelay(2, true);
155 }
156
157 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
158 {
159 // This spell currently can miss, maybe it's fine, maybe not
160 if (spellInfo->Id == SPELL_ANCESTRAL_LIFE)
161 {
165 }
166 }
167
168 void UpdateAI(uint32 /*diff*/) override
169 {
170 if (!UpdateVictim())
171 return;
172
174 }
175};
176
uint32_t uint32
Definition Define.h:133
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore GCD.
@ REACT_PASSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
void AddSC_boss_warp_splinter()
uint32 const 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:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition Creature.h:89
CreatureAI * AI() const
Definition Creature.h:154
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:769
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
void JustEngagedWith(Unit *who) override
boss_warp_splinter(Creature *creature)
void JustSummoned(Creature *summon) override
void OnSpellCast(SpellInfo const *spell) override
void JustDied(Unit *) override
void KilledUnit(Unit *) override
void UpdateAI(uint32 diff) override
void UpdateAI(uint32) override
npc_warp_splinter_sapling(Creature *creature)
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
@ DATA_WARP_SPLINTER
#define RegisterBotanicaCreatureAI(ai_name)