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
 Called at any Damage from any attacker (before damage apply)
 
void DoAction (int32 param) override
 
void SpellHitTarget (Unit *, SpellInfo const *spell) override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
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
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
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 DoTeleportPlayer (Unit *unit, Position pos)
 
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)
 
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
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () 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)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 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 IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
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 *)
 
virtual void OnAuraRemove (AuraApplication *, AuraRemoveMode)
 
- Public Member Functions inherited from UnitAI
 UnitAI (Unit *unit)
 
virtual ~UnitAI ()
 
virtual bool CanAIAttack (Unit const *) const
 
virtual void InitializeAI ()
 
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)
 Select the best (up to) <num> targets (in <targetType> order) from the threat list that fulfill the following:
 
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.
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat.
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage to any victim (before damage apply)
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal.
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates.
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals.
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations.
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT)
 
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)
 To specify the caster as target if the spell is self-cast.
 
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, bool withTank=true)
 Cast the spell on a random unit from the threat list.
 
SpellCastResult DoCastMaxThreat (uint32 spellId, uint32 threatTablePosition=0, float dist=0.0f, bool playerOnly=true, bool triggered=false)
 Cast spell on the top threat target, which may not 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)
 Called when a summon reaches a waypoint or point movement finished.
 
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
 

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 }
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1203
Definition ScriptedCreature.h:190
Creature * me
Definition ScriptedCreature.h:280
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 ,
DamageEffectType  ,
SpellSchoolMask   
)
inlineoverridevirtual

Called at any Damage from any attacker (before damage apply)

Note
It use for recalculation damage or special reaction at damage for attack reaction use AttackedBy called for non DOT damage in Unit::DealDamage also

Reimplemented from UnitAI.

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_DYNFLAG_DEAD
Definition SharedDefines.h:3126
@ UNIT_FLAG2_FEIGN_DEATH
Definition UnitDefines.h:289
@ UNIT_STATE_DIED
Definition UnitDefines.h:170
@ UNIT_STATE_STUNNED
Definition UnitDefines.h:173
@ UNIT_FLAG_PREVENT_EMOTES_FROM_CHAT_TEXT
Definition UnitDefines.h:279
@ UNIT_FLAG_NON_ATTACKABLE
Definition UnitDefines.h:251
@ SPELL_BK_FEIGN_DEATH
Definition boss_black_knight.cpp:28
@ SPELL_BK_GHOUL_EXPLODE
Definition boss_black_knight.cpp:49
events
Definition boss_sartura.cpp:43
virtual void SetDynamicFlag(uint32 flag)
Definition Object.h:123
void clear()
Definition ScriptedCreature.h:83
bool HasUnitFlag(UnitFlags flags) const
Definition Unit.h:718
uint32 GetMaxHealth() const
Definition Unit.h:1046
void SetUnitFlag2(UnitFlags2 flags)
Definition Unit.h:725
void SetHealth(uint32 val)
Definition Unit.cpp:15530
void AddUnitState(uint32 f)
Definition Unit.h:706
void SetControlled(bool apply, UnitState state, Unit *source=nullptr, bool isFear=false)
Definition Unit.cpp:18072
uint32 GetHealth() const
Definition Unit.h:1045
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:1178
void RemoveAllAuras()
Definition Unit.cpp:5351
void SetUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:719

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:59
@ TEAM_HORDE
Definition SharedDefines.h:761
@ 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
Definition Creature.h:43
ObjectGuid GetGuidData(uint32 type) const override
Definition InstanceScript.cpp:110
Map * instance
Definition InstanceScript.h:149
Creature * GetCreature(ObjectGuid const guid)
Definition Map.cpp:2498
void DespawnAll(uint32 delay=0)
Definition ScriptedCreature.cpp:71
Definition Unit.h:636
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:51
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:52
Talk
Definition hyjal.cpp:82
@ BOSS_BLACK_KNIGHT
Definition trial_of_the_champion.h:31
@ DATA_TEAMID_IN_INSTANCE
Definition trial_of_the_champion.h:44
@ DATA_ANNOUNCER
Definition trial_of_the_champion.h:35
@ SAY_BK_AGGRO
Definition trial_of_the_champion.h:240

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:208
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition Creature.cpp:2177

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

Referenced by SpellHitTarget().

◆ JustDied()

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

Reimplemented from CreatureAI.

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

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 CreatureAI.

297 {
298 summons.Summon(summon);
299 if (Unit* target = summon->SelectNearestTarget(200.0f))
300 {
301 summon->AI()->AttackStart(target);
302 DoZoneInCombat(summon);
303 }
304 }
void DoZoneInCombat(Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
Definition CreatureAI.cpp:106
Unit * SelectNearestTarget(float dist=0, bool playerOnly=false) const
Select nearest hostile unit within the given distance (regardless of threat list).
Definition Creature.cpp:2387
CreatureAI * AI() const
Definition Creature.h:141
void Summon(Creature const *summon)
Definition ScriptedCreature.h:88
virtual void AttackStart(Unit *)
Definition UnitAI.cpp:27

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 CreatureAI.

307 {
308 if (victim->IsPlayer())
309 {
311 }
312 }
bool IsPlayer() const
Definition Object.h:200
@ SAY_BK_KILL_PLAYER
Definition trial_of_the_champion.h:243

References Object::IsPlayer(), and SAY_BK_KILL_PLAYER.

◆ Reset()

void boss_black_knight::boss_black_knightAI::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

118 {
119 events.Reset();
121 Phase = 1;
124 me->SetImmuneToAll(true);
126 if (pInstance)
128
129 //me->SetLootMode(0); // [LOOT]
130 }
@ NOT_STARTED
Definition InstanceScript.h:58
@ REACT_PASSIVE
Definition Unit.h:548
Phase
Definition boss_zuljin.cpp:82
void SetDisplayId(uint32 displayId, float displayScale=1.f) override
Definition Creature.cpp:3532
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:95
uint32 GetNativeDisplayId() const
Definition Unit.h:1896
void SetImmuneToAll(bool apply, bool keepCombat=false)
Definition Unit.h:883

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 CreatureAI.

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
@ EVADE_REASON_OTHER
Definition CreatureAI.h:93
virtual void RemoveDynamicFlag(uint32 flag)
Definition Object.h:124
void ClearUnitState(uint32 f)
Definition Unit.h:708
void RemoveUnitFlag2(UnitFlags2 flags)
Definition Unit.h:726
void RemoveUnitFlag(UnitFlags flags)
UnitFlags available in UnitDefines.h.
Definition Unit.h:720
void EnterEvadeMode(EvadeReason why) override
Definition boss_black_knight.cpp:132
uint8 Phase
Definition boss_black_knight.cpp:115
@ SAY_BK_PHASE_3
Definition trial_of_the_champion.h:242
@ SAY_BK_PHASE_2
Definition trial_of_the_champion.h:241

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  )
inlineoverridevirtual

Use to start attacking a target. Called just before JustEngagedWith()

Todo:
: Multiple variations + not always happening, from video sources, needs sniff to transition from DB.

Implements UnitAI.

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
@ LANG_UNIVERSAL
Definition SharedDefines.h:735
@ UNIT_STATE_CASTING
Definition UnitDefines.h:185
#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
bool UpdateVictim()
Definition CreatureAI.cpp:280
bool empty() const
Definition ScriptedCreature.h:73
iterator begin()
Definition ScriptedCreature.h:48
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
Unit * GetVictim() const
Definition Unit.h:862
bool HasUnitState(const uint32 f) const
Definition Unit.h:707

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, Random, 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

The documentation for this struct was generated from the following file: