TrinityCore
Loading...
Searching...
No Matches
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
31
39
45
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
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
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
@ TEMPSUMMON_TIMED_OR_DEAD_DESPAWN
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:42
DamageEffectType
HerodSpells
@ SPELL_RUSHINGCHARGE
@ SPELL_CLEAVE
@ SPELL_FRENZY
@ SPELL_WHIRLWIND
HerodEvents
@ EVENT_WHIRLWIND
@ EVENT_CLEAVE
HerodNpcs
@ NPC_SCARLET_TRAINEE
@ NPC_SCARLET_MYRMIDON
void AddSC_boss_herod()
static constexpr uint32 PATH_ESCORT_SCARLET_TRAINEE
HerodSays
@ SAY_WHIRLWIND
@ SAY_AGGRO
@ SAY_KILL
@ EMOTE_ENRAGE
@ SAY_ENRAGE
Position const ScarletTraineePos
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
EventMap events
Creature *const me
Definition CreatureAI.h:63
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
void ScheduleEvent(uint32 eventId, Milliseconds time, uint32 group=0, uint8 phase=0)
Definition EventMap.cpp:40
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
SpellCastResult DoCastVictim(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.cpp:180
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:89
Definition Unit.h:635
bool HealthBelowPctDamaged(float pct, uint32 damage) const
Definition Unit.h:793
Position GetRandomPoint(Position const &srcPos, float distance, float minDistance=0.0f) const
Definition Object.cpp:680
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:1398
@ 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:82
constexpr float GetOrientation() const
Definition Position.h:90
boss_herod(Creature *creature)
void KilledUnit(Unit *victim) override
void DamageTaken(Unit *, uint32 &damage, DamageEffectType, SpellInfo const *) override
void Reset() override
void JustDied(Unit *) override
void ExecuteEvent(uint32 eventId) override
void JustEngagedWith(Unit *who) override
void UpdateAI(uint32 diff) override
npc_scarlet_trainee(Creature *creature)