Jump to content
TrinityCore
Rudnikov

Legion/scripts/MawOfSouls/boss_helya_maw.cpp

Recommended Posts

#include "ScriptMgr.h"
1 #include "ScriptedCreature.h"
2 #include "maw_of_souls.h"
   
3 enum Spells {
4 // Helya Spells
5 SPELL_HELYA_TORRENT_SIEGE = 197805,
6 SPELL_HELYA_TORRENT_BREACH = 198495,
7 SPELL_HELYA_WING_BUFFET = 198520,
8 SPELL_HELYA_CORRUPTED = 227223,
9 SPELL_HELYA_SUBMERGED = 196947,
10 SPELL_HELYA_BARRAGE = 202088,
   
11 // Destructor Tentacle Spells
12 SPELL_DESTRUCTOR_SMASH = 196534,
13 SPELL_DESTRUCTOR_RUPTURE = 185539,
   
14 // Grasping Tentacle Spells
   
   
15 // Piercing Tentacle Spells
16 SPELL_PIERCING_TENTACLE = 197117,
17 };
   
18 enum CreaturesIds {
19 NPC_DESTRUCTOR_TENTACLE = 99801, // Level 112
20 NPC_GRASPING_TENTACLE = 100360, // Level 111
21 NPC_PIERCING_TENTACLE = 100188, // Level 112
22 };
   
23 enum Auras {
24 AURA_HELYA_TAINT = 197262
25 };
   
26 enum Yells {
27 YELL_PRE_ENCOUNTER = 0,
28 YELL_ENTER_COMBAT = 1,
29 YELL_TAINT = 2,
30 YELL_TENTACLE = 3,
31 YELL_CORRUPTED = 4,
32 YELL_KILL = 5,
33 YELL_WIPE = 6,
34 YELL_KILLED = 7
35 };
   
36 enum Events {
37 EVENT_TAINT = 1,
38 EVENT_BARRAGE = 2
39 };
   
40 enum Phases {
41 PHASE_SIEGE = 0,
42 PHASE_SUBMERGE = 1,
43 PHASE_BREACH = 2
44 };
   
   
45 class boss_helya_maw : public CreatureScript {
46 public:
47 boss_helya_maw() : CreatureScript("boss_helya_maw") {}
   
48 struct boss_helya_mawAI : public BossAI {
49 boss_helya_mawAI(Creature* creature) : BossAI(creature, DATA_HELYA_MAW) {
50 Initialize();
51 SetCombatMovement(false);
52 }
   
53 void Initialize() {
54 DifficultyModifier();
55 Phase = PHASE_SIEGE;
56 if(isHeroic || isMythic) {
57 events.ScheduleEvent(EVENT_TAINT, 1 * IN_MILLISECONDS, PHASE_SIEGE);
58 events.ScheduleEvent(EVENT_BARRAGE, 42 * IN_MILLISECONDS, PHASE_SIEGE);
59 }
60 }
   
61 void Reset() override {
62 _Reset();
63 Initialize();
64 //summons.DespawnAll();
65 }
   
66 void DifficultyModifier() {
67 Difficulty instanceDifficulty = instance->instance->GetDifficultyID();
68 uint64 myHealth = me->GetHealth();
69 double healthModifier;
70 double damageModifier;
   
71 if(instanceDifficulty == DIFFICULTY_NORMAL) {
72 healthModifier = 1.0;
73 damageModifier = 1.0;
74 } else if(instanceDifficulty == DIFFICULTY_HEROIC) {
75 healthModifier = 1.29687495317; // HealthModifier 36.99
76 damageModifier = 1.30167051743;
77 isHeroic = true;
78 } else if(instanceDifficulty == DIFFICULTY_MYTHIC) {
79 healthModifier = 1.62109363383; // HealthModifier 46.25
80 damageModifier = 1.82000519133;
81 isMythic = true;
82 } else {
83 healthModifier = 20;
84 damageModifier = 20;
85 }
86 uint64 difficultyAdjustedHealth = static_cast<unsigned long long>(myHealth * healthModifier);
87 me->SetMaxHealth(difficultyAdjustedHealth);
88 me->SetHealth(difficultyAdjustedHealth);
89 me->SetModifierValue(UNIT_MOD_DAMAGE_MAINHAND, BASE_VALUE, static_cast<float>(damageModifier));
90 }
   
91 void EnterCombat(Unit* victim) override {
92 BossAI::EnterCombat(victim);
93 instance->SetBossState(DATA_HELYA_MAW, IN_PROGRESS);
94 Talk(YELL_ENTER_COMBAT);
95 DoZoneInCombat();
96 }
   
97 void JustDied(Unit* /*killer*/) override {
98 _JustDied();
99 Talk(YELL_KILLED);
100 //summons.DespawnAll();
101 instance->SetBossState(DATA_HELYA_MAW, DONE);
102 }
   
103 void EnterEvadeMode(EvadeReason /*why*/) override {
104 instance->SetBossState(DATA_HELYA_MAW, FAIL);
105 //summons.DespawnAll();
106 me->CombatStop();
107 me->DespawnOrUnsummon();
108 me->SetCorpseDelay(5);
109 me->SetRespawnDelay(10);
110 me->RemoveAllAuras();
111 events.Reset();
112 Initialize();
113 }
   
114 void KilledUnit(Unit* victim) override {
115 if(victim->GetTypeId() == TYPEID_PLAYER)
116 Talk(YELL_KILL);
117 }
   
118 void JustSummoned(Creature* summoned) override {
   
119 }
   
120 void EnterNextPhase() {
   
121 }
   
122 void UpdateAI(uint32 diff) override {
   
123 if(Phase < PHASE_BREACH) {
   
   
124 } else {
   
125 if(!UpdateVictim())
126 return;
127 }
   
128 events.Update(diff);
   
129 while(uint32 eventID = events.ExecuteEvent()) {
130 switch(eventID) {
131 case EVENT_TAINT:
132 if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) {
133 if(!target->HasAura(AURA_HELYA_TAINT)) {
134 DoCast(target, AURA_HELYA_TAINT, false);
135 }
136 }
137 break;
   
138 case EVENT_BARRAGE:
139 if(Unit* target = SelectTarget(SELECT_TARGET_RANDOM, 0, 100.0f, true)) {
140 DoCast(target, SPELL_HELYA_BARRAGE);
141 }
142 break;
143 }
144 }
   
145 DoMeleeAttackIfReady();
146 }
   
147 private:
148 uint8 Phase;
149 //SummonList summons;
150 bool isSubmerged;
151 bool isHeroic = false;
152 bool isMythic = false;
153 };
   
