TrinityCore
Loading...
Searching...
No Matches
boss_mr_smite.cpp
Go to the documentation of this file.
1/*
2 * This file is part of the TrinityCore Project. See AUTHORS file for Copyright information
3 *
4 * This program is free software; you can redistribute it and/or modify it
5 * under the terms of the GNU General Public License as published by the
6 * Free Software Foundation; either version 2 of the License, or (at your
7 * option) any later version.
8 *
9 * This program is distributed in the hope that it will be useful, but WITHOUT
10 * ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or
11 * FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for
12 * more details.
13 *
14 * You should have received a copy of the GNU General Public License along
15 * with this program. If not, see <http://www.gnu.org/licenses/>.
16 */
17
18/* ScriptData
19SDName: Boss Mr.Smite
20SD%Complete:
21SDComment: Timers and say taken from acid script
22EndScriptData */
23
24#include "ScriptMgr.h"
25#include "deadmines.h"
26#include "GameObject.h"
27#include "InstanceScript.h"
28#include "MotionMaster.h"
29#include "ObjectAccessor.h"
30#include "ScriptedCreature.h"
31
38
40{
42 EQUIP_AXE = 5196,
43 EQUIP_MACE = 7230
44};
45
47{
49 SAY_PHASE_2 = 3
50};
51
53{
54public:
55 boss_mr_smite() : CreatureScript("boss_mr_smite") { }
56
57 CreatureAI* GetAI(Creature* creature) const override
58 {
59 return GetDeadminesAI<boss_mr_smiteAI>(creature);
60 }
61
63 {
64 boss_mr_smiteAI(Creature* creature) : ScriptedAI(creature)
65 {
66 Initialize();
67 instance = creature->GetInstanceScript();
68 }
69
71 {
72 uiTrashTimer = urand(5000, 9000);
73 uiSlamTimer = 9000;
74
75 uiHealth = 0;
76
77 uiPhase = 0;
78 uiTimer = 0;
79
80 uiIsMoving = false;
81 }
82
84
87
89
92
94
104
105 void JustEngagedWith(Unit* /*who*/) override
106 {
107 }
108
110 {
111 uint32 uiChances = urand(0, 99);
112 if (uiChances <= 15)
113 return false;
114 else
115 return true;
116 }
117
118 void UpdateAI(uint32 uiDiff) override
119 {
120 if (!UpdateVictim())
121 return;
122
123 if (!uiIsMoving) // halt abilities in between phases
124 {
125 if (uiTrashTimer <= uiDiff)
126 {
127 if (bCheckChances())
129 uiTrashTimer = urand(6000, 15500);
130 }
131 else uiTrashTimer -= uiDiff;
132
133 if (uiSlamTimer <= uiDiff)
134 {
135 if (bCheckChances())
137 uiSlamTimer = 11000;
138 }
139 else uiSlamTimer -= uiDiff;
140
141 }
142
143 if ((uiHealth == 0 && !HealthAbovePct(66)) || (uiHealth == 1 && !HealthAbovePct(33)))
144 {
145 ++uiHealth;
147 SetCombatMovement(false);
148 me->AttackStop();
151 uiTimer = 2500;
152 uiPhase = 1;
153
154 switch (uiHealth)
155 {
156 case 1:
158 break;
159 case 2:
161 break;
162 }
163 }
164
165 if (uiPhase)
166 {
167 if (uiTimer <= uiDiff)
168 {
169 switch (uiPhase)
170 {
171 case 1:
172 {
173 if (uiIsMoving)
174 break;
175
177 {
179 me->GetMotionMaster()->MovePoint(1, go->GetPositionX() - 1.5f, go->GetPositionY() + 1.4f, go->GetPositionZ());
180 uiIsMoving = true;
181 }
182 break;
183 }
184 case 2:
185 if (uiHealth == 1)
187 else
189 uiTimer = 500;
190 uiPhase = 3;
191 break;
192 case 3:
194 uiTimer = 750;
195 uiPhase = 4;
196 break;
197 case 4:
199 SetCombatMovement(true);
201 uiIsMoving = false;
202 uiPhase = 0;
203 break;
204 }
205 } else uiTimer -= uiDiff;
206 }
207
209 }
210
211 void MovementInform(uint32 uiType, uint32 /*uiId*/) override
212 {
213 if (uiType != POINT_MOTION_TYPE)
214 return;
215
216 me->SetFacingTo(5.47f);
218
219 uiTimer = 2000;
220 uiPhase = 2;
221 }
222 };
223};
224
226{
227 new boss_mr_smite();
228}
@ EQUIP_UNEQUIP
Definition CreatureAI.h:76
@ EQUIP_NO_CHANGE
Definition CreatureAI.h:75
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ POINT_MOTION_TYPE
Spells
Definition PlayerAI.cpp:32
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STAND_STATE_KNEEL
Definition UnitDefines.h:42
@ UNIT_STAND_STATE_STAND
Definition UnitDefines.h:34
@ SPELL_SMITE_SLAM
@ SPELL_SMITE_STOMP
@ SPELL_TRASH
@ SAY_PHASE_1
@ SAY_PHASE_2
void AddSC_boss_mr_smite()
@ EQUIP_SWORD
@ EQUIP_AXE
@ EQUIP_MACE
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
void SetReactState(ReactStates st)
Definition Creature.h:119
float m_CombatDistance
Definition Creature.h:335
void SetNoCallAssistance(bool val)
Definition Creature.h:244
virtual ObjectGuid GetGuidData(uint32 type) const override
void MoveChase(Unit *target, Optional< ChaseRange > dist={}, Optional< ChaseAngle > angle={})
void MovePoint(uint32 id, Position const &pos, bool generatePath=true, Optional< float > finalOrient={})
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:166
SpellCastResult DoCastAOE(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:243
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
void InterruptNonMeleeSpells(bool withDelayed, uint32 spellid=0, bool withInstant=true)
Definition Unit.cpp:3093
MotionMaster * GetMotionMaster()
Definition Unit.h:1667
Unit * GetVictim() const
Definition Unit.h:859
void SetFacingTo(float ori, bool force=true, uint32 movementId=EVENT_FACE)
Definition Unit.cpp:13250
void SetStandState(UnitStandStateType state)
Definition Unit.cpp:10363
bool AttackStop()
Definition Unit.cpp:5645
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
CreatureAI * GetAI(Creature *creature) const override
@ DATA_SMITE_CHEST
Definition deadmines.h:55
TC_GAME_API GameObject * GetGameObject(WorldObject const &u, ObjectGuid const &guid)
void SetEquipmentSlots(bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
void SetCombatMovement(bool allowMovement)
bool HealthAbovePct(uint32 pct) const
boss_mr_smiteAI(Creature *creature)
void JustEngagedWith(Unit *) override
void UpdateAI(uint32 uiDiff) override
void MovementInform(uint32 uiType, uint32) override