SHOW:
|
|
- or go back to the newest paste.
1 | /* | |
2 | * Copyright (C) 2008-2014 TrinityCore <http://www.trinitycore.org/> | |
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 | /* ScriptData | |
19 | SDName: Argent Challenge Encounter. | |
20 | SD%Complete: 90 % | |
21 | SDComment: AI from bosses need more improvements. Need AI for lightwell | |
22 | SDCategory: Trial of the Champion | |
23 | EndScriptData */ | |
24 | ||
25 | #include "ScriptPCH.h" | |
26 | #include "ScriptMgr.h" | |
27 | #include "ScriptedCreature.h" | |
28 | #include "SpellScript.h" | |
29 | #include "trial_of_the_champion.h" | |
30 | #include "ScriptedEscortAI.h" | |
31 | /* | |
32 | enum Yells | |
33 | { | |
34 | // Eadric the Pure | |
35 | SAY_INTRO = 0, | |
36 | SAY_AGGRO = 1, | |
37 | EMOTE_RADIANCE = 2, | |
38 | EMOTE_HAMMER_RIGHTEOUS = 3, | |
39 | SAY_HAMMER_RIGHTEOUS = 4, | |
40 | SAY_KILL_PLAYER = 5, | |
41 | SAY_DEFEATED = 6, | |
42 | ||
43 | // Argent Confessor Paletress | |
44 | SAY_INTRO_1 = 0, | |
45 | SAY_INTRO_2 = 1, | |
46 | SAY_AGGRO = 2, | |
47 | SAY_MEMORY_SUMMON = 3, | |
48 | SAY_MEMORY_DEATH = 4, | |
49 | SAY_KILL_PLAYER = 5, | |
50 | SAY_DEFEATED = 6, | |
51 | ||
52 | // Memory of X | |
53 | EMOTE_WAKING_NIGHTMARE = 0 | |
54 | }; | |
55 | */ | |
56 | ||
57 | enum Spells | |
58 | { | |
59 | // Eadric the Pure | |
60 | SPELL_EADRIC_ACHIEVEMENT = 68197, | |
61 | SPELL_HAMMER_JUSTICE = 66863, | |
62 | SPELL_HAMMER_JUSTICE_STUN = 66940, | |
63 | SPELL_HAMMER_RIGHTEOUS = 66867, | |
64 | SPELL_HAMMER_OVERRIDE_BAR = 66904, // overrides players cast bar | |
65 | SPELL_HAMMER_THROWBACK_DMG = 66905, // the hammer that is thrown back by the player | |
66 | SPELL_RADIANCE = 66935, | |
67 | SPELL_VENGEANCE = 66865, | |
68 | ||
69 | // Paletress | |
70 | SPELL_CONFESSOR_ACHIEVEMENT = 68206, | |
71 | SPELL_SMITE = 66536, | |
72 | SPELL_SMITE_H = 67674, | |
73 | SPELL_HOLY_FIRE = 66538, | |
74 | SPELL_HOLY_FIRE_H = 67676, | |
75 | SPELL_RENEW = 66537, | |
76 | SPELL_RENEW_H = 67675, | |
77 | SPELL_HOLY_NOVA = 66546, | |
78 | SPELL_SHIELD = 66515, | |
79 | SPELL_CONFESS = 66680, | |
80 | /*SPELL_SUMMON_MEMORY = 66545,*/ | |
81 | ||
82 | //Npc_argent_soldier | |
83 | SPELL_STRIKE = 67237, | |
84 | SPELL_CLEAVE = 15284, | |
85 | SPELL_PUMMEL = 67235, | |
86 | SPELL_PAIN = 34942, | |
87 | SPELL_MIND = 67229, | |
88 | SPELL_SSMITE = 67289, | |
89 | SPELL_LIGHT_H = 67290, | |
90 | SPELL_LIGHT = 67247, | |
91 | SPELL_FLURRY = 67233, | |
92 | SPELL_FINAL = 67255, | |
93 | SPELL_DIVINE = 67251, | |
94 | ||
95 | // Memory of X (Summon) | |
96 | SPELL_MEMORY_ALGALON = 66715, | |
97 | SPELL_MEMORY_ARCHIMONDE = 66704, | |
98 | SPELL_MEMORY_CHROMAGGUS = 66697, | |
99 | SPELL_MEMORY_CYANIGOSA = 66709, | |
100 | SPELL_MEMORY_DELRISSA = 66706, | |
101 | SPELL_MEMORY_ECK = 66710, | |
102 | SPELL_MEMORY_ENTROPIUS = 66707, | |
103 | SPELL_MEMORY_GRUUL = 66702, | |
104 | SPELL_MEMORY_HAKKAR = 66698, | |
105 | SPELL_MEMORY_HEIGAN = 66712, | |
106 | SPELL_MEMORY_HEROD = 66694, | |
107 | SPELL_MEMORY_HOGGER = 66543, | |
108 | SPELL_MEMORY_IGNIS = 66713, | |
109 | SPELL_MEMORY_ILLIDAN = 66705, | |
110 | SPELL_MEMORY_INGVAR = 66708, | |
111 | SPELL_MEMORY_KALITHRESH = 66700, | |
112 | SPELL_MEMORY_LUCIFRON = 66695, | |
113 | SPELL_MEMORY_MALCHEZAAR = 66701, | |
114 | SPELL_MEMORY_MUTANUS = 66692, | |
115 | SPELL_MEMORY_ONYXIA = 66711, | |
116 | SPELL_MEMORY_THUNDERAAN = 66696, | |
117 | SPELL_MEMORY_VANCLEEF = 66691, | |
118 | SPELL_MEMORY_VASHJ = 66703, | |
119 | SPELL_MEMORY_VEKNILASH = 66699, | |
120 | SPELL_MEMORY_VEZAX = 66714, | |
121 | ||
122 | // Memory | |
123 | SPELL_OLD_WOUNDS = 66620, | |
124 | SPELL_OLD_WOUNDS_H = 67679, | |
125 | SPELL_SHADOWS_PAST = 66619, | |
126 | SPELL_SHADOWS_PAST_H = 67678, | |
127 | SPELL_WAKING_NIGHTMARE = 66552, | |
128 | SPELL_WAKING_NIGHTMARE_H = 67677, | |
129 | }; | |
130 | // custom | |
131 | const uint32 summonMemory[] = { | |
132 | 66543, | |
133 | 66705, | |
134 | 66706, | |
135 | 66707, | |
136 | 66708, | |
137 | 66709, | |
138 | 66710, | |
139 | 66711, | |
140 | 66712, | |
141 | 66713, | |
142 | 66714, | |
143 | 66704, | |
144 | 66703, | |
145 | 66702, | |
146 | 66691, | |
147 | 66692, | |
148 | 66694, | |
149 | 66695, | |
150 | 66696, | |
151 | 66697, | |
152 | 66698, | |
153 | 66699, | |
154 | 66700, | |
155 | 66701, | |
156 | 66715, | |
157 | }; | |
158 | ||
159 | enum Misc | |
160 | { | |
161 | ACHIEV_FACEROLLER = 3803, | |
162 | ACHIEV_CONF = 3802 | |
163 | }; | |
164 | ||
165 | enum Talk | |
166 | { | |
167 | SAY_ARGENT_ENTERS = 19, | |
168 | SAY_ARGENT_READY = 20, | |
169 | ||
170 | // Paletress | |
171 | SAY_PALETRESS_AGGRO = 2, | |
172 | SAY_PALETRESS_SUMMON_MEMORY = 3, | |
173 | SAY_PALETRESS_MEMORY_DIES = 4, | |
174 | SAY_PALETRESS_PLAYER_DIES = 5, | |
175 | SAY_PALETRESS_DEFEATED = 6, | |
176 | ||
177 | // Eadric | |
178 | SAY_EADRIC_AGGRO = 1, | |
179 | SAY_EADRIC_HAMMER = 2, | |
180 | SAY_EADRIC_PLAYER_DIES = 3, | |
181 | SAY_EADRIC_DEFEATED = 4 | |
182 | }; | |
183 | ||
184 | class OrientationCheck | |
185 | { | |
186 | public: | |
187 | explicit OrientationCheck(Unit* _caster) : caster(_caster) { } | |
188 | bool operator() (WorldObject* object) | |
189 | { | |
190 | return !object->isInFront(caster, 40.0f) || !object->IsWithinDist(caster, 40.0f); | |
191 | } | |
192 | ||
193 | private: | |
194 | Unit* caster; | |
195 | }; | |
196 | ||
197 | class spell_eadric_radiance : public SpellScriptLoader | |
198 | { | |
199 | public: | |
200 | spell_eadric_radiance() : SpellScriptLoader("spell_eadric_radiance") { } | |
201 | ||
202 | class spell_eadric_radiance_SpellScript : public SpellScript | |
203 | { | |
204 | PrepareSpellScript(spell_eadric_radiance_SpellScript); | |
205 | ||
206 | void FilterTargets(std::list<WorldObject*>& targets) | |
207 | { | |
208 | targets.remove_if(OrientationCheck(GetCaster())); | |
209 | } | |
210 | ||
211 | void Register() OVERRIDE | |
212 | { | |
213 | OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); | |
214 | OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_eadric_radiance_SpellScript::FilterTargets, EFFECT_1, TARGET_UNIT_SRC_AREA_ENEMY); | |
215 | } | |
216 | }; | |
217 | ||
218 | SpellScript *GetSpellScript() const /*OVERRIDE*/ | |
219 | { | |
220 | return new spell_eadric_radiance_SpellScript(); | |
221 | } | |
222 | }; | |
223 | ||
224 | class spell_eadric_hoj : public SpellScriptLoader | |
225 | { | |
226 | public: | |
227 | spell_eadric_hoj() : SpellScriptLoader("spell_eadric_hoj") { } | |
228 | ||
229 | class spell_eadric_hoj_SpellScript : public SpellScript | |
230 | { | |
231 | PrepareSpellScript(spell_eadric_hoj_SpellScript); | |
232 | ||
233 | void HandleOnHit() | |
234 | { | |
235 | if (GetHitUnit() && GetHitUnit()->GetTypeId() == TYPEID_PLAYER) | |
236 | if (!GetHitUnit()->HasAura(SPELL_HAMMER_JUSTICE_STUN)) | |
237 | { | |
238 | SetHitDamage(0); | |
239 | GetHitUnit()->AddAura(SPELL_HAMMER_OVERRIDE_BAR, GetHitUnit()); | |
240 | } | |
241 | } | |
242 | ||
243 | void Register() | |
244 | { | |
245 | OnHit += SpellHitFn(spell_eadric_hoj_SpellScript::HandleOnHit); | |
246 | } | |
247 | }; | |
248 | ||
249 | SpellScript* GetSpellScript() const | |
250 | { | |
251 | return new spell_eadric_hoj_SpellScript(); | |
252 | } | |
253 | }; | |
254 | ||
255 | ||
256 | class boss_eadric : public CreatureScript | |
257 | { | |
258 | public: | |
259 | boss_eadric() : CreatureScript("boss_eadric") {} | |
260 | ||
261 | struct boss_eadricAI : public BossAI | |
262 | { | |
263 | boss_eadricAI(Creature* creature) : BossAI(creature, BOSS_ARGENT_CHALLENGE_E) | |
264 | { | |
265 | instance = creature->GetInstanceScript(); | |
266 | creature->SetReactState(REACT_PASSIVE); | |
267 | creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); | |
268 | ||
269 | hasBeenInCombat = false; | |
270 | bCredit = false; | |
271 | } | |
272 | ||
273 | InstanceScript* instance; | |
274 | ||
275 | uint32 uiVenganceTimer; | |
276 | uint32 uiRadianceTimer; | |
277 | uint32 uiHammerJusticeTimer; | |
278 | uint32 uiResetTimer; | |
279 | ||
280 | bool bDone; | |
281 | bool hasBeenInCombat; | |
282 | bool bCredit; | |
283 | ||
284 | void Reset() OVERRIDE | |
285 | { | |
286 | uiVenganceTimer = 10000; | |
287 | uiRadianceTimer = 16000; | |
288 | uiHammerJusticeTimer = 25000; | |
289 | uiResetTimer = 5000; | |
290 | ||
291 | bDone = false; | |
292 | Map* pMap = me->GetMap(); | |
293 | if (hasBeenInCombat && pMap && pMap->IsDungeon()) | |
294 | { | |
295 | Map::PlayerList const &players = pMap->GetPlayers(); | |
296 | for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) | |
297 | { | |
298 | if (itr->GetSource() && itr->GetSource()->IsAlive() && !itr->GetSource()->IsGameMaster()) | |
299 | return; | |
300 | } | |
301 | ||
302 | if (instance) | |
303 | { | |
304 | GameObject* GO = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE1)); | |
305 | if (GO) | |
306 | instance->HandleGameObject(GO->GetGUID(), true); | |
307 | Creature* announcer = pMap->GetCreature(instance->GetData64(DATA_ANNOUNCER)); | |
308 | instance->SetData(DATA_ARGENT_SOLDIER_DEFEATED, 0); | |
309 | announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); | |
310 | } | |
311 | me->RemoveFromWorld(); | |
312 | } | |
313 | } | |
314 | ||
315 | void DamageTaken(Unit* /*who*/, uint32& damage) /*OVERRIDE*/ | |
316 | { | |
317 | if (damage >= me->GetHealth()) | |
318 | { | |
319 | damage = 0; | |
320 | if (!bCredit) | |
321 | { | |
322 | bCredit = true; | |
323 | HandleSpellOnPlayersInInstanceToC5(me, 68575); | |
324 | } | |
325 | EnterEvadeMode(); | |
326 | me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); | |
327 | Talk(SAY_EADRIC_DEFEATED); | |
328 | me->setFaction(35); | |
329 | bDone = true; | |
330 | if (GameObject* pGO = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE))) | |
331 | instance->HandleGameObject(pGO->GetGUID(), true); | |
332 | if (GameObject* pGO = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE1))) | |
333 | instance->HandleGameObject(pGO->GetGUID(), true); | |
334 | if (instance) | |
335 | instance->SetData(BOSS_ARGENT_CHALLENGE_E, DONE); | |
336 | } | |
337 | } | |
338 | ||
339 | void MovementInform(uint32 MovementType, uint32 Data) /*OVERRIDE*/ | |
340 | { | |
341 | if (MovementType != POINT_MOTION_TYPE) | |
342 | return; | |
343 | } | |
344 | ||
345 | void EnterCombat(Unit* pWho) | |
346 | { | |
347 | me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); | |
348 | _EnterCombat(); | |
349 | me->SetHomePosition(746.843f, 665.000f, 412.339f, 4.670f); | |
350 | Talk(SAY_EADRIC_AGGRO); | |
351 | hasBeenInCombat = true; | |
352 | } | |
353 | ||
354 | void SpellHit(Unit* caster, SpellInfo const* spell) | |
355 | { | |
356 | if (IsHeroic() && !bDone) | |
357 | if (caster->GetTypeId() == TYPEID_PLAYER) | |
358 | if (spell->Id == SPELL_HAMMER_THROWBACK_DMG && me->GetHealth() <= spell->Effects[0].BasePoints) | |
359 | DoCast(caster, SPELL_EADRIC_ACHIEVEMENT); | |
360 | } | |
361 | ||
362 | void UpdateAI(uint32 uiDiff) OVERRIDE | |
363 | { | |
364 | if (bDone && uiResetTimer <= uiDiff) | |
365 | { | |
366 | me->GetMotionMaster()->MovePoint(0, 746.843f, 695.68f, 412.339f); | |
367 | bDone = false; | |
368 | if (GameObject* pGO = GameObject::GetGameObject(*me, instance->GetData64(DATA_MAIN_GATE))) | |
369 | instance->HandleGameObject(pGO->GetGUID(), false); | |
370 | } | |
371 | else | |
372 | uiResetTimer -= uiDiff; | |
373 | ||
374 | if (!UpdateVictim()) | |
375 | return; | |
376 | ||
377 | if (uiHammerJusticeTimer <= uiDiff) | |
378 | { | |
379 | me->InterruptNonMeleeSpells(true); | |
380 | ||
381 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) | |
382 | { | |
383 | if (target && target->IsAlive()) | |
384 | { | |
385 | Talk(SAY_EADRIC_HAMMER); | |
386 | DoCast(target, SPELL_HAMMER_JUSTICE); | |
387 | DoCast(target, SPELL_HAMMER_RIGHTEOUS); | |
388 | } | |
389 | } | |
390 | ||
391 | uiHammerJusticeTimer = 25000; | |
392 | } | |
393 | else | |
394 | uiHammerJusticeTimer -= uiDiff; | |
395 | ||
396 | ||
397 | if (uiVenganceTimer <= uiDiff) | |
398 | { | |
399 | DoCast(me, SPELL_VENGEANCE); | |
400 | ||
401 | uiVenganceTimer = 10000; | |
402 | } | |
403 | else | |
404 | uiVenganceTimer -= uiDiff; | |
405 | ||
406 | if (uiRadianceTimer <= uiDiff) | |
407 | { | |
408 | DoCastAOE(SPELL_RADIANCE); | |
409 | ||
410 | uiRadianceTimer = 16000; | |
411 | } | |
412 | else | |
413 | uiRadianceTimer -= uiDiff; | |
414 | ||
415 | DoMeleeAttackIfReady(); | |
416 | } | |
417 | }; | |
418 | ||
419 | CreatureAI* GetAI(Creature* creature) const OVERRIDE | |
420 | { | |
421 | return GetInstanceAI<boss_eadricAI>(creature); | |
422 | }; | |
423 | }; | |
424 | ||
425 | class boss_paletress : public CreatureScript | |
426 | { | |
427 | public: | |
428 | boss_paletress() : CreatureScript("boss_paletress") {} | |
429 | ||
430 | struct boss_paletressAI : public BossAI | |
431 | { | |
432 | boss_paletressAI(Creature* creature) : BossAI(creature, BOSS_ARGENT_CHALLENGE_P) | |
433 | { | |
434 | pInstance = creature->GetInstanceScript(); | |
435 | ||
436 | hasBeenInCombat = false; | |
437 | bCredit = false; | |
438 | MemoryGUID = 0; | |
439 | creature->SetReactState(REACT_PASSIVE); | |
440 | creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); | |
441 | creature->RestoreFaction(); | |
442 | } | |
443 | ||
444 | InstanceScript* pInstance; | |
445 | ||
446 | Creature* pMemory; | |
447 | uint64 MemoryGUID; | |
448 | ||
449 | bool bHealth; | |
450 | bool bDone; | |
451 | bool hasBeenInCombat; | |
452 | bool bCredit; | |
453 | ||
454 | uint32 uiHolyFireTimer; | |
455 | uint32 uiHolySmiteTimer; | |
456 | uint32 uiRenewTimer; | |
457 | uint32 uiResetTimer; | |
458 | ||
459 | void Reset() OVERRIDE | |
460 | { | |
461 | me->RemoveAllAuras(); | |
462 | ||
463 | uiHolyFireTimer = urand(9000, 12000); | |
464 | uiHolySmiteTimer = urand(5000, 7000); | |
465 | uiRenewTimer = urand(2000, 5000); | |
466 | ||
467 | uiResetTimer = 7000; | |
468 | ||
469 | bHealth = false; | |
470 | bDone = false; | |
471 | ||
472 | if (Creature* pMemory = Unit::GetCreature(*me, MemoryGUID)) | |
473 | if (pMemory->IsAlive()) | |
474 | pMemory->RemoveFromWorld(); | |
475 | ||
476 | Map* pMap = me->GetMap(); | |
477 | if (hasBeenInCombat && pMap && pMap->IsDungeon()) | |
478 | { | |
479 | Map::PlayerList const &players = pMap->GetPlayers(); | |
480 | for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr) | |
481 | { | |
482 | if (itr->GetSource() && itr->GetSource()->IsAlive() && !itr->GetSource()->IsGameMaster()) | |
483 | return; | |
484 | } | |
485 | ||
486 | if (pInstance) | |
487 | { | |
488 | GameObject* GO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE1)); | |
489 | if (GO) | |
490 | pInstance->HandleGameObject(GO->GetGUID(), true); | |
491 | Creature* announcer = pMap->GetCreature(pInstance->GetData64(DATA_ANNOUNCER)); | |
492 | pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED, 0); | |
493 | announcer->SetFlag(UNIT_NPC_FLAGS, UNIT_NPC_FLAG_GOSSIP); | |
494 | } | |
495 | ||
496 | me->RemoveFromWorld(); | |
497 | } | |
498 | } | |
499 | ||
500 | void EnterCombat(Unit* pWho) | |
501 | { | |
502 | me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); | |
503 | _EnterCombat(); | |
504 | me->SetHomePosition(746.843f, 665.000f, 412.339f, 4.670f); | |
505 | hasBeenInCombat = true; | |
506 | Talk(SAY_PALETRESS_AGGRO); | |
507 | } | |
508 | ||
509 | void SetData(uint32 uiId, uint32 uiValue) OVERRIDE | |
510 | { | |
511 | if (uiId == 1) | |
512 | me->RemoveAura(SPELL_SHIELD); | |
513 | Talk(SAY_PALETRESS_MEMORY_DIES); | |
514 | } | |
515 | ||
516 | void DamageTaken(Unit* /*who*/, uint32& damage) /*OVERRIDE*/ | |
517 | { | |
518 | if (damage >= me->GetHealth()) | |
519 | { | |
520 | damage = 0; | |
521 | if (!bCredit) | |
522 | { | |
523 | bCredit = true; | |
524 | HandleSpellOnPlayersInInstanceToC5(me, 68574); | |
525 | } | |
526 | EnterEvadeMode(); | |
527 | me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); | |
528 | Talk(SAY_PALETRESS_DEFEATED); | |
529 | me->setFaction(35); | |
530 | bDone = true; | |
531 | if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) | |
532 | pInstance->HandleGameObject(pGO->GetGUID(), true); | |
533 | if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE1))) | |
534 | pInstance->HandleGameObject(pGO->GetGUID(), true); | |
535 | pInstance->SetData(BOSS_ARGENT_CHALLENGE_P, DONE); | |
536 | } | |
537 | } | |
538 | ||
539 | void MovementInform(uint32 MovementType, uint32 Data) /*OVERRIDE*/ | |
540 | { | |
541 | if (MovementType != POINT_MOTION_TYPE) | |
542 | return; | |
543 | } | |
544 | ||
545 | void UpdateAI(uint32 uiDiff) OVERRIDE | |
546 | { | |
547 | if (bDone && uiResetTimer <= uiDiff) | |
548 | { | |
549 | me->GetMotionMaster()->MovePoint(0, 746.843f, 695.68f, 412.339f); | |
550 | bDone = false; | |
551 | if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) | |
552 | pInstance->HandleGameObject(pGO->GetGUID(), false); | |
553 | } | |
554 | else | |
555 | uiResetTimer -= uiDiff; | |
556 | ||
557 | if (!UpdateVictim()) | |
558 | return; | |
559 | ||
560 | if (uiHolyFireTimer <= uiDiff) | |
561 | { | |
562 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) | |
563 | { | |
564 | if (target && target->IsAlive()) | |
565 | DoCast(target, DUNGEON_MODE(SPELL_HOLY_FIRE, SPELL_HOLY_FIRE_H)); | |
566 | } | |
567 | ||
568 | if (me->HasAura(SPELL_SHIELD)) | |
569 | uiHolyFireTimer = 13000; | |
570 | else | |
571 | uiHolyFireTimer = urand(9000, 12000); | |
572 | } | |
573 | else | |
574 | uiHolyFireTimer -= uiDiff; | |
575 | ||
576 | if (uiHolySmiteTimer <= uiDiff) | |
577 | { | |
578 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true)) | |
579 | { | |
580 | if (target && target->IsAlive()) | |
581 | DoCast(target, DUNGEON_MODE(SPELL_SMITE, SPELL_SMITE_H)); | |
582 | } | |
583 | ||
584 | if (me->HasAura(SPELL_SHIELD)) | |
585 | uiHolySmiteTimer = 9000; | |
586 | else | |
587 | uiHolySmiteTimer = urand(5000, 7000); | |
588 | } | |
589 | else | |
590 | uiHolySmiteTimer -= uiDiff; | |
591 | ||
592 | if (me->HasAura(SPELL_SHIELD)) | |
593 | { | |
594 | if (uiRenewTimer <= uiDiff) | |
595 | { | |
596 | me->InterruptNonMeleeSpells(true); | |
597 | uint8 uiTarget = urand(0, 1); | |
598 | switch (uiTarget) | |
599 | { | |
600 | case 0: | |
601 | DoCast(me, DUNGEON_MODE(SPELL_RENEW, SPELL_RENEW_H)); | |
602 | break; | |
603 | case 1: | |
604 | if (Creature* pMemory = Unit::GetCreature(*me, MemoryGUID)) | |
605 | if (pMemory->IsAlive()) | |
606 | DoCast(pMemory, DUNGEON_MODE(SPELL_RENEW, SPELL_RENEW_H)); | |
607 | break; | |
608 | } | |
609 | uiRenewTimer = urand(15000, 17000); | |
610 | } | |
611 | else | |
612 | uiRenewTimer -= uiDiff; | |
613 | } | |
614 | ||
615 | if (!bHealth && me->GetHealth() * 100 / me->GetMaxHealth() <= 35) | |
616 | { | |
617 | Talk(SAY_PALETRESS_SUMMON_MEMORY); | |
618 | me->InterruptNonMeleeSpells(true); | |
619 | DoCastAOE(SPELL_HOLY_NOVA, false); | |
620 | DoCast(me, SPELL_SHIELD); | |
621 | DoCastAOE(SPELL_CONFESS, false); | |
622 | ||
623 | bHealth = true; | |
624 | switch (urand(0, 24)) | |
625 | { | |
626 | case 0: | |
627 | me->SummonCreature(MEMORY_ALGALON, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
628 | break; | |
629 | case 1: | |
630 | me->SummonCreature(MEMORY_CHROMAGGUS, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
631 | break; | |
632 | case 2: | |
633 | me->SummonCreature(MEMORY_CYANIGOSA, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
634 | break; | |
635 | case 3: | |
636 | me->SummonCreature(MEMORY_DELRISSA, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
637 | break; | |
638 | case 4: | |
639 | me->SummonCreature(MEMORY_ECK, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
640 | break; | |
641 | case 5: | |
642 | me->SummonCreature(MEMORY_ENTROPIUS, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
643 | break; | |
644 | case 6: | |
645 | me->SummonCreature(MEMORY_GRUUL, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
646 | break; | |
647 | case 7: | |
648 | me->SummonCreature(MEMORY_HAKKAR, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
649 | break; | |
650 | case 8: | |
651 | me->SummonCreature(MEMORY_HEIGAN, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
652 | break; | |
653 | case 9: | |
654 | me->SummonCreature(MEMORY_HEROD, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
655 | break; | |
656 | case 10: | |
657 | me->SummonCreature(MEMORY_HOGGER, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
658 | break; | |
659 | case 11: | |
660 | me->SummonCreature(MEMORY_IGNIS, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
661 | break; | |
662 | case 12: | |
663 | me->SummonCreature(MEMORY_ILLIDAN, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
664 | break; | |
665 | case 13: | |
666 | me->SummonCreature(MEMORY_INGVAR, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
667 | break; | |
668 | case 14: | |
669 | me->SummonCreature(MEMORY_KALITHRESH, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
670 | break; | |
671 | case 15: | |
672 | me->SummonCreature(MEMORY_LUCIFRON, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
673 | break; | |
674 | case 16: | |
675 | me->SummonCreature(MEMORY_MALCHEZAAR, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
676 | break; | |
677 | case 17: | |
678 | me->SummonCreature(MEMORY_MUTANUS, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
679 | break; | |
680 | case 18: | |
681 | me->SummonCreature(MEMORY_ONYXIA, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
682 | break; | |
683 | case 19: | |
684 | me->SummonCreature(MEMORY_THUNDERAAN, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
685 | break; | |
686 | case 20: | |
687 | me->SummonCreature(MEMORY_VANCLEEF, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
688 | break; | |
689 | case 21: | |
690 | me->SummonCreature(MEMORY_VASHJ, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
691 | break; | |
692 | case 22: | |
693 | me->SummonCreature(MEMORY_VEKNILASH, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
694 | break; | |
695 | case 23: | |
696 | me->SummonCreature(MEMORY_VEZAX, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
697 | break; | |
698 | case 24: | |
699 | me->SummonCreature(MEMORY_ARCHIMONDE, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000); | |
700 | break; | |
701 | } | |
702 | } | |
703 | ||
704 | DoMeleeAttackIfReady(); | |
705 | } | |
706 | ||
707 | void JustSummoned(Creature* summon) OVERRIDE | |
708 | { | |
709 | MemoryGUID = summon->GetGUID(); | |
710 | } | |
711 | }; | |
712 | ||
713 | CreatureAI* GetAI(Creature* creature) const OVERRIDE | |
714 | { | |
715 | return GetInstanceAI<boss_paletressAI>(creature); | |
716 | }; | |
717 | }; | |
718 | ||
719 | class npc_memory : public CreatureScript | |
720 | { | |
721 | public: | |
722 | npc_memory() : CreatureScript("npc_memory") {} | |
723 | ||
724 | struct npc_memoryAI : public ScriptedAI | |
725 | { | |
726 | npc_memoryAI(Creature* creature) : ScriptedAI(creature) { } | |
727 | ||
728 | uint32 uiOldWoundsTimer; | |
729 | uint32 uiShadowPastTimer; | |
730 | uint32 uiWakingNightmare; | |
731 | ||
732 | void Reset() OVERRIDE | |
733 | { | |
734 | uiOldWoundsTimer = 12000; | |
735 | uiShadowPastTimer = 5000; | |
736 | uiWakingNightmare = 7000; | |
737 | } | |
738 | ||
739 | void UpdateAI(uint32 uiDiff) OVERRIDE | |
740 | { | |
741 | if (!UpdateVictim()) | |
742 | return; | |
743 | ||
744 | if (uiOldWoundsTimer <= uiDiff) | |
745 | { | |
746 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) | |
747 | { | |
748 | if (target && target->IsAlive()) | |
749 | DoCast(target, DUNGEON_MODE(SPELL_OLD_WOUNDS, SPELL_OLD_WOUNDS_H)); | |
750 | } | |
751 | uiOldWoundsTimer = 12000; | |
752 | ||
753 | uiOldWoundsTimer = 23000; | |
754 | } | |
755 | else | |
756 | uiOldWoundsTimer -= uiDiff; | |
757 | ||
758 | if (uiWakingNightmare <= uiDiff) | |
759 | { | |
760 | DoCast(me, DUNGEON_MODE(SPELL_WAKING_NIGHTMARE, SPELL_WAKING_NIGHTMARE_H)); | |
761 | uiWakingNightmare = 15000; | |
762 | } | |
763 | else | |
764 | uiWakingNightmare -= uiDiff; | |
765 | ||
766 | if (uiShadowPastTimer <= uiDiff) | |
767 | { | |
768 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1)) | |
769 | { | |
770 | if (target && target->IsAlive()) | |
771 | DoCast(target, DUNGEON_MODE(SPELL_SHADOWS_PAST, SPELL_SHADOWS_PAST_H)); | |
772 | } | |
773 | ||
774 | uiShadowPastTimer = 20000; | |
775 | } | |
776 | else | |
777 | uiShadowPastTimer -= uiDiff; | |
778 | ||
779 | DoMeleeAttackIfReady(); | |
780 | } | |
781 | ||
782 | void JustDied(Unit* killer) /*OVERRIDE*/ | |
783 | { | |
784 | if (me->IsSummon()) | |
785 | { | |
786 | if (Unit* summoner = me->ToTempSummon()->GetSummoner()) | |
787 | { | |
788 | if (summoner && summoner->IsAlive()) | |
789 | if (Creature* summoner = summoner->ToCreature()) | |
790 | summoner->AI()->SetData(1, 0); | |
791 | } | |
792 | } | |
793 | } | |
794 | }; | |
795 | ||
796 | CreatureAI* GetAI(Creature* creature) const OVERRIDE | |
797 | { | |
798 | return new npc_memoryAI(creature); | |
799 | }; | |
800 | }; | |
801 | ||
802 | class npc_argent_soldier : public CreatureScript | |
803 | { | |
804 | public: | |
805 | npc_argent_soldier() : CreatureScript("npc_argent_soldier") {} | |
806 | ||
807 | struct npc_argent_soldierAI : public npc_escortAI | |
808 | { | |
809 | npc_argent_soldierAI(Creature* creature) : npc_escortAI(creature) | |
810 | { | |
811 | pInstance = creature->GetInstanceScript(); | |
812 | me->SetReactState(REACT_PASSIVE); | |
813 | me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE); | |
814 | me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE); | |
815 | if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) | |
816 | pInstance->HandleGameObject(pGO->GetGUID(), true); | |
817 | SetDespawnAtEnd(false); | |
818 | uiWaypoint = 0; | |
819 | bStarted = false; | |
820 | } | |
821 | ||
822 | InstanceScript* pInstance; | |
823 | ||
824 | uint8 uiWaypoint; | |
825 | ||
826 | uint32 uiStrikeTimer; | |
827 | uint32 uiCleaveTimer; | |
828 | uint32 uiPummelTimer; | |
829 | uint32 uiPainTimer; | |
830 | uint32 uiMindTimer; | |
831 | uint32 uiSsmiteTimer; | |
832 | uint32 uiLightTimer; | |
833 | uint32 uiFlurryTimer; | |
834 | uint32 uiFinalTimer; | |
835 | uint32 uiDivineTimer; | |
836 | ||
837 | bool bStarted; | |
838 | ||
839 | void Reset() | |
840 | { | |
841 | uiStrikeTimer = 5000; | |
842 | uiCleaveTimer = 6000; | |
843 | uiPummelTimer = 10000; | |
844 | uiPainTimer = 60000; | |
845 | uiMindTimer = 70000; | |
846 | uiSsmiteTimer = 6000; | |
847 | uiLightTimer = 3000; | |
848 | uiFlurryTimer = 6000; | |
849 | uiFinalTimer = 30000; | |
850 | uiDivineTimer = 70000; | |
851 | ||
852 | if (bStarted) | |
853 | { | |
854 | me->SetReactState(REACT_AGGRESSIVE); | |
855 | me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); | |
856 | } | |
857 | } | |
858 | void WaypointReached(uint32 uiPoint) | |
859 | { | |
860 | if (uiPoint == 0) | |
861 | { | |
862 | switch (uiWaypoint) | |
863 | { | |
864 | case 1: | |
865 | me->SetFacingTo(4.60f); | |
866 | me->SetReactState(REACT_AGGRESSIVE); | |
867 | me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); | |
868 | bStarted = true; | |
869 | break; | |
870 | } | |
871 | } | |
872 | ||
873 | if (uiPoint == 1) | |
874 | { | |
875 | switch (uiWaypoint) | |
876 | { | |
877 | case 0: | |
878 | me->SetOrientation(5.81f); | |
879 | me->SetReactState(REACT_AGGRESSIVE); | |
880 | me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); | |
881 | bStarted = true; | |
882 | break; | |
883 | case 2: | |
884 | me->SetOrientation(3.39f); | |
885 | me->SetReactState(REACT_AGGRESSIVE); | |
886 | me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE | UNIT_FLAG_NOT_SELECTABLE); | |
887 | bStarted = true; | |
888 | if (GameObject* pGO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE))) | |
889 | pInstance->HandleGameObject(pGO->GetGUID(), false); | |
890 | break; | |
891 | } | |
892 | } | |
893 | } | |
894 | ||
895 | void SetData(uint32 uiType, uint32 uiData) /*OVERRIDE*/ | |
896 | { | |
897 | switch (me->GetEntry()) | |
898 | { | |
899 | case NPC_ARGENT_LIGHWIELDER: | |
900 | switch (uiType) | |
901 | { | |
902 | case 0: | |
903 | AddWaypoint(0, 737.14f, 655.42f, 412.88f); | |
904 | AddWaypoint(1, 712.14f, 628.42f, 411.88f); | |
905 | break; | |
906 | case 1: | |
907 | AddWaypoint(0, 742.44f, 650.29f, 411.79f); | |
908 | break; | |
909 | case 2: | |
910 | AddWaypoint(0, 756.14f, 655.42f, 411.88f); | |
911 | AddWaypoint(1, 775.912f, 639.033f, 411.907f); | |
912 | break; | |
913 | } | |
914 | break; | |
915 | case NPC_ARGENT_MONK: | |
916 | switch (uiType) | |
917 | { | |
918 | case 0: | |
919 | AddWaypoint(0, 737.14f, 655.42f, 412.88f); | |
920 | AddWaypoint(1, 713.12f, 632.97f, 411.90f); | |
921 | break; | |
922 | case 1: | |
923 | AddWaypoint(0, 746.73f, 650.24f, 411.56f); | |
924 | break; | |
925 | case 2: | |
926 | AddWaypoint(0, 756.14f, 655.42f, 411.88f); | |
927 | AddWaypoint(1, 784.817f, 629.883f, 411.908f); | |
928 | break; | |
929 | } | |
930 | break; | |
931 | case NPC_PRIESTESS: | |
932 | switch (uiType) | |
933 | { | |
934 | case 0: | |
935 | AddWaypoint(0, 737.14f, 655.42f, 412.88f); | |
936 | AddWaypoint(1, 715.06f, 637.07f, 411.91f); | |
937 | break; | |
938 | case 1: | |
939 | AddWaypoint(0, 750.72f, 650.20f, 411.77f); | |
940 | break; | |
941 | case 2: | |
942 | AddWaypoint(0, 756.14f, 655.42f, 411.88f); | |
943 | AddWaypoint(1, 779.942f, 634.061f, 411.905f); | |
944 | break; | |
945 | } | |
946 | break; | |
947 | } | |
948 | ||
949 | Start(false, true, 0); | |
950 | uiWaypoint = uiType; | |
951 | } | |
952 | ||
953 | void UpdateAI(uint32 uiDiff) OVERRIDE | |
954 | { | |
955 | npc_escortAI::UpdateAI(uiDiff); | |
956 | ||
957 | if (!UpdateVictim()) | |
958 | return; | |
959 | ||
960 | if (uiCleaveTimer <= uiDiff) | |
961 | { | |
962 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) | |
963 | DoCast(target, SPELL_STRIKE); | |
964 | uiCleaveTimer = 20000; | |
965 | } | |
966 | else | |
967 | uiCleaveTimer -= uiDiff; | |
968 | ||
969 | if (uiStrikeTimer <= uiDiff) | |
970 | { | |
971 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) | |
972 | DoCast(target, SPELL_CLEAVE); | |
973 | uiStrikeTimer = 25000; | |
974 | } | |
975 | else | |
976 | uiStrikeTimer -= uiDiff; | |
977 | ||
978 | if (uiPummelTimer <= uiDiff) | |
979 | { | |
980 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) | |
981 | DoCast(target, SPELL_PUMMEL); | |
982 | uiPummelTimer = 35000; | |
983 | } | |
984 | else | |
985 | uiPummelTimer -= uiDiff; | |
986 | ||
987 | if (uiPainTimer <= uiDiff) | |
988 | { | |
989 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) | |
990 | DoCast(target, SPELL_PAIN); | |
991 | uiPainTimer = 30000; | |
992 | } | |
993 | else | |
994 | uiPainTimer -= uiDiff; | |
995 | ||
996 | if (uiMindTimer <= uiDiff) | |
997 | { | |
998 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) | |
999 | DoCast(target, SPELL_MIND); | |
1000 | uiMindTimer = 90000; | |
1001 | } | |
1002 | else | |
1003 | uiMindTimer -= uiDiff; | |
1004 | ||
1005 | if (uiSsmiteTimer <= uiDiff) | |
1006 | { | |
1007 | if (Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0)) | |
1008 | DoCast(target, SPELL_SSMITE); | |
1009 | uiSsmiteTimer = 25000; | |
1010 | } | |
1011 | else | |
1012 | uiSsmiteTimer -= uiDiff; | |
1013 | ||
1014 | if (uiLightTimer <= uiDiff) | |
1015 | { | |
1016 | DoCast(me, DUNGEON_MODE(SPELL_LIGHT, SPELL_LIGHT_H)); | |
1017 | uiLightTimer = urand(15000, 17000); | |
1018 | } | |
1019 | else | |
1020 | uiLightTimer -= uiDiff; | |
1021 | ||
1022 | if (uiFlurryTimer <= uiDiff) | |
1023 | { | |
1024 | DoCast(me, SPELL_FLURRY); | |
1025 | uiFlurryTimer = 22000; | |
1026 | } | |
1027 | else | |
1028 | uiFlurryTimer -= uiDiff; | |
1029 | ||
1030 | if (uiFinalTimer <= uiDiff) | |
1031 | { | |
1032 | DoCast(me, SPELL_FINAL); | |
1033 | uiFinalTimer = 70000; | |
1034 | } | |
1035 | else | |
1036 | uiFinalTimer -= uiDiff; | |
1037 | ||
1038 | if (uiDivineTimer <= uiDiff) | |
1039 | { | |
1040 | DoCast(me, SPELL_DIVINE); | |
1041 | uiDivineTimer = 85000; | |
1042 | } | |
1043 | else | |
1044 | uiDivineTimer -= uiDiff; | |
1045 | ||
1046 | DoMeleeAttackIfReady(); | |
1047 | } | |
1048 | ||
1049 | void JustDied(Unit* killer) /*OVERRIDE*/ | |
1050 | { | |
1051 | if (pInstance) | |
1052 | pInstance->SetData(DATA_ARGENT_SOLDIER_DEFEATED, pInstance->GetData(DATA_ARGENT_SOLDIER_DEFEATED) + 1); | |
1053 | } | |
1054 | }; | |
1055 | ||
1056 | CreatureAI* GetAI(Creature* creature) const OVERRIDE | |
1057 | { | |
1058 | return GetInstanceAI<npc_argent_soldierAI>(creature); | |
1059 | }; | |
1060 | }; | |
1061 | ||
1062 | enum ReflectiveShield | |
1063 | { | |
1064 | SPELL_REFLECTIVE_SHIELD_TRIGGERED = 33619, | |
1065 | }; | |
1066 | ||
1067 | // Reflective Shield 66515 | |
1068 | class spell_gen_reflective_shield : public SpellScriptLoader | |
1069 | { | |
1070 | public: | |
1071 | spell_gen_reflective_shield() : SpellScriptLoader("spell_gen_reflective_shield") { } | |
1072 | ||
1073 | class spell_gen_reflective_shield_AuraScript : public AuraScript | |
1074 | { | |
1075 | PrepareAuraScript(spell_gen_reflective_shield_AuraScript); | |
1076 | ||
1077 | bool Validate(SpellInfo const* /*spellEntry*/) | |
1078 | { | |
1079 | return sSpellStore.LookupEntry(SPELL_REFLECTIVE_SHIELD_TRIGGERED); | |
1080 | } | |
1081 | ||
1082 | void Trigger(AuraEffect * aurEff, DamageInfo & dmgInfo, uint32 & absorbAmount) | |
1083 | { | |
1084 | Unit * target = dmgInfo.GetAttacker(); | |
1085 | if (!target) | |
1086 | return; | |
1087 | Unit * caster = GetCaster(); | |
1088 | if (!caster) | |
1089 | return; | |
1090 | int32 bp = CalculatePct(absorbAmount, 25); | |
1091 | target->CastCustomSpell(target, SPELL_REFLECTIVE_SHIELD_TRIGGERED, &bp, NULL, NULL, true, NULL, aurEff); | |
1092 | } | |
1093 | ||
1094 | void Register() | |
1095 | { | |
1096 | AfterEffectAbsorb += AuraEffectAbsorbFn(spell_gen_reflective_shield_AuraScript::Trigger, EFFECT_0); | |
1097 | } | |
1098 | }; | |
1099 | ||
1100 | AuraScript *GetAuraScript() const | |
1101 | { | |
1102 | return new spell_gen_reflective_shield_AuraScript(); | |
1103 | } | |
1104 | }; | |
1105 | ||
1106 | class achievement_toc5_argent_challenge : public AchievementCriteriaScript | |
1107 | { | |
1108 | public: | |
1109 | uint32 creature_entry; | |
1110 | ||
1111 | achievement_toc5_argent_challenge(const char* name, uint32 original_entry) : AchievementCriteriaScript(name) | |
1112 | { | |
1113 | creature_entry = original_entry; | |
1114 | } | |
1115 | ||
1116 | bool OnCheck(Player* source, Unit* target) | |
1117 | { | |
1118 | if (!target) | |
1119 | return false; | |
1120 | ||
1121 | if (Creature* creature = target->ToCreature()) | |
1122 | if (creature->GetOriginalEntry() == creature_entry) | |
1123 | return true; | |
1124 | ||
1125 | return false; | |
1126 | } | |
1127 | }; | |
1128 | ||
1129 | uint32 const memorySpellId[25] = | |
1130 | { | |
1131 | SPELL_MEMORY_ALGALON, | |
1132 | SPELL_MEMORY_ARCHIMONDE, | |
1133 | SPELL_MEMORY_CHROMAGGUS, | |
1134 | SPELL_MEMORY_CYANIGOSA, | |
1135 | SPELL_MEMORY_DELRISSA, | |
1136 | SPELL_MEMORY_ECK, | |
1137 | SPELL_MEMORY_ENTROPIUS, | |
1138 | SPELL_MEMORY_GRUUL, | |
1139 | SPELL_MEMORY_HAKKAR, | |
1140 | SPELL_MEMORY_HEIGAN, | |
1141 | SPELL_MEMORY_HEROD, | |
1142 | SPELL_MEMORY_HOGGER, | |
1143 | SPELL_MEMORY_IGNIS, | |
1144 | SPELL_MEMORY_ILLIDAN, | |
1145 | SPELL_MEMORY_INGVAR, | |
1146 | SPELL_MEMORY_KALITHRESH, | |
1147 | SPELL_MEMORY_LUCIFRON, | |
1148 | SPELL_MEMORY_MALCHEZAAR, | |
1149 | SPELL_MEMORY_MUTANUS, | |
1150 | SPELL_MEMORY_ONYXIA, | |
1151 | SPELL_MEMORY_THUNDERAAN, | |
1152 | SPELL_MEMORY_VANCLEEF, | |
1153 | SPELL_MEMORY_VASHJ, | |
1154 | SPELL_MEMORY_VEKNILASH, | |
1155 | SPELL_MEMORY_VEZAX | |
1156 | }; | |
1157 | ||
1158 | // 66545 - Summon Memory | |
1159 | class spell_paletress_summon_memory : public SpellScriptLoader | |
1160 | { | |
1161 | public: | |
1162 | spell_paletress_summon_memory() : SpellScriptLoader("spell_paletress_summon_memory") { } | |
1163 | ||
1164 | class spell_paletress_summon_memory_SpellScript : public SpellScript | |
1165 | { | |
1166 | PrepareSpellScript(spell_paletress_summon_memory_SpellScript); | |
1167 | ||
1168 | bool Validate(SpellInfo const* /*spellInfo*/) OVERRIDE | |
1169 | { | |
1170 | for (uint8 i = 0; i < 25; ++i) | |
1171 | if (!sSpellMgr->GetSpellInfo(memorySpellId[i])) | |
1172 | return false; | |
1173 | return true; | |
1174 | } | |
1175 | ||
1176 | void FilterTargets(std::list<WorldObject*>& targets) | |
1177 | { | |
1178 | if (targets.empty()) | |
1179 | return; | |
1180 | ||
1181 | WorldObject* target = Trinity::Containers::SelectRandomContainerElement(targets); | |
1182 | targets.clear(); | |
1183 | targets.push_back(target); | |
1184 | } | |
1185 | ||
1186 | void HandleScript(SpellEffIndex /*effIndex*/) | |
1187 | { | |
1188 | GetHitUnit()->CastSpell(GetHitUnit(), memorySpellId[urand(0, 24)], true, NULL, NULL, GetCaster()->GetGUID()); | |
1189 | } | |
1190 | ||
1191 | void Register() OVERRIDE | |
1192 | { | |
1193 | OnObjectAreaTargetSelect += SpellObjectAreaTargetSelectFn(spell_paletress_summon_memory_SpellScript::FilterTargets, EFFECT_0, TARGET_UNIT_SRC_AREA_ENEMY); | |
1194 | OnEffectHitTarget += SpellEffectFn(spell_paletress_summon_memory_SpellScript::HandleScript, EFFECT_0, SPELL_EFFECT_SCRIPT_EFFECT); | |
1195 | } | |
1196 | }; | |
1197 | ||
1198 | SpellScript* GetSpellScript() const OVERRIDE | |
1199 | { | |
1200 | return new spell_paletress_summon_memory_SpellScript(); | |
1201 | } | |
1202 | }; | |
1203 | ||
1204 | void AddSC_boss_argent_challenge() | |
1205 | { | |
1206 | new boss_eadric(); | |
1207 | new spell_eadric_radiance(); | |
1208 | new spell_eadric_hoj(); | |
1209 | new boss_paletress(); | |
1210 | new npc_memory(); | |
1211 | new npc_argent_soldier(); | |
1212 | new spell_gen_reflective_shield(); | |
1213 | new achievement_toc5_argent_challenge("achievement_toc5_paletress", NPC_PALETRESS); | |
1214 | new achievement_toc5_argent_challenge("achievement_toc5_eadric", NPC_EADRIC); | |
1215 | new spell_paletress_summon_memory(); | |
1216 | } |