TrinityCore
Loading...
Searching...
No Matches
boss_wrath_scryer_soccothrates.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 * Charge left to script
20 * Conversation between creatures requires rechecks and improvements
21 */
22
23#include "ScriptMgr.h"
24#include "arcatraz.h"
25#include "InstanceScript.h"
26#include "MotionMaster.h"
27#include "ObjectAccessor.h"
28#include "ScriptedCreature.h"
29#include "SpellInfo.h"
30
51
62
81
82// 20886 - Wrath-Scryer Soccothrates
84{
87
88 void Reset() override
89 {
90 _Reset();
91 _preFight = false;
92 _dalliahTaunt = false;
93 _dalliahDeath = false;
94 }
95
105
107 void MoveInLineOfSight(Unit* who) override
108 {
110 {
113
114 _preFight = true;
116 }
117
119 }
120
121 void SetData(uint32 /*type*/, uint32 data) override
122 {
123 switch (data)
124 {
125 case 1:
127 _dalliahDeath = true;
128 break;
129 default:
130 break;
131 }
132 }
133
134 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
135 {
136 if (!_dalliahTaunt && me->HealthBelowPctDamaged(25, damage))
137 {
138 _dalliahTaunt = true;
139
141 dalliah->AI()->Talk(SAY_SOCCOTHRATES_25_PERCENT);
142 }
143 }
144
145 void OnSpellCast(SpellInfo const* spell) override
146 {
147 if (spell->Id == SPELL_KNOCK_AWAY)
148 if (roll_chance_i(50))
150 }
151
152 void KilledUnit(Unit* /*victim*/) override
153 {
154 Talk(SAY_SLAY);
155 }
156
157 void JustDied(Unit* /*killer*/) override
158 {
159 _JustDied();
161
163 if (dalliah->IsAlive() && !dalliah->IsInCombat())
164 dalliah->AI()->SetData(1, 1);
165 }
166
167 void UpdateAI(uint32 diff) override
168 {
169 if (!UpdateVictim())
170 {
171 if (_preFight)
172 {
173 events.Update(diff);
174
175 while (uint32 eventId = events.ExecuteEvent())
176 {
177 switch (eventId)
178 {
179 case EVENT_PREFIGHT_1:
181 dalliah->AI()->Talk(SAY_DALLIAH_CONVO_1);
183 break;
184 case EVENT_PREFIGHT_2:
187 break;
188 case EVENT_PREFIGHT_3:
190 dalliah->AI()->Talk(SAY_DALLIAH_CONVO_2);
192 break;
193 case EVENT_PREFIGHT_4:
196 break;
197 case EVENT_PREFIGHT_5:
199 dalliah->AI()->Talk(SAY_DALLIAH_CONVO_3);
201 break;
202 case EVENT_PREFIGHT_6:
205 break;
206 case EVENT_PREFIGHT_7:
208 dalliah->GetMotionMaster()->MovePoint(0, 118.6048f, 96.84852f, 22.44115f);
210 break;
211 case EVENT_PREFIGHT_8:
212 me->GetMotionMaster()->MovePoint(0, 122.1035f, 192.7203f, 22.44115f);
214 break;
215 case EVENT_PREFIGHT_9:
217 {
218 dalliah->SetFacingToObject(me);
219 me->SetFacingToObject(dalliah);
220 dalliah->SetHomePosition(dalliah->GetPositionX(), dalliah->GetPositionY(), dalliah->GetPositionZ(), 1.51737f);
222 _preFight = false;
223 }
224 break;
225 default:
226 break;
227 }
228 }
229 }
230
231 if (_dalliahDeath)
232 {
233 events.Update(diff);
234
235 while (uint32 eventId = events.ExecuteEvent())
236 {
237 switch (eventId)
238 {
241 break;
242 default:
243 break;
244 }
245 }
246 }
247
248 return;
249 }
250
251 events.Update(diff);
252
254 return;
255
256 while (uint32 eventId = events.ExecuteEvent())
257 {
258 switch (eventId)
259 {
262 events.Repeat(10s, 15s);
263 break;
264 case EVENT_KNOCK_AWAY:
266 events.Repeat(25s, 30s);
267 break;
268
269 case EVENT_ME_FIRST:
271 if (dalliah->IsAlive() && !dalliah->IsInCombat())
272 dalliah->AI()->Talk(SAY_AGGRO_SOCCOTHRATES_FIRST);
273 break;
274 default:
275 break;
276 }
277
279 return;
280 }
281
283 }
284
285private:
289};
290
uint32_t uint32
Definition Define.h:133
@ DONE
@ NOT_STARTED
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
bool roll_chance_i(int chance)
Definition Random.h:59
@ UNIT_STATE_CASTING
Definition Unit.h:235
DamageEffectType
Definition Unit.h:352
#define RegisterArcatrazCreatureAI(ai_name)
Definition arcatraz.h:88
@ DATA_SOCCOTHRATES
Definition arcatraz.h:33
@ DATA_CONVERSATION
Definition arcatraz.h:37
@ DATA_DALLIAH
Definition arcatraz.h:32
void AddSC_boss_wrath_scryer_soccothrates()
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
virtual void MoveInLineOfSight(Unit *)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:293
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
virtual ObjectGuid GetGuidData(uint32 type) const override
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
TypeID GetTypeId() const
Definition Object.h:93
uint32 Id
Definition SpellInfo.h:289
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
Definition Unit.h:769
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
void SetFacingToObject(WorldObject const *object, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13259
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition Unit.h:918
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:1192
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:55
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:56
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
float GetPositionZ() const
Definition Position.h:81
float GetPositionX() const
Definition Position.h:79
float GetPositionY() const
Definition Position.h:80
void OnSpellCast(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void SetData(uint32, uint32 data) override