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
64
65#define SPELL_FEL_IMMOLATION DUNGEON_MODE<uint32>(SPELL_FEL_IMMOLATION_NORMAL, SPELL_FEL_IMMOLATION_HEROIC)
66
85
86// 20886 - Wrath-Scryer Soccothrates
88{
91
92 void Reset() override
93 {
94 _Reset();
95 _preFight = false;
96 _dalliahTaunt = false;
97 _dalliahDeath = false;
98
100 }
101
102 void JustEngagedWith(Unit* who) override
103 {
109 _preFight = false;
110 }
111
113 void MoveInLineOfSight(Unit* who) override
114 {
116 {
119
120 _preFight = true;
122 }
123
125 }
126
127 void SetData(uint32 /*type*/, uint32 data) override
128 {
129 switch (data)
130 {
131 case 1:
133 _dalliahDeath = true;
134 break;
135 default:
136 break;
137 }
138 }
139
140 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
141 {
142 if (!_dalliahTaunt && me->HealthBelowPctDamaged(25, damage))
143 {
144 _dalliahTaunt = true;
145
147 dalliah->AI()->Talk(SAY_SOCCOTHRATES_25_PERCENT);
148 }
149 }
150
151 void OnSpellCast(SpellInfo const* spell) override
152 {
153 if (spell->Id == SPELL_KNOCK_AWAY)
154 if (roll_chance(50))
156 }
157
158 void KilledUnit(Unit* /*victim*/) override
159 {
160 Talk(SAY_SLAY);
161 }
162
163 void JustDied(Unit* /*killer*/) override
164 {
165 _JustDied();
167
169 if (dalliah->IsAlive() && !dalliah->IsInCombat())
170 dalliah->AI()->SetData(1, 1);
171 }
172
173 void UpdateAI(uint32 diff) override
174 {
175 if (!UpdateVictim())
176 {
177 if (_preFight)
178 {
179 events.Update(diff);
180
181 while (uint32 eventId = events.ExecuteEvent())
182 {
183 switch (eventId)
184 {
185 case EVENT_PREFIGHT_1:
187 dalliah->AI()->Talk(SAY_DALLIAH_CONVO_1);
189 break;
190 case EVENT_PREFIGHT_2:
193 break;
194 case EVENT_PREFIGHT_3:
196 dalliah->AI()->Talk(SAY_DALLIAH_CONVO_2);
198 break;
199 case EVENT_PREFIGHT_4:
202 break;
203 case EVENT_PREFIGHT_5:
205 dalliah->AI()->Talk(SAY_DALLIAH_CONVO_3);
207 break;
208 case EVENT_PREFIGHT_6:
211 break;
212 case EVENT_PREFIGHT_7:
214 dalliah->GetMotionMaster()->MovePoint(0, 118.6048f, 96.84852f, 22.44115f);
216 break;
217 case EVENT_PREFIGHT_8:
218 me->GetMotionMaster()->MovePoint(0, 122.1035f, 192.7203f, 22.44115f);
220 break;
221 case EVENT_PREFIGHT_9:
223 {
224 dalliah->SetFacingToObject(me);
225 me->SetFacingToObject(dalliah);
226 dalliah->SetHomePosition(dalliah->GetPositionX(), dalliah->GetPositionY(), dalliah->GetPositionZ(), 1.51737f);
228 _preFight = false;
229 }
230 break;
231 default:
232 break;
233 }
234 }
235 }
236
237 if (_dalliahDeath)
238 {
239 events.Update(diff);
240
241 while (uint32 eventId = events.ExecuteEvent())
242 {
243 switch (eventId)
244 {
247 break;
248 default:
249 break;
250 }
251 }
252 }
253
254 return;
255 }
256
257 events.Update(diff);
258
260 return;
261
262 while (uint32 eventId = events.ExecuteEvent())
263 {
264 switch (eventId)
265 {
268 events.Repeat(10s, 15s);
269 break;
270 case EVENT_KNOCK_AWAY:
272 events.Repeat(25s, 30s);
273 break;
274
275 case EVENT_ME_FIRST:
277 if (dalliah->IsAlive() && !dalliah->IsInCombat())
278 dalliah->AI()->Talk(SAY_AGGRO_SOCCOTHRATES_FIRST);
279 break;
280 default:
281 break;
282 }
283
285 return;
286 }
287 }
288
289private:
293};
294
uint32_t uint32
Definition Define.h:154
@ DONE
@ NOT_STARTED
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
bool roll_chance(float chance, PseudoRandomDistributionState &state)
Definition Random.cpp:131
DamageEffectType
@ UNIT_STATE_CASTING
Definition Unit.h:290
#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
#define SPELL_FEL_IMMOLATION
void AddSC_boss_wrath_scryer_soccothrates()
TypeID GetTypeId() const
Definition BaseEntity.h:166
InstanceScript *const instance
void JustEngagedWith(Unit *who) override
EventMap events
virtual void MoveInLineOfSight(Unit *)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
void SetHomePosition(float x, float y, float z, float o)
Definition Creature.h:394
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
virtual ObjectGuid GetGuidData(uint32 type) const override
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={}, Optional< float > speed={}, MovementWalkRunSpeedSelectionMode speedSelectionMode=MovementWalkRunSpeedSelectionMode::Default, Optional< float > closeEnoughDistance={}, Optional< MovementFadeObject > fadeObject={}, Scripting::v2::ActionResultSetter< MovementStopReason > &&scriptResult={})
uint32 const Id
Definition SpellInfo.h:328
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:172
Definition Unit.h:647
MotionMaster * GetMotionMaster()
Definition Unit.h:1750
void SetFacingToObject(WorldObject const *object, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13394
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:805
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
bool IsWithinDistInMap(WorldObject const *obj, float dist2compare, bool is3D=true, bool incOwnRadius=true, bool incTargetRadius=true) const
Definition Object.cpp:499
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:99
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:100
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
constexpr float GetPositionX() const
Definition Position.h:87
constexpr float GetPositionY() const
Definition Position.h:88
constexpr float GetPositionZ() const
Definition Position.h:89
void OnSpellCast(SpellInfo const *spell) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void SetData(uint32, uint32 data) override