TrinityCore
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
24{
28 SAY_DEATH = 3
29};
30
32{
33 SPELL_STOMP = 34716,
35
45};
46
48{
52};
53
55{
58};
59
61{
63
64 void JustEngagedWith(Unit* who) override
65 {
71 }
72
73 void KilledUnit(Unit* /*victim*/) override
74 {
76 }
77
78 void JustDied(Unit* /*killer*/) override
79 {
80 _JustDied();
82 }
83
84 void OnSpellCast(SpellInfo const* spell) override
85 {
86 if (spell->Id == SPELL_SUMMON_SAPLINGS)
87 {
88 for (uint32 summonSpells : SummonSaplingsSpells)
89 DoCastSelf(summonSpells, 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 UpdateAI(uint32 diff) override
105 {
106 if (!UpdateVictim())
107 return;
108
109 events.Update(diff);
110
112 return;
113
114 while (uint32 eventId = events.ExecuteEvent())
115 {
116 switch (eventId)
117 {
118 case EVENT_SUMMON:
119 // Ignore shared cooldown because otherwise both spells will be not used in too many cases
120 // It looks like both spells indeed should have shared cooldown but it doesn't really blocks spell
121 // cast but delays it. Maybe not in all cases. Really long sniff can tell more
123 events.Repeat(40s, 50s);
124 break;
125 case EVENT_STOMP:
127 events.Repeat(20s, 30s);
128 break;
131 events.Repeat(20s, 35s);
132 break;
133 default:
134 break;
135 }
136
138 return;
139 }
140 }
141};
142
144{
146
147 void InitializeAI() override
148 {
149 me->SetCorpseDelay(2, true);
150 }
151
152 void SpellHit(WorldObject* /*caster*/, SpellInfo const* spellInfo) override
153 {
154 // This spell currently can miss, maybe it's fine, maybe not
155 if (spellInfo->Id == SPELL_ANCESTRAL_LIFE)
156 {
160 }
161 }
162};
163
165{
168}
Texts
uint32_t uint32
Definition: Define.h:142
Spells
Definition: PlayerAI.cpp:32
@ TRIGGERED_IGNORE_SPELL_AND_CATEGORY_CD
Will ignore Spell and Category cooldowns.
Definition: SpellDefines.h:248
@ REACT_PASSIVE
Definition: UnitDefines.h:506
@ UNIT_STATE_CASTING
Definition: Unit.h:270
void AddSC_boss_warp_splinter()
uint32 const SummonSaplingsSpells[]
@ 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
@ SAY_DEATH
@ SAY_AGGRO
@ SAY_SLAY
@ SAY_SUMMON
@ EVENT_ARCANE_VOLLEY
@ EVENT_STOMP
@ EVENT_SUMMON
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
void AttackStart(Unit *victim) override
== Triggered Actions Requested ==================
Definition: CreatureAI.cpp:328
Creature *const me
Definition: CreatureAI.h:61
bool IsEngaged() const override
Definition: Creature.cpp:3601
void SetReactState(ReactStates st)
Definition: Creature.h:160
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
Definition: Creature.cpp:2415
void SetCorpseDelay(uint32 delay, bool ignoreCorpseDecayRatio=false)
Definition: Creature.h:104
CreatureAI * AI() const
Definition: Creature.h:214
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
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
Definition: Unit.h:627
Unit * GetVictim() const
Definition: Unit.h:715
bool HasUnitState(const uint32 f) const
Definition: Unit.h:732
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
npc_warp_splinter_sapling(Creature *creature)
void SpellHit(WorldObject *, SpellInfo const *spellInfo) override
@ DATA_WARP_SPLINTER
Definition: the_botanica.h:34
#define RegisterBotanicaCreatureAI(ai_name)
Definition: the_botanica.h:52