AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI Struct Reference
Inheritance diagram for npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI:
NullCreatureAI CreatureAI UnitAI

Public Member Functions

 npc_infra_green_bomber_genericAI (Creature *creature)
 
UnitGetSummoner ()
 
void IsSummonedBy (WorldObject *summoner) override
 
void DamageTaken (Unit *who, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void SpreadFire (bool init)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
- Public Member Functions inherited from NullCreatureAI
 NullCreatureAI (Creature *c)
 
void MoveInLineOfSight (Unit *) override
 
void AttackStart (Unit *) override
 
void JustStartedThreateningMe (Unit *) override
 
void JustEnteredCombat (Unit *) override
 Called when the unit enters combat.
 
void UpdateAI (uint32) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void EnterEvadeMode (EvadeReason) override
 
void OnCharmed (bool) override
 Called when unit is charmed.
 
- 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)
 
WorldObjectGetSummoner () 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 void JustEngagedWith (Unit *)
 Called for reaction when initially engaged - this happens after JustEnteredCombat.
 
void EngagementStart (Unit *who)
 
void EngagementOver ()
 
void JustExitedCombat () override
 Called when the unit leaves combat.
 
virtual void JustDied (Unit *)
 
virtual void KilledUnit (Unit *)
 
virtual void JustSummoned (Creature *)
 
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 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 MovementInform (uint32, uint32)
 
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 void Reset ()
 
virtual void DoAction (int32)
 
virtual uint32 GetData (uint32) const
 
virtual void SetData (uint32, uint32)
 
virtual void SetGUID (ObjectGuid const &, 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 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)
 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
 

Private Attributes

EventMap events
 

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 NullCreatureAI
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)
 
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_infra_green_bomber_genericAI()

npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::npc_infra_green_bomber_genericAI ( Creature creature)
inline
1231 : NullCreatureAI(creature)
1232 {
1233 events.Reset();
1234 }
events
Definition boss_sartura.cpp:43
Definition PassiveAI.h:56
virtual void Reset()
Definition UnitAI.h:211

References UnitAI::Reset().

Member Function Documentation

◆ DamageTaken()

void npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::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.

1266 {
1267 if (who != me)
1268 if (me->HealthBelowPct(80) && urand(0, 1))
1269 SpreadFire(true);
1270 }
uint32 urand(uint32 min, uint32 max)
Definition Random.cpp:44
Creature *const me
Definition CreatureAI.h:71
bool HealthBelowPct(int32 pct) const
Definition Unit.h:1116
void SpreadFire(bool init)
Definition zone_icecrown.cpp:1272

References Unit::HealthBelowPct(), CreatureAI::me, SpreadFire(), and urand().

◆ GetSummoner()

Unit * npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::GetSummoner ( )
inline
1237 {
1238 if (TempSummon* tempSummon = me->ToTempSummon())
1239 return tempSummon->GetSummonerUnit();
1240 return nullptr;
1241 }
Definition TemporarySummon.h:50
TempSummon * ToTempSummon()
Definition Unit.h:731

References CreatureAI::me, and Unit::ToTempSummon().

Referenced by SpreadFire(), and UpdateAI().

◆ IsSummonedBy()

void npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::IsSummonedBy ( WorldObject summoner)
inlineoverridevirtual

Reimplemented from CreatureAI.

1244 {
1245 if (!summoner)
1246 return;
1247
1248 if (!summoner->IsPlayer())
1249 return;
1250
1251 Player* player = summoner->ToPlayer();
1252 if (!player)
1253 return;
1254
1255 player->CastSpell(player, SPELL_WAITING_FOR_A_BOMBER, true);
1256 player->CastSpell(player, SPELL_FLIGHT_ORDERS, true);
1257 events.ScheduleEvent(EVENT_START_FLIGHT, 0ms);
1258 events.ScheduleEvent(EVENT_TAKE_PASSENGER, 3s);
1259 me->SetCanFly(true);
1261 me->SetSpeed(MOVE_FLIGHT, 0.1f);
1262 me->SetFaction(player->GetFaction());
1263 }
@ MOVEMENTFLAG_FLYING
Definition UnitDefines.h:397
@ MOVE_FLIGHT
Definition UnitDefines.h:362
bool IsPlayer() const
Definition Object.h:201
Player * ToPlayer()
Definition Object.h:202
Definition Player.h:1084
void SetFaction(uint32 faction)
Definition Unit.cpp:7056
uint32 GetFaction() const
Definition Unit.h:851
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:16522
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:772
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:1350
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:11270
@ SPELL_FLIGHT_ORDERS
Definition zone_icecrown.cpp:1050
@ EVENT_START_FLIGHT
Definition zone_icecrown.cpp:1053
@ SPELL_WAITING_FOR_A_BOMBER
Definition zone_icecrown.cpp:1049
@ EVENT_TAKE_PASSENGER
Definition zone_icecrown.cpp:1052

References Unit::AddUnitMovementFlag(), Unit::CastSpell(), EVENT_START_FLIGHT, EVENT_TAKE_PASSENGER, Unit::GetFaction(), Object::IsPlayer(), CreatureAI::me, MOVE_FLIGHT, MOVEMENTFLAG_FLYING, Unit::SetCanFly(), Unit::SetFaction(), Unit::SetSpeed(), SPELL_FLIGHT_ORDERS, SPELL_WAITING_FOR_A_BOMBER, and Object::ToPlayer().

◆ SpreadFire()

void npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::SpreadFire ( bool  init)
inline
1273 {
1274 Vehicle* kit = me->GetVehicleKit();
1275 if (!kit)
1276 return;
1277
1278 if (Unit* passenger = kit->GetPassenger(SEAT_ENGINEERING))
1279 if (init && !passenger->HasAura(SPELL_BURNING))
1280 {
1281 me->TextEmote("Your Vehicle is burning!", GetSummoner(), true);
1282 passenger->AddAura(SPELL_BURNING, passenger);
1283 }
1284
1285 for (uint8 seat = 3; seat <= 5; ++seat)
1286 if (Unit* banner = kit->GetPassenger(seat))
1287 if (!banner->HasAura(SPELL_COSMETIC_FIRE))
1288 {
1289 banner->AddAura(SPELL_COSMETIC_FIRE, banner);
1290 break;
1291 }
1292 }
std::uint8_t uint8
Definition Define.h:109
Definition Unit.h:664
virtual void TextEmote(std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
Definition Unit.cpp:17150
Vehicle * GetVehicleKit() const
Definition Unit.h:1925
Definition Vehicle.h:28
Unit * GetPassenger(int8 seatId) const
Definition Vehicle.cpp:229
Unit * GetSummoner()
Definition zone_icecrown.cpp:1236
@ SEAT_ENGINEERING
Definition zone_icecrown.cpp:1060
@ SPELL_BURNING
Definition zone_icecrown.cpp:1045
@ SPELL_COSMETIC_FIRE
Definition zone_icecrown.cpp:1046

References Vehicle::GetPassenger(), GetSummoner(), Unit::GetVehicleKit(), CreatureAI::me, SEAT_ENGINEERING, SPELL_BURNING, SPELL_COSMETIC_FIRE, and Unit::TextEmote().

Referenced by DamageTaken().

◆ UpdateAI()

void npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

1295 {
1296 events.Update(diff);
1297 uint32 eventId = events.ExecuteEvent();
1298 switch (eventId)
1299 {
1301 if (Unit* owner = GetSummoner())
1302 if (Vehicle* kit = me->GetVehicleKit())
1303 if (Unit* turret = kit->GetPassenger(SEAT_TURRET))
1304 {
1305 me->SetSpeed(MOVE_FLIGHT, 1.2f);
1306 owner->RemoveAurasDueToSpell(SPELL_WAITING_FOR_A_BOMBER);
1307 turret->HandleSpellClick(owner, 0);
1308 return;
1309 }
1310 me->DespawnOrUnsummon(1ms);
1311 break;
1312 case EVENT_START_FLIGHT:
1313 {
1316 events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5s);
1317 break;
1318 }
1320 {
1321 // Check if path is finished
1323 {
1324 me->DespawnOrUnsummon(1ms);
1325 return;
1326 }
1327
1328 // Check fire count
1329 uint8 fireCount = 0;
1330 if (Vehicle* kit = me->GetVehicleKit())
1331 for (uint8 seat = 3; seat <= 5; ++seat)
1332 if (Unit* banner = kit->GetPassenger(seat))
1333 if (banner->HasAura(SPELL_COSMETIC_FIRE))
1334 fireCount++;
1335
1336 if (fireCount)
1337 Unit::DealDamage(me, me, 3000 * fireCount, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE);
1338 else // Heal
1339 me->ModifyHealth(2000);
1340
1342 break;
1343 }
1345 if (Vehicle* kit = me->GetVehicleKit())
1346 {
1347 // Xinef: check if we have player on any of the stations
1348 bool playerPresent = false;
1350 for (uint8 i = SEAT_BOMBER; i <= SEAT_ENGINEERING; ++i)
1351 if (Unit* station = kit->GetPassenger(i))
1352 {
1353 if (Vehicle* stationKit = station->GetVehicleKit())
1354 if (stationKit->GetPassenger(0))
1355 playerPresent = true;
1356
1357 if (stackAmount)
1358 station->SetAuraStack(SPELL_INFRA_GREEN_SHIELD, station, stackAmount);
1359 else
1360 station->RemoveAurasDueToSpell(SPELL_INFRA_GREEN_SHIELD);
1361 }
1362 if (!playerPresent)
1363 me->DespawnOrUnsummon(1ms);
1364 }
1365 events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 1s);
1366 break;
1367 case EVENT_SPREAD_FIRE:
1368 break;
1369 }
1370 }
std::uint32_t uint32
Definition Define.h:107
@ ESCORT_MOTION_TYPE
Definition MotionMaster.h:57
@ SMART_WAYPOINT_MGR
@ FORCED_MOVEMENT_NONE
Definition MotionMaster.h:86
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:287
@ DIRECT_DAMAGE
Definition Unit.h:254
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2126
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:961
void MovePath(uint32 path_id, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, PathSource pathSource=PathSource::WAYPOINT_MGR)
Definition MotionMaster.cpp:519
uint32 GetEntry() const
Definition Object.h:117
int32 ModifyHealth(int32 val)
Definition Unit.cpp:10940
MotionMaster * GetMotionMaster()
Definition Unit.h:1758
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:5943
static uint32 DealDamage(Unit *attacker, Unit *victim, uint32 damage, CleanDamage const *cleanDamage=nullptr, DamageEffectType damagetype=DIRECT_DAMAGE, SpellSchoolMask damageSchoolMask=SPELL_SCHOOL_MASK_NORMAL, SpellInfo const *spellProto=nullptr, bool durabilityLoss=true, bool allowGM=false, Spell const *spell=nullptr)
Definition Unit.cpp:983
@ SEAT_TURRET
Definition zone_icecrown.cpp:1059
@ EVENT_SPREAD_FIRE
Definition zone_icecrown.cpp:1056
@ SEAT_BOMBER
Definition zone_icecrown.cpp:1058
@ EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE
Definition zone_icecrown.cpp:1054
@ EVENT_SYNCHRONIZE_SHIELDS
Definition zone_icecrown.cpp:1055
@ SPELL_INFRA_GREEN_SHIELD
Definition zone_icecrown.cpp:1043

References Unit::DealDamage(), Creature::DespawnOrUnsummon(), DIRECT_DAMAGE, ESCORT_MOTION_TYPE, EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE, EVENT_SPREAD_FIRE, EVENT_START_FLIGHT, EVENT_SYNCHRONIZE_SHIELDS, EVENT_TAKE_PASSENGER, FORCED_MOVEMENT_NONE, Unit::GetAuraCount(), MotionMaster::GetCurrentMovementGeneratorType(), Object::GetEntry(), Unit::GetMotionMaster(), GetSummoner(), Unit::GetVehicleKit(), CreatureAI::me, Unit::ModifyHealth(), MOVE_FLIGHT, MotionMaster::MovePath(), SEAT_BOMBER, SEAT_ENGINEERING, SEAT_TURRET, Unit::SetSpeed(), SMART_WAYPOINT_MGR, SPELL_COSMETIC_FIRE, SPELL_INFRA_GREEN_SHIELD, SPELL_SCHOOL_MASK_FIRE, and SPELL_WAITING_FOR_A_BOMBER.

Member Data Documentation

◆ events

EventMap npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::events
private

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