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
1226 : NullCreatureAI(creature)
1227 {
1228 events.Reset();
1229 }
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.

1261 {
1262 if (who != me)
1263 if (me->HealthBelowPct(80) && urand(0, 1))
1264 SpreadFire(true);
1265 }
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:1267

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

◆ GetSummoner()

Unit * npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::GetSummoner ( )
inline
1232 {
1233 if (TempSummon* tempSummon = me->ToTempSummon())
1234 return tempSummon->GetSummonerUnit();
1235 return nullptr;
1236 }
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.

1239 {
1240 if (!summoner)
1241 return;
1242
1243 if (!summoner->IsPlayer())
1244 return;
1245
1246 Player* player = summoner->ToPlayer();
1247 if (!player)
1248 return;
1249
1250 player->CastSpell(player, SPELL_WAITING_FOR_A_BOMBER, true);
1251 player->CastSpell(player, SPELL_FLIGHT_ORDERS, true);
1252 events.ScheduleEvent(EVENT_START_FLIGHT, 0ms);
1253 events.ScheduleEvent(EVENT_TAKE_PASSENGER, 3s);
1254 me->SetCanFly(true);
1256 me->SetSpeed(MOVE_FLIGHT, 0.1f);
1257 me->SetFaction(player->GetFaction());
1258 }
@ 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:1071
void SetFaction(uint32 faction)
Definition Unit.cpp:10235
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:20607
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:14593
@ SPELL_FLIGHT_ORDERS
Definition zone_icecrown.cpp:1045
@ EVENT_START_FLIGHT
Definition zone_icecrown.cpp:1048
@ SPELL_WAITING_FOR_A_BOMBER
Definition zone_icecrown.cpp:1044
@ EVENT_TAKE_PASSENGER
Definition zone_icecrown.cpp:1047

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
1268 {
1269 Vehicle* kit = me->GetVehicleKit();
1270 if (!kit)
1271 return;
1272
1273 if (Unit* passenger = kit->GetPassenger(SEAT_ENGINEERING))
1274 if (init && !passenger->HasAura(SPELL_BURNING))
1275 {
1276 me->TextEmote("Your Vehicle is burning!", GetSummoner(), true);
1277 passenger->AddAura(SPELL_BURNING, passenger);
1278 }
1279
1280 for (uint8 seat = 3; seat <= 5; ++seat)
1281 if (Unit* banner = kit->GetPassenger(seat))
1282 if (!banner->HasAura(SPELL_COSMETIC_FIRE))
1283 {
1284 banner->AddAura(SPELL_COSMETIC_FIRE, banner);
1285 break;
1286 }
1287 }
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:21241
Vehicle * GetVehicleKit() const
Definition Unit.h:1904
Definition Vehicle.h:28
Unit * GetPassenger(int8 seatId) const
Definition Vehicle.cpp:228
Unit * GetSummoner()
Definition zone_icecrown.cpp:1231
@ SEAT_ENGINEERING
Definition zone_icecrown.cpp:1055
@ SPELL_BURNING
Definition zone_icecrown.cpp:1040
@ SPELL_COSMETIC_FIRE
Definition zone_icecrown.cpp:1041

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.

1290 {
1291 events.Update(diff);
1292 uint32 eventId = events.ExecuteEvent();
1293 switch (eventId)
1294 {
1296 if (Unit* owner = GetSummoner())
1297 if (Vehicle* kit = me->GetVehicleKit())
1298 if (Unit* turret = kit->GetPassenger(SEAT_TURRET))
1299 {
1300 me->SetSpeed(MOVE_FLIGHT, 1.2f);
1301 owner->RemoveAurasDueToSpell(SPELL_WAITING_FOR_A_BOMBER);
1302 turret->HandleSpellClick(owner, 0);
1303 return;
1304 }
1305 me->DespawnOrUnsummon(1ms);
1306 break;
1307 case EVENT_START_FLIGHT:
1308 {
1311 events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5s);
1312 break;
1313 }
1315 {
1316 // Check if path is finished
1318 {
1319 me->DespawnOrUnsummon(1ms);
1320 return;
1321 }
1322
1323 // Check fire count
1324 uint8 fireCount = 0;
1325 if (Vehicle* kit = me->GetVehicleKit())
1326 for (uint8 seat = 3; seat <= 5; ++seat)
1327 if (Unit* banner = kit->GetPassenger(seat))
1328 if (banner->HasAura(SPELL_COSMETIC_FIRE))
1329 fireCount++;
1330
1331 if (fireCount)
1332 Unit::DealDamage(me, me, 3000 * fireCount, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE);
1333 else // Heal
1334 me->ModifyHealth(2000);
1335
1337 break;
1338 }
1340 if (Vehicle* kit = me->GetVehicleKit())
1341 {
1342 // Xinef: check if we have player on any of the stations
1343 bool playerPresent = false;
1345 for (uint8 i = SEAT_BOMBER; i <= SEAT_ENGINEERING; ++i)
1346 if (Unit* station = kit->GetPassenger(i))
1347 {
1348 if (Vehicle* stationKit = station->GetVehicleKit())
1349 if (stationKit->GetPassenger(0))
1350 playerPresent = true;
1351
1352 if (stackAmount)
1353 station->SetAuraStack(SPELL_INFRA_GREEN_SHIELD, station, stackAmount);
1354 else
1355 station->RemoveAurasDueToSpell(SPELL_INFRA_GREEN_SHIELD);
1356 }
1357 if (!playerPresent)
1358 me->DespawnOrUnsummon(1ms);
1359 }
1360 events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 1s);
1361 break;
1362 case EVENT_SPREAD_FIRE:
1363 break;
1364 }
1365 }
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:2178
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:14264
MotionMaster * GetMotionMaster()
Definition Unit.h:1738
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:5801
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:1054
@ EVENT_SPREAD_FIRE
Definition zone_icecrown.cpp:1051
@ SEAT_BOMBER
Definition zone_icecrown.cpp:1053
@ EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE
Definition zone_icecrown.cpp:1049
@ EVENT_SYNCHRONIZE_SHIELDS
Definition zone_icecrown.cpp:1050
@ SPELL_INFRA_GREEN_SHIELD
Definition zone_icecrown.cpp:1038

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: