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

Public Member Functions

 npc_wild_wyrmAI (Creature *creature)
 
void EnterEvadeMode (EvadeReason why) override
 
void Reset () override
 
void PassengerBoarded (Unit *, int8, bool apply) override
 == Fields =======================================
 
void MovementInform (uint32 type, uint32 pointId) override
 
void DamageTaken (Unit *who, uint32 &damage, DamageEffectType, SpellSchoolMask) override
 
void AttackStart (Unit *) override
 
void MoveInLineOfSight (Unit *) override
 
void OnCharmed (bool apply) override
 
void SpellHit (Unit *caster, SpellInfo const *spellInfo) override
 
PlayerGetValidPlayer ()
 
void UpdateAI (uint32 diff) 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 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 HealDone (Unit *, uint32 &)
 
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

ObjectGuid playerGUID
 
uint32 checkTimer
 
uint32 announceAttackTimer
 
uint32 attackTimer
 
bool setCharm
 
bool switching
 
bool startPath
 
- 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
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_wild_wyrmAI()

npc_wild_wyrm::npc_wild_wyrmAI::npc_wild_wyrmAI ( Creature creature)
inline
341: ScriptedAI(creature) {}
Definition: ScriptedCreature.h:192

Member Function Documentation

◆ AttackStart()

void npc_wild_wyrm::npc_wild_wyrmAI::AttackStart ( Unit )
inlineoverridevirtual

Reimplemented from ScriptedAI.

407{ }

◆ DamageTaken()

