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

Public Member Functions

 npc_chesspiece (Creature *creature)
 
void Reset () override
 
void EnterEvadeMode (EvadeReason) override
 
void MovementInform (uint32 movementType, uint32) override
 
void AttackStart (Unit *) override
 
KarazhanChessOrientationType GetDefaultOrientationForTeam ()
 
void CastChangeFacing (Creature *piece, Creature *trigger)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
void DoAction (int32 param) override
 
void JustDied (Unit *) override
 
Creature * GetEnemyPiece (float maxDistance, uint8 searchType=CHESS_PIECE_SEARCH_TYPE_CLOSEST, bool checkFront=true)
 
Creature * GetLowestHpFriendlyPiece (float maxDistance, uint32 minHPDiff)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void InitializeCombatSpellsByEntry ()
 
void SpellHitTarget (Unit *target, SpellInfo const *spellInfo) override
 
void sGossipHello (Player *player) override
 
void sGossipSelect (Player *player, uint32, uint32 gossipListId) 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 (Position const *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged - this happens after JustEnteredCombat.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoRewardPlayersInArea ()
 
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)
 
Unit * DoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
Player * GetPlayerAtMinimumRange (float minRange)
 
Creature * DoSpawnCreature (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=0ms, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, 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 >
T const & DUNGEON_MODE (T const &normal5, T const &heroic10) const
 
template<class T >
T const & RAID_MODE (T const &normal10, T const &normal25) const
 
template<class T >
T const & RAID_MODE (T const &normal10, T const &normal25, T const &heroic10, T const &heroic25) const
 
Player * SelectTargetFromPlayerList (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=0ms)
 Causes the creature to talk/say the text assigned to their entry in the creature_text database table.
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObject * GetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon.
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
bool IsEngaged () const
 Check if creature is currently engaged in combat.
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At =================================
 
void TriggerAlert (Unit const *who) const
 
virtual bool CanRespawn ()
 
virtual bool IsEscortNPC (bool=true) const
 
void JustEnteredCombat (Unit *who) override
 Called when the unit enters combat.
 
virtual void JustStartedThreateningMe (Unit *who)
 
void EngagementStart (Unit *who)
 
void EngagementOver ()
 
void JustExitedCombat () override
 Called when the unit leaves combat.
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
virtual void OnSpellStart (SpellInfo const *)
 
virtual void OnSpellCast (SpellInfo const *)
 
virtual void OnSpellFailed (SpellInfo const *)
 
virtual void OnChannelFinished (SpellInfo const *)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void PathEndReached (uint32)
 
virtual void WaypointPathStarted (uint32)
 == Waypoints system =============================
 
virtual void WaypointStarted (uint32, uint32)
 
virtual void WaypointReached (uint32, uint32)
 
virtual void WaypointPathEnded (uint32, uint32)
 
virtual void JustReachedHome ()
 
void DoZoneInCombat (Creature *creature=nullptr, float maxRangeToNearestTarget=250.0f)
 
virtual void ReceiveEmote (Player *, uint32)
 
virtual void OwnerAttackedBy (Unit *attacker)
 
virtual void OwnerAttacked (Unit *target)
 
void OnOwnerCombatInteraction (Unit *target)
 
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 ()
 
int32 VisualizeBoundary (uint32 duration, Unit *owner=nullptr, bool fill=false, bool checkZ=false) const
 
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)
 
virtual void DistancingStarted ()
 
virtual void DistancingEnded ()
 
- 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 const &, int32=0)
 
virtual ObjectGuid GetGUID (int32=0) const
 
Unit * SelectTarget (SelectTargetMethod targetType, uint32 position=0, float dist=0.0f, bool playerOnly=false, bool withTank=true, int32 aura=0)
 
template<class PREDICATE >
Unit * SelectTarget (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 OnDespawn ()
 Called when the unit is about to be removed from the world (despawn, grid unload, corpse disappearing, player logging out etc.)
 
virtual void EvadeTimerExpired ()
 Called when evade timer expires (target unreachable for too long)
 
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, int32 aura=0)
 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 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
 

Private Attributes

InstanceScript * _instance
 
ObjectGuid _charmerGUID
 
uint32 _nextMoveTimer
 
uint32 _combatSpellTimer
 
uint32 _combatSpellTimerBase
 
uint32 _combatSpellTimer2
 
uint32 _combatSpellTimerBase2
 
KarazhanChessOrientationType _currentOrientation
 
bool _teamControlledByRaid
 
Position _homePosition
 

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 ()
 