154 private:
155 CreatureAI* GetAI(Creature* creature) const override {
156 return GetMawOfSoulsAI<boss_helya_mawAI>(creature);
157 }
158 };
   
159 // NPC 99801
160 class npc_helya_maw_destructor_tentacle : public CreatureScript {
161 public:
162 npc_helya_maw_destructor_tentacle() : CreatureScript("npc_helya_maw_destructor_tentacle") { }
   
163 struct npc_helya_maw_destructor_tentacleAI : public ScriptedAI {
   
164 npc_helya_maw_destructor_tentacleAI(Creature* creature) : ScriptedAI(creature) {
165 instance = creature->GetInstanceScript();
166 SetCombatMovement(false);
167 Initialize();
168 }
   
169 void Initialize() {
170 DoCastVictim(SPELL_DESTRUCTOR_RUPTURE);
171 }
   
172 void EnterCombat(Unit* who) override {
   
173 }
   
174 void JustDied(Unit* /*killer*/) {
175 if(Creature* helya = ObjectAccessor::GetCreature((*me), instance->GetGuidData(DATA_HELYA_MAW))) {
176 helya->AI()->Talk(YELL_TENTACLE);
177 uint64 damagePerTentacle = helya->GetMaxHealth() * 0.0333;
178 uint64 newHealth = helya->GetHealth() - damagePerTentacle;
179 helya->SetHealth(newHealth);
180 }
181 }
   
182 void UpdateAI(uint32 diff) override {
   
183 if(!UpdateVictim())
184 return;
   
185 if(presenseCheck <= diff) {
186 if (!playerInRange) {
187 DoCastAOE(SPELL_DESTRUCTOR_SMASH);
188 }
189 presenseCheck = 5 * IN_MILLISECONDS;
190 } else presenseCheck -= diff;
   
191 if(ruptureEvery <= diff) {
192 if(playerInRange) {
193 DoCastVictim(SPELL_DESTRUCTOR_RUPTURE);
194 ruptureEvery = 14 * IN_MILLISECONDS;
195 } else {
196 ruptureEvery = 1 * IN_MILLISECONDS;
197 }
198 } else ruptureEvery -= diff;
   
199 DoMeleeAttackIfReady();
  }
   
200 void MoveInLineOfSight(Unit* who) override {
201 playerInRange = (who->GetTypeId() == TYPEID_PLAYER && me->GetDistance2d(who) < 3.0f) ? true : false;
202 }
   
203 private:
204 InstanceScript* instance;
205 uint32 ruptureEvery = 14 * IN_MILLISECONDS;
206 uint32 presenseCheck = 5 * IN_MILLISECONDS;
207 bool playerInRange = false;
208 };
   
209 CreatureAI* GetAI(Creature* creature) const override {
210 return GetMawOfSoulsAI<npc_helya_maw_destructor_tentacleAI>(creature);
211 }
212 };
   
213 void AddSC_boss_helya_maw() {
214 new boss_helya_maw();
215 new npc_helya_maw_destructor_tentacle();
 
   

 

Share this post


Link to post
Share on other sites

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Paste as plain text instead

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.


  • Recently Browsing   0 members

    No registered users viewing this page.

×
×
  • Create New...