AzerothCore 3.3.5a
OpenSource WoW Emulator
Loading...
Searching...
No Matches
npc_simon_bunny::npc_simon_bunnyAI Struct Reference
Inheritance diagram for npc_simon_bunny::npc_simon_bunnyAI:
ScriptedAI CreatureAI UnitAI

Public Member Functions

 npc_simon_bunnyAI (Creature *creature)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void DoAction (int32 action) override
 
void SetData (uint32 type, uint32) override
 
void SetGUID (ObjectGuid const &guid, int32 id) override
 
void StartGame ()
 
void ResetNode ()
 
void CheckPlayerSequence ()
 
void GenerateColorSequence ()
 
void PrepareClusters (bool clustersOnly=false)
 
void PlayNextColor ()
 
void PlayColor (uint8 color)
 
void SetUpPreGame ()
 
void GiveRewardForLevel (uint8 level)
 
void GivePunishment ()
 
void SpellHitTarget (Unit *target, SpellInfo const *spell) override
 
bool CheckPlayer ()
 
- Public Member Functions inherited from ScriptedAI
 ScriptedAI (Creature *creature)
 
 ~ScriptedAI () override
 
void AttackStartNoMove (Unit *target)
 
void DamageTaken (Unit *, uint32 &, DamageEffectType, SpellSchoolMask) override
 Called at any Damage from any attacker (before damage apply)
 
void UpdateAI (uint32 diff) override
 Use to start attacking a target. Called just before JustEngagedWith()
 
void JustDied (Unit *) override
 
void KilledUnit (Unit *) override
 
void JustSummoned (Creature *) override
 
void SummonedCreatureDespawn (Creature *) override
 
void SpellHit (Unit *, SpellInfo const *) override
 
void SpellHitTarget (Unit *, SpellInfo const *) override
 
void MovementInform (uint32, uint32) override
 
void OnPossess (bool)
 
bool IsInRoom (const Position *pos, Axis axis, bool above)
 
void Reset () override
 
void JustEngagedWith (Unit *) override
 Called for reaction when initially engaged - this happens after JustEnteredCombat.
 
void AttackStart (Unit *) override
 
void DoStartMovement (Unit *target, float distance=0.0f, float angle=0.0f)
 
void DoStartNoMovement (Unit *target)
 
void DoStopAttack ()
 
void DoRewardPlayersInArea ()
 
void DoCastSpell (Unit *target, SpellInfo const *spellInfo, bool triggered=false)
 
void DoPlaySoundToSet (WorldObject *source, uint32 soundId)
 
void DoPlayMusic (uint32 soundId, bool zone)
 
void DoAddThreat (Unit *unit, float amount)
 
void DoModifyThreatByPercent (Unit *unit, int32 pct)
 
void DoResetThreat (Unit *unit)
 
void DoResetThreatList ()
 
float DoGetThreat (Unit *unit)
 
void DoTeleportPlayer (Unit *unit, float x, float y, float z, float o)
 
void DoTeleportPlayer (Unit *unit, Position pos)
 
void DoTeleportAll (float x, float y, float z, float o)
 
UnitDoSelectLowestHpFriendly (float range, uint32 minHPDiff=1)
 
std::list< Creature * > DoFindFriendlyCC (float range)
 
std::list< Creature * > DoFindFriendlyMissingBuff (float range, uint32 spellId)
 
PlayerGetPlayerAtMinimumRange (float minRange)
 
CreatureDoSpawnCreature (uint32 entry, float offsetX, float offsetY, float offsetZ, float angle, uint32 type, uint32 despawntime)
 
bool IsUniqueTimedEventDone (uint32 id) const
 
void SetUniqueTimedEventDone (uint32 id)
 
void ResetUniqueTimedEvent (uint32 id)
 
void ClearUniqueTimedEventsDone ()
 
void ScheduleTimedEvent (Milliseconds timerMin, Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
 
void ScheduleTimedEvent (Milliseconds timerMax, std::function< void()> exec, Milliseconds repeatMin, Milliseconds repeatMax=0ms, uint32 uniqueId=0)
 
void ScheduleUniqueTimedEvent (Milliseconds timer, std::function< void()> exec, uint32 uniqueId)
 
bool HealthBelowPct (uint32 pct) const
 
bool HealthAbovePct (uint32 pct) const
 
SpellInfo const * SelectSpell (Unit *target, uint32 school, uint32 mechanic, SelectTargetType targets, uint32 powerCostMin, uint32 powerCostMax, float rangeMin, float rangeMax, SelectEffect effect)
 
void SetEquipmentSlots (bool loadDefault, int32 mainHand=EQUIP_NO_CHANGE, int32 offHand=EQUIP_NO_CHANGE, int32 ranged=EQUIP_NO_CHANGE)
 
virtual bool CheckEvadeIfOutOfCombatArea () const
 
bool IsHeroic () const
 
Difficulty GetDifficulty () const
 
bool Is25ManRaid () const
 
template<class T >
const T & DUNGEON_MODE (const T &normal5, const T &heroic10) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25) const
 
