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 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
 
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.
 
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 OnSpellCastFinished (SpellInfo const *, SpellFinishReason)
 
virtual void AttackedBy (Unit *)
 
virtual bool IsEscorted ()
 
virtual void JustRespawned ()
 
virtual void MovementInform (uint32, uint32)
 
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 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 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
 

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
 
- 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
1230 : NullCreatureAI(creature)
1231 {
1232 events.Reset();
1233 }
events
Definition boss_sartura.cpp:43
Definition PassiveAI.h:53
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.

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

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

◆ GetSummoner()

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

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.

1243 {
1244 if (!summoner)
1245 return;
1246
1247 if (!summoner->IsPlayer())
1248 return;
1249
1250 Player* player = summoner->ToPlayer();
1251 if (!player)
1252 return;
1253
1254 player->CastSpell(player, SPELL_WAITING_FOR_A_BOMBER, true);
1255 player->CastSpell(player, SPELL_FLIGHT_ORDERS, true);
1256 events.ScheduleEvent(EVENT_START_FLIGHT, 0ms);
1257 events.ScheduleEvent(EVENT_TAKE_PASSENGER, 3s);
1258 me->SetCanFly(true);
1260 me->SetSpeed(MOVE_FLIGHT, 0.1f);
1261 me->SetFaction(player->GetFaction());
1262 }
@ MOVEMENTFLAG_FLYING
Definition UnitDefines.h:394
@ MOVE_FLIGHT
Definition UnitDefines.h:359
bool IsPlayer() const
Definition Object.h:200
Player * ToPlayer()
Definition Object.h:201
Definition Player.h:1066
void SetFaction(uint32 faction)
Definition Unit.cpp:10246
uint32 GetFaction() const
Definition Unit.h:841
void SetCanFly(bool enable)
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Unit.cpp:20622
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:762
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:1194
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:14606
@ SPELL_FLIGHT_ORDERS
Definition zone_icecrown.cpp:1049
@ EVENT_START_FLIGHT
Definition zone_icecrown.cpp:1052
@ SPELL_WAITING_FOR_A_BOMBER
Definition zone_icecrown.cpp:1048
@ EVENT_TAKE_PASSENGER
Definition zone_icecrown.cpp:1051

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
1272 {
1273 Vehicle* kit = me->GetVehicleKit();
1274 if (!kit)
1275 return;
1276
1277 if (Unit* passenger = kit->GetPassenger(SEAT_ENGINEERING))
1278 if (init && !passenger->HasAura(SPELL_BURNING))
1279 {
1280 me->TextEmote("Your Vehicle is burning!", GetSummoner(), true);
1281 passenger->AddAura(SPELL_BURNING, passenger);
1282 }
1283
1284 for (uint8 seat = 3; seat <= 5; ++seat)
1285 if (Unit* banner = kit->GetPassenger(seat))
1286 if (!banner->HasAura(SPELL_COSMETIC_FIRE))
1287 {
1288 banner->AddAura(SPELL_COSMETIC_FIRE, banner);
1289 break;
1290 }
1291 }
std::uint8_t uint8
Definition Define.h:109
Definition Unit.h:655
virtual void TextEmote(std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
Definition Unit.cpp:21256
Vehicle * GetVehicleKit() const
Definition Unit.h:1904
Definition Vehicle.h:28
Unit * GetPassenger(int8 seatId) const
Definition Vehicle.cpp:229
Unit * GetSummoner()
Definition zone_icecrown.cpp:1235
@ SEAT_ENGINEERING
Definition zone_icecrown.cpp:1059
@ SPELL_BURNING
Definition zone_icecrown.cpp:1044
@ SPELL_COSMETIC_FIRE
Definition zone_icecrown.cpp:1045

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.

1294 {
1295 events.Update(diff);
1296 uint32 eventId = events.ExecuteEvent();
1297 switch (eventId)
1298 {
1300 if (Unit* owner = GetSummoner())
1301 if (Vehicle* kit = me->GetVehicleKit())
1302 if (Unit* turret = kit->GetPassenger(SEAT_TURRET))
1303 {
1304 me->SetSpeed(MOVE_FLIGHT, 1.2f);
1305 owner->RemoveAurasDueToSpell(SPELL_WAITING_FOR_A_BOMBER);
1306 turret->HandleSpellClick(owner, 0);
1307 return;
1308 }
1309 me->DespawnOrUnsummon(1ms);
1310 break;
1311 case EVENT_START_FLIGHT:
1312 {
1315 events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5s);
1316 break;
1317 }
1319 {
1320 // Check if path is finished
1322 {
1323 me->DespawnOrUnsummon(1ms);
1324 return;
1325 }
1326
1327 // Check fire count
1328 uint8 fireCount = 0;
1329 if (Vehicle* kit = me->GetVehicleKit())
1330 for (uint8 seat = 3; seat <= 5; ++seat)
1331 if (Unit* banner = kit->GetPassenger(seat))
1332 if (banner->HasAura(SPELL_COSMETIC_FIRE))
1333 fireCount++;
1334
1335 if (fireCount)
1336 Unit::DealDamage(me, me, 3000 * fireCount, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE);
1337 else // Heal
1338 me->ModifyHealth(2000);
1339
1341 break;
1342 }
1344 if (Vehicle* kit = me->GetVehicleKit())
1345 {
1346 // Xinef: check if we have player on any of the stations
1347 bool playerPresent = false;
1349 for (uint8 i = SEAT_BOMBER; i <= SEAT_ENGINEERING; ++i)
1350 if (Unit* station = kit->GetPassenger(i))
1351 {
1352 if (Vehicle* stationKit = station->GetVehicleKit())
1353 if (stationKit->GetPassenger(0))
1354 playerPresent = true;
1355
1356 if (stackAmount)
1357 station->SetAuraStack(SPELL_INFRA_GREEN_SHIELD, station, stackAmount);
1358 else
1359 station->RemoveAurasDueToSpell(SPELL_INFRA_GREEN_SHIELD);
1360 }
1361 if (!playerPresent)
1362 me->DespawnOrUnsummon(1ms);
1363 }
1364 events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 1s);
1365 break;
1366 case EVENT_SPREAD_FIRE:
1367 break;
1368 }
1369 }
std::uint32_t uint32
Definition Define.h:107
@ ESCORT_MOTION_TYPE
Definition MotionMaster.h:57
@ SMART_WAYPOINT_MGR
@ FORCED_MOVEMENT_NONE
Definition MotionMaster.h:85
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:310
@ DIRECT_DAMAGE
Definition Unit.h:255
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2130
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:949
void MovePath(uint32 path_id, ForcedMovement forcedMovement=FORCED_MOVEMENT_NONE, PathSource pathSource=PathSource::WAYPOINT_MGR)
Definition MotionMaster.cpp:507
uint32 GetEntry() const
Definition Object.h:116
int32 ModifyHealth(int32 val)
Definition Unit.cpp:14277
MotionMaster * GetMotionMaster()
Definition Unit.h:1738
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:5812
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:824
@ SEAT_TURRET
Definition zone_icecrown.cpp:1058
@ EVENT_SPREAD_FIRE
Definition zone_icecrown.cpp:1055
@ SEAT_BOMBER
Definition zone_icecrown.cpp:1057
@ EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE
Definition zone_icecrown.cpp:1053
@ EVENT_SYNCHRONIZE_SHIELDS
Definition zone_icecrown.cpp:1054
@ SPELL_INFRA_GREEN_SHIELD
Definition zone_icecrown.cpp:1042

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: