TrinityCore
Loading...
Searching...
No Matches
boss_laj.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 "Containers.h"
24#include "ScriptedCreature.h"
25#include "the_botanica.h"
26
28{
29 EMOTE_SUMMON = 0
30};
31
49
59
68
69// 17980 - Laj
70struct boss_laj : public BossAI
71{
73
81
91
92 void JustSummoned(Creature* summon) override
93 {
94 // Not entirely correct, they aggro on their own in a weird way and in general behave weirdly
95 if (me->IsEngaged())
96 DoZoneInCombat(summon);
97 }
98
99 void UpdateAI(uint32 diff) override
100 {
101 if (!UpdateVictim())
102 return;
103
104 events.Update(diff);
105
107 return;
108
109 while (uint32 eventId = events.ExecuteEvent())
110 {
111 switch (eventId)
112 {
113 // Teleport sequence
114 case EVENT_SEQUENCE_1:
117 events.Repeat(25s, 40s);
119 break;
120 case EVENT_SEQUENCE_2:
123 break;
124 case EVENT_SEQUENCE_3:
128 break;
129
130 // Abilities
132 if (Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 8.f))
134 events.Repeat(20s, 30s);
135 break;
136 case EVENT_TRANSFORM:
137 {
139
140 std::array<uint32, 4> transformSpells;
141 std::ranges::remove_copy(AllTransformSpells, transformSpells.begin(), _lastTransformSpell);
143
145 events.Repeat(25s, 45s);
146 break;
147 }
148 case EVENT_THRASH:
150 events.Repeat(15s, 20s);
151 break;
152 default:
153 break;
154 }
155
157 return;
158 }
159
161 }
162
163private:
165};
166
First const & RAND(First const &first, Second const &second, Rest const &... rest)
uint32_t uint32
Definition Define.h:133
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:249
LajTexts
Definition boss_laj.cpp:28
@ EMOTE_SUMMON
Definition boss_laj.cpp:29
LajEvents
Definition boss_laj.cpp:51
@ EVENT_SEQUENCE_1
Definition boss_laj.cpp:52
@ EVENT_SEQUENCE_3
Definition boss_laj.cpp:54
@ EVENT_SEQUENCE_2
Definition boss_laj.cpp:53
@ EVENT_TRANSFORM
Definition boss_laj.cpp:56
@ EVENT_ALLERGIC_REACTION
Definition boss_laj.cpp:55
@ EVENT_THRASH
Definition boss_laj.cpp:57
LajSpells
Definition boss_laj.cpp:33
@ SPELL_SUMMON_FLAYER_1
Definition boss_laj.cpp:39
@ SPELL_TRANSFORM_SHADOW
Definition boss_laj.cpp:47
@ SPELL_TRANSFORM_FROST
Definition boss_laj.cpp:45
@ SPELL_TRANSFORM_FIRE
Definition boss_laj.cpp:44
@ SPELL_TELEPORT_SELF
Definition boss_laj.cpp:35
@ SPELL_TRANSFORM_ARCANE
Definition boss_laj.cpp:43
@ SPELL_SUMMON_FLAYER_2
Definition boss_laj.cpp:41
@ SPELL_SUMMON_LASHER_2
Definition boss_laj.cpp:40
@ SPELL_ALLERGIC_REACTION
Definition boss_laj.cpp:34
@ SPELL_THRASH
Definition boss_laj.cpp:36
@ SPELL_SUMMON_LASHER_1
Definition boss_laj.cpp:38
@ SPELL_TRANSFORM_NATURE
Definition boss_laj.cpp:46
void AddSC_boss_laj()
Definition boss_laj.cpp:167
static constexpr std::array< uint32, 5 > AllTransformSpells
Definition boss_laj.cpp:60
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 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
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
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
auto SelectRandomContainerElement(C const &container) -> typename std::add_const< decltype(*std::begin(container))>::type &
Definition Containers.h:108
boss_laj(Creature *creature)
Definition boss_laj.cpp:72
uint32 _lastTransformSpell
Definition boss_laj.cpp:164
void JustEngagedWith(Unit *who) override
Definition boss_laj.cpp:82
void UpdateAI(uint32 diff) override
Definition boss_laj.cpp:99
void Reset() override
Definition boss_laj.cpp:74
void JustSummoned(Creature *summon) override
Definition boss_laj.cpp:92
@ DATA_LAJ
#define RegisterBotanicaCreatureAI(ai_name)