template<class T >
const T & RAID_MODE (const T &normal10, const T &normal25, const T &heroic10, const T &heroic25) const
 
PlayerSelectTargetFromPlayerList (float maxdist, uint32 excludeAura=0, bool mustBeInLOS=false) const
 
void SetInvincibility (bool apply)
 
bool IsInvincible () const
 
void SetAutoAttackAllowed (bool allow)
 
bool IsAutoAttackAllowed () const
 
- 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 EnterEvadeMode (EvadeReason why=EVADE_REASON_OTHER)
 
void JustEnteredCombat (Unit *who) override
 Called when the unit enters combat.
 
virtual void JustStartedThreateningMe (Unit *who)
 
void EngagementStart (Unit *who)
 
void EngagementOver ()
 
void JustExitedCombat () override
 Called when the unit leaves combat.
 
virtual void IsSummonedBy (WorldObject *)
 
virtual void SummonedCreatureDies (Creature *, Unit *)
 
virtual void SummonedCreatureDespawnAll ()
 
virtual void SummonedCreatureEvade (Creature *)
 
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 PathEndReached (uint32)
 
virtual void WaypointPathStarted (uint32)
 == Waypoints system =============================
 
virtual void WaypointStarted (uint32, uint32)
 
virtual void WaypointReached (uint32, uint32)
 
virtual void WaypointPathEnded (uint32, uint32)
 
void OnCharmed (bool apply) override
 Called when unit is charmed.
 
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 uint32 GetData (uint32) const
 
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
 

Public Attributes

bool large
 
bool listening
 
uint8 gameLevel
 
uint8 fails
 
uint8 gameTicks
 
ObjectGuid playerGUID
 
uint32 clusterIds [SIMON_MAX_COLORS]
 
float zCoordCorrection
 
float searchDistance
 
EventMap _events
 
std::list< uint8colorSequence
 
std::list< uint8playableSequence
 
std::list< uint8playerSequence
 
- Public Attributes inherited from ScriptedAI
Creatureme
 

Additional Inherited Members

- Public Types inherited from ScriptedAI
enum class  Axis {
  AXIS_X ,
  AXIS_Y
}
 
- 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 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
 
bool _isEngaged
 
- Protected Attributes inherited from UnitAI
Unit *const me
 

Detailed Description

Constructor & Destructor Documentation

◆ npc_simon_bunnyAI()

npc_simon_bunny::npc_simon_bunnyAI::npc_simon_bunnyAI ( Creature creature)
inline
555: ScriptedAI(creature) { }
Definition ScriptedCreature.h:191

Member Function Documentation

◆ CheckPlayer()

bool npc_simon_bunny::npc_simon_bunnyAI::CheckPlayer ( )
inline
975 {
977 {
978 if (player->isDead())
979 return false;
980 if (player->GetDistance2d(me) >= 2.0f * searchDistance)
981 {
983 return false;
984 }
985 }
986 else
987 return false;
988
989 return true;
990 }
Definition Player.h:1084
Player * GetPlayer(Map const *, ObjectGuid const &guid)
Definition ObjectAccessor.cpp:220
Creature * me
Definition ScriptedCreature.h:281
float searchDistance
Definition zone_blades_edge_mountains.cpp:565
void GivePunishment()
Definition zone_blades_edge_mountains.cpp:939
ObjectGuid playerGUID
Definition zone_blades_edge_mountains.cpp:562

References ObjectAccessor::GetPlayer(), GivePunishment(), ScriptedAI::me, playerGUID, and searchDistance.

Referenced by UpdateAI().

◆ CheckPlayerSequence()

void npc_simon_bunny::npc_simon_bunnyAI::CheckPlayerSequence ( )
inline
786 {
787 bool correct = true;
788 if (playerSequence.size() <= colorSequence.size())
789 for (std::list<uint8>::const_iterator i = playerSequence.begin(), j = colorSequence.begin(); i != playerSequence.end(); ++i, ++j)
790 if ((*i) != (*j))
791 correct = false;
792
793 if (correct && (playerSequence.size() == colorSequence.size()))
795 else if (!correct)
797 }
std::list< uint8 > playerSequence
Definition zone_blades_edge_mountains.cpp:567
void DoAction(int32 action) override
Definition zone_blades_edge_mountains.cpp:623
std::list< uint8 > colorSequence
Definition zone_blades_edge_mountains.cpp:567
@ ACTION_SIMON_WRONG_SEQUENCE
Definition zone_blades_edge_mountains.cpp:535
@ ACTION_SIMON_CORRECT_FULL_SEQUENCE
Definition zone_blades_edge_mountains.cpp:534

