diff options
| author | ccrs <ccrs@users.noreply.github.com> | 2025-10-10 14:21:36 +0200 |
|---|---|---|
| committer | GitHub <noreply@github.com> | 2025-10-10 14:21:36 +0200 |
| commit | bc68d013da92f70c20a1dbed16e5c6b8bcba48ae (patch) | |
| tree | 6e94006315e72b11633d2df1a592405d312ab2dc /src/server/game/Miscellaneous/CommonHelpers.cpp | |
| parent | 676c1398d67fa40c13b4ab4ec30626093fdc6760 (diff) | |
Scripts/Gundrak: Drakkari Colossus cleanup (#31275)
Drakkari Colossus implementation cleanup
Diffstat (limited to 'src/server/game/Miscellaneous/CommonHelpers.cpp')
| -rw-r--r-- | src/server/game/Miscellaneous/CommonHelpers.cpp | 27 |
1 files changed, 27 insertions, 0 deletions
diff --git a/src/server/game/Miscellaneous/CommonHelpers.cpp b/src/server/game/Miscellaneous/CommonHelpers.cpp index e1a30cb6869..77b2f32ef41 100644 --- a/src/server/game/Miscellaneous/CommonHelpers.cpp +++ b/src/server/game/Miscellaneous/CommonHelpers.cpp @@ -17,10 +17,14 @@ #include "CommonHelpers.h" #include "Common.h" +#include "Creature.h" +#include "CreatureAI.h" #include "Item.h" #include "ItemTemplate.h" +#include "ObjectAccessor.h" #include "Player.h" #include "SharedDefines.h" +#include "UnitAI.h" enum PlayerSpecializationIconicSpellIds { @@ -322,3 +326,26 @@ bool Trinity::Helpers::Entity::IsPlayerRangedAttacker(Player const* who) return (Trinity::Helpers::Entity::GetPlayerSpecialization(who) == SPEC_DRUID_BALANCE); } } + +Trinity::Helpers::Events::SetAggresiveStateEvent::SetAggresiveStateEvent(Creature* owner, bool startCombat/* = true*/, ObjectGuid summonerGUID/* = ObjectGuid::Empty*/) : _owner(owner), _startCombat(startCombat), _summonerGUID(summonerGUID) +{ +} + +bool Trinity::Helpers::Events::SetAggresiveStateEvent::Execute(uint64 /*time*/, uint32 /*diff*/) +{ + _owner->SetReactState(REACT_AGGRESSIVE); + if (_startCombat) + { + if (Unit* currentVictim = _owner->SelectVictim()) + { + if (_owner->IsAIEnabled()) + _owner->AI()->AttackStart(currentVictim); + } + else if (!_summonerGUID.IsEmpty()) + if (Creature* summoner = ObjectAccessor::GetCreature(*_owner, _summonerGUID)) + if (summoner->IsEngaged() && summoner->IsAIEnabled() && _owner->IsAIEnabled()) + if (Unit* target = summoner->AI()->SelectTarget(SelectTargetMethod::Random, 0, 0.0f, true)) + _owner->AI()->AttackStart(target); + } + return true; +} |
