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
61{
63 void OnCharmed(bool isNew) override
64 {
65 if (me->GetMap()->IsDungeon())
67 {
68 blackheart->AI()->SetData(0, me->IsCharmed());
69 blackheart->GetThreatManager().AddThreat(me, 0.0f);
70 }
72 }
73};
74
75// 18667 - Blackheart the Inciter
77{
79
80 void Reset() override
81 {
83 _Reset();
84 }
85
95
96 void KilledUnit(Unit* who) override
97 {
98 if (who->GetTypeId() == TYPEID_PLAYER)
100 }
101
102 void JustDied(Unit* /*killer*/) override
103 {
104 _JustDied();
106 }
107
109 void SetData(uint32 /*index*/, uint32 data) override
110 {
111 if (data)
112 ++charmCount;
113 else
114 {
115 if (!charmCount)
116 EnterEvadeMode(EVADE_REASON_OTHER); // sanity check
117 --charmCount;
118 }
119 if (charmCount)
121 else
123 }
124
125 void UpdateAI(uint32 diff) override
126 {
127 events.Update(diff);
128
130 return;
131
133 return;
134
135 while (uint32 eventId = events.ExecuteEvent())
136 {
137 switch (eventId)
138 {
140 {
142 {
145 }
146 events.Repeat(40s);
147 break;
148 }
151 DoCast(target, SPELL_CHARGE);
152 events.Repeat(15s, 25s);
153 break;
154 case EVENT_WAR_STOMP:
156 events.Repeat(18s, 24s);
157 break;
158 }
159
161 return;
162 }
163
165 }
166};
167
169{
173
174 void IsSummonedBy(WorldObject* whoWO) override
175 {
176 Unit* who = whoWO->ToUnit();
177 if (!who)
178 return;
179 me->CastSpell(who, SPELL_INCITE_CHAOS_B, true);
180
181 // ensure everyone is in combat with everyone
182 if (auto* dummies = GetBlackheartDummies(me->GetInstanceScript()))
183 for (ObjectGuid const& guid : *dummies)
184 if (Creature* trigger = ObjectAccessor::GetCreature(*me, guid))
185 if (me->GetEntry() != trigger->GetEntry())
186 {
187 me->GetThreatManager().AddThreat(trigger, 0.0f);
188 trigger->GetThreatManager().AddThreat(who, 0.0f);
189 for (Unit* other : trigger->m_Controlled)
190 {
191 me->GetThreatManager().AddThreat(other, 0.0f);
192 other->GetThreatManager().AddThreat(who, 0.0f);
193 }
194 }
195 }
196
197 void UpdateAI(uint32 /*diff*/) override
198 {
199 if (me->m_Controlled.empty())
201 }
202
204 {
205 return new BlackheartCharmedPlayerAI(player);
206 }
207};
208
209// 33676 - Incite Chaos
211{
213
214 bool Validate(SpellInfo const* /*spell*/) override
215 {
217 }
218
219 static const uint8 NUM_INCITE_SPELLS = 5;
221 uint8 i = 0;
222
223 void HandleDummy(SpellEffIndex /*effIndex*/)
224 {
225 if (Unit* target = GetHitUnit())
226 {
227 target->CastSpell(nullptr, INCITE_SPELLS[i], true);
228 i = (i + 1) % NUM_INCITE_SPELLS;
229 }
230 }
231
236};
237
239
uint8_t uint8
Definition Define.h:135
uint32_t uint32
Definition Define.h:133
@ TYPEID_PLAYER
Definition ObjectGuid.h:39
#define RegisterSpellScript(spell_script)
Definition ScriptMgr.h:1128
SpellEffIndex
@ EFFECT_0
@ SPELL_EFFECT_SCRIPT_EFFECT
#define SpellEffectFn(F, I, N)
@ REACT_PASSIVE
@ REACT_AGGRESSIVE
@ UNIT_STATE_CASTING
Definition Unit.h:235
void AddSC_boss_blackheart_the_inciter()
void JustEngagedWith(Unit *who) override
EventMap events
@ EVADE_REASON_OTHER
Definition CreatureAI.h:98
bool UpdateVictim()
Creature *const me
Definition CreatureAI.h:82
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
bool HasReactState(ReactStates state) const
Definition Creature.h:121
void SetReactState(ReactStates st)
Definition Creature.h:119
void DespawnOrUnsummon(Milliseconds timeToDespawn=0s, Seconds forceRespawnTime=0s)
void Update(uint32 time)
Definition EventMap.h:67
void Repeat(Milliseconds time)
Definition EventMap.cpp:63
EventId ExecuteEvent()
Definition EventMap.cpp:73
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:36
virtual ObjectGuid GetGuidData(uint32 type) const override
bool IsDungeon() const
Definition Map.cpp:4236
NullCreatureAI(Creature *creature)
Definition PassiveAI.cpp:32
static Unit * ToUnit(Object *o)
Definition Object.h:192
TypeID GetTypeId() const
Definition Object.h:93
uint32 GetEntry() const
Definition Object.h:81
Player *const me
Definition PlayerAI.h:52
void OnCharmed(bool isNew) override
SimpleCharmedPlayerAI(Player *player)
Definition PlayerAI.h:98
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
void DoMeleeAttackIfReady()
Definition UnitAI.cpp:54
SpellCastResult DoCastSelf(uint32 spellId, CastSpellExtraArgs const &args={})
Definition UnitAI.h:241
Unit * SelectTarget(SelectTargetMethod targetType, uint32 offset=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition UnitAI.cpp:96
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:106
Definition Unit.h:769
bool IsCharmed() const
Definition Unit.h:1280
ThreatManager & GetThreatManager()
Definition Unit.h:1155
ControlList m_Controlled
Definition Unit.h:1276
bool HasUnitState(const uint32 f) const
Definition Unit.h:876
Map * GetMap() const
Definition Object.h:449
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1087
SpellCastResult CastSpell(CastSpellTargetArg const &targets, uint32 spellId, CastSpellExtraArgs const &args={ })
Definition Object.cpp:2832
static bool ValidateSpellInfo(std::initializer_list< uint32 > spellIds)
PrepareSpellScript(spell_blackheart_incite_chaos)
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 SetData(uint32, uint32 data) override