References ACTION_SIMON_CORRECT_FULL_SEQUENCE, ACTION_SIMON_WRONG_SEQUENCE, colorSequence, DoAction(), and playerSequence.

Referenced by SetData().

◆ DoAction()

void npc_simon_bunny::npc_simon_bunnyAI::DoAction ( int32  action)
inlineoverridevirtual

Reimplemented from UnitAI.

624 {
625 switch (action)
626 {
628 listening = false;
632 if (gameLevel == 10)
633 ResetNode();
634 else
636 break;
638 gameLevel++;
640 break;
644 break;
645 }
646 }
void CancelEventGroup(GroupIndex group)
Definition EventMap.cpp:177
void ScheduleEvent(EventId eventId, Milliseconds time, GroupIndex group=0u, PhaseIndex phase=0u)
Definition EventMap.cpp:48
SpellCastResult DoCast(uint32 spellId)
Definition UnitAI.cpp:178
bool listening
Definition zone_blades_edge_mountains.cpp:558
uint8 gameLevel
Definition zone_blades_edge_mountains.cpp:559
void ResetNode()
Definition zone_blades_edge_mountains.cpp:762
EventMap _events
Definition zone_blades_edge_mountains.cpp:566
void GiveRewardForLevel(uint8 level)
Definition zone_blades_edge_mountains.cpp:908
@ ACTION_SIMON_ROUND_FINISHED
Definition zone_blades_edge_mountains.cpp:536
@ EVENT_SIMON_SETUP_PRE_GAME
Definition zone_blades_edge_mountains.cpp:526
@ SPELL_VISUAL_START_AI_LEVEL
Definition zone_blades_edge_mountains.cpp:515

References _events, ACTION_SIMON_CORRECT_FULL_SEQUENCE, ACTION_SIMON_ROUND_FINISHED, ACTION_SIMON_WRONG_SEQUENCE, EventMap::CancelEventGroup(), DoAction(), UnitAI::DoCast(), EVENT_SIMON_SETUP_PRE_GAME, gameLevel, GivePunishment(), GiveRewardForLevel(), listening, ResetNode(), EventMap::ScheduleEvent(), and SPELL_VISUAL_START_AI_LEVEL.

Referenced by CheckPlayerSequence(), DoAction(), and UpdateAI().

◆ GenerateColorSequence()

void npc_simon_bunny::npc_simon_bunnyAI::GenerateColorSequence ( )
inline
804 {
805 colorSequence.clear();
806 for (uint8 i = 0; i <= gameLevel; i++)
808
809 for (std::list<uint8>::const_iterator i = colorSequence.begin(); i != colorSequence.end(); ++i)
810 playableSequence.push_back(*i);
811 }
static First const & RAND(First const &first, Second const &second, Rest const &... rest)
Definition CreatureAIImpl.h:25
std::uint8_t uint8
Definition Define.h:109
std::list< uint8 > playableSequence
Definition zone_blades_edge_mountains.cpp:567
@ SIMON_GREEN
Definition zone_blades_edge_mountains.cpp:543
@ SIMON_BLUE
Definition zone_blades_edge_mountains.cpp:541
@ SIMON_RED
Definition zone_blades_edge_mountains.cpp:542
@ SIMON_YELLOW
Definition zone_blades_edge_mountains.cpp:544

References colorSequence, gameLevel, playableSequence, RAND(), SIMON_BLUE, SIMON_GREEN, SIMON_RED, and SIMON_YELLOW.

Referenced by SetUpPreGame().

◆ GivePunishment()

void npc_simon_bunny::npc_simon_bunnyAI::GivePunishment ( )
inline
940 {
941 if (large)
942 {
945 guardian->AI()->AttackStart(player);
946
947 ResetNode();
948 }
949 else
950 {
951 fails++;
952
954 DoCast(player, SPELL_BAD_PRESS_TRIGGER, true);
955
956 if (fails >= 4)
957 ResetNode();
958 }
959 }
@ TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT
Definition Object.h:52
Definition Creature.h:47
TempSummon * SummonCreature(uint32 id, const Position &pos, TempSummonType spwtype=TEMPSUMMON_MANUAL_DESPAWN, uint32 despwtime=0, uint32 vehId=0, SummonPropertiesEntry const *properties=nullptr, bool visibleBySummonerOnly=false) const
Definition Object.cpp:2394
float GetPositionZ() const
Definition Position.h:123
float GetPositionX() const
Definition Position.h:121
float GetPositionY() const
Definition Position.h:122
bool large
Definition zone_blades_edge_mountains.cpp:557
uint8 fails
Definition zone_blades_edge_mountains.cpp:560
float zCoordCorrection
Definition zone_blades_edge_mountains.cpp:564
@ NPC_APEXIS_GUARDIAN
Definition zone_blades_edge_mountains.cpp:480
@ SPELL_BAD_PRESS_TRIGGER
Definition zone_blades_edge_mountains.cpp:517

