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=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 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 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 ()
 
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 Reset ()
 
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
 

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
1234 : NullCreatureAI(creature)
1235 {
1236 events.Reset();
1237 }
events
Definition boss_sartura.cpp:43
Definition PassiveAI.h:53
virtual void Reset()
Definition UnitAI.h:206

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.

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

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

◆ GetSummoner()

Unit * npc_infra_green_bomber_generic::npc_infra_green_bomber_genericAI::GetSummoner ( )
inline
1240 {
1241 if (TempSummon* tempSummon = me->ToTempSummon())
1242 return tempSummon->GetSummonerUnit();
1243 return nullptr;
1244 }
Definition TemporarySummon.h:40
TempSummon * ToTempSummon()
Definition Unit.h:702

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.

1247 {
1248 if (!summoner)
1249 return;
1250
1251 if (!summoner->IsPlayer())
1252 return;
1253
1254 Player* player = summoner->ToPlayer();
1255 if (!player)
1256 return;
1257
1258 player->CastSpell(player, SPELL_WAITING_FOR_A_BOMBER, true);
1259 player->CastSpell(player, SPELL_FLIGHT_ORDERS, true);
1260 events.ScheduleEvent(EVENT_START_FLIGHT, 0);
1261 events.ScheduleEvent(EVENT_TAKE_PASSENGER, 3000);
1262 me->SetCanFly(true);
1264 me->SetSpeed(MOVE_FLIGHT, 0.1f);
1265 me->SetFaction(player->GetFaction());
1266 }
@ MOVEMENTFLAG_FLYING
Definition UnitDefines.h:390
@ MOVE_FLIGHT
Definition UnitDefines.h:355
bool SetCanFly(bool enable, bool packetOnly=false) override
Add the movement flag: MOVEMENTFLAGCAN_FLY. Generaly only use by players, allowing them to fly by pre...
Definition Creature.cpp:3307
bool IsPlayer() const
Definition Object.h:200
Player * ToPlayer()
Definition Object.h:201
Definition Player.h:1081
void SetFaction(uint32 faction)
Definition Unit.cpp:10097
uint32 GetFaction() const
Definition Unit.h:817
void AddUnitMovementFlag(uint32 f)
Definition Unit.h:743
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
void SetSpeed(UnitMoveType mtype, float rate, bool forced=false)
Definition Unit.cpp:14481
@ SPELL_FLIGHT_ORDERS
Definition zone_icecrown.cpp:1053
@ EVENT_START_FLIGHT
Definition zone_icecrown.cpp:1056
@ SPELL_WAITING_FOR_A_BOMBER
Definition zone_icecrown.cpp:1052
@ EVENT_TAKE_PASSENGER
Definition zone_icecrown.cpp:1055

References Unit::AddUnitMovementFlag(), Unit::CastSpell(), EVENT_START_FLIGHT, EVENT_TAKE_PASSENGER, Unit::GetFaction(), Object::IsPlayer(), CreatureAI::me, MOVE_FLIGHT, MOVEMENTFLAG_FLYING, Creature::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
1276 {
1277 Vehicle* kit = me->GetVehicleKit();
1278 if (!kit)
1279 return;
1280
1281 if (Unit* passenger = kit->GetPassenger(SEAT_ENGINEERING))
1282 if (init && !passenger->HasAura(SPELL_BURNING))
1283 {
1284 me->TextEmote("Your Vehicle is burning!", GetSummoner(), true);
1285 passenger->AddAura(SPELL_BURNING, passenger);
1286 }
1287
1288 for (uint8 seat = 3; seat <= 5; ++seat)
1289 if (Unit* banner = kit->GetPassenger(seat))
1290 if (!banner->HasAura(SPELL_COSMETIC_FIRE))
1291 {
1292 banner->AddAura(SPELL_COSMETIC_FIRE, banner);
1293 break;
1294 }
1295 }
std::uint8_t uint8
Definition Define.h:109
Definition Unit.h:636
virtual void TextEmote(std::string_view text, WorldObject const *target=nullptr, bool isBossEmote=false)
Definition Unit.cpp:21199
Vehicle * GetVehicleKit() const
Definition Unit.h:1838
Definition Vehicle.h:28
Unit * GetPassenger(int8 seatId) const
Definition Vehicle.cpp:227
Unit * GetSummoner()
Definition zone_icecrown.cpp:1239
@ SEAT_ENGINEERING
Definition zone_icecrown.cpp:1063
@ SPELL_BURNING
Definition zone_icecrown.cpp:1048
@ SPELL_COSMETIC_FIRE
Definition zone_icecrown.cpp:1049

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.

