AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
boss_black_knight::boss_black_knightAI Struct Reference
Inheritance diagram for boss_black_knight::boss_black_knightAI:
ScriptedAI CreatureAI UnitAI

Public Member Functions

 boss_black_knightAI (Creature *pCreature)
 
void Reset () override
 
void EnterEvadeMode (EvadeReason why) override
 
void DamageTaken (Unit *, uint32 &damage, DamageEffectType, SpellSchoolMask) override
 
void DoAction (int32 param) override
 
void SpellHitTarget (Unit *, SpellInfo const *spell) override
 
void UpdateAI (uint32 diff) override
 
void JustSummoned (Creature *summon) override
 
void KilledUnit (Unit *victim) override
 
void JustDied (Unit *) override
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 
void UpdateAI (uint32 diff) override
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0s, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
void SetCombatMovement (bool allowMovement)
 
bool IsCombatMovementAllowed () const
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
PlayerSelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
- Public Member Functions inherited from CreatureAI
void Talk (uint8 id, WorldObject const *whisperTarget=nullptr, Milliseconds delay=0s)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
 
void Talk (uint8 id, Milliseconds delay)
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual void EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
virtual void JustEngagedWith (Unit *)
 Called for reaction when initially engaged.
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDespawn (Creature *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SpellHit (Unit *, SpellInfo const *)
 
virtual void SpellHitTarget (Unit *, SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *)
 
virtual void OwnerAttacked (Unit *)
 
virtual void CorpseRemoved (uint32 &)
 == Triggered Actions Requested ==================
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields =======================================
 
virtual bool BeforeSpellClick (Unit *)
 
virtual void OnSpellClick (Unit *, bool &)
 
virtual bool CanSeeAlways (WorldObject const *)
 
virtual bool CanBeSeen (Player const *)
 
virtual bool CanAlwaysBeDetectable (WorldObject const *)
 
virtual void PetStopAttack ()
 
virtual bool CheckInRoom ()
 
CreatureBoundary const * GetBoundary () const
 
void SetBoundary (CreatureBoundary const *boundary, bool negativeBoundaries=false)
 
bool IsInBoundary (Position const *who=nullptr) const
 
virtual void CalculateThreat (Unit *, float &, SpellInfo const *)
 
virtual bool OnTeleportUnreacheablePlayer (Player *)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
UnitSelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
UnitSelectTarget (SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
void SelectTargetList (std::list< Unit * > &targetList, uint32 num, SelectTargetMethod targetType, uint32 position, PREDICATE const &predicate)
 
virtual void JustEnteredCombat (Unit *)
 Called when the unit enters combat (NOTE: Creature engage logic should NOT be here, but in JustEngagedWith, which happens once threat is established!)
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 
virtual void HealReceived (Unit *, uint32 &)
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 
virtual void HealDone (Unit *, uint32 &)
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 
void AttackStartCaster (Unit *victim, float dist)
 
SpellCastResult DoAddAuraToAllHostilePlayers (uint32 spellid)
 
SpellCastResult DoCast (uint32 spellId)
 
SpellCastResult DoCast (Unit *victim, uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastSelf (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastToAllHostilePlayers (uint32 spellid, bool triggered=false)
 
SpellCastResult DoCastVictim (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastAOE (uint32 spellId, bool triggered=false)
 
SpellCastResult DoCastRandomTarget (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the max threat target, which may not always be the current victim.
 
float DoGetSpellMaxRange (uint32 spellId, bool positive=false)
 
void DoMeleeAttackIfReady ()
 
bool DoSpellAttackIfReady (uint32 spell)
 
void DoSpellAttackToRandomTargetIfReady (uint32 spell, uint32 threatTablePosition=0, float dist=0.f, bool playerOnly=true)
 
virtual void SummonMovementInform (Creature *, uint32, uint32)
 
virtual void sGossipHello (Player *)
 
virtual void sGossipSelect (Player *, uint32, uint32)
 
virtual void sGossipSelectCode (Player *, uint32, uint32, char const *)
 
virtual void sQuestAccept (Player *, Quest const *)
 
virtual void sQuestSelect (Player *, Quest const *)
 
virtual void sQuestComplete (Player *, Quest const *)
 
virtual void sQuestReward (Player *, Quest const *, uint32)
 
virtual void sOnGameEvent (bool, uint16)
 
virtual std::string GetDebugInfo () const
 

Public Attributes

InstanceScriptpInstance
 
EventMap events
 
SummonList summons
 
uint8 Phase
 
- Public Attributes inherited from ScriptedAI
Creatureme
 
bool IsFleeing
 

Additional Inherited Members

- Public Types inherited from ScriptedAI
enum class  Axis {
  AXIS_X ,
  AXIS_Y
}
 
- Public Types inherited from CreatureAI
enum  EvadeReason {
  EVADE_REASON_NO_HOSTILES ,
  EVADE_REASON_BOUNDARY ,
  EVADE_REASON_SEQUENCE_BREAK ,
  EVADE_REASON_NO_PATH ,
  EVADE_REASON_OTHER
}
 
- Static Public Member Functions inherited from CreatureAI
static bool IsInBounds (CreatureBoundary const &boundary, Position const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
virtual void MoveInLineOfSight (Unit *)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
TaskScheduler scheduler
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ boss_black_knightAI()

boss_black_knight::boss_black_knightAI::boss_black_knightAI ( Creature pCreature)
inline
107 : ScriptedAI(pCreature), summons(me)
108 {
109 pInstance = pCreature->GetInstanceScript();
110 }
Definition: ScriptedCreature.h:192
Creature * me
Definition: ScriptedCreature.h:282
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1192
SummonList summons
Definition: boss_black_knight.cpp:114
InstanceScript * pInstance
Definition: boss_black_knight.cpp:112

References WorldObject::GetInstanceScript(), and pInstance.

Member Function Documentation

◆ DamageTaken()

void boss_black_knight::boss_black_knightAI::DamageTaken ( Unit ,
uint32 damage,
DamageEffectType  ,
SpellSchoolMask   
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

139 {
141 {
142 damage = 0;
143 return;
144 }
145
146 if( Phase < 3 && damage >= me->GetHealth() )
147 {
148 damage = 0;
150 events.Reset();
155 summons.clear();
156
162 }
163 }
@ UNIT_FLAG2_FEIGN_DEATH
Definition: Unit.h:488
@ UNIT_STATE_DIED
Definition: Unit.h:325
@ UNIT_STATE_STUNNED
Definition: Unit.h:328
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
Definition: Unit.h:477
@ UNIT_FLAG_NON_ATTACKABLE
Definition: Unit.h:449
events
Definition: boss_sartura.cpp:43
@ SPELL_BK_FEIGN_DEATH
Definition: boss_black_knight.cpp:28
@ SPELL_BK_GHOUL_EXPLODE
Definition: boss_black_knight.cpp:49
@ UNIT_DYNFLAG_DEAD
Definition: SharedDefines.h:3126
void clear()
Definition: ScriptedCreature.h:85
virtual void SetDynamicFlag(uint32 flag)
Definition: Object.h:117
bool HasUnitFlag(UnitFlags flags) const
Definition: Unit.h:1494
uint32 GetMaxHealth() const
Definition: Unit.h:1455
void SetUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:1501
void SetHealth(uint32 val)
Definition: Unit.cpp:15464
void AddUnitState(uint32 f)
Definition: Unit.h:1409
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition: Unit.cpp:18288
uint32 GetHealth() const
Definition: Unit.h:1454
SpellCastResult CastSpell(SpellCastTargets const &targets, SpellInfo const *spellInfo, CustomSpellValues const *value, TriggerCastFlags triggerFlags=TRIGGERED_NONE, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition: Unit.cpp:1169
void RemoveAllAuras()
Definition: Unit.cpp:5259
void SetUnitFlag(UnitFlags flags)
Definition: Unit.h:1495

References Unit::AddUnitState(), Unit::CastSpell(), SummonList::clear(), Unit::GetHealth(), Unit::GetMaxHealth(), Unit::HasUnitFlag(), ScriptedAI::me, Unit::RemoveAllAuras(), Unit::SetControlled(), Object::SetDynamicFlag(), Unit::SetHealth(), Unit::SetUnitFlag(), Unit::SetUnitFlag2(), SPELL_BK_FEIGN_DEATH, SPELL_BK_GHOUL_EXPLODE, summons, UNIT_DYNFLAG_DEAD, UNIT_FLAG2_FEIGN_DEATH, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT, UNIT_STATE_DIED, and UNIT_STATE_STUNNED.

◆ DoAction()

void boss_black_knight::boss_black_knightAI::DoAction ( int32  param)
inlineoverridevirtual

Reimplemented from UnitAI.

166 {
167 if( param == -1 )
168 {
170 }
171 else if( param == 1 )
172 {
173 if( !pInstance )
174 return;
175
180 announcer->DespawnOrUnsummon();
181
182 events.Reset();
183 events.ScheduleEvent(EVENT_ANNOUNCER_SAY_ZOMBIE, 2500ms);
184 events.ScheduleEvent(EVENT_SPELL_PLAGUE_STRIKE, 7s, 9s);
185 events.ScheduleEvent(EVENT_SPELL_ICY_TOUCH, 3500ms, 7000ms);
186 events.ScheduleEvent(EVENT_SPELL_DEATH_RESPITE, 13s, 15s);
187 events.ScheduleEvent(EVENT_SPELL_OBLITERATE, 11s, 19s);
188 }
189 }
@ IN_PROGRESS
Definition: InstanceScript.h:58
@ SPELL_RAISE_DEAD_ARELAS
Definition: boss_black_knight.cpp:27
@ SPELL_RAISE_DEAD_JAEREN
Definition: boss_black_knight.cpp:26
@ EVENT_ANNOUNCER_SAY_ZOMBIE
Definition: boss_black_knight.cpp:79
@ EVENT_SPELL_ICY_TOUCH
Definition: boss_black_knight.cpp:81
@ EVENT_SPELL_OBLITERATE
Definition: boss_black_knight.cpp:83
@ EVENT_SPELL_DEATH_RESPITE
Definition: boss_black_knight.cpp:82
@ EVENT_SPELL_PLAGUE_STRIKE
Definition: boss_black_knight.cpp:80
@ BOSS_BLACK_KNIGHT
Definition: trial_of_the_champion.h:32
@ DATA_TEAMID_IN_INSTANCE
Definition: trial_of_the_champion.h:45
@ DATA_ANNOUNCER
Definition: trial_of_the_champion.h:36
@ SAY_BK_AGGRO
Definition: trial_of_the_champion.h:241
Talk
Definition: boss_fathomlord_karathress.cpp:25
@ TEAM_HORDE
Definition: SharedDefines.h:761
void DespawnAll(uint32 delay=0)
Definition: ScriptedCreature.cpp:71
Definition: Creature.h:46
Definition: Unit.h:1302
ObjectGuid GetGuidData(uint32 type) const override
Definition: InstanceScript.cpp:94
Map * instance
Definition: InstanceScript.h:147
Creature * GetCreature(ObjectGuid const guid)
Definition: Map.cpp:3307
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:52
virtual void SetData(uint32, uint32)
Definition: ZoneScript.h:53

References BOSS_BLACK_KNIGHT, Unit::CastSpell(), DATA_ANNOUNCER, DATA_TEAMID_IN_INSTANCE, SummonList::DespawnAll(), EVENT_ANNOUNCER_SAY_ZOMBIE, EVENT_SPELL_DEATH_RESPITE, EVENT_SPELL_ICY_TOUCH, EVENT_SPELL_OBLITERATE, EVENT_SPELL_PLAGUE_STRIKE, Map::GetCreature(), ZoneScript::GetData(), InstanceScript::GetGuidData(), IN_PROGRESS, InstanceScript::instance, ScriptedAI::me, pInstance, SAY_BK_AGGRO, ZoneScript::SetData(), SPELL_RAISE_DEAD_ARELAS, SPELL_RAISE_DEAD_JAEREN, summons, and TEAM_HORDE.

◆ EnterEvadeMode()

void boss_black_knight::boss_black_knightAI::EnterEvadeMode ( EvadeReason  why)
inlineoverridevirtual

Reimplemented from CreatureAI.

133 {
136 }
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:196
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2117

References Creature::DespawnOrUnsummon(), CreatureAI::EnterEvadeMode(), and ScriptedAI::me.

Referenced by SpellHitTarget().

◆ JustDied()

void boss_black_knight::boss_black_knightAI::JustDied ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

315 {
316 me->CastSpell((Unit*)nullptr, SPELL_BK_KILL_CREDIT, true);
318 if( pInstance )
320 if( me->ToTempSummon() )
322 }
@ TEMPSUMMON_MANUAL_DESPAWN
Definition: Object.h:49
@ DONE
Definition: InstanceScript.h:60
@ SPELL_BK_KILL_CREDIT
Definition: boss_black_knight.cpp:30
@ SAY_BK_DEATH
Definition: trial_of_the_champion.h:245
void SetTempSummonType(TempSummonType type)
Definition: TemporarySummon.cpp:277
TempSummon * ToTempSummon()
Definition: Unit.h:2414

References BOSS_BLACK_KNIGHT, Unit::CastSpell(), DONE, ScriptedAI::me, pInstance, SAY_BK_DEATH, ZoneScript::SetData(), TempSummon::SetTempSummonType(), SPELL_BK_KILL_CREDIT, TEMPSUMMON_MANUAL_DESPAWN, and Unit::ToTempSummon().

◆ JustSummoned()

void boss_black_knight::boss_black_knightAI::JustSummoned ( Creature summon)
inlineoverridevirtual

Reimplemented from ScriptedAI.

297 {
298 summons.Summon(summon);
299 if( Unit* target = summon->SelectNearestTarget(200.0f) )
300 {
301 summon->AI()->AttackStart(target);
302 DoZoneInCombat(summon);
303 }
304 }
virtual void AttackStart(Unit *)
Definition: UnitAI.cpp:27
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition: CreatureAI.cpp:94
void Summon(Creature const *summon)
Definition: ScriptedCreature.h:90
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
Definition: Creature.cpp:2323
CreatureAI * AI() const
Definition: Creature.h:136

References Creature::AI(), UnitAI::AttackStart(), CreatureAI::DoZoneInCombat(), Creature::SelectNearestTarget(), SummonList::Summon(), and summons.

◆ KilledUnit()

void boss_black_knight::boss_black_knightAI::KilledUnit ( Unit victim)
inlineoverridevirtual

Reimplemented from ScriptedAI.

307 {
308 if( victim->GetTypeId() == TYPEID_PLAYER )
309 {
311 }
312 }
@ TYPEID_PLAYER
Definition: ObjectGuid.h:38
@ SAY_BK_KILL_PLAYER
Definition: trial_of_the_champion.h:244
TypeID GetTypeId() const
Definition: Object.h:121

References Object::GetTypeId(), SAY_BK_KILL_PLAYER, and TYPEID_PLAYER.

◆ Reset()

void boss_black_knight::boss_black_knightAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

118 {
119 events.Reset();
121 Phase = 1;
124 me->SetImmuneToAll(true);
126 if( pInstance )
128
129 //me->SetLootMode(0); // [LOOT]
130 }
@ REACT_PASSIVE
Definition: Unit.h:1035
@ NOT_STARTED
Definition: InstanceScript.h:57
Phase
Definition: boss_zuljin.cpp:84
void SetDisplayId(uint32 modelId) override
Definition: Creature.cpp:3422
void SetReactState(ReactStates st)
Definition: Creature.h:90
uint32 GetNativeDisplayId() const
Definition: Unit.h:2184
void SetImmuneToAll(bool apply, bool keepCombat=false)
Definition: Unit.h:1692

References BOSS_BLACK_KNIGHT, SummonList::DespawnAll(), Unit::GetNativeDisplayId(), ScriptedAI::me, NOT_STARTED, pInstance, REACT_PASSIVE, ZoneScript::SetData(), Creature::SetDisplayId(), Unit::SetImmuneToAll(), Creature::SetReactState(), Unit::SetUnitFlag(), summons, and UNIT_FLAG_NON_ATTACKABLE.

◆ SpellHitTarget()

void boss_black_knight::boss_black_knightAI::SpellHitTarget ( Unit ,
SpellInfo const *  spell 
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

192 {
193 switch( spell->Id )
194 {
198 me->SetImmuneToAll(false);
200
205
206 ++Phase;
207
208 switch( Phase )
209 {
210 case 2:
213 me->CastSpell(me, SPELL_ARMY_DEAD, false);
214
215 events.Reset();
216 events.ScheduleEvent(EVENT_SPELL_PLAGUE_STRIKE, 7s, 9s);
217 events.ScheduleEvent(EVENT_SPELL_ICY_TOUCH, 3500ms, 7000ms);
218 events.ScheduleEvent(EVENT_SPELL_OBLITERATE, 11s, 19s);
219 events.ScheduleEvent(EVENT_SPELL_DESECRATION, 2s, 3s);
220 break;
221 case 3:
224
225 events.Reset();
226 events.ScheduleEvent(EVENT_SPELL_DEATH_BITE, 2s);
227 events.ScheduleEvent(EVENT_SPELL_MARKED_DEATH, 1s);
228 break;
229 default:
231 break;
232 }
233 break;
234 }
235 }
@ SPELL_BLACK_KNIGHT_RES
Definition: boss_black_knight.cpp:29
#define SPELL_ARMY_DEAD
Definition: boss_black_knight.cpp:72
@ MODEL_SKELETON
Definition: boss_black_knight.cpp:96
@ MODEL_GHOST
Definition: boss_black_knight.cpp:97
@ EVENT_SPELL_MARKED_DEATH
Definition: boss_black_knight.cpp:86
@ EVENT_SPELL_DESECRATION
Definition: boss_black_knight.cpp:84
@ EVENT_SPELL_DEATH_BITE
Definition: boss_black_knight.cpp:85
@ SAY_BK_PHASE_3
Definition: trial_of_the_champion.h:243
@ SAY_BK_PHASE_2
Definition: trial_of_the_champion.h:242
@ EVADE_REASON_OTHER
Definition: CreatureAI.h:94
virtual void RemoveDynamicFlag(uint32 flag)
Definition: Object.h:118
void ClearUnitState(uint32 f)
Definition: Unit.h:1411
void RemoveUnitFlag2(UnitFlags2 flags)
Definition: Unit.h:1502
void RemoveUnitFlag(UnitFlags flags)
Definition: Unit.h:1496
void EnterEvadeMode(EvadeReason why) override
Definition: boss_black_knight.cpp:132
uint8 Phase
Definition: boss_black_knight.cpp:115

References Unit::CastSpell(), Unit::ClearUnitState(), EnterEvadeMode(), CreatureAI::EVADE_REASON_OTHER, EVENT_SPELL_DEATH_BITE, EVENT_SPELL_DESECRATION, EVENT_SPELL_ICY_TOUCH, EVENT_SPELL_MARKED_DEATH, EVENT_SPELL_OBLITERATE, EVENT_SPELL_PLAGUE_STRIKE, Unit::GetMaxHealth(), SpellInfo::Id, ScriptedAI::me, MODEL_GHOST, MODEL_SKELETON, Phase, Object::RemoveDynamicFlag(), Unit::RemoveUnitFlag(), Unit::RemoveUnitFlag2(), SAY_BK_PHASE_2, SAY_BK_PHASE_3, Unit::SetControlled(), Creature::SetDisplayId(), Unit::SetHealth(), Unit::SetImmuneToAll(), SPELL_ARMY_DEAD, SPELL_BLACK_KNIGHT_RES, UNIT_DYNFLAG_DEAD, UNIT_FLAG2_FEIGN_DEATH, UNIT_FLAG_NON_ATTACKABLE, UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT, UNIT_STATE_DIED, and UNIT_STATE_STUNNED.

◆ UpdateAI()

void boss_black_knight::boss_black_knightAI::UpdateAI ( uint32  diff)
inlineoverridevirtual
Todo:
: Multiple variations + not always happening, from video sources, needs sniff to transition from DB.

Reimplemented from ScriptedAI.

238 {
239 if( !UpdateVictim() )
240 return;
241
242 events.Update(diff);
243
245 return;
246
247 switch( events.ExecuteEvent() )
248 {
249 case 0:
250 break;
252 if( pInstance && !summons.empty() )
254 if (urand(0, 1))
255 ghoul->Yell("[Zombie] .... . Brains ....", LANG_UNIVERSAL);
256 break;
258 if( me->GetVictim() )
260 events.Repeat(10s, 12s);
261 break;
263 if( me->GetVictim() )
265 events.Repeat(5s, 6s);
266 break;
268 if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true) )
269 me->CastSpell(target, SPELL_DEATH_RESPITE, false);
270 events.Repeat(13s, 15s);
271 break;
273 if( me->GetVictim() )
275 events.Repeat(15s, 17s);
276 break;
278 if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 50.0f, true) )
279 me->CastSpell(target, SPELL_DESECRATION, false);
280 events.Repeat(14s, 17s);
281 break;
283 me->CastSpell((Unit*)nullptr, SPELL_DEATH_BITE, false);
284 events.Repeat(2s, 4s);
285 break;
287 if( Unit* target = SelectTarget(SelectTargetMethod::Random, 0, 0.000000f, true) )
288 me->CastSpell(target, SPELL_MARKED_DEATH, false);
289 events.Repeat(9s);
290 break;
291 }
292
294 }
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
@ UNIT_STATE_CASTING
Definition: Unit.h:340
#define SPELL_DEATH_RESPITE
Definition: boss_black_knight.cpp:70
#define SPELL_OBLITERATE
Definition: boss_black_knight.cpp:71
#define SPELL_ICY_TOUCH
Definition: boss_black_knight.cpp:69
#define SPELL_MARKED_DEATH
Definition: boss_black_knight.cpp:75
#define SPELL_PLAGUE_STRIKE
Definition: boss_black_knight.cpp:68
#define SPELL_DESECRATION
Definition: boss_black_knight.cpp:73
#define SPELL_DEATH_BITE
Definition: boss_black_knight.cpp:74
@ LANG_UNIVERSAL
Definition: SharedDefines.h:735
void DoMeleeAttackIfReady()
Definition: UnitAI.cpp:39
Unit * SelectTarget(SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
Definition: UnitAI.cpp:110
bool UpdateVictim()
Definition: CreatureAI.cpp:268
bool empty() const
Definition: ScriptedCreature.h:75
iterator begin()
Definition: ScriptedCreature.h:50
Unit * GetVictim() const
Definition: Unit.h:1398
bool HasUnitState(const uint32 f) const
Definition: Unit.h:1410

References SummonList::begin(), Unit::CastSpell(), UnitAI::DoMeleeAttackIfReady(), SummonList::empty(), EVENT_ANNOUNCER_SAY_ZOMBIE, EVENT_SPELL_DEATH_BITE, EVENT_SPELL_DEATH_RESPITE, EVENT_SPELL_DESECRATION, EVENT_SPELL_ICY_TOUCH, EVENT_SPELL_MARKED_DEATH, EVENT_SPELL_OBLITERATE, EVENT_SPELL_PLAGUE_STRIKE, Map::GetCreature(), Unit::GetVictim(), Unit::HasUnitState(), InstanceScript::instance, LANG_UNIVERSAL, ScriptedAI::me, pInstance, UnitAI::SelectTarget(), SPELL_DEATH_BITE, SPELL_DEATH_RESPITE, SPELL_DESECRATION, SPELL_ICY_TOUCH, SPELL_MARKED_DEATH, SPELL_OBLITERATE, SPELL_PLAGUE_STRIKE, summons, UNIT_STATE_CASTING, CreatureAI::UpdateVictim(), and urand().

Member Data Documentation

◆ events

EventMap boss_black_knight::boss_black_knightAI::events

◆ Phase

uint8 boss_black_knight::boss_black_knightAI::Phase

Referenced by SpellHitTarget().

◆ pInstance

InstanceScript* boss_black_knight::boss_black_knightAI::pInstance

◆ summons

SummonList boss_black_knight::boss_black_knightAI::summons