References UnitAI::DoCast(), fails, ObjectAccessor::GetPlayer(), Position::GetPositionX(), Position::GetPositionY(), Position::GetPositionZ(), large, ScriptedAI::me, NPC_APEXIS_GUARDIAN, playerGUID, ResetNode(), SPELL_BAD_PRESS_TRIGGER, WorldObject::SummonCreature(), TEMPSUMMON_TIMED_DESPAWN_OUT_OF_COMBAT, and zCoordCorrection.

Referenced by CheckPlayer(), DoAction(), and GiveRewardForLevel().

◆ GiveRewardForLevel()

void npc_simon_bunny::npc_simon_bunnyAI::GiveRewardForLevel ( uint8  level)
inline
909 {
910 uint32 rewSpell = 0;
911 switch (level)
912 {
913 case 6:
914 if (large)
916 else
917 rewSpell = SPELL_REWARD_BUFF_1;
918 break;
919 case 8:
920 rewSpell = SPELL_REWARD_BUFF_2;
921 break;
922 case 10:
923 rewSpell = SPELL_REWARD_BUFF_3;
924 break;
925 }
926
927 if (rewSpell)
929 DoCast(player, rewSpell, true);
930 }
std::uint32_t uint32
Definition Define.h:107
@ SPELL_REWARD_BUFF_2
Definition zone_blades_edge_mountains.cpp:520
@ SPELL_REWARD_BUFF_3
Definition zone_blades_edge_mountains.cpp:521
@ SPELL_REWARD_BUFF_1
Definition zone_blades_edge_mountains.cpp:519

References UnitAI::DoCast(), ObjectAccessor::GetPlayer(), GivePunishment(), large, ScriptedAI::me, playerGUID, SPELL_REWARD_BUFF_1, SPELL_REWARD_BUFF_2, and SPELL_REWARD_BUFF_3.

Referenced by DoAction().

◆ PlayColor()

void npc_simon_bunny::npc_simon_bunnyAI::PlayColor ( uint8  color)
inline
840 {
841 switch (color)
842 {
843 case SIMON_BLUE:
846 break;
847 case SIMON_GREEN:
850 break;
851 case SIMON_RED:
854 break;
855 case SIMON_YELLOW:
858 break;
859 }
860 }
void DoPlaySoundToSet(WorldObject *source, uint32 soundId)
Definition ScriptedCreature.cpp:291
@ SOUND_RED
Definition zone_blades_edge_mountains.cpp:509
@ SOUND_YELLOW
Definition zone_blades_edge_mountains.cpp:510
@ SOUND_BLUE
Definition zone_blades_edge_mountains.cpp:507
@ SOUND_GREEN
Definition zone_blades_edge_mountains.cpp:508
@ SPELL_VISUAL_YELLOW
Definition zone_blades_edge_mountains.cpp:505
@ SPELL_VISUAL_BLUE
Definition zone_blades_edge_mountains.cpp:502
@ SPELL_VISUAL_RED
Definition zone_blades_edge_mountains.cpp:504
@ SPELL_VISUAL_GREEN
Definition zone_blades_edge_mountains.cpp:503

References UnitAI::DoCast(), ScriptedAI::DoPlaySoundToSet(), ScriptedAI::me, SIMON_BLUE, SIMON_GREEN, SIMON_RED, SIMON_YELLOW, SOUND_BLUE, SOUND_GREEN, SOUND_RED, SOUND_YELLOW, SPELL_VISUAL_BLUE, SPELL_VISUAL_GREEN, SPELL_VISUAL_RED, and SPELL_VISUAL_YELLOW.

Referenced by PlayNextColor(), and SetData().

◆ PlayNextColor()

void npc_simon_bunny::npc_simon_bunnyAI::PlayNextColor ( )
inline
833 {
834 PlayColor(*playableSequence.begin());
835 playableSequence.erase(playableSequence.begin());
836 }
void PlayColor(uint8 color)
Definition zone_blades_edge_mountains.cpp:839

References playableSequence, and PlayColor().

Referenced by UpdateAI().

◆ PrepareClusters()