void npc_wild_wyrm::npc_wild_wyrmAI::DamageTaken ( Unit who,
uint32 damage,
DamageEffectType  ,
SpellSchoolMask   
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

398 {
399 if (who != me)
400 {
401 damage = 0;
402 if (!GetValidPlayer())
403 setCharm = true; // will enter evade on next update
404 }
405 }
Creature * me
Definition: ScriptedCreature.h:282
bool setCharm
Definition: zone_storm_peaks.cpp:347
Player * GetValidPlayer()
Definition: zone_storm_peaks.cpp:455

References GetValidPlayer(), ScriptedAI::me, and setCharm.

◆ EnterEvadeMode()

void npc_wild_wyrm::npc_wild_wyrmAI::EnterEvadeMode ( EvadeReason  why)
inlineoverridevirtual

Reimplemented from CreatureAI.

352 {
354 return;
356 }
@ SPELL_AURA_CONTROL_VEHICLE
Definition: SpellAuraDefines.h:299
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition: CreatureAI.cpp:197
bool HasAuraType(AuraType auraType) const
Definition: Unit.cpp:5617
bool switching
Definition: zone_storm_peaks.cpp:348

References CreatureAI::EnterEvadeMode(), Unit::HasAuraType(), ScriptedAI::me, SPELL_AURA_CONTROL_VEHICLE, and switching.

Referenced by UpdateAI().

◆ GetValidPlayer()

Player * npc_wild_wyrm::npc_wild_wyrmAI::GetValidPlayer ( )
inline
456 {
458 if (charmer && charmer->IsAlive() && me->GetDistance(charmer) < 20.0f)
459 return charmer;
460 return nullptr;
461 }
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition: ObjectAccessor.cpp:225
float GetDistance(WorldObject const *obj) const
Definition: Object.cpp:1245
Definition: Player.h:1046
bool IsAlive() const
Definition: Unit.h:1808
ObjectGuid playerGUID
Definition: zone_storm_peaks.cpp:343

References WorldObject::GetDistance(), ObjectAccessor::GetPlayer(), Unit::IsAlive(), ScriptedAI::me, and playerGUID.

Referenced by DamageTaken(), MovementInform(), SpellHit(), and UpdateAI().

◆ MoveInLineOfSight()

void npc_wild_wyrm::npc_wild_wyrmAI::MoveInLineOfSight ( Unit )
inlineoverridevirtual

Reimplemented from CreatureAI.

408{ }

◆ MovementInform()

void npc_wild_wyrm::npc_wild_wyrmAI::MovementInform ( uint32  type,
uint32  pointId 
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

379 {
380 if (type == POINT_MOTION_TYPE && pointId == 1 && !me->GetCharmerGUID())
381 {
382 if (Player* player = GetValidPlayer())
383 {
384 checkTimer = 1;
385 me->SetFullHealth();
386 player->CastSpell(me, SPELL_FIGHT_WYRM_BASE, true);
389 }
390 }
391 else if (type == ESCORT_MOTION_TYPE && me->movespline->Finalized())
392 startPath = true;
393 else if (type == EFFECT_MOTION_TYPE && pointId == me->GetEntry())
394 me->KillSelf();
395 }
@ ESCORT_MOTION_TYPE
Definition: MotionMaster.h:55
@ POINT_MOTION_TYPE
Definition: MotionMaster.h:46
@ EFFECT_MOTION_TYPE
Definition: MotionMaster.h:54
@ SPELL_WYRM_GRIP
Definition: zone_storm_peaks.cpp:325
@ SPELL_FIGHT_WYRM_BASE
Definition: zone_storm_peaks.cpp:321
void SetRegeneratingHealth(bool c)
Definition: Creature.h:310
uint32 GetEntry() const
Definition: Object.h:109
Movement::MoveSpline * movespline
Definition: Unit.h:2440
void SetFullHealth()
Definition: Unit.h:1455
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
ObjectGuid GetCharmerGUID() const
Definition: Unit.h:1820
void KillSelf(bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition: Unit.h:1551
bool Finalized() const
Definition: MoveSpline.h:116
bool startPath
Definition: zone_storm_peaks.cpp:349
uint32 checkTimer
Definition: zone_storm_peaks.cpp:344

References Unit::CastSpell(), checkTimer, EFFECT_MOTION_TYPE, ESCORT_MOTION_TYPE, Movement::MoveSpline::Finalized(), Unit::GetCharmerGUID(), Object::GetEntry(), GetValidPlayer(), Unit::KillSelf(), ScriptedAI::me, Unit::movespline, POINT_MOTION_TYPE, Unit::SetFullHealth(), Creature::SetRegeneratingHealth(), SPELL_FIGHT_WYRM_BASE, SPELL_WYRM_GRIP, and startPath.

◆ OnCharmed()

void npc_wild_wyrm::npc_wild_wyrmAI::OnCharmed ( bool  apply)
inlineoverridevirtual

Reimplemented from CreatureAI.

411 {
412 if (apply)
413 setCharm = true;
414 }

References setCharm.

◆ PassengerBoarded()

void npc_wild_wyrm::npc_wild_wyrmAI::PassengerBoarded ( Unit ,
int8  ,
bool   
)
inlineoverridevirtual

== Fields =======================================

Reimplemented from CreatureAI.

373 {
374 if (!apply && me->IsAlive() && me->HasAura(SPELL_WYRM_GRIP))
376 }
bool HasAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5610
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition: Unit.cpp:4835

References Unit::HasAura(), Unit::IsAlive(), ScriptedAI::me, Unit::RemoveAurasDueToSpell(), and SPELL_WYRM_GRIP.

◆ Reset()

void npc_wild_wyrm::npc_wild_wyrmAI::Reset ( )
inlineoverridevirtual

Reimplemented from ScriptedAI.

359 {
361 me->SetSpeed(MOVE_RUN, 1.14f, true); // ZOMG!
362 setCharm = false;
363 switching = false;
364 startPath = false;
365 checkTimer = 0;
367 attackTimer = 0;
370 }
@ UNIT_STATE_NO_ENVIRONMENT_UPD
Definition: Unit.h:353
@ MOVE_RUN
Definition: Unit.h:379
void Clear()
Definition: ObjectGuid.h:140
void AddUnitState(uint32 f)
Definition: Unit.h:1397
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition: Unit.cpp:14323
uint32 announceAttackTimer
Definition: zone_storm_peaks.cpp:345
uint32 attackTimer
Definition: zone_storm_peaks.cpp:346

References Unit::AddUnitState(), announceAttackTimer, attackTimer, checkTimer, ObjectGuid::Clear(), ScriptedAI::me, MOVE_RUN, playerGUID, setCharm, Creature::SetRegeneratingHealth(), Unit::SetSpeed(), startPath, switching, and UNIT_STATE_NO_ENVIRONMENT_UPD.

◆ SpellHit()

void npc_wild_wyrm::npc_wild_wyrmAI::SpellHit ( Unit caster,
SpellInfo const *  spellInfo 
)
inlineoverridevirtual

Reimplemented from ScriptedAI.

417 {
418 if (!playerGUID && spellInfo->Id == SPELL_SPEAR_OF_HODIR)
419 {
420 me->GetMotionMaster()->MovePoint(1, caster->GetPositionX(), caster->GetPositionY(), caster->GetPositionZ() + 12.0f);
421 playerGUID = caster->GetGUID();
422 }
423 else if (spellInfo->Id == SPELL_GRAB_ON)
424 {
425 if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP))
426 aura->ModStackAmount(10);
427 }
428 else if (spellInfo->Id == SPELL_THRUST_SPEAR)
429 {
430 if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP))
431 aura->ModStackAmount(-5);
432 }
433 else if (spellInfo->Id == SPELL_MIGHTY_SPEAR_THRUST)
434 {
435 if (Aura* aura = me->GetAura(SPELL_WYRM_GRIP))
436 aura->ModStackAmount(-15);
437 }
438 else if (spellInfo->Id == SPELL_FATAL_STRIKE)
439 {
441 {
442 if (Player* player = GetValidPlayer())
443 {
444 player->KilledMonsterCredit(30415);
445 player->RemoveAurasDueToSpell(SPELL_JAWS_OF_DEATH);
446 }
449 }
450 else
451 Talk(2);
452 }
453 }
bool roll_chance_i(int chance)
Definition: Random.h:59
@ UNIT_STAND_STATE_DEAD
Definition: Unit.h:60
@ SPELL_JAWS_OF_DEATH
Definition: zone_storm_peaks.cpp:331
@ SPELL_MIGHTY_SPEAR_THRUST
Definition: zone_storm_peaks.cpp:328
@ SPELL_FATAL_STRIKE
Definition: zone_storm_peaks.cpp:329
@ SPELL_THRUST_SPEAR
Definition: zone_storm_peaks.cpp:327
@ SPELL_SPEAR_OF_HODIR
Definition: zone_storm_peaks.cpp:323
@ SPELL_PRY_JAWS_OPEN
Definition: zone_storm_peaks.cpp:330
@ SPELL_GRAB_ON
Definition: zone_storm_peaks.cpp:326
Talk
Definition: boss_fathomlord_karathress.cpp:23
static ObjectGuid GetGUID(Object const *o)
Definition: Object.h:106
float GetPositionZ() const
Definition: Position.h:119
float GetPositionX() const
Definition: Position.h:117
float GetPositionY() const
Definition: Position.h:118
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition: Unit.cpp:5499
MotionMaster * GetMotionMaster()
Definition: Unit.h:2262
uint32 GetAuraCount(uint32 spellId) const
Definition: Unit.cpp:5594
void SetStandState(uint8 state)
Definition: Unit.cpp:16900
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:210
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
Definition: MotionMaster.cpp:545
Definition: SpellAuras.h:87

