AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_oculus_drake::npc_oculus_drakeAI Struct Reference
Inheritance diagram for npc_oculus_drake::npc_oculus_drakeAI:
VehicleAI CreatureAI UnitAI

Public Member Functions

 npc_oculus_drakeAI (Creature *creature)
 
void IsSummonedBy (WorldObject *summoner) override
 
void MovementInform (uint32 type, uint32 id) override
 
void PassengerBoarded (Unit *passenger, int8, bool add) override
 == Fields ======================================= More...
 
void SpellHitTarget (Unit *target, SpellInfo const *spell) override
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
- Public Member Functions inherited from VehicleAI
 VehicleAI (Creature *creature)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
void MoveInLineOfSight (Unit *) override
 
void AttackStart (Unit *) override
 
void OnCharmed (bool apply) override
 Called when unit is charmed. More...
 
- 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. More...
 
void Talk (uint8 id, Milliseconds delay)
 
WorldObjectGetSummoner () const
 Returns the summoner creature/object, if the creature is a temporary summon. More...
 
 CreatureAI (Creature *creature)
 
 ~CreatureAI () override
 
void MoveCircleChecks ()
 
void MoveBackwardsChecks ()
 
void MoveInLineOfSight_Safe (Unit *who)
 == Reactions At ================================= More...
 
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. More...
 
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 SummonedCreatureEvade (Creature *)
 
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
 Called when unit is charmed. More...
 
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 ================== More...
 
virtual void PassengerBoarded (Unit *, int8, bool)
 == Fields ======================================= More...
 
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 AttackStart (Unit *)
 
virtual void UpdateAI (uint32)=0
 Use to start attacking a target. Called just before JustEngagedWith() More...
 
virtual void InitializeAI ()
 
virtual void Reset ()
 
virtual void OnCharmed (bool apply)=0
 Called when unit is charmed. More...
 
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: More...
 
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. More...
 
virtual void JustExitedCombat ()
 Called when the unit leaves combat. More...
 
virtual void DamageDealt (Unit *, uint32 &, DamageEffectType)
 Called at any Damage to any victim (before damage apply) More...
 
virtual void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask)
 Called at any Damage from any attacker (before damage apply) More...
 
virtual void HealReceived (Unit *, uint32 &)
 Called when the creature receives heal. More...
 
virtual void OnPowerUpdate (Powers, int32, int32, uint32)
 Called when the creature power updates. More...
 
virtual void HealDone (Unit *, uint32 &)
 Called when the unit heals. More...
 
virtual void OnCalculateMeleeDamageReceived (uint32 &, Unit *)
 Called during damage calculations. More...
 
virtual void OnCalculateSpellDamageReceived (int32 &, Unit *)
 
virtual void OnCalculatePeriodicTickReceived (uint32 &, Unit *)
 Called during calculation when receiving periodic healing or damage (DoT or HoT) More...
 
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. More...
 
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. More...
 
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. More...
 
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. More...
 
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

InstanceScriptm_pInstance
 
bool JustSummoned
 
uint16 despawnTimer
 

Additional Inherited Members

- 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 VehicleAI
static int32 Permissible (Creature const *creature)
 
- Static Public Member Functions inherited from CreatureAI
static bool IsInBounds (CreatureBoundary const &boundary, Position const *who)
 
- Static Public Member Functions inherited from UnitAI
static void FillAISpellInfo ()
 
- Static Public Attributes inherited from UnitAI
static AISpellInfoTypeAISpellInfo
 
- Protected Member Functions inherited from CreatureAI
bool UpdateVictim ()
 
bool UpdateVictimWithGaze ()
 
void SetGazeOn (Unit *target)
 
