feat(Core/AI): allow instance creatures to teleport to unreachable targets (#26459)

Co-authored-by: Claude Fable 5 <noreply@anthropic.com>
This commit is contained in:
Andrew
2026-07-05 20:43:21 -03:00
committed by GitHub
parent 55de765eb4
commit fee9709b3e
4 changed files with 33 additions and 0 deletions
@@ -3184,6 +3184,16 @@ WaypointMovementStopTimeForPlayer = 120
NpcRegenHPIfTargetIsUnreachable = 1
# Creature.Instance.TeleportToUnreachableTarget
# Description: In dungeons and raids, non-boss creatures that cannot path to their
# target teleport to it instead of evading or regenerating in place
# (retail-like behaviour). Bosses and player-controlled creatures are
# not affected.
# Default: 0 - (Disabled)
# 1 - (Enabled)
Creature.Instance.TeleportToUnreachableTarget = 0
# Creatures.CustomIDs
# Description: The list of custom creatures with gossip dialogues hardcoded in core,
# divided by "," without spaces.
+21
View File
@@ -24,6 +24,7 @@
#include "SpellAuraEffects.h"
#include "SpellInfo.h"
#include "SpellMgr.h"
#include "World.h"
void UnitAI::AttackStart(Unit* victim)
{
@@ -414,6 +415,26 @@ void UnitAI::EvadeTimerExpired()
}
}
// Retail-like: instance trash teleports to its unreachable target instead of evading
if (sWorld->getBoolConfig(CONFIG_CREATURE_INSTANCE_TELEPORT_TO_UNREACHABLE_TARGET)
&& creature->GetMap()->IsDungeon()
&& !creature->IsDungeonBoss() && !creature->isWorldBoss()
&& !creature->IsControlledByPlayer())
{
if (ObjectGuid targetGuid = creature->GetCannotReachTarget())
{
if (Unit* target = ObjectAccessor::GetUnit(*creature, targetGuid))
{
if (target->IsAlive() && creature->IsEngagedBy(target))
{
creature->NearTeleportTo(target->GetPositionX(), target->GetPositionY(), target->GetPositionZ(), target->GetOrientation());
creature->SetCannotReachTarget();
return;
}
}
}
}
if (creature->GetMap()->IsRaid())
{
creature->GetCombatManager().ContinueEvadeRegen();
+1
View File
@@ -477,6 +477,7 @@ void WorldConfig::BuildConfigCache()
SetConfigValue<bool>(CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN, "OffhandCheckAtSpellUnlearn", true);
SetConfigValue<bool>(CONFIG_CREATURE_REPOSITION_AGAINST_NPCS, "Creature.RepositionAgainstNpcs", true);
SetConfigValue<bool>(CONFIG_CREATURE_INSTANCE_TELEPORT_TO_UNREACHABLE_TARGET, "Creature.Instance.TeleportToUnreachableTarget", false);
SetConfigValue<uint32>(CONFIG_CREATURE_STOP_FOR_PLAYER, "Creature.MovingStopTimeForPlayer", 180000);
SetConfigValue<uint32>(CONFIG_WATER_BREATH_TIMER, "WaterBreath.Timer", 180000, ConfigValueCache::Reloadable::Yes, [](uint32 const& value) { return value > 0; }, "> 0");
+1
View File
@@ -75,6 +75,7 @@ enum ServerConfigs
CONFIG_ARENA_QUEUE_ANNOUNCER_PLAYERONLY,
CONFIG_OFFHAND_CHECK_AT_SPELL_UNLEARN,
CONFIG_CREATURE_REPOSITION_AGAINST_NPCS,
CONFIG_CREATURE_INSTANCE_TELEPORT_TO_UNREACHABLE_TARGET,
CONFIG_VMAP_INDOOR_CHECK,
CONFIG_VMAP_ENABLE_LOS,
CONFIG_VMAP_ENABLE_HEIGHT,