References Unit::GetAura(), Unit::GetAuraCount(), Object::GetEntry(), Object::GetGUID(), Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetValidPlayer(), SpellInfo::Id, ScriptedAI::me, MotionMaster::MoveFall(), MotionMaster::MovePoint(), playerGUID, roll_chance_i(), Unit::SetStandState(), SPELL_FATAL_STRIKE, SPELL_GRAB_ON, SPELL_JAWS_OF_DEATH, SPELL_MIGHTY_SPEAR_THRUST, SPELL_PRY_JAWS_OPEN, SPELL_SPEAR_OF_HODIR, SPELL_THRUST_SPEAR, SPELL_WYRM_GRIP, and UNIT_STAND_STATE_DEAD.

◆ UpdateAI()

void npc_wild_wyrm::npc_wild_wyrmAI::UpdateAI ( uint32  diff)
inlineoverridevirtual

Reimplemented from ScriptedAI.

464 {
465 if (startPath)
466 {
467 startPath = false;
468 Movement::PointsArray pathPoints;
469 pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
470
471 WaypointPath const* i_path = sWaypointMgr->GetPath(me->GetWaypointPath());
472 for (uint8 i = 0; i < i_path->size(); ++i)
473 {
474 WaypointData const* node = i_path->at(i);
475 pathPoints.push_back(G3D::Vector3(node->x, node->y, node->z));
476 }
477
478 me->GetMotionMaster()->MoveSplinePath(&pathPoints);
479 }
480 if (setCharm)
481 {
482 setCharm = false;
483
484 if (Player* charmer = GetValidPlayer())
485 {
487 charmer->SetClientControl(me, 0, true);
488
489 me->SetSpeed(MOVE_RUN, 2.0f, true);
490 startPath = true;
491 }
492 else
493 {
496 }
497 return;
498 }
499
500 if (!checkTimer)
501 return;
502
503 if (checkTimer < 10000)
504 {
505 checkTimer += diff;
506 if (checkTimer >= 2000)
507 {
508 checkTimer = 1;
509 if (me->HealthBelowPct(25))
510 {
511 if (Player* player = GetValidPlayer())
512 {
513 Talk(3);
514 switching = true;
517 player->CastSpell(me, SPELL_FIGHT_WYRM_NEXT, true);
518 checkTimer = 10000;
519 return;
520 }
521 else
522 {
525 return;
526 }
527 }
528 }
529 }
530 else if (checkTimer < 20000)
531 {
532 checkTimer += diff;
533 if (checkTimer >= 13000)
534 {
535 switching = false;
536 checkTimer = 20000;
537 }
538 }
539 else if (checkTimer < 30000)
540 {
541 checkTimer += diff;
542 if (checkTimer >= 22000)
543 {
544 checkTimer = 20000;
545 Player* player = GetValidPlayer();
546 if (!player)
547 {
550 }
551 }
552 return;
553 }
554
555 announceAttackTimer += diff;
556 if (announceAttackTimer >= 7000)
557 {
558 announceAttackTimer = urand(0, 3000);
559 Talk(0);
560 attackTimer = 1;
561 }
562 if (attackTimer)
563 {
564 attackTimer += diff;
565 if (attackTimer > 2000)
566 {
567 attackTimer = 0;
569 if (player && player->HasAura(SPELL_DODGE_CLAWS))
570 Talk(1);
571 else if (player)
572 me->AttackerStateUpdate(player);
573 else
574 {
577 }
578 }
579 }
580 }
std::uint8_t uint8
Definition: Define.h:110
uint32 urand(uint32 min, uint32 max)
Definition: Random.cpp:44
std::vector< WaypointData * > WaypointPath
Definition: WaypointMgr.h:46
#define sWaypointMgr
Definition: WaypointMgr.h:77
@ SPELL_DODGE_CLAWS
Definition: zone_storm_peaks.cpp:324
@ SPELL_FIGHT_WYRM_NEXT
Definition: zone_storm_peaks.cpp:322
@ FACTION_MONSTER_2
Definition: SharedDefines.h:168
std::vector< Vector3 > PointsArray
Definition: MoveSplineInitArgs.h:28
@ EVADE_REASON_OTHER
Definition: CreatureAI.h:92
uint32 GetWaypointPath() const
Definition: Creature.h:338
void SetFaction(uint32 faction)
Definition: Unit.cpp:10029
bool HealthBelowPct(int32 pct) const
Definition: Unit.h:1444
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition: Unit.cpp:2527
void RemoveAllAuras()
Definition: Unit.cpp:5239
void MoveSplinePath(Movement::PointsArray *path)
Definition: MotionMaster.cpp:409
Definition: WaypointMgr.h:36
float z
Definition: WaypointMgr.h:38
float x
Definition: WaypointMgr.h:38
float y
Definition: WaypointMgr.h:38
void EnterEvadeMode(EvadeReason why) override
Definition: zone_storm_peaks.cpp:351

