TrinityCore
Loading...
Searching...
No Matches
boss_fankriss.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 "SpellInfo.h"
26#include "SpellScript.h"
27#include "temple_of_ahnqiraj.h"
28
45
52
53// 15510 - Fankriss the Unyielding
54struct boss_fankriss : public BossAI
55{
57
60
69
78
79 void UpdateAI(uint32 diff) override
80 {
81 if (!UpdateVictim())
82 return;
83
84 events.Update(diff);
85
87 return;
88
89 while (uint32 eventId = events.ExecuteEvent())
90 {
91 switch (eventId)
92 {
95 events.Repeat(4s, 12s);
96 break;
98 {
100
102
104 {
107 events.Repeat(20s, 70s);
108 }
109 else
110 events.Repeat(5s, 20s);
111 break;
112 }
113 case EVENT_ENTANGLE:
114 {
115 Unit* target = SelectTarget(SelectTargetMethod::Random, 1, 100.0f, true);
116
117 if (!target)
118 target = me->GetVictim();
119
120 if (target)
122
124
125 if (!_entanglePerWave)
126 {
127 _entanglePerWave = urand(1, 3);
129 events.Repeat(25s, 55s);
130 }
131 else
132 events.Repeat(5s, 10s);
133 break;
134 }
135 default:
136 break;
137 }
138
140 return;
141 }
142
144 }
145
146private:
149};
150
151// 720, 731, 1121 - Entangle
153{
155
156 bool Validate(SpellInfo const* /*spellInfo*/) override
157 {
159 }
160
162 {
163 switch (GetSpellInfo()->Id)
164 {
165 case SPELL_ENTANGLE_1:
167 break;
168 case SPELL_ENTANGLE_2:
170 break;
171 case SPELL_ENTANGLE_3:
173 break;
174 default:
175 break;
176 }
177 }
178
183};
184
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
#define SpellCastFn(F)
@ UNIT_STATE_CASTING
Definition Unit.h:235
FankrissSpells
@ SPELL_SPAWN_HATCHLING_2
@ SPELL_SPAWN_HATCHLING_3
@ SPELL_ENTANGLE_2
@ SPELL_ENTANGLE_1
@ SPELL_SUMMON_WORM_2
@ SPELL_ENTANGLE_3
@ SPELL_SPAWN_HATCHLING_1
@ SPELL_SUMMON_WORM_3
@ SPELL_MORTAL_WOUND
@ SPELL_SUMMON_WORM_1
void AddSC_boss_fankriss()
FankrissEvents
@ EVENT_MORTAL_WOUND
@ EVENT_SUMMON_WORM
@ EVENT_ENTANGLE
void JustEngagedWith(Unit *who) override
EventMap events
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
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
HookList< CastHandler > AfterCast
Unit * GetCaster() const
SpellInfo const * GetSpellInfo() const
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
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:769
Unit * GetVictim() const
Definition Unit.h:859
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_fankriss_entangle)
bool Validate(SpellInfo const *) override
void RandomShuffle(C &container)
Reorder the elements of the container randomly.
Definition Containers.h:166
std::vector< uint32 > SummonWormSpells
void UpdateAI(uint32 diff) override
std::vector< uint32 > EntangleSpells
void JustEngagedWith(Unit *who) override
boss_fankriss(Creature *creature)
void Reset() override
#define RegisterAQ40CreatureAI(ai_name)
@ DATA_FRANKRIS