From 3e7e4df2edb3af32a9a5344e77fa2f3875d1e863 Mon Sep 17 00:00:00 2001 From: dnqbob Date: Wed, 26 Nov 2025 21:42:06 +0800 Subject: [PATCH] Bot's GetNearbyIndicesThreat: fix the wrong parameter passing --- .../Traits/BotModules/HarvesterBotModule.cs | 2 +- .../Traits/BotModules/McvExpansionManagerBotModule.cs | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs index 0626ea7fdd..7e15239438 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/HarvesterBotModule.cs @@ -225,7 +225,7 @@ namespace OpenRA.Mods.Common.Traits attraction -= indiceSideLengthSquare << 4; else { - var (indiceCount, nearbyEnemyBase, nearbyEnemy) = resourceMapModule.GetNearbyIndicesThreat(i); + var (indiceCount, nearbyEnemy, nearbyEnemyBase) = resourceMapModule.GetNearbyIndicesThreat(i); if (nearbyEnemyBase + nearbyEnemy > 0) attraction -= indiceSideLengthSquare >> 5; } diff --git a/OpenRA.Mods.Common/Traits/BotModules/McvExpansionManagerBotModule.cs b/OpenRA.Mods.Common/Traits/BotModules/McvExpansionManagerBotModule.cs index 0510cbeb4b..ef10452e6f 100644 --- a/OpenRA.Mods.Common/Traits/BotModules/McvExpansionManagerBotModule.cs +++ b/OpenRA.Mods.Common/Traits/BotModules/McvExpansionManagerBotModule.cs @@ -290,7 +290,7 @@ namespace OpenRA.Mods.Common.Traits * * 2). the weight of friendly construction yard within range: -indiceSideLengthSquare. If it belongs to an ally, -indiceSideLengthSquare/2. * - * 3). the weight of enemy within range: -indiceSideLengthSquare*16 for base building, otherwise -indiceSideLengthSquare/64 + * 3). the weight of enemy within range: -indiceSideLengthSquare*8 for base building, otherwise -indiceSideLengthSquare/64 * * 4). the weight of friendly refinery within range (not for CheckBase mode): -indiceSideLengthSquare. If it belongs to an ally, -indiceSideLengthSquare/2. * @@ -503,17 +503,17 @@ namespace OpenRA.Mods.Common.Traits { var baseIndice = resourceMapModule.GetIndice(index); - var (indiceCount, nearbyEnemyBaseThreat, nearbyEnemyThreat) = resourceMapModule.GetNearbyIndicesThreat(index); + var (indiceCount, nearbyEnemyThreat, nearbyEnemyBaseThreat) = resourceMapModule.GetNearbyIndicesThreat(index); var indiceEnemyBaseThreat = Math.Max(baseIndice.EnemyBaseCount - baseIndice.FriendlyBaseCount, 0); var indiceEnemyUnitThreat = Math.Max(baseIndice.EnemyUnitCount - baseIndice.FriendlyUnitCount, 0); if (indiceCount == 0) - return (indiceEnemyUnitThreat * indiceSideLengthSquare >> 6) + (indiceEnemyBaseThreat * indiceSideLengthSquare << 4); + return (indiceEnemyUnitThreat * indiceSideLengthSquare >> 6) + (indiceEnemyBaseThreat * indiceSideLengthSquare << 3); - return ((indiceEnemyUnitThreat + nearbyEnemyThreat / indiceCount) * indiceSideLengthSquare >> 6) + - ((indiceEnemyBaseThreat + nearbyEnemyBaseThreat / indiceCount) * indiceSideLengthSquare << 4); + return ((indiceEnemyUnitThreat * indiceSideLengthSquare + nearbyEnemyThreat * indiceSideLengthSquare / indiceCount) >> 6) + + ((indiceEnemyBaseThreat * indiceSideLengthSquare + nearbyEnemyBaseThreat * indiceSideLengthSquare / indiceCount) << 3); } void IBotTick.BotTick(IBot bot)