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 }
143
144private:
147};
148
149// 720, 731, 1121 - Entangle
151{
152 bool Validate(SpellInfo const* /*spellInfo*/) override
153 {
155 }
156
158 {
159 switch (GetSpellInfo()->Id)
160 {
161 case SPELL_ENTANGLE_1:
163 break;
164 case SPELL_ENTANGLE_2:
166 break;
167 case SPELL_ENTANGLE_3:
169 break;
170 default:
171 break;
172 }
173 }
174
179};
180
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:43
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
#define SpellCastFn(F)
@ UNIT_STATE_CASTING
Definition Unit.h:290
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:63
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
HookList< CastHandler > AfterCast
Unit * GetCaster() const
SpellInfo const * GetSpellInfo() const
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
Unit * GetVictim() const
Definition Unit.h:738
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool Validate(SpellInfo const *) override
void RandomShuffle(Iterator begin, Iterator end)
Reorder the elements of the iterator range randomly.
Definition Containers.h:171
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