Advertisement
Rushor

Untitled

Aug 10th, 2014
370
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 25.12 KB | None | 0 0
  1.  
  2.  
  3. /*
  4. * Copyright (C) 2008-2013 TrinityCore <http://www.trinitycore.org/>
  5. * Copyright (C) 2006-2009 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
  6. *
  7. * This program is free software; you can redistribute it and/or modify it
  8. * under the terms of the GNU General Public License as published by the
  9. * Free Software Foundation; either version 2 of the License, or (at your
  10. * option) any later version.
  11. *
  12. * This program is distributed in the hope that it will be useful, but WITHOUT
  13. * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
  14. * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
  15. * more details.
  16. *
  17. * You should have received a copy of the GNU General Public License along
  18. * with this program. If not, see <http://www.gnu.org/licenses/>.
  19. */
  20.  
  21. /* ScriptData
  22. SDName: Boss_Kalecgos
  23. SD%Complete: 95
  24. SDComment:
  25. SDCategory: Sunwell_Plateau
  26. EndScriptData */
  27.  
  28. #include "ScriptMgr.h"
  29. #include "ScriptedCreature.h"
  30. #include "sunwell_plateau.h"
  31. #include "Player.h"
  32. #include "WorldSession.h"
  33.  
  34. enum Yells
  35. {
  36. SAY_SATH_AGGRO = 0,
  37. SAY_SATH_SLAY = 1,
  38. SAY_SATH_DEATH = 2,
  39. SAY_SATH_SPELL1 = 3,
  40. SAY_SATH_SPELL2 = 4,
  41.  
  42. SAY_EVIL_AGGRO = 0,
  43. SAY_EVIL_SLAY = 1,
  44. SAY_GOOD_PLRWIN = 2,
  45. SAY_EVIL_ENRAGE = 3,
  46.  
  47. SAY_GOOD_AGGRO = 0,
  48. SAY_GOOD_NEAR_DEATH = 1,
  49. SAY_GOOD_NEAR_DEATH2 = 2,
  50. };
  51.  
  52. enum Spells
  53. {
  54. AURA_SUNWELL_RADIANCE = 45769,
  55. AURA_SPECTRAL_EXHAUSTION = 44867,
  56. AURA_SPECTRAL_REALM = 46021,
  57. AURA_SPECTRAL_INVISIBILITY = 44801,
  58. AURA_DEMONIC_VISUAL = 44800,
  59.  
  60. SPELL_SPECTRAL_BLAST = 44869,
  61. SPELL_TELEPORT_SPECTRAL = 46019,
  62. SPELL_ARCANE_BUFFET = 45018,
  63. SPELL_FROST_BREATH = 44799,
  64. SPELL_TAIL_LASH = 45122,
  65.  
  66. SPELL_BANISH = 44836,
  67. SPELL_TRANSFORM_KALEC = 44670,
  68. SPELL_ENRAGE = 44807,
  69.  
  70. SPELL_CORRUPTION_STRIKE = 45029,
  71. SPELL_AGONY_CURSE = 45032,
  72. SPELL_SHADOW_BOLT = 45031,
  73.  
  74. SPELL_HEROIC_STRIKE = 45026,
  75. SPELL_REVITALIZE = 45027
  76. };
  77.  
  78. enum SWPActions
  79. {
  80. DO_ENRAGE = 1,
  81. DO_BANISH = 2,
  82. };
  83.  
  84. #define GO_FAILED "You are unable to use this currently."
  85.  
  86. #define EMOTE_UNABLE_TO_FIND "is unable to find Kalecgos"
  87.  
  88. #define FLY_X 1679
  89. #define FLY_Y 900
  90. #define FLY_Z 82
  91.  
  92. #define CENTER_X 1705
  93. #define CENTER_Y 930
  94. #define RADIUS 30
  95.  
  96. #define DRAGON_REALM_Z 53.079f
  97. #define DEMON_REALM_Z -74.558f
  98.  
  99. #define MAX_PLAYERS_IN_SPECTRAL_REALM 13 //over this, teleport object won't work, 0 disables check
  100.  
  101. uint32 WildMagic[] = { 44978, 45001, 45002, 45004, 45006, 45010 };
  102.  
  103. class boss_kalecgos : public CreatureScript
  104. {
  105. public:
  106. boss_kalecgos() : CreatureScript("boss_kalecgos") { }
  107.  
  108. CreatureAI* GetAI(Creature* creature) const
  109. {
  110. return new boss_kalecgosAI (creature);
  111. }
  112.  
  113. struct boss_kalecgosAI : public ScriptedAI
  114. {
  115. boss_kalecgosAI(Creature* creature) : ScriptedAI(creature)
  116. {
  117. instance = creature->GetInstanceScript();
  118. SathGUID = 0;
  119. DoorGUID = 0;
  120. bJustReset = false;
  121. me->setActive(true);
  122. }
  123.  
  124. InstanceScript* instance;
  125.  
  126. uint32 ArcaneBuffetTimer;
  127. uint32 FrostBreathTimer;
  128. uint32 WildMagicTimer;
  129. uint32 SpectralBlastTimer;
  130. uint32 TailLashTimer;
  131. uint32 CheckTimer;
  132. uint32 TalkTimer;
  133. uint32 TalkSequence;
  134. uint32 ResetTimer;
  135.  
  136. bool isFriendly;
  137. bool isEnraged;
  138. bool isBanished;
  139. bool bJustReset;
  140.  
  141. uint64 SathGUID;
  142. uint64 DoorGUID;
  143.  
  144. void Reset()
  145. {
  146. if (instance)
  147. {
  148. SathGUID = instance->GetData64(DATA_SATHROVARR);
  149. instance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED);
  150. }
  151.  
  152. if (Creature* Sath = Unit::GetCreature(*me, SathGUID))
  153. Sath->AI()->EnterEvadeMode();
  154.  
  155. me->setFaction(14);
  156. //if (!bJustReset) //first reset at create
  157. //{
  158. me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
  159. me->SetDisableGravity(false);
  160. me->SetVisible(true);
  161. me->SetStandState(UNIT_STAND_STATE_SLEEP);
  162. /*}*/
  163. me->SetFullHealth();//dunno why it does not resets health at evade..
  164. ArcaneBuffetTimer = 8000;
  165. FrostBreathTimer = 15000;
  166. WildMagicTimer = 10000;
  167. TailLashTimer = 25000;
  168. SpectralBlastTimer = urand(20000, 25000);
  169. CheckTimer = 1000;
  170. ResetTimer = 30000;
  171.  
  172. TalkTimer = 0;
  173. TalkSequence = 0;
  174. isFriendly = false;
  175. isEnraged = false;
  176. isBanished = false;
  177. }
  178.  
  179. void EnterEvadeMode()
  180. {
  181. //bJustReset = true;
  182. //me->SetVisible(false);
  183. me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
  184. ScriptedAI::EnterEvadeMode();
  185. }
  186.  
  187. void DoAction(int32 param)
  188. {
  189. switch (param)
  190. {
  191. case DO_ENRAGE:
  192. isEnraged = true;
  193. me->CastSpell(me, SPELL_ENRAGE, true);
  194. break;
  195. case DO_BANISH:
  196. isBanished = true;
  197. me->CastSpell(me, SPELL_BANISH, true);
  198. break;
  199. }
  200. }
  201.  
  202. void UpdateAI(uint32 diff)
  203. {
  204. if (TalkTimer)
  205. {
  206. if (!TalkSequence)
  207. {
  208. me->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE + UNIT_FLAG_NOT_SELECTABLE);
  209. me->InterruptNonMeleeSpells(true);
  210. me->RemoveAllAuras();
  211. me->DeleteThreatList();
  212. me->CombatStop();
  213. ++TalkSequence;
  214. }
  215. if (TalkTimer <= diff)
  216. {
  217. if (isFriendly)
  218. GoodEnding();
  219. else
  220. BadEnding();
  221. ++TalkSequence;
  222. } else TalkTimer -= diff;
  223. }
  224. else
  225. {
  226. if (bJustReset)
  227. {
  228. /*if (ResetTimer <= diff)
  229. {
  230. me->RemoveFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE|UNIT_FLAG_NOT_SELECTABLE);
  231. me->SetDisableGravity(false);
  232. me->SetVisible(true);
  233. me->SetStandState(UNIT_STAND_STATE_SLEEP);
  234. ResetTimer = 10000;
  235. bJustReset = false;
  236. } else ResetTimer -= diff;*/
  237. return;
  238. }
  239. if (!UpdateVictim())
  240. return;
  241.  
  242. if (CheckTimer <= diff)
  243. {
  244. if (me->GetDistance(CENTER_X, CENTER_Y, DRAGON_REALM_Z) >= 75)
  245. {
  246. me->AI()->EnterEvadeMode();
  247. return;
  248. }
  249. if (HealthBelowPct(10) && !isEnraged)
  250. {
  251. if (Creature* Sath = Unit::GetCreature(*me, SathGUID))
  252. Sath->AI()->DoAction(DO_ENRAGE);
  253. DoAction(DO_ENRAGE);
  254. }
  255. if (!isBanished && HealthBelowPct(1))
  256. {
  257. if (Creature* Sath = Unit::GetCreature(*me, SathGUID))
  258. {
  259. if (Sath->HasAura(SPELL_BANISH))
  260. {
  261. Sath->DealDamage(Sath, Sath->GetHealth());
  262. return;
  263. }
  264. else
  265. DoAction(DO_BANISH);
  266. }
  267. else
  268. {
  269. TC_LOG_ERROR(LOG_FILTER_TSCR, "Didn't find Shathrowar. Kalecgos event reseted.");
  270. EnterEvadeMode();
  271. return;
  272. }
  273. }
  274. CheckTimer = 1000;
  275. } else CheckTimer -= diff;
  276.  
  277. if (ArcaneBuffetTimer <= diff)
  278. {
  279. DoCastAOE(SPELL_ARCANE_BUFFET);
  280. ArcaneBuffetTimer = 8000;
  281. } else ArcaneBuffetTimer -= diff;
  282.  
  283. if (FrostBreathTimer <= diff)
  284. {
  285. DoCastAOE(SPELL_FROST_BREATH);
  286. FrostBreathTimer = 15000;
  287. } else FrostBreathTimer -= diff;
  288.  
  289. if (TailLashTimer <= diff)
  290. {
  291. DoCastAOE(SPELL_TAIL_LASH);
  292. TailLashTimer = 15000;
  293. } else TailLashTimer -= diff;
  294.  
  295. if (WildMagicTimer <= diff)
  296. {
  297. DoCastAOE(WildMagic[rand()%6]);
  298. WildMagicTimer = 20000;
  299. } else WildMagicTimer -= diff;
  300.  
  301. if (SpectralBlastTimer <= diff)
  302. {
  303. DoCast(SelectTarget(SELECT_TARGET_RANDOM, 1), SPELL_SPECTRAL_BLAST);
  304. SpectralBlastTimer = 20000+rand()%5000;
  305. } else SpectralBlastTimer -= diff;
  306.  
  307. DoMeleeAttackIfReady();
  308. }
  309. }
  310.  
  311. void MoveInLineOfSight(Unit* who)
  312. {
  313. if (bJustReset)//boss is invisible, don't attack
  314. return;
  315.  
  316. if (!me->GetVictim() && me->IsValidAttackTarget(who))
  317. {
  318. float attackRadius = me->GetAttackDistance(who);
  319. if (me->IsWithinDistInMap(who, attackRadius))
  320. AttackStart(who);
  321. }
  322. }
  323.  
  324. void DamageTaken(Unit* done_by, uint32 &damage)
  325. {
  326. if (damage >= me->GetHealth() && done_by != me)
  327. damage = 0;
  328. }
  329.  
  330. void EnterCombat(Unit* /*who*/)
  331. {
  332. me->SetStandState(UNIT_STAND_STATE_STAND);
  333. Talk(SAY_EVIL_AGGRO);
  334. DoZoneInCombat();
  335.  
  336. if (instance)
  337. instance->SetData(DATA_KALECGOS_EVENT, IN_PROGRESS);
  338. }
  339.  
  340. void KilledUnit(Unit* /*victim*/)
  341. {
  342. Talk(SAY_EVIL_SLAY);
  343. }
  344.  
  345. void MovementInform(uint32 type, uint32 /*id*/)
  346. {
  347. if (type != POINT_MOTION_TYPE)
  348. return;
  349. me->SetVisible(false);
  350. if (isFriendly)
  351. {
  352. me->setDeathState(JUST_DIED);
  353.  
  354. Map::PlayerList const& players = me->GetMap()->GetPlayers();
  355. if (!players.isEmpty())
  356. {
  357. for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  358. {
  359. Player* player = itr->GetSource();
  360. if (player)
  361. me->GetMap()->ToInstanceMap()->PermBindAllPlayers(player);
  362. }
  363. }
  364. }
  365. else
  366. {
  367. me->GetMotionMaster()->MoveTargetedHome();
  368. TalkTimer = 1000;
  369. }
  370. }
  371.  
  372. void GoodEnding()
  373. {
  374. switch (TalkSequence)
  375. {
  376. case 1:
  377. me->setFaction(35);
  378. TalkTimer = 1000;
  379. break;
  380. case 2:
  381. Talk(SAY_GOOD_PLRWIN);
  382. TalkTimer = 10000;
  383. break;
  384. case 3:
  385. me->SetDisableGravity(true);
  386. me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z);
  387. TalkTimer = 600000;
  388. break;
  389. default:
  390. break;
  391. }
  392. }
  393.  
  394. void BadEnding()
  395. {
  396. switch (TalkSequence)
  397. {
  398. case 1:
  399. Talk(SAY_EVIL_ENRAGE);
  400. TalkTimer = 3000;
  401. break;
  402. case 2:
  403. me->SetDisableGravity(true);
  404. me->GetMotionMaster()->MovePoint(0, FLY_X, FLY_Y, FLY_Z);
  405. TalkTimer = 15000;
  406. break;
  407. case 3:
  408. EnterEvadeMode();
  409. break;
  410. default:
  411. break;
  412. }
  413. }
  414. };
  415. };
  416.  
  417. class boss_kalec : public CreatureScript
  418. {
  419. public:
  420. boss_kalec() : CreatureScript("boss_kalec") { }
  421.  
  422. CreatureAI* GetAI(Creature* creature) const
  423. {
  424. return new boss_kalecAI (creature);
  425. }
  426.  
  427. struct boss_kalecAI : public ScriptedAI
  428. {
  429. InstanceScript* instance;
  430.  
  431. uint32 RevitalizeTimer;
  432. uint32 HeroicStrikeTimer;
  433. uint32 YellTimer;
  434. uint32 YellSequence;
  435.  
  436. uint64 SathGUID;
  437.  
  438. bool isEnraged; // if demon is enraged
  439.  
  440. boss_kalecAI(Creature* creature) : ScriptedAI(creature)
  441. {
  442. instance = creature->GetInstanceScript();
  443. }
  444.  
  445. void Reset()
  446. {
  447. if (instance)
  448. SathGUID = instance->GetData64(DATA_SATHROVARR);
  449.  
  450. RevitalizeTimer = 5000;
  451. HeroicStrikeTimer = 3000;
  452. YellTimer = 5000;
  453. YellSequence = 0;
  454.  
  455. isEnraged = false;
  456. }
  457.  
  458. void DamageTaken(Unit* done_by, uint32 &damage)
  459. {
  460. if (done_by->GetGUID() != SathGUID)
  461. damage = 0;
  462. else if (isEnraged)
  463. damage *= 3;
  464. }
  465.  
  466. void UpdateAI(uint32 diff)
  467. {
  468. if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY))
  469. me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true);
  470. if (!UpdateVictim())
  471. return;
  472.  
  473. if (YellTimer <= diff)
  474. {
  475. switch (YellSequence)
  476. {
  477. case 0:
  478. Talk(SAY_GOOD_AGGRO);
  479. ++YellSequence;
  480. break;
  481. case 1:
  482. if (HealthBelowPct(50))
  483. {
  484. Talk(SAY_GOOD_NEAR_DEATH);
  485. ++YellSequence;
  486. }
  487. break;
  488. case 2:
  489. if (HealthBelowPct(10))
  490. {
  491. Talk(SAY_GOOD_NEAR_DEATH2);
  492. ++YellSequence;
  493. }
  494. break;
  495. default:
  496. break;
  497. }
  498. YellTimer = 5000;
  499. }
  500.  
  501. if (RevitalizeTimer <= diff)
  502. {
  503. DoCast(me, SPELL_REVITALIZE);
  504. RevitalizeTimer = 5000;
  505. } else RevitalizeTimer -= diff;
  506.  
  507. if (HeroicStrikeTimer <= diff)
  508. {
  509. DoCastVictim(SPELL_HEROIC_STRIKE);
  510. HeroicStrikeTimer = 2000;
  511. } else HeroicStrikeTimer -= diff;
  512.  
  513. DoMeleeAttackIfReady();
  514. }
  515. };
  516. };
  517.  
  518. class kalecgos_teleporter : public GameObjectScript
  519. {
  520. public:
  521. kalecgos_teleporter() : GameObjectScript("kalecgos_teleporter") { }
  522.  
  523. bool OnGossipHello(Player* player, GameObject* go)
  524. {
  525. uint8 SpectralPlayers = 0;
  526. Map* map = go->GetMap();
  527. if (!map->IsDungeon())
  528. return true;
  529.  
  530. Map::PlayerList const &PlayerList = map->GetPlayers();
  531. for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
  532. {
  533. if (i->GetSource() && i->GetSource()->GetPositionZ() < DEMON_REALM_Z + 5)
  534. ++SpectralPlayers;
  535. }
  536. uint8 MaxSpectralPlayers = MAX_PLAYERS_IN_SPECTRAL_REALM;
  537. if (player->HasAura(AURA_SPECTRAL_EXHAUSTION) || (MaxSpectralPlayers && SpectralPlayers >= MaxSpectralPlayers))
  538. player->GetSession()->SendNotification(GO_FAILED);
  539. else
  540. player->CastSpell(player, SPELL_TELEPORT_SPECTRAL, true);
  541. return true;
  542. }
  543. };
  544.  
  545. class boss_sathrovarr : public CreatureScript
  546. {
  547. public:
  548. boss_sathrovarr() : CreatureScript("boss_sathrovarr") { }
  549.  
  550. CreatureAI* GetAI(Creature* creature) const
  551. {
  552. return new boss_sathrovarrAI (creature);
  553. }
  554.  
  555. struct boss_sathrovarrAI : public ScriptedAI
  556. {
  557. boss_sathrovarrAI(Creature* creature) : ScriptedAI(creature)
  558. {
  559. instance = creature->GetInstanceScript();
  560. KalecGUID = 0;
  561. KalecgosGUID = 0;
  562. }
  563.  
  564. InstanceScript* instance;
  565.  
  566. uint32 CorruptionStrikeTimer;
  567. uint32 AgonyCurseTimer;
  568. uint32 ShadowBoltTimer;
  569. uint32 CheckTimer;
  570. uint32 ResetThreat;
  571.  
  572. uint64 KalecGUID;
  573. uint64 KalecgosGUID;
  574.  
  575. bool isEnraged;
  576. bool isBanished;
  577.  
  578. void Reset()
  579. {
  580. me->SetFullHealth();//dunno why it does not resets health at evade..
  581. me->setActive(true);
  582. if (instance)
  583. {
  584. KalecgosGUID = instance->GetData64(DATA_KALECGOS_DRAGON);
  585. instance->SetData(DATA_KALECGOS_EVENT, NOT_STARTED);
  586. }
  587. if (KalecGUID)
  588. {
  589. if (Creature* Kalec = Unit::GetCreature(*me, KalecGUID))
  590. Kalec->setDeathState(JUST_DIED);
  591. KalecGUID = 0;
  592. }
  593.  
  594. ShadowBoltTimer = urand(7, 10) * 1000;
  595. AgonyCurseTimer = 20000;
  596. CorruptionStrikeTimer = 13000;
  597. CheckTimer = 1000;
  598. /*ResetThreat = 1000;*/
  599. isEnraged = false;
  600. isBanished = false;
  601.  
  602. me->CastSpell(me, AURA_DEMONIC_VISUAL, true);
  603. //TeleportAllPlayersBack();
  604. }
  605.  
  606. void EnterCombat(Unit* /*who*/)
  607. {
  608. Talk(SAY_SATH_AGGRO);
  609. }
  610.  
  611. void DamageTaken(Unit* done_by, uint32 &damage)
  612. {
  613. if (damage >= me->GetHealth() && done_by != me)
  614. damage = 0;
  615. }
  616.  
  617. void KilledUnit(Unit* target)
  618. {
  619. if (target->GetGUID() == KalecGUID)
  620. {
  621. TeleportAllPlayersBack();
  622. if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
  623. {
  624. CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1;
  625. CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = false;
  626. }
  627. EnterEvadeMode();
  628. return;
  629. }
  630. Talk(SAY_SATH_SLAY);
  631. }
  632.  
  633. void JustDied(Unit* /*killer*/)
  634. {
  635. Talk(SAY_SATH_DEATH);
  636. me->SetPosition(1704.138184, 901.663269, DRAGON_REALM_Z, 1.520955);
  637. TeleportAllPlayersBack();
  638. if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
  639. {
  640. CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->TalkTimer = 1;
  641. CAST_AI(boss_kalecgos::boss_kalecgosAI, Kalecgos->AI())->isFriendly = true;
  642. }
  643.  
  644. if (instance)
  645. instance->SetData(DATA_KALECGOS_EVENT, DONE);
  646. }
  647.  
  648. void TeleportAllPlayersBack()
  649. {
  650. Map* map = me->GetMap();
  651. if (!map->IsDungeon())
  652. return;
  653.  
  654. Map::PlayerList const &PlayerList = map->GetPlayers();
  655. for (Map::PlayerList::const_iterator i = PlayerList.begin(); i != PlayerList.end(); ++i)
  656. {
  657. if (i->GetSource()->GetPositionZ() <= DRAGON_REALM_Z-5)
  658. {
  659. i->GetSource()->RemoveAura(AURA_SPECTRAL_REALM);
  660. i->GetSource()->TeleportTo(me->GetMap()->GetId(), i->GetSource()->GetPositionX(), i->GetSource()->GetPositionY(), DRAGON_REALM_Z+5, i->GetSource()->GetOrientation());
  661. }
  662. }
  663. }
  664.  
  665. void DoAction(int32 param)
  666. {
  667. switch (param)
  668. {
  669. case DO_ENRAGE:
  670. isEnraged = true;
  671. me->CastSpell(me, SPELL_ENRAGE, true);
  672. break;
  673. case DO_BANISH:
  674. isBanished = true;
  675. me->CastSpell(me, SPELL_BANISH, true);
  676. break;
  677. }
  678. }
  679.  
  680. void UpdateAI(uint32 diff)
  681. {
  682. if (!me->HasAura(AURA_SPECTRAL_INVISIBILITY))
  683. me->CastSpell(me, AURA_SPECTRAL_INVISIBILITY, true);
  684. if (!UpdateVictim())
  685. return;
  686.  
  687. if (CheckTimer <= diff)
  688. {
  689. /*Creature* Kalec = Unit::GetCreature(*me, KalecGUID);
  690. if (!Kalec || !Kalec->IsAlive())
  691. {
  692. if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
  693. Kalecgos->AI()->EnterEvadeMode();
  694. return;
  695. }*/
  696.  
  697. if (HealthBelowPct(10) && !isEnraged)
  698. {
  699. if (Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID))
  700. Kalecgos->AI()->DoAction(DO_ENRAGE);
  701. DoAction(DO_ENRAGE);
  702. }
  703.  
  704. Creature* Kalecgos = Unit::GetCreature(*me, KalecgosGUID);
  705. if (Kalecgos && !Kalecgos->IsInCombat())
  706. {
  707. me->AI()->EnterEvadeMode();
  708. return;
  709. }
  710.  
  711. if (!isBanished && HealthBelowPct(1))
  712. {
  713. if (Kalecgos)
  714. {
  715. if (Kalecgos->HasAura(SPELL_BANISH))
  716. {
  717. me->SetPosition(1704.138184, 901.663269, DRAGON_REALM_Z, 1.520955);
  718. TeleportAllPlayersBack();
  719. me->DealDamage(me, me->GetHealth());
  720. return;
  721. }
  722. DoAction(DO_BANISH);
  723. }
  724. else
  725. {
  726. me->MonsterTextEmote(EMOTE_UNABLE_TO_FIND, 0);
  727. EnterEvadeMode();
  728. return;
  729. }
  730. }
  731. CheckTimer = 1000;
  732. } else CheckTimer -= diff;
  733.  
  734. if (ResetThreat <= diff)
  735. {
  736. for (std::list<HostileReference*>::const_iterator itr = me->getThreatManager().getThreatList().begin(); itr !=
  737. me->getThreatManager().getThreatList().end(); ++itr)
  738. {
  739. if (Unit* unit = Unit::GetUnit(*me, (*itr)->getUnitGuid()))
  740. {
  741. if (unit->GetPositionZ() > me->GetPositionZ() + 5)
  742. {
  743. me->getThreatManager().modifyThreatPercent(unit, -100);
  744. }
  745. }
  746. }
  747. ResetThreat = 1000;
  748. } else ResetThreat -= diff;
  749.  
  750. if (ShadowBoltTimer <= diff)
  751. {
  752. if (!(rand()%5))Talk(SAY_SATH_SPELL1);
  753. DoCast(me, SPELL_SHADOW_BOLT);
  754. ShadowBoltTimer = 7000+(rand()%3000);
  755. } else ShadowBoltTimer -= diff;
  756.  
  757. if (AgonyCurseTimer <= diff)
  758. {
  759. Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
  760. if (!target)
  761. target = me->GetVictim();
  762. DoCast(target, SPELL_AGONY_CURSE);
  763. AgonyCurseTimer = 20000;
  764. } else AgonyCurseTimer -= diff;
  765.  
  766. if (CorruptionStrikeTimer <= diff)
  767. {
  768. if (!(rand()%5))Talk(SAY_SATH_SPELL2);
  769. DoCastVictim(SPELL_CORRUPTION_STRIKE);
  770. CorruptionStrikeTimer = 13000;
  771. } else CorruptionStrikeTimer -= diff;
  772.  
  773. DoMeleeAttackIfReady();
  774. }
  775. };
  776. };
  777.  
  778. void AddSC_boss_kalecgos()
  779. {
  780. new boss_kalecgos();
  781. new boss_sathrovarr();
  782. new boss_kalec();
  783. new kalecgos_teleporter();
  784. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement