Skip to content

Commit

Permalink
StaticFlags: Implement SPAWN_DEFENSIVE and IGNORE_COMBAT (#538)
Browse files Browse the repository at this point in the history
* StaticFlags: Implement SPAWN_DEFENSIVE and IGNORE_COMBAT

* StaticFlags: Correct Passive to SetCanEnterCombat(false)
  • Loading branch information
insunaa authored Oct 7, 2024
1 parent e522570 commit 65d9086
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 0 deletions.
4 changes: 4 additions & 0 deletions src/game/AI/BaseAI/CreatureAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,10 @@ CreatureAI::CreatureAI(Creature* creature, uint32 combatActions) :
SetMeleeEnabled(!(m_creature->GetCreatureInfo()->ExtraFlags & CREATURE_EXTRA_FLAG_NO_MELEE));
if (m_creature->IsNoAggroOnSight())
SetReactState(REACT_DEFENSIVE);
if (m_creature->GetSettings().HasFlag(CreatureStaticFlags2::SPAWN_DEFENSIVE))
SetReactState(REACT_DEFENSIVE);
else if (m_creature->GetSettings().HasFlag(CreatureStaticFlags::IGNORE_COMBAT))
m_creature->SetCanEnterCombat(false);
if (m_creature->IsGuard() || m_unit->GetCharmInfo()) // guards and charmed targets
m_visibilityDistance = sWorld.getConfig(CONFIG_FLOAT_SIGHT_GUARDER);
}
Expand Down
4 changes: 4 additions & 0 deletions src/game/AI/EventAI/CreatureEventAI.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -1422,6 +1422,10 @@ void CreatureEventAI::JustRespawned() // NOTE that this is
SetReactState(REACT_DEFENSIVE);
else
SetReactState(REACT_AGGRESSIVE);
if (m_creature->GetSettings().HasFlag(CreatureStaticFlags2::SPAWN_DEFENSIVE))
SetReactState(REACT_DEFENSIVE);
else if (m_creature->GetSettings().HasFlag(CreatureStaticFlags::IGNORE_COMBAT))
m_creature->SetCanEnterCombat(false);
m_EventUpdateTime = EVENT_UPDATE_TIME;
m_EventDiff = 0;
m_throwAIEventStep = 0;
Expand Down

0 comments on commit 65d9086

Please sign in to comment.