void npc_simon_bunny::npc_simon_bunnyAI::PrepareClusters ( bool  clustersOnly = false)
inline
815 {
816 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
817 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], searchDistance))
818 cluster->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
819
820 if (clustersOnly)
821 return;
822
823 for (uint32 auraId = GO_AURA_BLUE; auraId <= GO_AURA_YELLOW; auraId++)
824 if (GameObject* auraGo = me->FindNearestGameObject(auraId, searchDistance))
825 auraGo->RemoveFromWorld();
826 }
@ GO_FLAG_NOT_SELECTABLE
Definition SharedDefines.h:1613
Definition GameObject.h:120
GameObject * FindNearestGameObject(uint32 entry, float range, bool onlySpawned=false) const
Definition Object.cpp:2508
uint32 clusterIds[SIMON_MAX_COLORS]
Definition zone_blades_edge_mountains.cpp:563
@ SIMON_MAX_COLORS
Definition zone_blades_edge_mountains.cpp:545
@ GO_AURA_YELLOW
Definition zone_blades_edge_mountains.cpp:487
@ GO_AURA_BLUE
Definition zone_blades_edge_mountains.cpp:484

References clusterIds, WorldObject::FindNearestGameObject(), GO_AURA_BLUE, GO_AURA_YELLOW, GO_FLAG_NOT_SELECTABLE, ScriptedAI::me, searchDistance, SIMON_BLUE, and SIMON_MAX_COLORS.

Referenced by UpdateAI().

◆ ResetNode()

void npc_simon_bunny::npc_simon_bunnyAI::ResetNode ( )
inline
763 {
765
766 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
767 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], searchDistance))
768 cluster->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
769
770 for (uint32 auraId = GO_AURA_BLUE; auraId <= GO_AURA_YELLOW; auraId++)
771 if (GameObject* auraGo = me->FindNearestGameObject(auraId, searchDistance))
772 auraGo->RemoveFromWorld();
773
775 relic->RemoveGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
776
778 }
void DespawnOrUnsummon(Milliseconds msTimeToDespawn=0ms, Seconds forcedRespawnTimer=0s)
Definition Creature.cpp:2126
@ GO_APEXIS_MONUMENT
Definition zone_blades_edge_mountains.cpp:483
@ GO_APEXIS_RELIC
Definition zone_blades_edge_mountains.cpp:482
@ SOUND_DISABLE_NODE
Definition zone_blades_edge_mountains.cpp:511

References clusterIds, Creature::DespawnOrUnsummon(), ScriptedAI::DoPlaySoundToSet(), WorldObject::FindNearestGameObject(), GO_APEXIS_MONUMENT, GO_APEXIS_RELIC, GO_AURA_BLUE, GO_AURA_YELLOW, GO_FLAG_NOT_SELECTABLE, large, ScriptedAI::me, searchDistance, SIMON_BLUE, SIMON_MAX_COLORS, and SOUND_DISABLE_NODE.

Referenced by DoAction(), GivePunishment(), and UpdateAI().

◆ SetData()

void npc_simon_bunny::npc_simon_bunnyAI::SetData ( uint32  type,
uint32   
)
inlineoverridevirtual

Reimplemented from UnitAI.

650 {
651 if (!listening)
652 return;
653
654 uint8 pressedColor = SIMON_MAX_COLORS;
655
656 if (type == clusterIds[SIMON_RED])
657 pressedColor = SIMON_RED;
658 else if (type == clusterIds[SIMON_BLUE])
659 pressedColor = SIMON_BLUE;
660 else if (type == clusterIds[SIMON_GREEN])
661 pressedColor = SIMON_GREEN;
662 else if (type == clusterIds[SIMON_YELLOW])
663 pressedColor = SIMON_YELLOW;
664
665 PlayColor(pressedColor);
666 playerSequence.push_back(pressedColor);
669 }
void CheckPlayerSequence()
Definition zone_blades_edge_mountains.cpp:785
@ EVENT_SIMON_RESET_CLUSTERS
Definition zone_blades_edge_mountains.cpp:528

References _events, CheckPlayerSequence(), clusterIds, EVENT_SIMON_RESET_CLUSTERS, listening, PlayColor(), playerSequence, EventMap::ScheduleEvent(), SIMON_BLUE, SIMON_GREEN, SIMON_MAX_COLORS, SIMON_RED, and SIMON_YELLOW.

◆ SetGUID()

void npc_simon_bunny::npc_simon_bunnyAI::SetGUID ( ObjectGuid const &  guid,
int32  id 
)
inlineoverridevirtual

Reimplemented from UnitAI.

673 {
674 me->SetCanFly(true);
675
676 large = (bool)id;
677 playerGUID = guid;
678 StartGame();
679 }
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 StartGame()
Definition zone_blades_edge_mountains.cpp:685

References large, ScriptedAI::me, playerGUID, Unit::SetCanFly(), and StartGame().