1298 {
1299 events.Update(diff);
1300 uint32 eventId = events.ExecuteEvent();
1301 switch (eventId)
1302 {
1304 if (Unit* owner = GetSummoner())
1305 if (Vehicle* kit = me->GetVehicleKit())
1306 if (Unit* turret = kit->GetPassenger(SEAT_TURRET))
1307 {
1308 me->SetSpeed(MOVE_FLIGHT, 1.2f);
1309 owner->RemoveAurasDueToSpell(SPELL_WAITING_FOR_A_BOMBER);
1310 turret->HandleSpellClick(owner, 0);
1311 return;
1312 }
1314 break;
1315 case EVENT_START_FLIGHT:
1316 {
1317 WPPath* path = sSmartWaypointMgr->GetPath(me->GetEntry());
1318 if (!path || path->empty())
1319 {
1321 return;
1322 }
1323
1324 Movement::PointsArray pathPoints;
1325 pathPoints.push_back(G3D::Vector3(me->GetPositionX(), me->GetPositionY(), me->GetPositionZ()));
1326
1327 uint32 wpCounter = 1;
1328 WPPath::const_iterator itr;
1329 while ((itr = path->find(wpCounter++)) != path->end())
1330 {
1331 WayPoint* wp = itr->second;
1332 pathPoints.push_back(G3D::Vector3(wp->x, wp->y, wp->z));
1333 }
1334
1335 me->GetMotionMaster()->MoveSplinePath(&pathPoints);
1337 events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 5s);
1338 break;
1339 }
1341 {
1342 // Check if path is finished
1344 {
1346 return;
1347 }
1348
1349 // Check fire count
1350 uint8 fireCount = 0;
1351 if (Vehicle* kit = me->GetVehicleKit())
1352 for (uint8 seat = 3; seat <= 5; ++seat)
1353 if (Unit* banner = kit->GetPassenger(seat))
1354 if (banner->HasAura(SPELL_COSMETIC_FIRE))
1355 fireCount++;
1356
1357 if (fireCount)
1358 Unit::DealDamage(me, me, 3000 * fireCount, nullptr, DIRECT_DAMAGE, SPELL_SCHOOL_MASK_FIRE);
1359 else // Heal
1360 me->ModifyHealth(2000);
1361
1363 break;
1364 }
1366 if (Vehicle* kit = me->GetVehicleKit())
1367 {
1368 // Xinef: check if we have player on any of the stations
1369 bool playerPresent = false;
1371 for (uint8 i = SEAT_BOMBER; i <= SEAT_ENGINEERING; ++i)
1372 if (Unit* station = kit->GetPassenger(i))
1373 {
1374 if (Vehicle* stationKit = station->GetVehicleKit())
1375 if (stationKit->GetPassenger(0))
1376 playerPresent = true;
1377
1378 if (stackAmount)
1379 station->SetAuraStack(SPELL_INFRA_GREEN_SHIELD, station, stackAmount);
1380 else
1381 station->RemoveAurasDueToSpell(SPELL_INFRA_GREEN_SHIELD);
1382 }
1383 if (!playerPresent)
1385 }
1386 events.ScheduleEvent(EVENT_SYNCHRONIZE_SHIELDS, 1s);
1387 break;
1388 case EVENT_SPREAD_FIRE:
1389 break;
1390 }
1391 }
std::uint32_t uint32
Definition Define.h:107
@ ESCORT_MOTION_TYPE
Definition MotionMaster.h:57
@ SPELL_SCHOOL_MASK_FIRE
Definition SharedDefines.h:299
#define sSmartWaypointMgr
Definition SmartScriptMgr.h:2237
std::unordered_map< uint32, WayPoint * > WPPath
Definition SmartScriptMgr.h:1999
@ DIRECT_DAMAGE
Definition Unit.h:248
void DespawnOrUnsummon(Milliseconds msTimeToDespawn, Seconds forcedRespawnTimer)
Definition Creature.cpp:2183
MovementGeneratorType GetCurrentMovementGeneratorType() const
Definition MotionMaster.cpp:913
void MoveSplinePath(Movement::PointsArray *path)
Definition MotionMaster.cpp:454
uint32 GetEntry() const
Definition Object.h:115
int32 ModifyHealth(int32 val)
Definition Unit.cpp:14143
MotionMaster * GetMotionMaster()
Definition Unit.h:1673
uint32 GetAuraCount(uint32 spellId) const
Definition Unit.cpp:5714
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:810
std::vector< Vector3 > PointsArray
Definition MoveSplineInitArgs.h:28
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122
Definition SmartScriptMgr.h:33
float z
Definition SmartScriptMgr.h:47
float y
Definition SmartScriptMgr.h:46
float x
Definition SmartScriptMgr.h:45
@ SEAT_TURRET
Definition zone_icecrown.cpp:1062
@ EVENT_SPREAD_FIRE
Definition zone_icecrown.cpp:1059
@ SEAT_BOMBER
Definition zone_icecrown.cpp:1061
@ EVENT_CHECK_PATH_REGEN_HEALTH_BURN_DAMAGE
Definition zone_icecrown.cpp:1057
@ EVENT_SYNCHRONIZE_SHIELDS
Definition zone_icecrown.cpp:1058
@ SPELL_INFRA_GREEN_SHIELD
Definition zone_icecrown.cpp:1046

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, Unit::GetAuraCount(), MotionMaster::GetCurrentMovementGeneratorType(), Object::GetEntry(), Unit::GetMotionMaster(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), GetSummoner(), Unit::GetVehicleKit(), CreatureAI::me, Unit::ModifyHealth(), MOVE_FLIGHT, MotionMaster::MoveSplinePath(), SEAT_BOMBER, SEAT_ENGINEERING, SEAT_TURRET, Unit::SetSpeed(), SPELL_COSMETIC_FIRE, SPELL_INFRA_GREEN_SHIELD, SPELL_SCHOOL_MASK_FIRE, SPELL_WAITING_FOR_A_BOMBER, sSmartWaypointMgr, WayPoint::x, WayPoint::y, and WayPoint::z.

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: