TrinityCore
Loading...
Searching...
No Matches
boss_blackheart_the_inciter.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 "InstanceScript.h"
19#include "Map.h"
20#include "ObjectAccessor.h"
21#include "PassiveAI.h"
22#include "Player.h"
23#include "PlayerAI.h"
24#include "ScriptMgr.h"
25#include "ScriptedCreature.h"
26#include "SpellScript.h"
27#include "shadow_labyrinth.h"
28
30{
36
37 //below, not used
42 SAY2_DEATH = 9
43};
44
46{
48 SPELL_INCITE_CHAOS_B = 33684, //debuff applied to each member of party
49 SPELL_CHARGE = 33709,
50 SPELL_WAR_STOMP = 33707
51};
52
59
64
66{
68 void OnCharmed(bool isNew) override
69 {
70 if (me->GetMap()->IsDungeon())
72 {
73 blackheart->AI()->SetData(0, me->IsCharmed());
74 blackheart->GetThreatManager().AddThreat(me, 0.0f);
75 }
77 }
78};
79
80// 18667 - Blackheart the Inciter
82{
84
85 void Reset() override
86 {
88 _Reset();
89 }
90
100
101 void KilledUnit(Unit* who) override
102 {
103 if (who->GetTypeId() == TYPEID_PLAYER)
104 Talk(SAY_SLAY);
105 }
106
107 void JustDied(Unit* /*killer*/) override
108 {
109 _JustDied();
111 }
112
114 void SetData(uint32 /*index*/, uint32 data) override
115 {
116 if (data)
117 ++charmCount;
118 else
119 {
120 if (!charmCount)
121 EnterEvadeMode(EvadeReason::Other); // sanity check
122 --charmCount;
123 }
124 if (charmCount)
126 else
128 }
129
130 void UpdateAI(uint32 diff) override
131 {
132 events.Update(diff);
133
135 return;
136
138 return;
139
140 while (uint32 eventId = events.ExecuteEvent())
141 {
142 switch (eventId)
143 {
145 {
147 {
150 }
151 events.Repeat(40s);
152 break;
153 }
156 DoCast(target, SPELL_CHARGE);
157 events.Repeat(15s, 25s);
158 break;
159 case EVENT_WAR_STOMP:
161 events.Repeat(18s, 24s);
162 break;
163 }
164
166 return;
167 }
168 }
169
170 void WaypointReached(uint32 waypointId, uint32 pathId) override
171 {
172 if (pathId != PATH_BLACKHEART_IDLE)
173 return;
174
175 if (waypointId == 2)
176 Talk(SAY_DEATH); // ?
177 else if (waypointId == 3)
178 Talk(SAY_AGGRO); // ?
179 }
180};
181
183{
187
188 void IsSummonedBy(WorldObject* whoWO) override
189 {
190 Unit* who = whoWO->ToUnit();
191 if (!who)
192 return;
193 me->CastSpell(who, SPELL_INCITE_CHAOS_B, true);
194
195 // ensure everyone is in combat with everyone
197 for (ObjectGuid const& guid : *dummies)
198 if (Creature* trigger = ObjectAccessor::GetCreature(*me, guid))
199 if (me->GetEntry() != trigger->GetEntry())
200 {
201 me->GetThreatManager().AddThreat(trigger, 0.0f);
202 trigger->GetThreatManager().AddThreat(who, 0.0f);
203 for (Unit* other : trigger->m_Controlled)
204 {
205 me->GetThreatManager().AddThreat(other, 0.0f);
206 other->GetThreatManager().AddThreat(who, 0.0f);
207 }
208 }
209 }
210
211 void UpdateAI(uint32 /*diff*/) override
212 {
213 if (me->m_Controlled.empty())
215 }
216
218 {
219 return new BlackheartCharmedPlayerAI(player);
220 }
221};
222
223// 33676 - Incite Chaos
225{
226 bool Validate(SpellInfo const* /*spell*/) override
227 {
229 }
230
231 static const uint8 NUM_INCITE_SPELLS = 5;
233 uint8 i = 0;
234
235 void HandleDummy(SpellEffIndex /*effIndex*/)
236 {
237 if (Unit* target = GetHitUnit())
238 {
239 target->CastSpell(nullptr, INCITE_SPELLS[i], true);
240 i = (i + 1) % NUM_INCITE_SPELLS;
241 }
242 }
243
248};
249
251
uint8_t uint8
Definition Define.h:156
uint32_t uint32
Definition Define.h:154
std::unordered_set< ObjectGuid > GuidUnorderedSet
Definition ObjectGuid.h:435
@ TYPEID_PLAYER
Definition ObjectGuid.h:44
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1383
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:290
void AddSC_boss_blackheart_the_inciter()
TypeID GetTypeId() const
Definition BaseEntity.h:166
void JustEngagedWith(Unit *who) override
EventMap events
virtual void EnterEvadeMode(EvadeReason why=EvadeReason::Other)
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:63
bool HasReactState(ReactStates state) const
Definition Creature.h:182
void SetReactState(ReactStates st)
Definition Creature.h:180
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Update(uint32 time)
Definition EventMap.h:77
void Repeat(Milliseconds time)
Definition EventMap.cpp:67
EventId ExecuteEvent()
Definition EventMap.cpp:77
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:40
virtual ObjectGuid GetGuidData(uint32 type) const override
bool IsDungeon() const
Definition Map.cpp:3303
NullCreatureAI(Creature *creature, uint32 scriptId={}) noexcept
Definition PassiveAI.cpp:33
uint32 GetEntry() const
Definition Object.h:89
Unit * ToUnit()
Definition Object.h:116
Player *const me
Definition PlayerAI.h:51
void OnCharmed(bool isNew) override
SimpleCharmedPlayerAI(Player *player)
Definition PlayerAI.h:97
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
Unit * GetHitUnit() const
HookList< EffectHandler > OnEffectHitTarget
void AddThreat(Unit *target, float amount, SpellInfo const *spell=nullptr, bool ignoreModifiers=false, bool ignoreRedirects=false)
== AFFECT MY THREAT LIST ==
uint32 GetThreatListPlayerCount(bool includeOffline=false) const
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:160
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:71
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:81
Definition Unit.h:647
bool IsCharmed() const
Definition Unit.h:1256
ThreatManager & GetThreatManager()
Definition Unit.h:1093
ControlList m_Controlled
Definition Unit.h:1252
bool HasUnitState(const uint32 f) const
Definition Unit.h:755
Map * GetMap() const
Definition Object.h:411
InstanceScript * GetInstanceScript() const
Definition Object.cpp:394
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2222
bool Validate(SpellInfo const *) override
static const uint32 INCITE_SPELLS[NUM_INCITE_SPELLS]
GuidUnorderedSet const * GetBlackheartDummies(InstanceScript const *s)
TC_GAME_API Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
@ NPC_BLACKHEART_DUMMY1
@ NPC_BLACKHEART_DUMMY5
#define RegisterShadowLabyrinthCreatureAI(ai_name)
@ DATA_BLACKHEART_THE_INCITER
void ResetThreatList(Unit *who=nullptr)
void IsSummonedBy(WorldObject *whoWO) override
PlayerAI * GetAIForCharmedPlayer(Player *player) override
void WaypointReached(uint32 waypointId, uint32 pathId) override
void SetData(uint32, uint32 data) override