- Public Attributes inherited from ScriptedAI
Creature * me
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoType * AISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
Creature * DoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
Creature * DoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
Creature * DoSummonFlyer (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
 
bool _isEngaged
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_chesspiece()

npc_chesspiece::npc_chesspiece ( Creature *  creature)
inline
1423 : ScriptedAI(creature)
1424 {
1425 _instance = creature->GetInstanceScript();
1426
1428 _homePosition = creature->GetPosition();
1429
1431
1433
1435 {
1436 case TEAM_ALLIANCE:
1438 break;
1439 case TEAM_HORDE:
1441 break;
1442 case TEAM_NEUTRAL:
1443 _teamControlledByRaid = true;
1444 break;
1445 }
1446 }
constexpr auto IN_MILLISECONDS
Definition Common.h:53
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ TEAM_NEUTRAL
Definition SharedDefines.h:750
@ TEAM_ALLIANCE
Definition SharedDefines.h:748
@ TEAM_HORDE
Definition SharedDefines.h:749
uint32 GetFaction() const override
Definition Unit.h:857
InstanceScript * GetInstanceScript() const
Definition Object.cpp:1247
virtual uint32 GetData(uint32) const
Definition ZoneScript.h:51
@ CHESS_FACTION_HORDE
Definition karazhan.h:204
@ CHESS_FACTION_ALLIANCE
Definition karazhan.h:205
@ CHESS_EVENT_TEAM
Definition karazhan.h:57
void GetPosition(float &x, float &y) const
Definition Position.h:126
Definition ScriptedCreature.h:202
Creature * me
Definition ScriptedCreature.h:292
void InitializeCombatSpellsByEntry()
Definition boss_chess_event.cpp:1850
KarazhanChessOrientationType _currentOrientation
Definition boss_chess_event.cpp:2048
uint32 _nextMoveTimer
Definition boss_chess_event.cpp:2042
Position _homePosition
Definition boss_chess_event.cpp:2051
bool _teamControlledByRaid
Definition boss_chess_event.cpp:2050
KarazhanChessOrientationType GetDefaultOrientationForTeam()
Definition boss_chess_event.cpp:1500
InstanceScript * _instance
Definition boss_chess_event.cpp:2038

References _currentOrientation, _homePosition, _instance, _nextMoveTimer, _teamControlledByRaid, CHESS_EVENT_TEAM, CHESS_FACTION_ALLIANCE, CHESS_FACTION_HORDE, ZoneScript::GetData(), GetDefaultOrientationForTeam(), Unit::GetFaction(), WorldObject::GetInstanceScript(), Position::GetPosition(), IN_MILLISECONDS, InitializeCombatSpellsByEntry(), ScriptedAI::me, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, and urand().

Member Function Documentation

◆ AttackStart()

void npc_chesspiece::AttackStart ( Unit *  )
inlineoverridevirtual

Reimplemented from UnitAI.

1497 {
1498 }

◆ CastChangeFacing()

void npc_chesspiece::CastChangeFacing ( Creature *  piece,
Creature *  trigger 
)
inline
1514 {
1515 piece->CastSpell(trigger, SPELL_CHANGE_FACING, true);
1516 }
@ SPELL_CHANGE_FACING
Definition boss_chess_event.cpp:51
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:1378

References Unit::CastSpell(), and SPELL_CHANGE_FACING.

Referenced by MovementInform().

◆ DoAction()

void npc_chesspiece::DoAction ( int32  param)
inlineoverridevirtual

Reimplemented from UnitAI.

1627 {
1628 switch (param)
1629 {
1633 break;
1634 default:
1635 break;
1636 }
1637 }
@ ACTION_CHESS_PIECE_RESET_ORIENTATION
Definition karazhan.h:174

References _currentOrientation, _nextMoveTimer, ACTION_CHESS_PIECE_RESET_ORIENTATION, GetDefaultOrientationForTeam(), IN_MILLISECONDS, and urand().

◆ EnterEvadeMode()

void npc_chesspiece::EnterEvadeMode ( EvadeReason  )
inlineoverridevirtual

Reimplemented from CreatureAI.

1467 {
1468 }

◆ GetDefaultOrientationForTeam()

KarazhanChessOrientationType npc_chesspiece::GetDefaultOrientationForTeam ( )
inline
1501 {
1502 switch (me->GetFaction())
1503 {
1505 return ORI_NW;
1507 return ORI_SE;
1508 }
1509
1510 return ORI_SE;
1511 }
@ ORI_NW
Definition boss_chess_event.cpp:80
@ ORI_SE
Definition boss_chess_event.cpp:76

References CHESS_FACTION_ALLIANCE, CHESS_FACTION_HORDE, Unit::GetFaction(), ScriptedAI::me, ORI_NW, and ORI_SE.

Referenced by DoAction(), and npc_chesspiece().

◆ GetEnemyPiece()

Creature * npc_chesspiece::GetEnemyPiece ( float  maxDistance,
uint8  searchType = CHESS_PIECE_SEARCH_TYPE_CLOSEST,
bool  checkFront = true 
)
inline
1650 {
1652 {
1653 return CAST_AI(npc_echo_of_medivh, medivh->AI())->GetPiece(me, searchType, maxDistance, true, 0, checkFront);
1654 }
1655
1656 return nullptr;
1657 }
#define CAST_AI(a, b)
Definition UnitAI.h:26
Definition Creature.h:47
ObjectGuid GetGuidData(uint32 type) const override
Definition InstanceScript.cpp:121
@ DATA_ECHO_OF_MEDIVH
Definition karazhan.h:60
Creature * GetCreature(WorldObject const &u, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:234
Definition boss_chess_event.cpp:192

References _instance, CAST_AI, DATA_ECHO_OF_MEDIVH, ObjectAccessor::GetCreature(), InstanceScript::GetGuidData(), and ScriptedAI::me.

Referenced by SpellHitTarget(), and UpdateAI().

◆ GetLowestHpFriendlyPiece()

Creature * npc_chesspiece::GetLowestHpFriendlyPiece ( float  maxDistance,
uint32  minHPDiff 
)
inline
1660 {
1662 {
1663 return CAST_AI(npc_echo_of_medivh, medivh->AI())->GetPiece(me, CHESS_PIECE_SEARCH_TYPE_RANDOM, maxDistance, false, minHPDiff, false);
1664 }
1665
1666 return nullptr;
1667 }
@ CHESS_PIECE_SEARCH_TYPE_RANDOM
Definition boss_chess_event.cpp:188

References _instance, CAST_AI, CHESS_PIECE_SEARCH_TYPE_RANDOM, DATA_ECHO_OF_MEDIVH, ObjectAccessor::GetCreature(), InstanceScript::GetGuidData(), and ScriptedAI::me.

Referenced by UpdateAI().

◆ InitializeCombatSpellsByEntry()

void npc_chesspiece::InitializeCombatSpellsByEntry ( )
inline
1851 {
1852 switch (me->GetEntry())
1853 {
1854 case NPC_PAWN_A:
1855 case NPC_PAWN_H:
1858 break;
1859 case NPC_KING_A:
1860 case NPC_KING_H:
1863 break;
1864 case NPC_BISHOP_A:
1865 case NPC_BISHOP_H:
1868 break;
1869 case NPC_ROOK_A:
1870 case NPC_ROOK_H:
1871 case NPC_KNIGHT_A:
1872 case NPC_KNIGHT_H:
1873 case NPC_QUEEN_A:
1874 case NPC_QUEEN_H:
1877 break;
1878
1879 default:
1880 return;
1881 }
1882
1885 }
uint32 GetEntry() const
Definition Object.h:123
@ NPC_QUEEN_H
Definition karazhan.h:123
@ NPC_ROOK_A
Definition karazhan.h:128
@ NPC_KNIGHT_H
Definition karazhan.h:121
@ NPC_KING_A
Definition karazhan.h:130
@ NPC_PAWN_H
Definition karazhan.h:119
@ NPC_PAWN_A
Definition karazhan.h:120
@ NPC_ROOK_H
Definition karazhan.h:127
@ NPC_KING_H
Definition karazhan.h:129
@ NPC_QUEEN_A
Definition karazhan.h:124
@ NPC_BISHOP_H
Definition karazhan.h:125
@ NPC_BISHOP_A
Definition karazhan.h:126
@ NPC_KNIGHT_A
Definition karazhan.h:122
uint32 _combatSpellTimer
Definition boss_chess_event.cpp:2043
uint32 _combatSpellTimer2
Definition boss_chess_event.cpp:2045
uint32 _combatSpellTimerBase2
Definition boss_chess_event.cpp:2046
uint32 _combatSpellTimerBase
Definition boss_chess_event.cpp:2044

References _combatSpellTimer, _combatSpellTimer2, _combatSpellTimerBase, _combatSpellTimerBase2, Object::GetEntry(), IN_MILLISECONDS, ScriptedAI::me, NPC_BISHOP_A, NPC_BISHOP_H, NPC_KING_A, NPC_KING_H, NPC_KNIGHT_A, NPC_KNIGHT_H, NPC_PAWN_A, NPC_PAWN_H, NPC_QUEEN_A, NPC_QUEEN_H, NPC_ROOK_A, NPC_ROOK_H, and urand().

Referenced by npc_chesspiece().

◆ JustDied()

void npc_chesspiece::JustDied ( Unit *  )
inlineoverridevirtual

Reimplemented from CreatureAI.

1640 {
1642 {
1643 CAST_AI(npc_echo_of_medivh, medivh->AI())->HandlePieceJustDied(me);
1644 }
1645
1647 }
Unit * GetCharmer() const
Definition Unit.cpp:7525
void RemoveCharmedBy(Unit *charmer)
Definition Unit.cpp:14502

References _instance, CAST_AI, DATA_ECHO_OF_MEDIVH, Unit::GetCharmer(), ObjectAccessor::GetCreature(), InstanceScript::GetGuidData(), ScriptedAI::me, and Unit::RemoveCharmedBy().

◆ MovementInform()

void npc_chesspiece::MovementInform ( uint32  movementType,
uint32   
)
inlineoverridevirtual

Reimplemented from CreatureAI.

1471 {
1472 if (movementType != POINT_MOTION_TYPE)
1473 {
1474 return;
1475 }
1476
1477 if (!me->IsCharmed())
1478 {
1480
1481 if (!_nextMoveTimer)
1482 {
1484 }
1485
1487 {
1488 if (Creature* target = CAST_AI(npc_echo_of_medivh, medivh->AI())->GetHostileTargetForChangeFacing(me, _currentOrientation))
1489 {
1490 CastChangeFacing(me, target);
1491 }
1492 }
1493 }
1494 }
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
@ UNIT_NPC_FLAG_GOSSIP
Definition UnitDefines.h:322
bool IsCharmed() const
Definition Unit.h:1327
void SetNpcFlag(NPCFlags flags)
Definition Unit.h:770
void CastChangeFacing(Creature *piece, Creature *trigger)
Definition boss_chess_event.cpp:1513

References _currentOrientation, _instance, _nextMoveTimer, CAST_AI, CastChangeFacing(), DATA_ECHO_OF_MEDIVH, ObjectAccessor::GetCreature(), InstanceScript::GetGuidData(), IN_MILLISECONDS, Unit::IsCharmed(), ScriptedAI::me, POINT_MOTION_TYPE, Unit::SetNpcFlag(), UNIT_NPC_FLAG_GOSSIP, and urand().

◆ OnCharmed()

void npc_chesspiece::OnCharmed ( bool  apply)
inlineoverridevirtual

Called when unit is charmed.

Reimplemented from CreatureAI.

1519 {
1520 Unit* charmer = me->GetCharmer();
1521 if (apply)
1522 {
1523 ASSERT(charmer);
1524 _charmerGUID = charmer->GetGUID();
1526 me->SetWalk(true);
1528
1529 // Build new action bar
1530 if (Player* playerCharmer = charmer->ToPlayer())
1531 {
1532 WorldPacket data(SMSG_PET_SPELLS, 1 + 8 + 2 + 4 + 1 + 1 + 2 + MAX_SPELL_CONTROL_BAR * 4 + 1 + 1);
1533 data << me->GetGUID();
1534 data << uint16(0);
1535 data << uint32(0);
1536 data << uint8(me->GetReactState());
1537 data << uint8(0);
1538 data << uint16(0);
1539
1540 for (uint32 i = 0; i < MAX_CREATURE_SPELLS; ++i)
1541 {
1542 uint32 spellId = me->m_spells[i];
1543 SpellInfo const* spellInfo = sSpellMgr->GetSpellInfo(spellId);
1544 if (!spellInfo)
1545 {
1546 data << uint16(0) << uint8(0) << uint8(i + 8);
1547 continue;
1548 }
1549
1550 data << uint32(MAKE_UNIT_ACTION_BUTTON(spellId, ACT_ENABLED));
1551 }
1552
1554 data << uint32(0);
1555
1556 data << uint8(0);
1557 data << uint8(0);
1558
1559 playerCharmer->SendDirectMessage(&data);
1560 }
1561 }
1562 else
1563 {
1565
1566 if (Unit* charmer = ObjectAccessor::GetUnit(*me, _charmerGUID))
1567 {
1569 charmer->CastSpell(charmer, SPELL_GAME_IN_SESSION, true);
1570 charmer->CastSpell(charmer, SPELL_RECENTLY_INGAME, true);
1571 charmer->NearTeleportTo(-11106.92f, -1843.32f, 229.626f, 4.2331f);
1572 }
1573
1575 }
1576
1577 if (apply)
1578 {
1580 {
1582 }
1584 {
1586 }
1587 else if (uint32 oldFaction = me->GetOldFactionId())
1588 {
1589 me->SetFaction(oldFaction);
1590 }
1591 else if (FactionTemplateEntry const* factionTemplateEntry = me->GetFactionTemplateEntry())
1592 {
1593 me->SetFaction(factionTemplateEntry->faction);
1594 }
1595 else
1596 {
1598 }
1599 }
1600 else
1601 {
1602 switch (me->GetEntry())
1603 {
1604 case NPC_PAWN_A:
1605 case NPC_KING_A:
1606 case NPC_KNIGHT_A:
1607 case NPC_QUEEN_A:
1608 case NPC_BISHOP_A:
1609 case NPC_ROOK_A:
1611 break;
1612 case NPC_KING_H:
1613 case NPC_ROOK_H:
1614 case NPC_BISHOP_H:
1615 case NPC_QUEEN_H:
1616 case NPC_KNIGHT_H:
1617 case NPC_PAWN_H:
1619 break;
1620 default:
1621 break;
1622 }
1623 }
1624 }
#define MAKE_UNIT_ACTION_BUTTON(A, T)
Definition CharmInfo.h:33
@ ACT_ENABLED
Definition CharmInfo.h:63
#define MAX_SPELL_CONTROL_BAR
Definition CharmInfo.h:27
std::uint8_t uint8
Definition Define.h:109
std::uint32_t uint32
Definition Define.h:107
std::uint16_t uint16
Definition Define.h:108
#define ASSERT
Definition Errors.h:68
#define sSpellMgr
Definition SpellMgr.h:851
static constexpr uint32 MAX_CREATURE_SPELLS
Definition Unit.h:47
@ SPELL_CONTROL_PIECE
Definition boss_chess_event.cpp:54
@ SPELL_RECENTLY_INGAME
Definition boss_chess_event.cpp:55
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition Creature.h:255
ReactStates GetReactState() const
Definition Creature.h:100
bool SetWalk(bool enable) override
Enable or disable the creature's walk mode by removing: MOVEMENTFLAG_WALKING. Infom also the client.
Definition Creature.cpp:3416
void Clear()
Definition ObjectGuid.h:141
Player * ToPlayer()
Definition Object.h:208
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:120
Definition Player.h:1086
Definition SpellInfo.h:340
Definition Unit.h:670
void SetFaction(uint32 faction)
Definition Unit.cpp:6886
FactionTemplateEntry const * GetFactionTemplateEntry() const
Definition Unit.cpp:6864
void RemoveNpcFlag(NPCFlags flags)
Definition Unit.h:771
uint32 GetOldFactionId() const
Definition Unit.h:861
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4969
void NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:15650
Definition WorldPacket.h:26
@ SMSG_PET_SPELLS
Definition Opcodes.h:407
@ CHESS_FACTION_BOTH
Definition karazhan.h:206
@ SPELL_GAME_IN_SESSION
Definition karazhan.h:186
Unit * GetUnit(WorldObject const &, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:223
Definition DBCStructure.h:975
ObjectGuid _charmerGUID
Definition boss_chess_event.cpp:2040

References _charmerGUID, _instance, ACT_ENABLED, ASSERT, Unit::CastSpell(), CHESS_EVENT_TEAM, CHESS_FACTION_ALLIANCE, CHESS_FACTION_BOTH, CHESS_FACTION_HORDE, ObjectGuid::Clear(), Unit::GetCharmer(), ZoneScript::GetData(), Object::GetEntry(), Unit::GetFactionTemplateEntry(), Object::GetGUID(), Unit::GetOldFactionId(), Creature::GetReactState(), ObjectAccessor::GetUnit(), Creature::m_spells, MAKE_UNIT_ACTION_BUTTON, MAX_CREATURE_SPELLS, MAX_SPELL_CONTROL_BAR, ScriptedAI::me, Unit::NearTeleportTo(), NPC_BISHOP_A, NPC_BISHOP_H, NPC_KING_A, NPC_KING_H, NPC_KNIGHT_A, NPC_KNIGHT_H, NPC_PAWN_A, NPC_PAWN_H, NPC_QUEEN_A, NPC_QUEEN_H, NPC_ROOK_A, NPC_ROOK_H, Unit::RemoveAurasDueToSpell(), Unit::RemoveNpcFlag(), Unit::SetFaction(), Unit::SetNpcFlag(), Creature::SetWalk(), SMSG_PET_SPELLS, SPELL_CONTROL_PIECE, SPELL_GAME_IN_SESSION, SPELL_RECENTLY_INGAME, sSpellMgr, TEAM_ALLIANCE, TEAM_HORDE, Object::ToPlayer(), and UNIT_NPC_FLAG_GOSSIP.

◆ Reset()

void npc_chesspiece::Reset ( )
inlineoverridevirtual

Reimplemented from UnitAI.

1449 {
1451
1454 me->SetWalk(true);
1455
1457
1458 for (uint8 i = SPELL_SCHOOL_NORMAL; i < MAX_SPELL_SCHOOL; ++i)
1459 {
1461 }
1462
1464 }
SpellSchools
Definition SharedDefines.h:270
@ SPELL_SCHOOL_NORMAL
Definition SharedDefines.h:271
constexpr auto MAX_SPELL_SCHOOL
Definition SharedDefines.h:280
@ IMMUNITY_ID
Definition SharedDefines.h:1404
@ SHEATH_STATE_MELEE
Definition UnitDefines.h:130
@ REACT_PASSIVE
Definition Unit.h:574
@ SPELL_MELEE_ATTACK_TIMER
Definition boss_chess_event.cpp:58
void SetReactState(ReactStates state)
A creature can have 3 ReactStates : Agressive, Passive, Neutral.
Definition Creature.h:99
SpellCastResult DoCastSelf(uint32 spellId, bool triggered=false)
Definition UnitAI.h:399
void ApplySpellImmune(uint32 spellId, uint32 op, uint32 type, bool apply, SpellImmuneBlockType blockType=SPELL_BLOCK_TYPE_ALL)
Definition Unit.cpp:10247
virtual void SetSheath(SheathState sheathed)
Definition Unit.h:1793
void SetResistance(SpellSchools school, int32 val)
Definition Unit.h:1215

References _homePosition, Unit::ApplySpellImmune(), UnitAI::DoCastSelf(), IMMUNITY_ID, MAX_SPELL_SCHOOL, ScriptedAI::me, Unit::NearTeleportTo(), REACT_PASSIVE, Creature::SetReactState(), Unit::SetResistance(), Unit::SetSheath(), Creature::SetWalk(), SHEATH_STATE_MELEE, SPELL_GAME_IN_SESSION, SPELL_MELEE_ATTACK_TIMER, and SPELL_SCHOOL_NORMAL.

◆ sGossipHello()

void npc_chesspiece::sGossipHello ( Player *  player)
inlineoverridevirtual

Reimplemented from UnitAI.

1948 {
1951 {
1952 SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
1953 return;
1954 }
1955
1957 {
1958 SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
1959 return;
1960 }
1961
1962 bool ok = true;
1963 switch (me->GetEntry())
1964 {
1965 case NPC_PAWN_H:
1966 case NPC_PAWN_A:
1967 case NPC_KNIGHT_H:
1968 case NPC_KNIGHT_A:
1969 case NPC_QUEEN_H:
1970 case NPC_QUEEN_A:
1971 case NPC_BISHOP_H:
1972 case NPC_BISHOP_A:
1973 case NPC_ROOK_H:
1974 case NPC_ROOK_A:
1975 if (chessPhase != CHESS_PHASE_INPROGRESS_PVE && chessPhase != CHESS_PHASE_INPROGRESS_PVP)
1976 {
1977 ok = false;
1978 }
1979 break;
1980 case NPC_KING_H:
1981 case NPC_KING_A:
1982 if (chessPhase != CHESS_PHASE_INPROGRESS_PVE && chessPhase != CHESS_PHASE_INPROGRESS_PVP && chessPhase != CHESS_PHASE_PVE_WARMUP && chessPhase != CHESS_PHASE_PVP_WARMUP)
1983 {
1984 ok = false;
1985 }
1986 break;
1987 default:
1988 ok = false;
1989 break;
1990 }
1991
1992 if (ok && !player->HasAura(SPELL_RECENTLY_INGAME))
1993 {
1995 }
1996
1997 SendGossipMenuFor(player, player->GetGossipTextId(me), me->GetGUID());
1998 }
@ GOSSIP_ICON_CHAT
Definition GossipDef.h:61
void AddGossipItemFor(Player *player, uint32 icon, std::string const &text, uint32 sender, uint32 action)
Definition ScriptedGossip.cpp:28
void SendGossipMenuFor(Player *player, uint32 npcTextID, ObjectGuid const &guid)
Definition ScriptedGossip.cpp:45
@ GOSSIP_SENDER_MAIN
Definition ScriptedGossip.h:70
@ GOSSIP_ACTION_INFO_DEF
Definition ScriptedGossip.h:68
uint32 GetGossipTextId(uint32 menuId, WorldObject *source)
Definition PlayerGossip.cpp:409
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5798
std::string const & GetName() const
Definition Object.h:535
@ CHESS_PHASE_PVE_FINISHED
Definition karazhan.h:197
@ CHESS_PHASE_INPROGRESS_PVP
Definition karazhan.h:199
@ CHESS_PHASE_INPROGRESS_PVE
Definition karazhan.h:195
@ CHESS_PHASE_PVE_WARMUP
Definition karazhan.h:194
@ CHESS_PHASE_PVP_WARMUP
Definition karazhan.h:198
@ DATA_CHESS_GAME_PHASE
Definition karazhan.h:59

References _instance, AddGossipItemFor(), CHESS_EVENT_TEAM, CHESS_FACTION_ALLIANCE, CHESS_FACTION_HORDE, CHESS_PHASE_INPROGRESS_PVE, CHESS_PHASE_INPROGRESS_PVP, CHESS_PHASE_PVE_FINISHED, CHESS_PHASE_PVE_WARMUP, CHESS_PHASE_PVP_WARMUP, DATA_CHESS_GAME_PHASE, ZoneScript::GetData(), Object::GetEntry(), Unit::GetFaction(), Player::GetGossipTextId(), Object::GetGUID(), WorldObject::GetName(), GOSSIP_ACTION_INFO_DEF, GOSSIP_ICON_CHAT, GOSSIP_SENDER_MAIN, Unit::HasAura(), ScriptedAI::me, NPC_BISHOP_A, NPC_BISHOP_H, NPC_KING_A, NPC_KING_H, NPC_KNIGHT_A, NPC_KNIGHT_H, NPC_PAWN_A, NPC_PAWN_H, NPC_QUEEN_A, NPC_QUEEN_H, NPC_ROOK_A, NPC_ROOK_H, SendGossipMenuFor(), SPELL_RECENTLY_INGAME, TEAM_ALLIANCE, and TEAM_HORDE.

◆ sGossipSelect()

void npc_chesspiece::sGossipSelect ( Player *  player,
uint32  ,
uint32  gossipListId 
)
inlineoverridevirtual

Reimplemented from UnitAI.

2001 {
2002 if (me->IsCharmed() && me->GetCharmerGUID() == player->GetGUID())
2003 {
2005 player->StopCastingCharm();
2006 }
2007
2008 uint32 const action = player->PlayerTalkClass->GetGossipOptionAction(gossipListId);
2009 if (action == GOSSIP_ACTION_INFO_DEF + 1)
2010 {
2011 player->CastSpell(me, SPELL_CONTROL_PIECE, false);
2012
2013 switch (me->GetEntry())
2014 {
2015 case NPC_KING_H:
2016 case NPC_KING_A:
2017 {
2019 if (chessPhase == CHESS_PHASE_PVE_WARMUP)
2020 {
2022 }
2023 else if (chessPhase == CHESS_PHASE_PVP_WARMUP)
2024 {
2026 }
2027 break;
2028 }
2029 default:
2030 break;
2031 }
2032 }
2033
2034 CloseGossipMenuFor(player);
2035 }
void CloseGossipMenuFor(Player *player)
Definition ScriptedGossip.cpp:56
uint32 GetGossipOptionAction(uint32 selection) const
Definition GossipDef.h:271
PlayerMenu * PlayerTalkClass
Definition Player.h:2287
void StopCastingCharm(Aura *except=nullptr)
Definition Player.cpp:9551
ObjectGuid GetCharmerGUID() const
Definition Unit.h:725
virtual void SetData(uint32, uint32)
Definition ZoneScript.h:52

References _instance, Unit::CastSpell(), CHESS_PHASE_INPROGRESS_PVE, CHESS_PHASE_INPROGRESS_PVP, CHESS_PHASE_PVE_WARMUP, CHESS_PHASE_PVP_WARMUP, CloseGossipMenuFor(), DATA_CHESS_GAME_PHASE, Unit::GetCharmer(), Unit::GetCharmerGUID(), ZoneScript::GetData(), Object::GetEntry(), PlayerMenu::GetGossipOptionAction(), Object::GetGUID(), GOSSIP_ACTION_INFO_DEF, Unit::IsCharmed(), ScriptedAI::me, NPC_KING_A, NPC_KING_H, Player::PlayerTalkClass, Unit::RemoveCharmedBy(), ZoneScript::SetData(), SPELL_CONTROL_PIECE, and Player::StopCastingCharm().

◆ SpellHitTarget()

void npc_chesspiece::SpellHitTarget ( Unit *  target,
SpellInfo const *  spellInfo 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

1888 {
1889 if (spellInfo->Id == SPELL_MELEE_ATTACK_TIMER_TRIGGER)
1890 {
1891 if (Creature* victim = GetEnemyPiece(10.0f))
1892 {
1893 DoCast(victim, SPELL_MELEE_DAMAGE, true);
1894 }
1895
1896 return;
1897 }
1898
1900 {
1901 return;
1902 }
1903
1904 switch (spellInfo->Id)
1905 {
1906 case SPELL_MOVE_1:
1907 case SPELL_MOVE_2:
1908 case SPELL_MOVE_3:
1909 case SPELL_MOVE_4:
1910 case SPELL_MOVE_5:
1911 case SPELL_MOVE_6:
1912 case SPELL_MOVE_GENERIC:
1914 {
1915 int8 result = CAST_AI(npc_echo_of_medivh, medivh->AI())->HandlePieceMove(me, target->GetGUID(), spellInfo->Id == SPELL_MOVE_GENERIC);
1916 if (result != -1)
1917 {
1920 me->GetMotionMaster()->MovePoint(0, target->GetPositionX(), target->GetPositionY(), target->GetPositionZ());
1921 target->CastSpell(target, SPELL_MOVE_MARKER, false);
1923 }
1924 }
1925 break;
1928 {
1929 int8 result = CAST_AI(npc_echo_of_medivh, medivh->AI())->HandlePieceRotate(me, target->GetGUID());
1930 if (result != -1)
1931 {
1935 if (!_nextMoveTimer)
1936 {
1938 }
1939 }
1940 }
1941 break;
1942 default:
1943 break;
1944 }
1945 }
std::int8_t int8
Definition Define.h:105
@ UNIT_FLAG_NOT_SELECTABLE
Definition UnitDefines.h:282
@ UNIT_FIELD_FLAGS
Definition UpdateFields.h:117
static std::array< float, MAX_ORI > orientations
Definition boss_chess_event.cpp:178
KarazhanChessOrientationType
Definition boss_chess_event.cpp:75
@ SPELL_MOVE_6
Definition boss_chess_event.cpp:47
@ SPELL_MOVE_2
Definition boss_chess_event.cpp:43
@ SPELL_MELEE_ATTACK_TIMER_TRIGGER
Definition boss_chess_event.cpp:59
@ SPELL_MOVE_5
Definition boss_chess_event.cpp:46
@ SPELL_MOVE_COOLDOWN
Definition boss_chess_event.cpp:53
@ SPELL_MOVE_1
Definition boss_chess_event.cpp:42
@ SPELL_MOVE_MARKER
Definition boss_chess_event.cpp:52
@ SPELL_MOVE_3
Definition boss_chess_event.cpp:44
@ SPELL_MOVE_4
Definition boss_chess_event.cpp:45
@ SPELL_MELEE_DAMAGE
Definition boss_chess_event.cpp:60
@ SPELL_MOVE_GENERIC
Definition boss_chess_event.cpp:49
@ NPC_CHESS_MOVE_TRIGGER
Definition boss_chess_event.cpp:65
void MovePoint(uint32 id, Position const &pos, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, float speed=0.f, bool generatePath=true, bool forceDestination=true, std::optional< AnimTier > animTier=std::nullopt)
Definition MotionMaster.h:241
bool HasFlag(uint16 index, uint32 flag) const
Definition Object.cpp:880
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:175
void SetFacingTo(float ori)
Definition Unit.cpp:16157
MotionMaster * GetMotionMaster()
Definition Unit.h:1774
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122
Creature * GetEnemyPiece(float maxDistance, uint8 searchType=CHESS_PIECE_SEARCH_TYPE_CLOSEST, bool checkFront=true)
Definition boss_chess_event.cpp:1649

References _currentOrientation, _instance, _nextMoveTimer, CAST_AI, Unit::CastSpell(), DATA_ECHO_OF_MEDIVH, UnitAI::DoCast(), ObjectAccessor::GetCreature(), GetEnemyPiece(), Object::GetEntry(), Object::GetGUID(), InstanceScript::GetGuidData(), Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), Object::HasFlag(), SpellInfo::Id, IN_MILLISECONDS, ScriptedAI::me, MotionMaster::MovePoint(), NPC_CHESS_MOVE_TRIGGER, orientations, Unit::RemoveNpcFlag(), Unit::SetFacingTo(), SPELL_CHANGE_FACING, SPELL_MELEE_ATTACK_TIMER_TRIGGER, SPELL_MELEE_DAMAGE, SPELL_MOVE_1, SPELL_MOVE_2, SPELL_MOVE_3, SPELL_MOVE_4, SPELL_MOVE_5, SPELL_MOVE_6, SPELL_MOVE_COOLDOWN, SPELL_MOVE_GENERIC, SPELL_MOVE_MARKER, UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE, UNIT_NPC_FLAG_GOSSIP, and urand().

◆ UpdateAI()

void npc_chesspiece::UpdateAI ( uint32  )
inlineoverridevirtual

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

Re-check after a second

Shield Block

Heroism

Smash

Elemental Blast

Holy Lance

Geyser

Bloodlust

Hellfire

Shadow Spear

Fireball

Howl

Weapon Deflection

Heroic Blow

Sweep

Stomp

Rain of Fire

Water Shield

Cleave

Fire Shield

Poison Cloud

Bite

Vicious Strike

Implements UnitAI.

1670 {
1672 {
1673 return;
1674 }
1675
1677 if (chessPhase != CHESS_PHASE_INPROGRESS_PVE && chessPhase != CHESS_PHASE_INPROGRESS_PVP)
1678 {
1679 return;
1680 }
1681
1682 if (!me->IsCharmed())
1683 {
1685 {
1686 case TEAM_ALLIANCE:
1688 break;
1689 case TEAM_HORDE:
1691 break;
1692 case TEAM_NEUTRAL:
1693 _teamControlledByRaid = false;
1694 break;
1695 }
1696
1698 {
1699 if (_nextMoveTimer)
1700 {
1701 if (_nextMoveTimer <= diff)
1702 {
1704 {
1705 if (CAST_AI(npc_echo_of_medivh, medivh->AI())->HandlePieceMoveByAI(me, _currentOrientation))
1706 {
1707 _nextMoveTimer = 0;
1708 }
1709 else
1710 {
1712 }
1713 }
1714 }
1715 else
1716 {
1717 _nextMoveTimer -= diff;
1718 }
1719 }
1720 }
1721
1723 {
1724 if (_combatSpellTimer <= diff)
1725 {
1727
1728 switch (me->GetEntry())
1729 {
1730 case NPC_PAWN_A:
1732 break;
1733 case NPC_KING_A:
1735 break;
1736 case NPC_KNIGHT_A:
1738 break;
1739 case NPC_QUEEN_A:
1740 if (Creature* victim = GetEnemyPiece(20.0f))
1741 {
1742 DoCast(victim, SPELL_QUEEN_A_1);
1743 }
1744 break;
1745 case NPC_BISHOP_A:
1747 break;
1748 case NPC_ROOK_A:
1750 break;
1751 case NPC_KING_H:
1753 break;
1754 case NPC_ROOK_H:
1756 break;
1757 case NPC_BISHOP_H:
1759 break;
1760 case NPC_QUEEN_H:
1761 if (Creature* victim = GetEnemyPiece(20.0f))
1762 {
1763 DoCast(victim, SPELL_QUEEN_H_1);
1764 }
1765 break;
1766 case NPC_KNIGHT_H:
1768 break;
1769 case NPC_PAWN_H:
1771 break;
1772 default:
1773 break;
1774 }
1775 }
1776 else
1777 {
1778 _combatSpellTimer -= diff;
1779 }
1780 }
1781
1783 {
1784 if (_combatSpellTimer2 <= diff)
1785 {
1787
1788 switch (me->GetEntry())
1789 {
1790 case NPC_PAWN_A:
1792 break;
1793 case NPC_KING_A:
1795 break;
1796 case NPC_KNIGHT_A:
1798 break;
1799 case NPC_QUEEN_A:
1800 if (Creature* victim = GetEnemyPiece(25.0f, CHESS_PIECE_SEARCH_TYPE_RANDOM, false))
1801 {
1802 DoCast(victim, SPELL_QUEEN_A_2);
1803 }
1804 break;
1805 case NPC_BISHOP_A:
1806 if (Creature* target = GetLowestHpFriendlyPiece(25.0f, 5000))
1807 {
1808 DoCast(target, SPELL_BISHOP_A_2);
1809 }
1810 break;
1811 case NPC_ROOK_A:
1813 break;
1814 case NPC_KING_H:
1816 break;
1817 case NPC_ROOK_H:
1819 break;
1820 case NPC_QUEEN_H:
1821 if (Creature* victim = GetEnemyPiece(25.0f, CHESS_PIECE_SEARCH_TYPE_RANDOM, false))
1822 {
1823 DoCast(victim, SPELL_QUEEN_H_2);
1824 }
1825 break;
1826 case NPC_BISHOP_H:
1827 if (Unit* target = GetLowestHpFriendlyPiece(25.0f, 5000))
1828 {
1829 DoCast(target, SPELL_BISHOP_H_2);
1830 }
1831 break;
1832 case NPC_KNIGHT_H:
1834 break;
1835 case NPC_PAWN_H:
1837 break;
1838 default:
1839 break;
1840 }
1841 }
1842 else
1843 {
1844 _combatSpellTimer2 -= diff;
1845 }
1846 }
1847 }
1848 }
@ SPELL_BISHOP_H_1
Definition boss_chess_event.cpp:95
@ SPELL_ROOK_H_2
Definition boss_chess_event.cpp:113
@ SPELL_KNIGHT_H_1
Definition boss_chess_event.cpp:97
@ SPELL_PAWN_A_1
Definition boss_chess_event.cpp:102
@ SPELL_ROOK_H_1
Definition boss_chess_event.cpp:99
@ SPELL_BISHOP_A_1
Definition boss_chess_event.cpp:96
@ SPELL_KING_H_2
Definition boss_chess_event.cpp:105
@ SPELL_ROOK_A_2
Definition boss_chess_event.cpp:114
@ SPELL_PAWN_A_2
Definition boss_chess_event.cpp:116
@ SPELL_KING_A_1
Definition boss_chess_event.cpp:92
@ SPELL_PAWN_H_1
Definition boss_chess_event.cpp:101
@ SPELL_BISHOP_A_2
Definition boss_chess_event.cpp:110
@ SPELL_QUEEN_A_1
Definition boss_chess_event.cpp:94
@ SPELL_PAWN_H_2
Definition boss_chess_event.cpp:115
@ SPELL_QUEEN_H_2
Definition boss_chess_event.cpp:107
@ SPELL_KING_H_1
Definition boss_chess_event.cpp:91
@ SPELL_QUEEN_H_1
Definition boss_chess_event.cpp:93
@ SPELL_KNIGHT_A_2
Definition boss_chess_event.cpp:112
@ SPELL_QUEEN_A_2
Definition boss_chess_event.cpp:108
@ SPELL_KNIGHT_A_1
Definition boss_chess_event.cpp:98
@ SPELL_KNIGHT_H_2
Definition boss_chess_event.cpp:111
@ SPELL_ROOK_A_1
Definition boss_chess_event.cpp:100
@ SPELL_BISHOP_H_2
Definition boss_chess_event.cpp:109
@ SPELL_KING_A_2
Definition boss_chess_event.cpp:106
SpellCastResult DoCastAOE(uint32 spellId, bool triggered=false)
Definition UnitAI.cpp:282
bool IsNonMeleeSpellCast(bool withDelayed, bool skipChanneled=false, bool skipAutorepeat=false, bool isAutoshoot=false, bool skipInstant=true) const
Definition Unit.cpp:4049
Creature * GetLowestHpFriendlyPiece(float maxDistance, uint32 minHPDiff)
Definition boss_chess_event.cpp:1659

References _combatSpellTimer, _combatSpellTimer2, _combatSpellTimerBase, _combatSpellTimerBase2, _currentOrientation, _instance, _nextMoveTimer, _teamControlledByRaid, CAST_AI, CHESS_EVENT_TEAM, CHESS_FACTION_ALLIANCE, CHESS_FACTION_HORDE, CHESS_PHASE_INPROGRESS_PVE, CHESS_PHASE_INPROGRESS_PVP, CHESS_PIECE_SEARCH_TYPE_RANDOM, DATA_CHESS_GAME_PHASE, DATA_ECHO_OF_MEDIVH, UnitAI::DoCast(), UnitAI::DoCastAOE(), UnitAI::DoCastSelf(), ObjectAccessor::GetCreature(), ZoneScript::GetData(), GetEnemyPiece(), Object::GetEntry(), Unit::GetFaction(), InstanceScript::GetGuidData(), GetLowestHpFriendlyPiece(), Object::HasFlag(), IN_MILLISECONDS, Unit::IsCharmed(), Unit::IsNonMeleeSpellCast(), ScriptedAI::me, NPC_BISHOP_A, NPC_BISHOP_H, NPC_KING_A, NPC_KING_H, NPC_KNIGHT_A, NPC_KNIGHT_H, NPC_PAWN_A, NPC_PAWN_H, NPC_QUEEN_A, NPC_QUEEN_H, NPC_ROOK_A, NPC_ROOK_H, SPELL_BISHOP_A_1, SPELL_BISHOP_A_2, SPELL_BISHOP_H_1, SPELL_BISHOP_H_2, SPELL_KING_A_1, SPELL_KING_A_2, SPELL_KING_H_1, SPELL_KING_H_2, SPELL_KNIGHT_A_1, SPELL_KNIGHT_A_2, SPELL_KNIGHT_H_1, SPELL_KNIGHT_H_2, SPELL_PAWN_A_1, SPELL_PAWN_A_2, SPELL_PAWN_H_1, SPELL_PAWN_H_2, SPELL_QUEEN_A_1, SPELL_QUEEN_A_2, SPELL_QUEEN_H_1, SPELL_QUEEN_H_2, SPELL_ROOK_A_1, SPELL_ROOK_A_2, SPELL_ROOK_H_1, SPELL_ROOK_H_2, TEAM_ALLIANCE, TEAM_HORDE, TEAM_NEUTRAL, UNIT_FIELD_FLAGS, UNIT_FLAG_NOT_SELECTABLE, and urand().

Member Data Documentation

◆ _charmerGUID

ObjectGuid npc_chesspiece::_charmerGUID
private

Referenced by OnCharmed().

◆ _combatSpellTimer

uint32 npc_chesspiece::_combatSpellTimer
private

◆ _combatSpellTimer2

uint32 npc_chesspiece::_combatSpellTimer2
private

◆ _combatSpellTimerBase

uint32 npc_chesspiece::_combatSpellTimerBase
private

◆ _combatSpellTimerBase2

uint32 npc_chesspiece::_combatSpellTimerBase2
private

◆ _currentOrientation

KarazhanChessOrientationType npc_chesspiece::_currentOrientation
private

◆ _homePosition

Position npc_chesspiece::_homePosition
private

Referenced by npc_chesspiece(), and Reset().

◆ _instance

◆ _nextMoveTimer

uint32 npc_chesspiece::_nextMoveTimer
private

◆ _teamControlledByRaid

bool npc_chesspiece::_teamControlledByRaid
private

Referenced by npc_chesspiece(), and UpdateAI().


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