Guest User

Untitled

a guest
May 26th, 2018
81
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 17.46 KB | None | 0 0
  1. /***********************
  2. * Scripted by Jinung
  3. * for Shindo'Rei
  4. * Core 4.0.6
  5. *
  6. * Salles des Origines
  7. * Boss - RAJH
  8. *
  9. ***********************/
  10.  
  11. #include"ScriptPCH.h"
  12. #include"WorldPacket.h"
  13. #include"halls_of_origination.h"
  14. #include"ScriptMgr.h"
  15. #include"ScriptedCreature.h"
  16. #include"SpellScript.h"
  17. #include"SpellAuraEffects.h"
  18.  
  19. enum Spells
  20. {
  21. Coupdesoleil = 73872,
  22. Bonddufeu = 87653,
  23. Ventsolaires = 89130,
  24. Feusolaire = 89131,
  25. Benediction = 76355,
  26. Invocorb = 76338,
  27. Berz = 26662,
  28. Bond = 82856,
  29. Chanorb = 80352,
  30. Indicateur = 82643,
  31. SPELL_AURA_spell_Dotsoleil = 44444, //Id pour l'appeler?
  32. SPELL_AURA_spell_BumpnDamage = 44445, //Id pour l'appeler?
  33.  
  34.  
  35. };
  36.  
  37. enum NPC
  38. {
  39. mobs_ventsolaire = 47922,
  40. mobs_orbdusoleil = 40835,
  41. mobs_flamesvent = 888888, //id????
  42. mobs_indicateur = 999999, //id????
  43. };
  44.  
  45. class Rajh : public CreatureScript
  46. {
  47. public:
  48. Rajh() : CreatureScript("Rajh"){}
  49.  
  50. CreatureAI* GetAI(Creature* pCreature) const
  51. {
  52. return new RajhAI(pCreature);
  53. }
  54.  
  55. struct RajhAI : public ScriptedAI
  56. {
  57. //imperatif a chaque boss
  58. RajhAI(Creature* pCreature) : ScriptedAI(pCreature)
  59. {
  60. pMap = me->GetMap();
  61. pInstance = pCreature->GetInstanceScript();
  62. }
  63.  
  64. InstanceScript *pInstance;
  65.  
  66. bool check_in;
  67. Map* pMap;
  68.  
  69. uint32 Coupdesoleil_timer;
  70. uint32 Bonddufeu_timer;
  71. uint32 Ventsolaires_timer;
  72. uint32 Chanorb_timer;
  73. uint32 Power;
  74. uint32 Berz_timer;
  75.  
  76.  
  77. //Fonction Reset
  78. void Reset()
  79. {
  80.  
  81.  
  82. // les DATA sont dans le .h de l'instance
  83. if (pInstance && (pInstance->GetData(DATA_RAJH_EVENT) != DONE && !check_in))
  84. pInstance->SetData(DATA_RAJH, NOT_STARTED);
  85. check_in = false;
  86. //CR Sheero
  87. if (IsHeroic())
  88. me->SetHealth(5137000);
  89. //Fin CR
  90. Coupdesoleil_timer = 8000; //CD non blizz (à vérifier)
  91. Bonddufeu_timer = 15000;
  92. Ventsolaires_timer = 10000;
  93. Chanorb_timer = 10000;
  94. Berz_timer = 480000;
  95.  
  96. Power = 100;
  97.  
  98.  
  99. me->ApplySpellImmune(0, IMMUNITY_STATE, SPELL_AURA_MOD_STUN, true); //Prot
  100. me->ApplySpellImmune(0, IMMUNITY_EFFECT, SPELL_EFFECT_KNOCK_BACK, true); //Prot
  101. }
  102.  
  103. void KilledUnit(Unit* /*Killed*/)
  104. {
  105. switch(urand(0,1))
  106. {
  107.  
  108. case 0:me->MonsterYell("Je prends cette vie en guise d'offrande !",LANG_UNIVERSAL,NULL);
  109. break;
  110.  
  111. case 1:me->MonsterYell("Je vous renvoie à vos dieux.",LANG_UNIVERSAL,NULL);
  112. break;
  113.  
  114. }
  115. }
  116.  
  117. void JustDied(Unit* /*Kill*/)
  118. {
  119. switch(urand(1,1000))
  120. {
  121. default:me->MonsterYell("Lumière étincelante… Emporte-moi.",LANG_UNIVERSAL,NULL);
  122. break;
  123. case 666:me->MonsterYell("Jinung est-ce toi?",LANG_UNIVERSAL,NULL);
  124. break;
  125. }
  126. if (pInstance)
  127. pInstance->SetData(DATA_RAJH_EVENT, DONE);
  128. //CR Sheero
  129. if (IsHeroic())
  130. {
  131. AchievementEntry const *AchievHero = GetAchievementStore()->LookupEntry(5065);
  132. if (AchievHero)
  133. {
  134. if (pMap && pMap->IsDungeon())
  135. {
  136. Map::PlayerList const &players = pMap->GetPlayers();
  137. for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  138.  
  139. itr->getSource()->CompletedAchievement(AchievHero);
  140. }
  141. }
  142. }
  143. AchievementEntry const *Achiev = GetAchievementStore()->LookupEntry(4841);
  144. if (Achiev)
  145. {
  146. if (pMap && pMap->IsDungeon())
  147. {
  148. Map::PlayerList const &players = pMap->GetPlayers();
  149. for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  150. itr->getSource()->CompletedAchievement(Achiev);
  151. }
  152. }
  153. //Fin CR
  154. }
  155.  
  156. void EnterCombat(Unit* /*Ent*/)
  157. {
  158. me->MonsterYell("Profanateurs ! Misérables ! Monstres ! Sortez d'ici !",LANG_UNIVERSAL,NULL);
  159. if (pInstance)
  160. pInstance->SetData(DATA_RAJH_EVENT, IN_PROGRESS);
  161.  
  162. DoZoneInCombat();
  163. }
  164.  
  165. //Fonction Update
  166. void UpdateAI(const uint32 uiDiff)
  167. {
  168. if (!UpdateVictim())
  169. return;
  170.  
  171. //Coupdesoeil
  172. if(Coupdesoleil_timer <= uiDiff)
  173. {
  174.  
  175. DoCastAOE(Coupdesoleil,true);
  176. Unit * ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 50, true);
  177.  
  178. if(IsHeroic())
  179. {
  180. Map::PlayerList const &players = pMap->GetPlayers();
  181. for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  182. if(me->IsWithinDistInMap(itr->getSource(), 50.0f))
  183. {
  184. me->DealDamage(itr->getSource(),urand(3237, 3762));
  185. DoCast(me->getVictim(), SPELL_AURA_spell_Dotsoleil ,true);
  186. }
  187. }
  188.  
  189. else
  190. {
  191. Map::PlayerList const &players = pMap->GetPlayers();
  192. for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  193. if(me->IsWithinDistInMap(itr->getSource(), 50.0f))
  194. {
  195. me->DealDamage(itr->getSource(),urand(14137, 15862));
  196. DoCast(me->getVictim(), SPELL_AURA_spell_Dotsoleil ,true);
  197. }
  198. }
  199.  
  200.  
  201. me->ModifyPower(me->GetPower(POWER_MANA) - 20);
  202.  
  203. }
  204.  
  205. else
  206. Coupdesoleil_timer -= uiDiff;
  207.  
  208. //Bonddufeu
  209. if(Bonddufeu_timer <= uiDiff)
  210. {
  211. Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 250, true);
  212.  
  213. me->CastSpell(ptarget, Bonddufeu, true); //Channel 1.5s sans saut
  214.  
  215. me->SummonCreature(mobs_indicateur, ptarget); //// Spell qui met un indicateur sur la personne qui va se faire cibléparer le Bond
  216.  
  217. me->GetMotionMaster()->MovePoint(uint32, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()+ 5.0f); //Eleve de 5m vers le haut
  218.  
  219. me->DoCast(ptarget, Bond, true);
  220.  
  221.  
  222.  
  223. me->ModifyPower(me->GetPower(POWER_MANA) - 20);
  224. }
  225. else
  226. Bonddufeu_timer -= uiDiff;
  227.  
  228. //Ventsolaires
  229.  
  230. if(Ventsolaires_timer <= uiDiff)
  231. {
  232. me->SummonCreature(mobs_ventsolaire, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ(),1.0f); //Cast devant soit
  233. me->ModifyPower(me->GetPower(POWER_MANA) - 20);
  234. }
  235. else
  236. Ventsolaires_timer -= uiDiff;
  237.  
  238.  
  239. //Orb du soleil
  240.  
  241. if(Chanorb_timer <= uiDiff)
  242. {
  243. Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 5000, true);
  244.  
  245. for(int i=0; i<=1500; i++) //temps d'attente = 1.5s (remplace le channeling)
  246. {
  247. //nothing
  248. }
  249.  
  250. me->SummonCreature(mobs_orbdusoleil, me->GetPositionX(), me->GetPositionY(), me->GetPositionZ() + 20.0f,1.0f);
  251.  
  252.  
  253. me->ModifyPower(me->GetPower(POWER_MANA) - 20);
  254. }
  255.  
  256. //Bénédiction du Soleil
  257.  
  258. if(me->GetPower(POWER_MANA) <= 10)
  259. {
  260. me->GetMotionMaster()->MovePoint(uint32, -319.596161, 193.420105, 342.945282); //Milieu salle
  261. me->MonsterYell("Sentez-vous cette caresse ? La chaleur bénie du soleil … ?",LANG_UNIVERSAL,NULL);
  262.  
  263. for(int i = 0 ; i <= 20; i++)
  264. {
  265. DoCastAOE(Benediction, true);
  266. if(IsHeroic())
  267. {
  268. Map::PlayerList const &players = pMap->GetPlayers();
  269. for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  270. me->DealDamage(itr->getSource(),urand(4162, 4837));
  271.  
  272. me->ModifyPower(me->GetPower(POWER_MANA) + 5);
  273.  
  274. }
  275. else
  276. {
  277. Map::PlayerList const &players = pMap->GetPlayers();
  278. for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  279. me->DealDamage(itr->getSource(),urand(3237, 3762));
  280.  
  281. me->ModifyPower(me->GetPower(POWER_MANA) + 5);
  282. }
  283. }
  284. }
  285.  
  286. if(Berz_timer <= uiDiff)
  287. {
  288. DoCast(me, Berz);
  289. }
  290. else
  291. Berz_timer -= uiDiff;
  292.  
  293. DoMeleeAttackIfReady();
  294.  
  295. }
  296.  
  297. };
  298. };
  299.  
  300. class mobs_vents_solaires : public CreatureScript
  301. {
  302. public:
  303. mobs_vents_solaires() : CreatureScript("mobs_vents_solaires") { }
  304.  
  305. CreatureAI* GetAI(Creature* creature) const
  306. {
  307. return new mobs_vents_solairesAI (creature);
  308. }
  309.  
  310. struct mobs_vents_solairesAI : public ScriptedAI
  311. {
  312. mobs_vents_solairesAI(Creature* creature) : ScriptedAI(creature) { }
  313.  
  314. uint32 uiCheckDistanceTimer;
  315. uint32 Feusolaire_timer;
  316. uint32 Spawn_timer;
  317.  
  318. void Reset()
  319. {
  320. uiCheckDistanceTimer = 2*IN_MILLISECONDS;
  321. Feusolaire_timer = 1500; // A ajuster en fct° de la vitesse des tornades
  322. Spawn_timer = 20000;
  323. }
  324.  
  325. void EnterCombat(Unit* /*pWho*/) { }
  326.  
  327. void JustDied(Unit* /*Killer*/) {}
  328.  
  329. void UpdateAI(const uint32 Diff)
  330. {
  331. if (!UpdateVictim())
  332. return;
  333.  
  334. Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 5000, true);
  335. me->GetMotionMaster()->MoveChase(ptarget);
  336.  
  337. if (me->IsWithinDistInMap(ptarget, 2.0f))
  338. {
  339. if (uiCheckDistanceTimer <= Diff)
  340. {
  341. me->CastSpell(ptarget, SPELL_AURA_spell_BumpnDamage, true);
  342.  
  343. uiCheckDistanceTimer = 86400*IN_MILLISECONDS;
  344. }
  345. else uiCheckDistanceTimer -= Diff;
  346. }
  347.  
  348. if(Feusolaire_timer <= Diff)
  349. {
  350. me->SummonCreature(mobs_flamesvent, me->GetPositionX(),me->GetPositionY(),me->GetPositionZ(),1.0f); //crée mobs_flames sur soi
  351. }
  352. else Feusolaire_timer -= Diff;
  353.  
  354. if(Spawn_timer <= Diff)
  355. {
  356. me->DespawnOrUnsummon();
  357. }
  358. //Do not attack
  359. }
  360. };
  361. };
  362.  
  363. class mobs_orbdusoleil : public CreatureScript
  364. {
  365. public:
  366. mobs_orbdusoleil() : CreatureScript("mobs_orbdusoleil") { }
  367.  
  368. CreatureAI* GetAI(Creature* creature) const
  369. {
  370. return new mobs_orbdusoleilAI (creature);
  371. }
  372.  
  373. struct mobs_orbdusoleilAI : public ScriptedAI
  374. {
  375. mobs_orbdusoleilAI(Creature* creature) : ScriptedAI(creature) { }
  376.  
  377. uint32 attente;
  378. Position *PosTar;
  379. Map *pMap;
  380.  
  381. void Reset()
  382. {
  383. attente = 1000;
  384. }
  385.  
  386. void EnterCombat(Unit* /*pWho*/) { }
  387.  
  388. void JustDied(Unit* /*Killer*/) {}
  389.  
  390. void UpdateAI(const uint32 Diff)
  391. {
  392. if (!UpdateVictim())
  393. return;
  394. if(attente <= Diff)
  395. {
  396.  
  397. Unit *ptarget = SelectTarget(SELECT_TARGET_RANDOM, 0, 5000, true);
  398.  
  399. if (ptarget && ptarget->isAlive())
  400. {
  401. ptarget->GetPosition(PosTar);
  402. me->SetOrientation(me->GetAngle(ptarget));
  403. me->GetNearPosition(*PosTar, 10.0f, 0.0f);
  404.  
  405. }
  406.  
  407. if(ptarget->GetPositionX(), ptarget->GetPositionY(), ptarget->GetPositionZ())
  408. {
  409. Map::PlayerList const &players = pMap->GetPlayers();
  410. for (Map::PlayerList::const_iterator itr = players.begin(); itr != players.end(); ++itr)
  411. if(me->IsWithinDistInMap(itr->getSource(), 10.0f))
  412. {
  413. me->DealDamage(itr->getSource(),urand(18500, 21500));
  414.  
  415. }
  416. }
  417.  
  418. me->DespawnOrUnsummon();
  419. }
  420. //Do not attack
  421. }
  422. };
  423. };
  424.  
  425. class mobs_flamesvent : public CreatureScript
  426. {
  427. public:
  428. mobs_flamesvent() : CreatureScript("mobs_flamesvent") { }
  429.  
  430. CreatureAI* GetAI(Creature* creature) const
  431. {
  432. return new mobs_flamesventAI (creature);
  433. }
  434.  
  435. struct mobs_flamesventAI : public ScriptedAI
  436. {
  437. mobs_flamesventAI(Creature* creature) : ScriptedAI(creature) { }
  438.  
  439. uint32 Feusolaire_timer;
  440. uint32 Spawn_timer;
  441.  
  442. void Reset()
  443. {
  444.  
  445. Feusolaire_timer = 1420;
  446. Spawn_timer = 7100;
  447. }
  448.  
  449. void EnterCombat(Unit* /*pWho*/) { }
  450.  
  451. void JustDied(Unit* /*Killer*/) {}
  452.  
  453. void UpdateAI(const uint32 Diff)
  454. {
  455. if (!UpdateVictim())
  456. return;
  457.  
  458. if(Feusolaire_timer <= Diff)
  459. {
  460. DoCast(me, Feusolaire);
  461. }
  462. else Feusolaire_timer -= Diff;
  463.  
  464. if(Spawn_timer <= Diff)
  465. {
  466. me->DespawnOrUnsummon();
  467. }
  468. //Do not attack
  469. }
  470. };
  471. };
  472.  
  473. class mobs_indicateur : public CreatureScript
  474. {
  475. public:
  476. mobs_indicateur() : CreatureScript("mobs_indicateur") { }
  477.  
  478. CreatureAI* GetAI(Creature* creature) const
  479. {
  480. return new mobs_indicateurAI (creature);
  481. }
  482.  
  483. struct mobs_indicateurAI : public ScriptedAI
  484. {
  485. mobs_indicateurAI(Creature* creature) : ScriptedAI(creature) { }
  486.  
  487. uint32 Indicateur_timer;
  488. uint32 Spawn_timer;
  489.  
  490. void Reset()
  491. {
  492.  
  493. Indicateur_timer = 500;
  494. Spawn_timer = 900;
  495. }
  496.  
  497. void EnterCombat(Unit* /*pWho*/) { }
  498.  
  499. void JustDied(Unit* /*Killer*/) {}
  500.  
  501. void UpdateAI(const uint32 Diff)
  502. {
  503. if (!UpdateVictim())
  504. return;
  505.  
  506. if(Indicateur_timer <= Diff)
  507. {
  508. DoCast(me, Indicateur);
  509. }
  510. else Indicateur_timer -= Diff;
  511.  
  512. if(Spawn_timer <= Diff)
  513. {
  514. me->DespawnOrUnsummon();
  515. }
  516. //Do not attack
  517. }
  518.  
  519. };
  520. };
  521.  
  522. class spell_BumpnDamage : public SpellScriptLoader
  523. {
  524. public:
  525. spell_BumpnDamage() : SpellScriptLoader("spell_BumpnDamage") { }
  526.  
  527. class spell_BumpnDamage_AuraScript : public AuraScript
  528. {
  529. PrepareAuraScript(spell_BumpnDamage_AuraScript)
  530.  
  531. enum Spells
  532. {
  533. // SPELL_X = ,
  534. };
  535.  
  536. bool Load()
  537. {
  538. //Si caster = player, ne s'active pas.
  539. if (Unit * caster = GetCaster())
  540. if (caster->GetTypeId() == TYPEID_PLAYER)
  541. return false;
  542. return true;
  543. }
  544.  
  545.  
  546. //void Unload(){}
  547.  
  548. void HandleEffectApply(AuraEffect const * /*aurEff*/, AuraEffectHandleModes /*mode*/)
  549. {
  550. Unit * caster = GetCaster();
  551. sLog->outString("Aura Effect is about to be applied on target!");
  552.  
  553. Unit *target = caster->SelectNearbyTarget(5.0f);
  554.  
  555.  
  556. target->DealDamage(target, urand(9620, 11180));
  557.  
  558. target->KnockbackFrom(caster->GetPositionX(), caster->GetPositionY(), 5.0, 2.0); //Speed à régler 5.0 = xy ; 2.0 = z
  559. }
  560.  
  561.  
  562.  
  563.  
  564. void Register()
  565. {
  566.  
  567. OnEffectApply += AuraEffectApplyFn(spell_BumpnDamage_AuraScript::HandleEffectApply, EFFECT_0, SPELL_AURA_DUMMY, AURA_EFFECT_HANDLE_REAL);
  568.  
  569.  
  570. }
  571. };
  572.  
  573. AuraScript *GetAuraScript() const
  574. {
  575. return new spell_BumpnDamage_AuraScript();
  576. }
  577. };
  578.  
  579. class spell_Dotsoleil : public SpellScriptLoader
  580. {
  581. public:
  582. spell_Dotsoleil() : SpellScriptLoader("spell_Dotsoleil") { }
  583.  
  584. class spell_Dotsoleil_AuraScript : public AuraScript
  585. {
  586. PrepareAuraScript(spell_Dotsoleil_AuraScript)
  587.  
  588. enum Spells
  589. {
  590.  
  591. };
  592.  
  593. bool Load()
  594. {
  595. //Si caster = player, ne s'active pas.
  596. if (Unit * caster = GetCaster())
  597. if (caster->GetTypeId() == TYPEID_PLAYER)
  598. return false;
  599. return true;
  600. }
  601.  
  602.  
  603. //void Unload(){}
  604.  
  605. void HandleEffectCalcAmount(AuraEffect const * /*aurEff*/, int32 & amount, bool & canBeRecalculated)
  606. {
  607. sLog->outString("Amount of Aura Effect is being calculated now!");
  608. // we're setting amount to 5
  609. amount = 5;
  610. // amount will be never recalculated due to applying passive aura
  611. canBeRecalculated = false;
  612. }
  613.  
  614. void HandleEffectCalcPeriodic(AuraEffect const * /*aurEff*/, bool & isPeriodic, int32 & amplitude)
  615. {
  616. sLog->outString("Periodic data of Aura Effect is being calculated now!");
  617. // we're setting aura to be periodic and tick every 3 seconds
  618. isPeriodic = true;
  619. amplitude = 3 * IN_MILLISECONDS;
  620. }
  621.  
  622. void HandleEffectPeriodic(AuraEffect const * /*aurEff*/)
  623. {
  624. Map *pMap;
  625. if(pMap->IsHeroic())
  626. {
  627. sLog->outString("Perioidic Aura Effect IF_HEROIC_DJ is does a tick on target!");
  628. Unit * target = GetTarget();
  629. // aura targets damage self on tick
  630. target->DealDamage(target, urand(7500 , 8500));
  631. return;
  632. }
  633.  
  634. Unit * target = GetTarget();
  635. // aura targets damage self on tick
  636. target->DealDamage(target, urand(4687, 5312));
  637. }
  638.  
  639.  
  640.  
  641. void Register()
  642. {
  643. OnEffectPeriodic += AuraEffectPeriodicFn(spell_Dotsoleil_AuraScript::HandleEffectPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
  644. DoEffectCalcAmount += AuraEffectCalcAmountFn(spell_Dotsoleil_AuraScript::HandleEffectCalcAmount, EFFECT_0, SPELL_AURA_DUMMY);
  645. DoEffectCalcPeriodic += AuraEffectCalcPeriodicFn(spell_Dotsoleil_AuraScript::HandleEffectCalcPeriodic, EFFECT_0, SPELL_AURA_DUMMY);
  646.  
  647. }
  648. };
  649.  
  650. AuraScript *GetAuraScript() const
  651. {
  652. return new spell_Dotsoleil_AuraScript();
  653. }
  654. };
  655.  
  656. void AddSC_Rajh()
  657. {
  658. new Rajh();
  659. new mobs_vents_solaires();
  660. new mobs_orbdusoleil();
  661. new mobs_flamesvent();
  662. new mobs_indicateur();
  663. new spell_BumbnDamage();
  664. new spell_Dotsoleil();
  665.  
  666. }
Add Comment
Please, Sign In to add comment