CreatureDoSummon (uint32 entry, Position const &pos, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummon (uint32 entry, WorldObject *obj, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
CreatureDoSummonFlyer (uint32 entry, WorldObject *obj, float flightZ, float radius=5.0f, uint32 despawnTime=30000, TempSummonType summonType=TEMPSUMMON_CORPSE_TIMED_DESPAWN)
 
virtual void MoveInLineOfSight (Unit *)
 
bool _EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
- Protected Attributes inherited from CreatureAI
Creature *const me
 
EventMap events
 
TaskScheduler scheduler
 
CreatureBoundary const * _boundary
 
bool _negateBoundary
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_oculus_drakeAI()

npc_oculus_drake::npc_oculus_drakeAI::npc_oculus_drakeAI ( Creature creature)
inline
345 : VehicleAI(creature)
346 {
348 JustSummoned = true;
349 }
Definition: CombatAI.h:99
Creature *const me
Definition: CreatureAI.h:72
InstanceScript * GetInstanceScript() const
Definition: Object.cpp:1203
InstanceScript * m_pInstance
Definition: oculus.cpp:351
bool JustSummoned
Definition: oculus.cpp:352

References WorldObject::GetInstanceScript(), JustSummoned, m_pInstance, and CreatureAI::me.

Member Function Documentation

◆ IsSummonedBy()

void npc_oculus_drake::npc_oculus_drakeAI::IsSummonedBy ( WorldObject summoner)
inlineoverridevirtual

Reimplemented from CreatureAI.

356 {
357 if (!summoner->IsPlayer())
358 {
359 return;
360 }
361
363 if (Creature* eregos = me->FindNearestCreature(NPC_EREGOS, 450.0f, true))
364 eregos->DespawnOrUnsummon(); // On retail this kills abusive call of drake during engaged Eregos
365
366 me->SetFacingToObject(summoner);
367
368 switch (me->GetEntry())
369 {
370 case NPC_RUBY_DRAKE:
372 break;
375 break;
376 case NPC_AMBER_DRAKE:
378 break;
379 default:
380 return;
381 }
382
383 Position pos = summoner->GetPosition();
385 }
@ NPC_EREGOS
Definition: oculus.h:53
@ NPC_AMBER_DRAKE
Definition: oculus.h:59
@ NPC_EMERALD_DRAKE
Definition: oculus.h:60
@ NPC_RUBY_DRAKE
Definition: oculus.h:61
@ DATA_EREGOS
Definition: oculus.h:37
@ SPELL_RIDE_EMERALD_DRAKE_QUE
Definition: oculus.cpp:37
@ POINT_LAND
Definition: oculus.cpp:56
@ SPELL_RIDE_AMBER_DRAKE_QUE
Definition: oculus.cpp:36
@ SPELL_RIDE_RUBY_DRAKE_QUE
Definition: oculus.cpp:35
@ IN_PROGRESS
Definition: InstanceScript.h:58
Definition: Creature.h:43
bool IsPlayer() const
Definition: Object.h:200
uint32 GetEntry() const
Definition: Object.h:115
Unit * ToUnit()
Definition: Object.h:209
Creature * FindNearestCreature(uint32 entry, float range, bool alive=true) const
Definition: Object.cpp:2457
Definition: Position.h:27
void GetPosition(float &x, float &y) const
Definition: Position.h:121
MotionMaster * GetMotionMaster()
Definition: Unit.h:1620
void SetFacingToObject(WorldObject *object)
Definition: Unit.cpp:20537
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:1167
EncounterState GetBossState(uint32 id) const
Definition: InstanceScript.h:235
void MovePoint(uint32 id, const Position &pos, bool generatePath=true, bool forceDestination=true)
Definition: MotionMaster.h:213

References Unit::CastSpell(), DATA_EREGOS, WorldObject::FindNearestCreature(), InstanceScript::GetBossState(), Object::GetEntry(), Unit::GetMotionMaster(), Position::GetPosition(), IN_PROGRESS, Object::IsPlayer(), m_pInstance, CreatureAI::me, MotionMaster::MovePoint(), NPC_AMBER_DRAKE, NPC_EMERALD_DRAKE, NPC_EREGOS, NPC_RUBY_DRAKE, POINT_LAND, Unit::SetFacingToObject(), SPELL_RIDE_AMBER_DRAKE_QUE, SPELL_RIDE_EMERALD_DRAKE_QUE, SPELL_RIDE_RUBY_DRAKE_QUE, and Object::ToUnit().

◆ MovementInform()

void npc_oculus_drake::npc_oculus_drakeAI::MovementInform ( uint32  type,
uint32  id 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

388 {
389 if (type == POINT_MOTION_TYPE && id == POINT_LAND)
390 me->SetDisableGravity(false); // Needed this for proper animation after spawn, the summon in air fall to ground bug leave no other option for now, if this isn't used the drake will only walk on move.
391 }
@ POINT_MOTION_TYPE
Definition: MotionMaster.h:48
bool SetDisableGravity(bool disable, bool packetOnly=false, bool updateAnimationTier=true) override
Enable or disable the creature's fly mode by adding or removing: MOVEMENTFLAG_FLYING....
Definition: Creature.cpp:3205

References CreatureAI::me, POINT_LAND, POINT_MOTION_TYPE, and Creature::SetDisableGravity().

◆ PassengerBoarded()

void npc_oculus_drake::npc_oculus_drakeAI::PassengerBoarded ( Unit ,
int8  ,
bool   
)
inlineoverridevirtual

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

Reimplemented from CreatureAI.

394 {
395 if (!passenger->IsPlayer())
396 return;
397
398 if (add)
399 {
400 despawnTimer = 0;
401 }
402 else
403 {
404 me->DespawnOrUnsummon(2050);
405 me->SetOrientation(2.5f);
407 Position pos = me->GetPosition();
408 Position offset = { 10.0f, 10.0f, 12.0f, 0.0f };
409 pos.RelocateOffset(offset);
410 me->SetDisableGravity(true);
412 }
413 }
@ POINT_TAKE_OFF
Definition: oculus.cpp:57
@ MOVE_FLIGHT
Definition: UnitDefines.h:334
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition: Creature.cpp:2178
void RelocateOffset(const Position &offset)
Definition: Position.cpp:59
void SetOrientation(float orientation)
Definition: Position.h:111
void SetSpeedRate(UnitMoveType mtype, float rate)
Definition: Unit.h:1603
uint16 despawnTimer
Definition: oculus.cpp:353

References Creature::DespawnOrUnsummon(), despawnTimer, Unit::GetMotionMaster(), Position::GetPosition(), Object::IsPlayer(), CreatureAI::me, MOVE_FLIGHT, MotionMaster::MovePoint(), POINT_TAKE_OFF, Position::RelocateOffset(), Creature::SetDisableGravity(), Position::SetOrientation(), and Unit::SetSpeedRate().

◆ SpellHitTarget()

void npc_oculus_drake::npc_oculus_drakeAI::SpellHitTarget ( Unit target,
SpellInfo const *  spell 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

416 {
417 for( uint8 i = 0; i < 8; ++i )
418 if (me->m_spells[i] == spell->Id)
419 {
420 if (target && target->IsAlive() && !target->CanFly() && target->IsHostileTo(me) && !spell->IsTargetingArea())
421 {
422 if (Unit* charmer = me->GetCharmer())
423 Unit::Kill(charmer, charmer, false);
424 }
425 break;
426 }
427 }
std::uint8_t uint8
Definition: Define.h:109
uint32 m_spells[MAX_CREATURE_SPELLS]
Definition: Creature.h:250
Definition: Unit.h:630
Unit * GetCharmer() const
Definition: Unit.cpp:10608
static void Kill(Unit *killer, Unit *victim, bool durabilityLoss=true, WeaponAttackType attackType=BASE_ATTACK, SpellInfo const *spellProto=nullptr, Spell const *spell=nullptr)
Definition: Unit.cpp:17702
virtual bool CanFly() const =0
bool IsAlive() const
Definition: Unit.h:1654
bool IsHostileTo(Unit const *unit) const
Definition: Unit.cpp:10236

References Unit::CanFly(), Unit::GetCharmer(), SpellInfo::Id, Unit::IsAlive(), Unit::IsHostileTo(), SpellInfo::IsTargetingArea(), Unit::Kill(), Creature::m_spells, and CreatureAI::me.

◆ UpdateAI()

void npc_oculus_drake::npc_oculus_drakeAI::UpdateAI ( uint32  )
inlineoverridevirtual

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

Reimplemented from VehicleAI.

430 {
431 if (JustSummoned)
432 {
433 despawnTimer = 1;
434 JustSummoned = false;
435 if (m_pInstance)
436 {
438 {
439 if (me->GetVehicleKit() && me->IsSummon())
440 if (!me->GetVehicleKit()->GetPassenger(0))
441 {
443 {
444 switch (me->GetEntry())
445 {
446 case 27692:
447 me->m_spells[5] = 50344;
448 break;
449 case 27755:
450 me->m_spells[5] = 49592;
451 break;
452 case 27756:
453 me->m_spells[5] = 50253;
454 break;
455 }
456 }
457 }
458 }
459 else
460 {
461 me->DespawnOrUnsummon(2050);
462 me->SetOrientation(2.5f);
464 Position pos = me->GetPosition();
465 Position offset = { 10.0f, 10.0f, 12.0f, 0.0f };
466 pos.RelocateOffset(offset);
467 me->SetDisableGravity(true);
469 return;
470 }
471 }
472 }
473
474 if (despawnTimer)
475 {
476 if (despawnTimer >= 5000)
477 {
478 me->DespawnOrUnsummon(2050);
479 me->SetOrientation(2.5f);
480 Position pos = me->GetPosition();
481 Position offset = { 10.0f, 10.0f, 12.0f, 0.0f };
482 pos.RelocateOffset(offset);
483 return;
484 }
485 else
486 despawnTimer += diff;
487 }
488
490 }
@ DATA_UROM
Definition: oculus.h:36
@ DONE
Definition: InstanceScript.h:60
void UpdateAI(uint32 diff) override
Use to start attacking a target. Called just before JustEngagedWith()
Definition: CombatAI.cpp:275
bool IsSummon() const
Definition: Unit.h:751
Vehicle * GetVehicleKit() const
Definition: Unit.h:1785
Unit * GetPassenger(int8 seatId) const
Definition: Vehicle.cpp:227
virtual bool IsEncounterInProgress() const
Definition: InstanceScript.cpp:125
virtual uint32 GetData(uint32) const
Definition: ZoneScript.h:51

References DATA_EREGOS, DATA_UROM, Creature::DespawnOrUnsummon(), despawnTimer, DONE, ZoneScript::GetData(), Object::GetEntry(), Unit::GetMotionMaster(), Vehicle::GetPassenger(), Position::GetPosition(), Unit::GetVehicleKit(), IN_PROGRESS, InstanceScript::IsEncounterInProgress(), Unit::IsSummon(), JustSummoned, m_pInstance, Creature::m_spells, CreatureAI::me, MOVE_FLIGHT, MotionMaster::MovePoint(), POINT_TAKE_OFF, Position::RelocateOffset(), Creature::SetDisableGravity(), Position::SetOrientation(), Unit::SetSpeedRate(), and VehicleAI::UpdateAI().

Member Data Documentation

◆ despawnTimer

uint16 npc_oculus_drake::npc_oculus_drakeAI::despawnTimer

Referenced by PassengerBoarded(), and UpdateAI().

◆ JustSummoned

bool npc_oculus_drake::npc_oculus_drakeAI::JustSummoned

Referenced by npc_oculus_drakeAI(), and UpdateAI().

◆ m_pInstance

InstanceScript* npc_oculus_drake::npc_oculus_drakeAI::m_pInstance