◆ SetUpPreGame()

void npc_simon_bunny::npc_simon_bunnyAI::SetUpPreGame ( )
inline
867 {
868 for (uint32 clusterId = SIMON_BLUE; clusterId < SIMON_MAX_COLORS; clusterId++)
869 {
870 if (GameObject* cluster = me->FindNearestGameObject(clusterIds[clusterId], 2.0f * searchDistance))
871 {
872 cluster->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
873
874 // break since we don't need glowing auras for large clusters
875 if (large)
876 break;
877
878 float x, y, z, o;
879 cluster->GetPosition(x, y, z, o);
880 me->NearTeleportTo(x, y, z, o);
881
882 uint32 preGameSpellId;
883 if (cluster->GetEntry() == clusterIds[SIMON_RED])
884 preGameSpellId = SPELL_PRE_GAME_RED;
885 else if (cluster->GetEntry() == clusterIds[SIMON_BLUE])
886 preGameSpellId = SPELL_PRE_GAME_BLUE;
887 else if (cluster->GetEntry() == clusterIds[SIMON_GREEN])
888 preGameSpellId = SPELL_PRE_GAME_GREEN;
889 else if (cluster->GetEntry() == clusterIds[SIMON_YELLOW])
890 preGameSpellId = SPELL_PRE_GAME_YELLOW;
891 else break;
892
893 me->CastSpell(cluster, preGameSpellId, true);
894 }
895 }
896
898 {
899 float x, y, z, o;
900 relic->GetPosition(x, y, z, o);
901 me->NearTeleportTo(x, y, z + zCoordCorrection, o);
902 }
903
905 }
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 NearTeleportTo(Position &pos, bool casting=false, bool vehicleTeleport=false, bool withPet=false, bool removeTransport=false)
Definition Unit.cpp:15921
void GenerateColorSequence()
Definition zone_blades_edge_mountains.cpp:803
@ SPELL_PRE_GAME_RED
Definition zone_blades_edge_mountains.cpp:500
@ SPELL_PRE_GAME_GREEN
Definition zone_blades_edge_mountains.cpp:499
@ SPELL_PRE_GAME_YELLOW
Definition zone_blades_edge_mountains.cpp:501
@ SPELL_PRE_GAME_BLUE
Definition zone_blades_edge_mountains.cpp:498

References Unit::CastSpell(), clusterIds, WorldObject::FindNearestGameObject(), GenerateColorSequence(), GO_APEXIS_MONUMENT, GO_APEXIS_RELIC, GO_FLAG_NOT_SELECTABLE, large, ScriptedAI::me, Unit::NearTeleportTo(), searchDistance, SIMON_BLUE, SIMON_GREEN, SIMON_MAX_COLORS, SIMON_RED, SIMON_YELLOW, SPELL_PRE_GAME_BLUE, SPELL_PRE_GAME_GREEN, SPELL_PRE_GAME_RED, SPELL_PRE_GAME_YELLOW, and zCoordCorrection.

Referenced by UpdateAI().

◆ SpellHitTarget()

void npc_simon_bunny::npc_simon_bunnyAI::SpellHitTarget ( Unit target,
SpellInfo const *  spell 
)
inlineoverridevirtual

Reimplemented from CreatureAI.

962 {
963 // Cast SPELL_BAD_PRESS_DAMAGE with scaled basepoints when the visual hits the target.
964 // Need Fix: When SPELL_BAD_PRESS_TRIGGER hits target it triggers spell SPELL_BAD_PRESS_DAMAGE by itself
965 // so player gets damage equal to calculated damage dbc basepoints for SPELL_BAD_PRESS_DAMAGE (~50)
966 if (spell->Id == SPELL_BAD_PRESS_TRIGGER)
967 {
968 int32 bp = (int32)((float)(fails) * 0.33f * target->GetMaxHealth());
969 target->CastCustomSpell(target, SPELL_BAD_PRESS_DAMAGE, &bp, nullptr, nullptr, true);
970 }
971 }
std::int32_t int32
Definition Define.h:103
uint32 GetMaxHealth() const
Definition Unit.h:1109
SpellCastResult CastCustomSpell(Unit *victim, uint32 spellId, int32 const *bp0, int32 const *bp1, int32 const *bp2, bool triggered, Item *castItem=nullptr, AuraEffect const *triggeredByAura=nullptr, ObjectGuid originalCaster=ObjectGuid::Empty)
Definition Unit.cpp:1407
@ SPELL_BAD_PRESS_DAMAGE
Definition zone_blades_edge_mountains.cpp:518

References Unit::CastCustomSpell(), fails, Unit::GetMaxHealth(), SpellInfo::Id, SPELL_BAD_PRESS_DAMAGE, and SPELL_BAD_PRESS_TRIGGER.

