Guest User

Untitled

a guest
Jan 21st, 2018
68
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 11.59 KB | None | 0 0
  1. class boss_paletress : public CreatureScript
  2. {
  3. public:
  4. boss_paletress() : CreatureScript("boss_paletress") { }
  5.  
  6. struct boss_paletressAI : public ScriptedAI
  7. {
  8. boss_paletressAI(Creature* creature) : ScriptedAI(creature)
  9. {
  10. pInstance = creature->GetInstanceScript();
  11.  
  12. MemoryGUID = 0;
  13. MyGUID 0;
  14.  
  15. creature->RestoreFaction();
  16. creature->SetReactState(REACT_PASSIVE);
  17. creature->SetFlag(UNIT_FIELD_FLAGS, UNIT_FLAG_NON_ATTACKABLE);
  18. }
  19.  
  20. InstanceScript* pInstance;
  21.  
  22. Creature* pMemory;
  23. uint64 MemoryGUID;
  24. uint64 MyGUID;
  25.  
  26. bool bHealth;
  27. bool bDone;
  28.  
  29. uint32 uiHolyFireTimer;
  30. uint32 uiHolySmiteTimer;
  31. uint32 uiRenewTimer;
  32. uint32 uiResetTimer;
  33.  
  34. void Reset()
  35. {
  36. me->RemoveAllAuras();
  37.  
  38. uiHolyFireTimer = urand(9000,12000);
  39. uiHolySmiteTimer = urand(5000,7000);
  40. uiRenewTimer = urand(2000,5000);
  41.  
  42. uiResetTimer = 7000;
  43.  
  44. bHealth = false;
  45. bDone = false;
  46.  
  47. Creature* pMemory = Unit::GetCreature(*me, MemoryGUID);
  48. if (pMemory && pMemory->isAlive())
  49. pMemory->RemoveFromWorld();
  50. }
  51.  
  52. void SetData(uint32 uiId, uint32 /*uiValue*/)
  53. {
  54. if (uiId == 1)
  55. {
  56. me->RemoveAura(SPELL_SHIELD);
  57. DoScriptText(SAY_MEM_DIE, me);
  58. }
  59. }
  60.  
  61. void DamageTaken(Unit* /*done_by*/, uint32 &damage)
  62. {
  63. if (damage >= me->GetHealth())
  64. {
  65. damage = 0;
  66. EnterEvadeMode();
  67. me->RestoreFaction();
  68. bDone = true;
  69. DoScriptText(SAY_DEATH_P, me);
  70. if (GameObject* GO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE)))
  71. pInstance->HandleGameObject(GO->GetGUID(), true);
  72. if (GameObject* GO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE1)))
  73. pInstance->HandleGameObject(GO->GetGUID(), true);
  74.  
  75. pInstance->SetData(BOSS_ARGENT_CHALLENGE_P, DONE);
  76. // if (IsHeroic())
  77. // pInstance->DoCompleteAchievement(ACHIEV_CONF);
  78. }
  79. }
  80.  
  81. void EnterCombat(Unit* /*who*/)
  82. {
  83. DoScriptText(SAY_START_P, me);
  84. }
  85.  
  86. void KilledUnit(Unit* /*pVictim*/)
  87. {
  88. DoScriptText(urand(0, 1) ? SAY_KILL1_P : SAY_KILL2_P, me);
  89. if (pInstance)
  90. pInstance->SetData(BOSS_ARGENT_CHALLENGE_P, IN_PROGRESS);
  91. }
  92.  
  93. void UpdateAI(const uint32 uiDiff)
  94. {
  95. if (bDone && uiResetTimer <= uiDiff)
  96. {
  97. me->GetMotionMaster()->MovePoint(0, 746.843f, 695.68f, 412.339f);
  98. pInstance->SetData(BOSS_ARGENT_CHALLENGE_P, DONE);
  99. me->DisappearAndDie();
  100. bDone = false;
  101.  
  102. if (GameObject* GO = GameObject::GetGameObject(*me, pInstance->GetData64(DATA_MAIN_GATE)))
  103. pInstance->HandleGameObject(GO->GetGUID(), true);
  104. }
  105. else
  106. uiResetTimer -= uiDiff;
  107.  
  108. if (!UpdateVictim())
  109. return;
  110.  
  111.  
  112. // Holy Fire
  113. if (uiHolyFireTimer <= uiDiff)
  114. {
  115. Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true);
  116. if (target && target->isAlive())
  117. DoCast(target, DUNGEON_MODE(SPELL_HOLY_FIRE,SPELL_HOLY_FIRE_H));
  118. if (me->HasAura(SPELL_SHIELD))
  119. uiHolyFireTimer = 13000;
  120. else
  121. uiHolyFireTimer = urand(9000,12000);
  122. }
  123. else
  124. uiHolyFireTimer -= uiDiff;
  125.  
  126. // Holy Smite
  127. if (uiHolySmiteTimer <= uiDiff)
  128. {
  129. Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true);
  130. if (target && target->isAlive())
  131. DoCast(target, DUNGEON_MODE(SPELL_SMITE,SPELL_SMITE_H));
  132. if (me->HasAura(SPELL_SHIELD))
  133. uiHolySmiteTimer = 9000;
  134. else
  135. uiHolySmiteTimer = urand(5000, 7000);
  136. }
  137. else
  138. uiHolySmiteTimer -= uiDiff;
  139.  
  140. if (me->HasAura(SPELL_SHIELD))
  141. {
  142. // Renew
  143. if (uiRenewTimer <= uiDiff)
  144. {
  145. me->InterruptNonMeleeSpells(true);
  146. uint8 uiTarget = urand(0, 1);
  147. switch (uiTarget)
  148. {
  149. case 0:
  150. DoCast(me, DUNGEON_MODE(SPELL_RENEW,SPELL_RENEW_H));
  151. break;
  152. case 1:
  153. Creature *pMemory = Unit::GetCreature(*me, MemoryGUID);
  154. if (pMemory && pMemory->isAlive())
  155. DoCast(pMemory, DUNGEON_MODE(SPELL_RENEW,SPELL_RENEW_H));
  156. break;
  157. }
  158. uiRenewTimer = urand(15000,17000);
  159. }
  160. else
  161. uiRenewTimer -= uiDiff;
  162. }
  163.  
  164. if (!bHealth && !HealthAbovePct(25))
  165. {
  166. bHealth = true;
  167.  
  168. me->InterruptNonMeleeSpells(true);
  169. DoCastAOE(SPELL_HOLY_NOVA, false);
  170. DoCast(me, SPELL_SHIELD);
  171. DoCastAOE(SPELL_SUMMON_MEMORY, false);
  172. DoCastAOE(SPELL_CONFESS, false);
  173.  
  174. uint8 memoryRand = urand(0, 24);
  175. sLog->outError("memory: %u", memoryRand);
  176. int16 memoryId;
  177. switch(memoryRand)
  178. {
  179. case 0:
  180. memoryId = MEMORY_ALGALON;
  181. break;
  182. case 1:
  183. memoryId = MEMORY_CHROMAGGUS;
  184. break;
  185. case 2:
  186. memoryId = MEMORY_CYANIGOSA;
  187. break;
  188. case 3:
  189. memoryId = MEMORY_DELRISSA;
  190. break;
  191. case 4:
  192. memoryId = MEMORY_ECK;
  193. break;
  194. case 5:
  195. memoryId = MEMORY_ENTROPIUS;
  196. break;
  197. case 6:
  198. memoryId = MEMORY_GRUUL;
  199. break;
  200. case 7:
  201. memoryId = MEMORY_HAKKAR;
  202. break;
  203. case 8:
  204. memoryId = MEMORY_HEIGAN;
  205. break;
  206. case 9:
  207. memoryId = MEMORY_HEROD;
  208. break;
  209. case 10:
  210. memoryId = MEMORY_HOGGER;
  211. break;
  212. case 11:
  213. memoryId = MEMORY_IGNIS;
  214. break;
  215. case 12:
  216. memoryId = MEMORY_ILLIDAN;
  217. break;
  218. case 13:
  219. memoryId = MEMORY_INGVAR;
  220. break;
  221. case 14:
  222. memoryId = MEMORY_KALITHRESH;
  223. break;
  224. case 15:
  225. memoryId = MEMORY_LUCIFRON;
  226. break;
  227. case 16:
  228. memoryId = MEMORY_MALCHEZAAR;
  229. break;
  230. case 17:
  231. memoryId = MEMORY_MUTANUS;
  232. break;
  233. case 18:
  234. memoryId = MEMORY_ONYXIA;
  235. break;
  236. case 19:
  237. memoryId = MEMORY_THUNDERAAN;
  238. break;
  239. case 20:
  240. memoryId = MEMORY_VANCLEEF;
  241. break;
  242. case 21:
  243. memoryId = MEMORY_VASHJ;
  244. break;
  245. case 22:
  246. memoryId = MEMORY_VEKNILASH;
  247. break;
  248. case 23:
  249. memoryId = MEMORY_VEZAX;
  250. break;
  251. case 24:
  252. memoryId = MEMORY_ARCHIMONDE;
  253. break;
  254. }
  255. sLog->outError("memory: %i", memoryId);
  256. me->SummonCreature(memoryId, 0.0f, 0.0f, 0.0f, 0, TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, 5000);
  257. }
  258.  
  259. DoMeleeAttackIfReady();
  260. }
  261.  
  262. void JustSummoned(Creature* summon)
  263. {
  264. MemoryGUID = summon->GetGUID();
  265. }
  266. };
  267.  
  268. CreatureAI* GetAI(Creature* creature) const
  269. {
  270. return new boss_paletressAI(creature);
  271. }
  272. };
  273.  
  274. class npc_memory : public CreatureScript
  275. {
  276. public:
  277. npc_memory() : CreatureScript("npc_memory") { }
  278.  
  279. struct npc_memoryAI : public ScriptedAI
  280. {
  281. npc_memoryAI(Creature* creature) : ScriptedAI(creature) {}
  282.  
  283. uint32 uiOldWoundsTimer;
  284. uint32 uiShadowPastTimer;
  285. uint32 uiWakingNightmare;
  286.  
  287. void Reset()
  288. {
  289. uiOldWoundsTimer = 12000;
  290. uiShadowPastTimer = 5000;
  291. uiWakingNightmare = 7000;
  292. }
  293. void EnterCombat(Unit* /*who*/)
  294. {
  295. MyGUID = me->GetGUID;
  296. if (MyGUID != MemoryGUID)
  297. me->DespawnOrUnsummon;
  298. }
  299.  
  300. void UpdateAI(const uint32 uiDiff)
  301. {
  302. if (!UpdateVictim())
  303. return;
  304.  
  305. // Old Wounds
  306. if (uiOldWoundsTimer <= uiDiff)
  307. {
  308. Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0);
  309. if (target && target->isAlive())
  310. DoCast(target, DUNGEON_MODE(SPELL_OLD_WOUNDS, SPELL_OLD_WOUNDS_H));
  311. uiOldWoundsTimer = 12000;
  312. }
  313. else
  314. uiOldWoundsTimer -= uiDiff;
  315.  
  316. if (uiWakingNightmare <= uiDiff)
  317. {
  318. DoCast(me, DUNGEON_MODE(SPELL_WAKING_NIGHTMARE, SPELL_WAKING_NIGHTMARE_H));
  319. uiWakingNightmare = 7000;
  320. }
  321. else
  322. uiWakingNightmare -= uiDiff;
  323.  
  324. // Shadows of the Past
  325. if (uiShadowPastTimer <= uiDiff)
  326. {
  327. Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 1);
  328. if (target && target->isAlive())
  329. DoCast(target, DUNGEON_MODE(SPELL_SHADOWS_PAST,SPELL_SHADOWS_PAST_H));
  330. uiShadowPastTimer = 5000;
  331. }
  332. else
  333. uiShadowPastTimer -= uiDiff;
  334.  
  335. DoMeleeAttackIfReady();
  336. }
  337.  
  338. void JustDied(Unit* /*pKiller*/)
  339. {
  340. if (me->isSummon())
  341. {
  342. Unit* pSummoner = me->ToTempSummon()->GetSummoner();
  343. if (pSummoner && pSummoner->isAlive())
  344. pSummoner->GetAI()->SetData(1, 0);
  345. }
  346. }
  347. };
  348.  
  349. CreatureAI* GetAI(Creature* creature) const
  350. {
  351. return new npc_memoryAI(creature);
  352. }
  353. };
Add Comment
Please, Sign In to add comment