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
 Called at any Damage from any attacker (before damage apply)
 
void AttackStart (Unit *) override
 
void MoveInLineOfSight (Unit *) override
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
void SpellHit (Unit *caster, SpellInfo const *spellInfo) override
 
PlayerGetValidPlayer ()
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
- 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)
 
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 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 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)
 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

ObjectGuid playerGUID
 
uint32 checkTimer
 
uint32 announceAttackTimer
 
uint32 attackTimer
 
bool setCharm
 
bool switching
 
bool startPath
 
- 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)
 
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

◆ npc_wild_wyrmAI()

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

Member Function Documentation

◆ AttackStart()

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

Reimplemented from UnitAI.

407{ }

◆ DamageTaken()

void npc_wild_wyrm::npc_wild_wyrmAI::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.

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:280
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 }
virtual void EnterEvadeMode(EvadeReason why=EVADE_REASON_OTHER)
Definition CreatureAI.cpp:208
bool HasControlVehicleAura() const
Definition Unit.h:1734
bool switching
Definition zone_storm_peaks.cpp:348

References CreatureAI::EnterEvadeMode(), Unit::HasControlVehicleAura(), ScriptedAI::me, 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 }
Definition Player.h:1081
bool IsAlive() const
Definition Unit.h:1707
float GetDistance(WorldObject const *obj) const
Definition Object.cpp:1256
Player * GetPlayer(Map const *, ObjectGuid const guid)
Definition ObjectAccessor.cpp:220
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 CreatureAI.

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:57
@ POINT_MOTION_TYPE
Definition MotionMaster.h:48
@ EFFECT_MOTION_TYPE
Definition MotionMaster.h:56
void SetRegeneratingHealth(bool enable)
Definition Creature.h:322
bool Finalized() const
Definition MoveSpline.h:116
uint32 GetEntry() const
Definition Object.h:115
Movement::MoveSpline * movespline
Definition Unit.h:2029
void SetFullHealth()
Definition Unit.h:1056
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
ObjectGuid GetCharmerGUID() const
Definition Unit.h:690
void KillSelf(bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition Unit.h:1168
bool startPath
Definition zone_storm_peaks.cpp:349
uint32 checkTimer
Definition zone_storm_peaks.cpp:344
@ SPELL_WYRM_GRIP
Definition zone_storm_peaks.cpp:325
@ SPELL_FIGHT_WYRM_BASE
Definition zone_storm_peaks.cpp:321

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

Called when unit is charmed.

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:5753
void RemoveAurasDueToSpell(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, uint8 reqEffMask=0, AuraRemoveMode removeMode=AURA_REMOVE_BY_DEFAULT)
Definition Unit.cpp:4941

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

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 UnitDefines.h:198
@ MOVE_RUN
Definition UnitDefines.h:350
void Clear()
Definition ObjectGuid.h:138
void AddUnitState(uint32 f)
Definition Unit.h:706
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:14481
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 CreatureAI.

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:60
@ UNIT_STAND_STATE_DEAD
Definition UnitDefines.h:39
Definition SpellAuras.h:87
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition MotionMaster.h:213
void MoveFall(uint32 id=0, bool addFlagForNPC=false)
The unit will fall. Used when in the air. Doesn't work with UNIT_FLAG_DISABLE_MOVE.
Definition MotionMaster.cpp:627
static ObjectGuid GetGUID(Object const *o)
Definition Object.h:112
Aura * GetAura(uint32 spellId, ObjectGuid casterGUID=ObjectGuid::Empty, ObjectGuid itemCasterGUID=ObjectGuid::Empty, uint8 reqEffMask=0) const
Definition Unit.cpp:5613
MotionMaster * GetMotionMaster()
Definition Unit.h:1673
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:5714
void SetStandState(uint8 state)
Definition Unit.cpp:16778
Talk
Definition hyjal.cpp:82
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122
@ 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

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

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

Implements UnitAI.

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:109
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
@ FACTION_MONSTER_2
Definition SharedDefines.h:196
std::vector< WaypointData * > WaypointPath
Definition WaypointMgr.h:47
#define sWaypointMgr
Definition WaypointMgr.h:78
@ EVADE_REASON_OTHER
Definition CreatureAI.h:93
uint32 GetWaypointPath() const
Definition Creature.h:350
void MoveSplinePath(Movement::PointsArray *path)
Definition MotionMaster.cpp:454
void SetFaction(uint32 faction)
Definition Unit.cpp:10097
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1046
void AttackerStateUpdate(Unit *victim, WeaponAttackType attType=BASE_ATTACK, bool extra=false, bool ignoreCasting=false)
Definition Unit.cpp:2576
void RemoveAllAuras()
Definition Unit.cpp:5351
std::vector< Vector3 > PointsArray
Definition MoveSplineInitArgs.h:28
Definition WaypointMgr.h:37
float z
Definition WaypointMgr.h:39
float x
Definition WaypointMgr.h:39
float y
Definition WaypointMgr.h:39
void EnterEvadeMode(EvadeReason why) override
Definition zone_storm_peaks.cpp:351
@ SPELL_DODGE_CLAWS
Definition zone_storm_peaks.cpp:324
@ SPELL_FIGHT_WYRM_NEXT
Definition zone_storm_peaks.cpp:322

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().


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