References announceAttackTimer, Unit::AttackerStateUpdate(), attackTimer, Unit::CastSpell(), checkTimer, EnterEvadeMode(), CreatureAI::EVADE_REASON_OTHER, FACTION_MONSTER_2, Unit::GetMotionMaster(), ObjectAccessor::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetValidPlayer(), Creature::GetWaypointPath(), Unit::HasAura(), Unit::HealthBelowPct(), ScriptedAI::me, MOVE_RUN, MotionMaster::MoveSplinePath(), playerGUID, Unit::RemoveAllAuras(), setCharm, Unit::SetFaction(), Unit::SetSpeed(), SPELL_DODGE_CLAWS, SPELL_FIGHT_WYRM_NEXT, SPELL_JAWS_OF_DEATH, startPath, sWaypointMgr, switching, urand(), WaypointData::x, WaypointData::y, and WaypointData::z.

Member Data Documentation

◆ announceAttackTimer

uint32 npc_wild_wyrm::npc_wild_wyrmAI::announceAttackTimer

Referenced by Reset(), and UpdateAI().

◆ attackTimer

uint32 npc_wild_wyrm::npc_wild_wyrmAI::attackTimer

Referenced by Reset(), and UpdateAI().

◆ checkTimer

uint32 npc_wild_wyrm::npc_wild_wyrmAI::checkTimer

Referenced by MovementInform(), Reset(), and UpdateAI().

◆ playerGUID

ObjectGuid npc_wild_wyrm::npc_wild_wyrmAI::playerGUID

◆ setCharm

bool npc_wild_wyrm::npc_wild_wyrmAI::setCharm

◆ startPath

bool npc_wild_wyrm::npc_wild_wyrmAI::startPath

Referenced by MovementInform(), Reset(), and UpdateAI().

◆ switching

bool npc_wild_wyrm::npc_wild_wyrmAI::switching

Referenced by EnterEvadeMode(), Reset(), and UpdateAI().