Advertisement
Guest User

Hor script

a guest
Mar 25th, 2013
131
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 18.51 KB | None | 0 0
  1. /*
  2. * Copyright (C) 2008 - 2010 Trinity <http://www.trinitycore.org/>
  3. *
  4. * Copyright (C) 2006 - 2010 ScriptDev2 <https://scriptdev2.svn.sourceforge.net/>
  5. *
  6. * This program is free software; you can redistribute it and/or modify
  7. * it under the terms of the GNU General Public License as published by
  8. * the Free Software Foundation; either version 2 of the License, or
  9. * (at your option) any later version.
  10. *
  11. * This program is distributed in the hope that it will be useful,
  12. * but WITHOUT ANY WARRANTY; without even the implied warranty of
  13. * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
  14. * GNU General Public License for more details.
  15. *
  16. * You should have received a copy of the GNU General Public License
  17. * along with this program; if not, write to the Free Software
  18. * Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
  19. */
  20.  
  21. /* ScriptData
  22. SDName: boss_Lich_king
  23. SD%Complete: 0%
  24. SDComment: new script for tc implementation.
  25. SDCategory: Halls of Reflection
  26. EndScriptData */
  27.  
  28. #include "ScriptPCH.h"
  29. #include "halls_of_reflection.h"
  30. #include "ScriptedEscortAI.h"
  31. #include "Unit.h"
  32.  
  33. enum
  34. {
  35. SPELL_WINTER = 69780,
  36. SPELL_FURY_OF_FROSTMOURNE = 70063,
  37. SPELL_SOUL_REAPER = 73797,
  38. SPELL_RAISE_DEAD = 69818,
  39. SPELL_ICE_PRISON = 69708,
  40. SPELL_DARK_ARROW = 70194,
  41. SPELL_EMERGE_VISUAL = 50142,
  42. SPELL_DESTROY_ICE_WALL_02 = 70224,
  43. SPELL_SILENCE = 69413,
  44. SPELL_LICH_KING_CAST = 57561,
  45. SPELL_GNOUL_JUMP = 70150,
  46. SPELL_ABON_STRIKE = 40505,
  47. SPELL_FROSTMOURNE_VISUAL = 73220,
  48.  
  49. /*SPELLS - Witch Doctor*/
  50. SPELL_COURSE_OF_DOOM = 70144,
  51. SPELL_SHADOW_BOLT_VALLEY = 70145,
  52. SPELL_SHADOW_BOLT_N = 70080,
  53. SPELL_SHADOW_BOLT_H = 70182,
  54.  
  55. SAY_LICH_KING_WALL_01 = -1594486,
  56. SAY_LICH_KING_WALL_02 = -1594491,
  57. SAY_LICH_KING_GNOUL = -1594482,
  58. SAY_LICH_KING_ABON = -1594483,
  59. SAY_LICH_KING_WINTER = -1594481,
  60. SAY_LICH_KING_END_DUN = -1594504,
  61. SAY_LICH_KING_WIN = -1594485,
  62. };
  63.  
  64. class boss_lich_king_hor : public CreatureScript
  65. {
  66. public:
  67. boss_lich_king_hor() : CreatureScript("boss_lich_king_hor") { }
  68.  
  69. CreatureAI* GetAI(Creature* pCreature) const
  70. {
  71. return new boss_lich_king_horAI(pCreature);
  72. }
  73.  
  74. struct boss_lich_king_horAI : public npc_escortAI
  75. {
  76. boss_lich_king_horAI(Creature *pCreature) : npc_escortAI(pCreature)
  77. {
  78. m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  79. Reset();
  80. }
  81.  
  82. InstanceScript* m_pInstance;
  83. uint32 Step;
  84. uint32 StepTimer;
  85. bool StartEscort;
  86. bool IceWall01;
  87. bool NonFight;
  88. bool Finish;
  89.  
  90. void Reset()
  91. {
  92. if(!m_pInstance)
  93. return;
  94. NonFight = false;
  95. StartEscort = false;
  96. me->CastSpell(me, SPELL_FROSTMOURNE_VISUAL, false);
  97. }
  98.  
  99. void JustDied(Unit* pKiller) { }
  100.  
  101. void WaypointReached(uint32 i)
  102. {
  103. switch(i)
  104. {
  105. case 20:
  106. SetEscortPaused(true);
  107. Finish = true;
  108. DoCast(me, SPELL_LICH_KING_CAST);
  109. m_pInstance->SetData(SPELL_LICH_KING, SPECIAL);
  110. DoScriptText(SAY_LICH_KING_END_DUN, me);
  111. if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ESCAPE_LIDER))))
  112. me->CastSpell(pLider, SPELL_SILENCE, false);
  113. me->setActive(false);
  114. break;
  115. }
  116. }
  117.  
  118. void AttackStart(Unit* who)
  119. {
  120. if (!m_pInstance || !who)
  121. return;
  122.  
  123. if (NonFight)
  124. return;
  125.  
  126. if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS || who->GetTypeId() == TYPEID_PLAYER)
  127. return;
  128.  
  129. npc_escortAI::AttackStart(who);
  130. }
  131.  
  132. void JustSummoned(Creature* summoned)
  133. {
  134. if(!m_pInstance || !summoned)
  135. return;
  136.  
  137. summoned->SetPhaseMask(65535, true);
  138. summoned->SetInCombatWithZone();
  139. summoned->setActive(true);
  140.  
  141. m_pInstance->SetData(DATA_SUMMONS, 1);
  142. if (Unit* pLider = Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ESCAPE_LIDER)))
  143. {
  144. summoned->GetMotionMaster()->MoveChase(pLider);
  145. summoned->AddThreat(pLider, 100.0f);
  146. }
  147. }
  148.  
  149. void CallGuard(uint32 GuardID)
  150. {
  151. me->SummonCreature(GuardID,(me->GetPositionX()-5)+rand()%10, (me->GetPositionY()-5)+rand()%10, me->GetPositionZ(),4.17f,TEMPSUMMON_TIMED_OR_DEAD_DESPAWN,360000);
  152. }
  153.  
  154. void Wall01()
  155. {
  156. switch(Step)
  157. {
  158. case 0:
  159. SetEscortPaused(true);
  160. m_pInstance->SetData(DATA_SUMMONS, 3);
  161. DoScriptText(SAY_LICH_KING_WALL_01, me);
  162. DoCast(me, SPELL_DESTROY_ICE_WALL_02);
  163. StepTimer = 2000;
  164. ++Step;
  165. break;
  166. case 1:
  167. StepTimer = 2000;
  168. ++Step;
  169. break;
  170. case 2:
  171. DoCast(me, SPELL_RAISE_DEAD);
  172. DoScriptText(SAY_LICH_KING_GNOUL, me);
  173. StepTimer = 7000;
  174. ++Step;
  175. break;
  176. case 3:
  177. DoCast(me, SPELL_WINTER);
  178. DoScriptText(SAY_LICH_KING_WINTER, me);
  179. me->SetSpeed(MOVE_WALK, 1.1f, true);
  180. StepTimer = 1000;
  181. ++Step;
  182. break;
  183. case 4:
  184. SetEscortPaused(false);
  185. StepTimer = 2000;
  186. ++Step;
  187. break;
  188. case 5:
  189. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  190. m_pInstance->SetData(TYPE_ICE_WALL_01, DONE);
  191. StepTimer = 100;
  192. Step = 0;
  193. break;
  194. }
  195. }
  196.  
  197. void Wall02()
  198. {
  199. switch(Step)
  200. {
  201. case 0:
  202. m_pInstance->SetData(DATA_SUMMONS, 3);
  203. SetEscortPaused(true);
  204. DoCast(me, SPELL_RAISE_DEAD);
  205. DoScriptText(SAY_LICH_KING_GNOUL, me);
  206. StepTimer = 10000;
  207. ++Step;
  208. break;
  209. case 1:
  210. SetEscortPaused(false);
  211. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  212. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  213. CallGuard(NPC_ABON);
  214. m_pInstance->SetData(TYPE_ICE_WALL_02, DONE);
  215. StepTimer = 100;
  216. Step = 0;
  217. break;
  218. }
  219. }
  220.  
  221. void Wall03()
  222. {
  223. switch(Step)
  224. {
  225. case 0:
  226. m_pInstance->SetData(DATA_SUMMONS, 3);
  227. SetEscortPaused(true);
  228. DoCast(me, SPELL_RAISE_DEAD);
  229. DoScriptText(SAY_LICH_KING_GNOUL, me);
  230. StepTimer = 10000;
  231. ++Step;
  232. break;
  233. case 1:
  234. SetEscortPaused(false);
  235. DoScriptText(SAY_LICH_KING_ABON, me);
  236. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  237. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  238. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  239. CallGuard(NPC_ABON);
  240. CallGuard(NPC_ABON);
  241. m_pInstance->SetData(TYPE_ICE_WALL_03, DONE);
  242. StepTimer = 100;
  243. Step = 0;
  244. break;
  245. }
  246. }
  247.  
  248. void Wall04()
  249. {
  250. switch(Step)
  251. {
  252. case 0:
  253. m_pInstance->SetData(DATA_SUMMONS, 3);
  254. SetEscortPaused(true);
  255. DoCast(me, SPELL_RAISE_DEAD);
  256. DoScriptText(SAY_LICH_KING_GNOUL, me);
  257. StepTimer = 10000;
  258. ++Step;
  259. break;
  260. case 1:
  261. SetEscortPaused(false);
  262. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  263. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  264. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  265. CallGuard(NPC_ABON);
  266. CallGuard(NPC_ABON);
  267. StepTimer = 15000;
  268. ++Step;
  269. break;
  270. case 2:
  271. DoScriptText(SAY_LICH_KING_ABON, me);
  272. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  273. CallGuard(NPC_RISEN_WITCH_DOCTOR);
  274. m_pInstance->SetData(TYPE_ICE_WALL_04, DONE);
  275. ++Step;
  276. break;
  277. }
  278. }
  279.  
  280. void UpdateEscortAI(const uint32 diff)
  281. {
  282. if(!m_pInstance)
  283. return;
  284.  
  285. if(m_pInstance->GetData(TYPE_LICH_KING) != IN_PROGRESS)
  286. {
  287. if (!UpdateVictim())
  288. return;
  289.  
  290. DoMeleeAttackIfReady();
  291. }
  292.  
  293. if(me->isInCombat() && m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  294. {
  295. npc_escortAI::EnterEvadeMode();
  296. }
  297.  
  298. if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS && StartEscort != true)
  299. {
  300. StartEscort = true;
  301. me->RemoveAurasDueToSpell(SPELL_ICE_PRISON);
  302. me->RemoveAurasDueToSpell(SPELL_DARK_ARROW);
  303. //me->RemoveAllAuras();
  304. me->setActive(true);
  305. me->CastSpell(me, SPELL_FROSTMOURNE_VISUAL, false);
  306. NonFight = true;
  307. me->AttackStop();
  308. me->SetSpeed(MOVE_WALK, 2.5f, true);
  309. Start(false, false);
  310. Step = 0;
  311. StepTimer = 100;
  312. }
  313.  
  314. if (Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_pInstance->GetData64(DATA_ESCAPE_LIDER))))
  315. {
  316. if (pLider->IsWithinDistInMap(me, 2.0f))
  317. {
  318. me->setActive(false);
  319. SetEscortPaused(true);
  320. npc_escortAI::EnterEvadeMode();
  321. DoScriptText(SAY_LICH_KING_WIN, me);
  322. me->CastSpell(me, SPELL_FURY_OF_FROSTMOURNE, false);
  323. me->DealDamage(pLider, pLider->GetHealth(), NULL, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_NORMAL, NULL, false);
  324. me->NearTeleportTo(5572.077f, 2283.1f, 734.976f, 3.89f);
  325. m_pInstance->SetData(TYPE_LICH_KING, FAIL);
  326. }
  327. }
  328.  
  329. if(m_pInstance->GetData(TYPE_ICE_WALL_01) == IN_PROGRESS)
  330. {
  331. if(StepTimer < diff)
  332. Wall01();
  333. else
  334. StepTimer -= diff;
  335. }
  336.  
  337. if(m_pInstance->GetData(TYPE_ICE_WALL_02) == IN_PROGRESS)
  338. {
  339. if(StepTimer < diff)
  340. Wall02();
  341. else
  342. StepTimer -= diff;
  343. }
  344.  
  345. if(m_pInstance->GetData(TYPE_ICE_WALL_03) == IN_PROGRESS)
  346. {
  347. if(StepTimer < diff)
  348. Wall03();
  349. else
  350. StepTimer -= diff;
  351. }
  352.  
  353. if(m_pInstance->GetData(TYPE_ICE_WALL_04) == IN_PROGRESS)
  354. {
  355. if(StepTimer < diff)
  356. Wall04();
  357. else
  358. StepTimer -= diff;
  359. }
  360. return;
  361. }
  362. };
  363. };
  364.  
  365. class npc_raging_gnoul : public CreatureScript
  366. {
  367. public:
  368. npc_raging_gnoul() : CreatureScript("npc_raging_gnoul") { }
  369.  
  370. struct npc_raging_gnoulAI : public ScriptedAI
  371. {
  372. npc_raging_gnoulAI(Creature *pCreature) : ScriptedAI(pCreature)
  373. {
  374. m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  375. me->setActive(true);
  376. Reset();
  377. }
  378.  
  379. InstanceScript* m_pInstance;
  380. uint32 EmergeTimer;
  381. bool Emerge;
  382. uint64 m_uiLiderGUID;
  383.  
  384. void Reset()
  385. {
  386. DoCast(me, SPELL_EMERGE_VISUAL);
  387. EmergeTimer = 4000;
  388. Emerge = false;
  389. }
  390.  
  391. void JustDied(Unit* pKiller)
  392. {
  393. if(!m_pInstance)
  394. return;
  395.  
  396. m_pInstance->SetData(DATA_SUMMONS, 0);
  397. }
  398.  
  399. void AttackStart(Unit* who)
  400. {
  401. if (!who)
  402. return;
  403.  
  404. if(Emerge == false)
  405. return;
  406.  
  407. ScriptedAI::AttackStart(who);
  408. }
  409.  
  410. void UpdateAI(const uint32 diff)
  411. {
  412. if(!m_pInstance)
  413. return;
  414.  
  415. if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  416. {
  417. if(Emerge != true)
  418. {
  419. if(EmergeTimer < diff)
  420. {
  421. //me->RemoveFlag(SPLINEFLAG_WALKING | MOVEMENTFLAG_WALKING, true);
  422. Emerge = true;
  423. m_uiLiderGUID = m_pInstance->GetData64(DATA_ESCAPE_LIDER);
  424. if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_uiLiderGUID)))
  425. {
  426. DoResetThreat();
  427. me->AI()->AttackStart(pLider);
  428. me->GetMotionMaster()->Clear();
  429. me->GetMotionMaster()->MoveChase(pLider);
  430. }
  431. }
  432. else
  433. EmergeTimer -= diff;
  434. }
  435. }
  436. DoMeleeAttackIfReady();
  437. }
  438. };
  439.  
  440. CreatureAI* GetAI(Creature* pCreature) const
  441. {
  442. return new npc_raging_gnoulAI(pCreature);
  443. }
  444.  
  445. };
  446.  
  447. class npc_risen_witch_doctor : public CreatureScript
  448. {
  449. public:
  450. npc_risen_witch_doctor() : CreatureScript("npc_risen_witch_doctor") { }
  451.  
  452. struct npc_risen_witch_doctorAI : public ScriptedAI
  453. {
  454. npc_risen_witch_doctorAI(Creature *pCreature) : ScriptedAI(pCreature)
  455. {
  456. m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  457. me->setActive(true);
  458. Reset();
  459. }
  460.  
  461. InstanceScript* m_pInstance;
  462. uint32 EmergeTimer;
  463. bool Emerge;
  464. uint64 m_uiLiderGUID;
  465.  
  466. void Reset()
  467. {
  468. DoCast(me, SPELL_EMERGE_VISUAL);
  469. EmergeTimer = 5000;
  470. Emerge = false;
  471. }
  472.  
  473. void JustDied(Unit* pKiller)
  474. {
  475. if(!m_pInstance)
  476. return;
  477.  
  478. m_pInstance->SetData(DATA_SUMMONS, 0);
  479.  
  480. }
  481.  
  482. void AttackStart(Unit* who)
  483. {
  484. if (!who)
  485. return;
  486.  
  487. if(Emerge == false)
  488. return;
  489.  
  490. ScriptedAI::AttackStart(who);
  491. }
  492.  
  493. void UpdateAI(const uint32 diff)
  494. {
  495. if(!m_pInstance)
  496. return;
  497.  
  498. if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  499. {
  500. if(Emerge != true)
  501. {
  502. if(EmergeTimer < diff)
  503. {
  504. Emerge = true;
  505. m_uiLiderGUID = m_pInstance->GetData64(DATA_ESCAPE_LIDER);
  506. if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_uiLiderGUID)))
  507. {
  508. DoResetThreat();
  509. me->AI()->AttackStart(pLider);
  510. me->GetMotionMaster()->Clear();
  511. me->GetMotionMaster()->MoveChase(pLider);
  512. }
  513. }
  514. else
  515. EmergeTimer -= diff;
  516. }
  517. }
  518. DoMeleeAttackIfReady();
  519. }
  520. };
  521.  
  522. CreatureAI* GetAI(Creature* pCreature) const
  523. {
  524. return new npc_risen_witch_doctorAI(pCreature);
  525. }
  526.  
  527. };
  528.  
  529. class npc_abon : public CreatureScript
  530. {
  531. public:
  532. npc_abon() : CreatureScript("npc_abon") { }
  533.  
  534. struct npc_abonAI : public ScriptedAI
  535. {
  536. npc_abonAI(Creature *pCreature) : ScriptedAI(pCreature)
  537. {
  538. m_pInstance = (InstanceScript*)pCreature->GetInstanceScript();
  539. me->setActive(true);
  540. Reset();
  541. }
  542.  
  543. InstanceScript* m_pInstance;
  544. uint64 m_uiLiderGUID;
  545. bool Walk;
  546.  
  547. void Reset()
  548. {
  549. Walk = false;
  550. }
  551.  
  552. void UpdateAI(const uint32 diff)
  553. {
  554. if(!m_pInstance) return;
  555.  
  556. if(m_pInstance->GetData(TYPE_LICH_KING) == IN_PROGRESS)
  557. {
  558. if(Walk != true)
  559. {
  560. Walk = true;
  561. m_uiLiderGUID = m_pInstance->GetData64(DATA_ESCAPE_LIDER);
  562. if(Creature* pLider = ((Creature*)Unit::GetUnit((*me), m_uiLiderGUID)))
  563. {
  564. DoResetThreat();
  565. me->AI()->AttackStart(pLider);
  566. me->GetMotionMaster()->Clear();
  567. me->GetMotionMaster()->MoveChase(pLider);
  568. }
  569. }
  570. }
  571. DoMeleeAttackIfReady();
  572. }
  573.  
  574. void JustDied(Unit* pKiller)
  575. {
  576. if(!m_pInstance)
  577. return;
  578.  
  579. m_pInstance->SetData(DATA_SUMMONS, 0);
  580. }
  581. };
  582.  
  583. CreatureAI* GetAI(Creature* pCreature) const
  584. {
  585. return new npc_abonAI(pCreature);
  586. }
  587. };
  588.  
  589. void AddSC_boss_lich_king_hr()
  590. {
  591. new boss_lich_king_hor();
  592. new npc_raging_gnoul();
  593. new npc_risen_witch_doctor();
  594. new npc_abon();
  595. }
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement