TrinityCore
boss_herod.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#include "scarlet_monastery.h"
19#include "ScriptedCreature.h"
20#include "ScriptedEscortAI.h"
21#include "ScriptMgr.h"
22
24{
29 EMOTE_ENRAGE = 4
30};
31
33{
35 SPELL_CLEAVE = 15496,
37 SPELL_FRENZY = 8269
38};
39
41{
44};
45
47{
50};
51
52Position const ScarletTraineePos = { 1939.18f, -431.58f, 17.09f, 6.22f };
53
54struct boss_herod : public BossAI
55{
56 boss_herod(Creature* creature) : BossAI(creature, DATA_HEROD)
57 {
58 _enrage = false;
59 }
60
61 void Reset() override
62 {
63 _enrage = false;
64 _Reset();
65 }
66
67 void JustEngagedWith(Unit* who) override
68 {
72
75 }
76
77 void KilledUnit(Unit* victim) override
78 {
79 if (victim->GetTypeId() == TYPEID_PLAYER)
81 }
82
83 void JustDied(Unit* /*killer*/) override
84 {
85 _JustDied();
86
87 for (uint8 itr = 0; itr < 20; ++itr)
88 {
89 Position randomNearPosition = me->GetRandomPoint(ScarletTraineePos, 5.f);
92 }
93 }
94
95 void DamageTaken(Unit* /*attacker*/, uint32& damage, DamageEffectType /*damageType*/, SpellInfo const* /*spellInfo = nullptr*/) override
96 {
97 if (!_enrage && me->HealthBelowPctDamaged(30, damage))
98 {
102 _enrage = true;
103 }
104 }
105
106 void ExecuteEvent(uint32 eventId) override
107 {
108 switch (eventId)
109 {
110 case EVENT_CLEAVE:
112 events.Repeat(12s);
113 break;
114 case EVENT_WHIRLWIND:
117 events.Repeat(30s);
118 break;
119 default:
120 break;
121 }
122 }
123
124private:
126};
127
128static constexpr uint32 PATH_ESCORT_SCARLET_TRAINEE = 52602;
129
131{
132 npc_scarlet_trainee(Creature* creature) : EscortAI(creature)
133 {
134 _startTimer = urand(1000, 6000);
135 }
136
137 void UpdateAI(uint32 diff) override
138 {
139 if (_startTimer)
140 {
141 if (_startTimer <= diff)
142 {
144 Start(true);
145 _startTimer = 0;
146 }
147 else
148 _startTimer -= diff;
149 }
150
151 EscortAI::UpdateAI(diff);
152 }
153
154private:
156};
157
159{
162}
uint8_t uint8
Definition: Define.h:144
uint32_t uint32
Definition: Define.h:142
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
Definition: ObjectDefines.h:63
@ TYPEID_PLAYER
Definition: ObjectGuid.h:41
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:42
DamageEffectType
Definition: UnitDefines.h:131
HerodSpells
Definition: boss_herod.cpp:33
@ SPELL_RUSHINGCHARGE
Definition: boss_herod.cpp:34
@ SPELL_CLEAVE
Definition: boss_herod.cpp:35
@ SPELL_FRENZY
Definition: boss_herod.cpp:37
@ SPELL_WHIRLWIND
Definition: boss_herod.cpp:36
HerodEvents
Definition: boss_herod.cpp:47
@ EVENT_WHIRLWIND
Definition: boss_herod.cpp:49
@ EVENT_CLEAVE
Definition: boss_herod.cpp:48
HerodNpcs
Definition: boss_herod.cpp:41
@ NPC_SCARLET_TRAINEE
Definition: boss_herod.cpp:42
@ NPC_SCARLET_MYRMIDON
Definition: boss_herod.cpp:43
void AddSC_boss_herod()
Definition: boss_herod.cpp:158
static constexpr uint32 PATH_ESCORT_SCARLET_TRAINEE
Definition: boss_herod.cpp:128
HerodSays
Definition: boss_herod.cpp:24
@ SAY_WHIRLWIND
Definition: boss_herod.cpp:26
@ SAY_AGGRO
Definition: boss_herod.cpp:25
@ SAY_KILL
Definition: boss_herod.cpp:28
@ EMOTE_ENRAGE
Definition: boss_herod.cpp:29
@ SAY_ENRAGE
Definition: boss_herod.cpp:27
Position const ScarletTraineePos
Definition: boss_herod.cpp:52
void JustEngagedWith(Unit *who) override
EventMap events
void _JustDied()
void Talk(uint8 id, WorldObject const *whisperTarget=nullptr)
Definition: CreatureAI.cpp:56
Creature *const me
Definition: CreatureAI.h:61
void Repeat(Milliseconds time)
Definition: EventMap.cpp:63
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition: EventMap.cpp:36
TypeID GetTypeId() const
Definition: Object.h:173
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.h:159
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition: UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition: UnitAI.cpp:89
Definition: Unit.h:627
bool HealthBelowPctDamaged(int32 pct, uint32 damage) const
Definition: Unit.h:781
TempSummon * SummonCreature(uint32 entry, Position const &pos, TempSummonType despawnType=TEMPSUMMON_MANUAL_DESPAWN, Milliseconds despawnTime=0s, uint32 vehId=0, uint32 spellId=0, ObjectGuid privateObjectOwner=ObjectGuid::Empty)
Definition: Object.cpp:2025
void GetRandomPoint(Position const &srcPos, float distance, float &rand_x, float &rand_y, float &rand_z) const
Definition: Object.cpp:1331
@ DATA_HEROD
#define RegisterScarletMonasteryCreatureAI(ai)
void Start(bool isActiveAttacker=true, ObjectGuid playerGUID=ObjectGuid::Empty, Quest const *quest=nullptr, bool instantRespawn=false, bool canLoopPath=false)
void LoadPath(uint32 pathId)
void UpdateAI(uint32 diff) override
constexpr void SetOrientation(float orientation)
Definition: Position.h:71
constexpr float GetOrientation() const
Definition: Position.h:79
boss_herod(Creature *creature)
Definition: boss_herod.cpp:56
void KilledUnit(Unit *victim) override
Definition: boss_herod.cpp:77
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
Definition: boss_herod.cpp:95
void Reset() override
Definition: boss_herod.cpp:61
void JustDied(Unit *) override
Definition: boss_herod.cpp:83
void ExecuteEvent(uint32 eventId) override
Definition: boss_herod.cpp:106
void JustEngagedWith(Unit *who) override
Definition: boss_herod.cpp:67
void UpdateAI(uint32 diff) override
Definition: boss_herod.cpp:137
npc_scarlet_trainee(Creature *creature)
Definition: boss_herod.cpp:132