From 65d9086c2b341dae6bd666bfd7b684dd388b1733 Mon Sep 17 00:00:00 2001 From: insuna Date: Mon, 7 Oct 2024 09:58:42 +0200 Subject: [PATCH] StaticFlags: Implement SPAWN_DEFENSIVE and IGNORE_COMBAT (#538) * StaticFlags: Implement SPAWN_DEFENSIVE and IGNORE_COMBAT * StaticFlags: Correct Passive to SetCanEnterCombat(false) --- src/game/AI/BaseAI/CreatureAI.cpp | 4 ++++ src/game/AI/EventAI/CreatureEventAI.cpp | 4 ++++ 2 files changed, 8 insertions(+) diff --git a/src/game/AI/BaseAI/CreatureAI.cpp b/src/game/AI/BaseAI/CreatureAI.cpp index 77d7473fd77..e3106f760d6 100644 --- a/src/game/AI/BaseAI/CreatureAI.cpp +++ b/src/game/AI/BaseAI/CreatureAI.cpp @@ -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); } diff --git a/src/game/AI/EventAI/CreatureEventAI.cpp b/src/game/AI/EventAI/CreatureEventAI.cpp index 8e7fdc1f4c4..05306cca228 100644 --- a/src/game/AI/EventAI/CreatureEventAI.cpp +++ b/src/game/AI/EventAI/CreatureEventAI.cpp @@ -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;