◆ StartGame()

void npc_simon_bunny::npc_simon_bunnyAI::StartGame ( )
inline
686 {
687 listening = false;
688 gameLevel = 0;
689 fails = 0;
690 gameTicks = 0;
691 zCoordCorrection = large ? 8.0f : 2.75f;
692 searchDistance = large ? 13.0f : 5.0f;
693 colorSequence.clear();
694 playableSequence.clear();
695 playerSequence.clear();
696 me->SetObjectScale(large ? 2.0f : 1.0f);
697
698 std::list<WorldObject*> ClusterList;
702
703 for (std::list<WorldObject*>::const_iterator i = ClusterList.begin(); i != ClusterList.end(); ++i)
704 {
705 if (GameObject* go = (*i)->ToGameObject())
706 {
707 // We are checking for displayid because all simon nodes have 4 clusters with different entries
708 if (large)
709 {
710 switch (go->GetGOInfo()->displayId)
711 {
713 clusterIds[SIMON_BLUE] = go->GetEntry();
714 break;
715
717 clusterIds[SIMON_RED] = go->GetEntry();
718 break;
719
721 clusterIds[SIMON_GREEN] = go->GetEntry();
722 break;
723
725 clusterIds[SIMON_YELLOW] = go->GetEntry();
726 break;
727 }
728 }
729 else
730 {
731 switch (go->GetGOInfo()->displayId)
732 {
734 clusterIds[SIMON_BLUE] = go->GetEntry();
735 break;
736
738 clusterIds[SIMON_RED] = go->GetEntry();
739 break;
740
742 clusterIds[SIMON_GREEN] = go->GetEntry();
743 break;
744
746 clusterIds[SIMON_YELLOW] = go->GetEntry();
747 break;
748 }
749 }
750 }
751 }
752
753 _events.Reset();
756
758 relic->SetGameObjectFlag(GO_FLAG_NOT_SELECTABLE);
759 }
Definition GridNotifiers.h:1616
void SetObjectScale(float scale) override
Definition Creature.cpp:3418
void Reset()
Definition EventMap.cpp:21
GameObject * ToGameObject()
Definition Object.h:214
Definition GridNotifiers.h:230
static void VisitObjects(WorldObject const *obj, T &visitor, float radius)
Definition CellImpl.h:165
uint8 gameTicks
Definition zone_blades_edge_mountains.cpp:561
@ EVENT_SIMON_PERIODIC_PLAYER_CHECK
Definition zone_blades_edge_mountains.cpp:529
@ EVENT_SIMON_ROUND_FINISHED
Definition zone_blades_edge_mountains.cpp:532
@ GO_YELLOW_CLUSTER_DISPLAY
Definition zone_blades_edge_mountains.cpp:492
@ GO_BLUE_CLUSTER_DISPLAY_LARGE
Definition zone_blades_edge_mountains.cpp:493
@ GO_GREEN_CLUSTER_DISPLAY
Definition zone_blades_edge_mountains.cpp:490
@ GO_BLUE_CLUSTER_DISPLAY
Definition zone_blades_edge_mountains.cpp:489
@ GO_GREEN_CLUSTER_DISPLAY_LARGE
Definition zone_blades_edge_mountains.cpp:494
@ GO_RED_CLUSTER_DISPLAY_LARGE
Definition zone_blades_edge_mountains.cpp:495
@ GO_RED_CLUSTER_DISPLAY
Definition zone_blades_edge_mountains.cpp:491
@ GO_YELLOW_CLUSTER_DISPLAY_LARGE
Definition zone_blades_edge_mountains.cpp:496

References _events, clusterIds, colorSequence, EVENT_SIMON_PERIODIC_PLAYER_CHECK, EVENT_SIMON_ROUND_FINISHED, fails, WorldObject::FindNearestGameObject(), gameLevel, gameTicks, GO_APEXIS_MONUMENT, GO_APEXIS_RELIC, GO_BLUE_CLUSTER_DISPLAY, GO_BLUE_CLUSTER_DISPLAY_LARGE, GO_FLAG_NOT_SELECTABLE, GO_GREEN_CLUSTER_DISPLAY, GO_GREEN_CLUSTER_DISPLAY_LARGE, GO_RED_CLUSTER_DISPLAY, GO_RED_CLUSTER_DISPLAY_LARGE, GO_YELLOW_CLUSTER_DISPLAY, GO_YELLOW_CLUSTER_DISPLAY_LARGE, large, listening, ScriptedAI::me, playableSequence, playerSequence, EventMap::Reset(), EventMap::ScheduleEvent(), searchDistance, Creature::SetObjectScale(), SIMON_BLUE, SIMON_GREEN, SIMON_RED, SIMON_YELLOW, Object::ToGameObject(), Cell::VisitObjects(), and zCoordCorrection.

Referenced by SetGUID().

◆ UpdateAI()

void npc_simon_bunny::npc_simon_bunnyAI::UpdateAI ( uint32  )
inlineoverridevirtual

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

Implements UnitAI.

570 {
571 _events.Update(diff);
572
573 switch (_events.ExecuteEvent())
574 {
576 if (!CheckPlayer())
577 ResetNode();
578 else
580 break;
582 SetUpPreGame();
585 break;
587 if (!playableSequence.empty())
588 {
591 }
592 else
593 {
594 listening = true;
596 playerSequence.clear();
598 gameTicks = 0;
600 }
601 break;
604
605 if (gameTicks > gameLevel)
607 else
609 gameTicks++;
610 break;
612 PrepareClusters(true);
613 break;
616 break;
619 break;
620 }
621 }
void Update(uint32 time)
Definition EventMap.h:67
EventId ExecuteEvent()
Definition EventMap.cpp:86
void CancelEvent(EventId eventId)
Definition EventMap.cpp:160
void PlayNextColor()
Definition zone_blades_edge_mountains.cpp:832
bool CheckPlayer()
Definition zone_blades_edge_mountains.cpp:974
void PrepareClusters(bool clustersOnly=false)
Definition zone_blades_edge_mountains.cpp:814
void SetUpPreGame()
Definition zone_blades_edge_mountains.cpp:866
@ EVENT_SIMON_GAME_TICK
Definition zone_blades_edge_mountains.cpp:531
@ EVENT_SIMON_PLAY_SEQUENCE
Definition zone_blades_edge_mountains.cpp:527
@ EVENT_SIMON_TOO_LONG_TIME
Definition zone_blades_edge_mountains.cpp:530
@ SPELL_VISUAL_START_PLAYER_LEVEL
Definition zone_blades_edge_mountains.cpp:514
@ SPELL_AUDIBLE_GAME_TICK
Definition zone_blades_edge_mountains.cpp:513

References _events, ACTION_SIMON_ROUND_FINISHED, ACTION_SIMON_WRONG_SEQUENCE, EventMap::CancelEvent(), CheckPlayer(), DoAction(), UnitAI::DoCast(), EVENT_SIMON_GAME_TICK, EVENT_SIMON_PERIODIC_PLAYER_CHECK, EVENT_SIMON_PLAY_SEQUENCE, EVENT_SIMON_RESET_CLUSTERS, EVENT_SIMON_ROUND_FINISHED, EVENT_SIMON_SETUP_PRE_GAME, EVENT_SIMON_TOO_LONG_TIME, EventMap::ExecuteEvent(), gameLevel, gameTicks, listening, playableSequence, playerSequence, PlayNextColor(), PrepareClusters(), ResetNode(), EventMap::ScheduleEvent(), SetUpPreGame(), SPELL_AUDIBLE_GAME_TICK, SPELL_VISUAL_START_PLAYER_LEVEL, and EventMap::Update().

Member Data Documentation

◆ _events

EventMap npc_simon_bunny::npc_simon_bunnyAI::_events

Referenced by DoAction(), SetData(), StartGame(), and UpdateAI().

◆ clusterIds

uint32 npc_simon_bunny::npc_simon_bunnyAI::clusterIds[SIMON_MAX_COLORS]

◆ colorSequence

std::list<uint8> npc_simon_bunny::npc_simon_bunnyAI::colorSequence

◆ fails

uint8 npc_simon_bunny::npc_simon_bunnyAI::fails

◆ gameLevel

uint8 npc_simon_bunny::npc_simon_bunnyAI::gameLevel

◆ gameTicks

uint8 npc_simon_bunny::npc_simon_bunnyAI::gameTicks

Referenced by StartGame(), and UpdateAI().

◆ large

bool npc_simon_bunny::npc_simon_bunnyAI::large

◆ listening

bool npc_simon_bunny::npc_simon_bunnyAI::listening

Referenced by DoAction(), SetData(), StartGame(), and UpdateAI().

◆ playableSequence

std::list<uint8> npc_simon_bunny::npc_simon_bunnyAI::playableSequence

◆ playerGUID

ObjectGuid npc_simon_bunny::npc_simon_bunnyAI::playerGUID

◆ playerSequence

std::list<uint8> npc_simon_bunny::npc_simon_bunnyAI::playerSequence

◆ searchDistance

float npc_simon_bunny::npc_simon_bunnyAI::searchDistance

◆ zCoordCorrection

float npc_simon_bunny::npc_simon_bunnyAI::zCoordCorrection

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