Bot's GetNearbyIndicesThreat: fix the wrong parameter passing
This commit is contained in:
committed by
Gustas Kažukauskas
parent
7e8f4a3479
commit
3e7e4df2ed
@@ -225,7 +225,7 @@ namespace OpenRA.Mods.Common.Traits
|
|||||||
attraction -= indiceSideLengthSquare << 4;
|
attraction -= indiceSideLengthSquare << 4;
|
||||||
else
|
else
|
||||||
{
|
{
|
||||||
var (indiceCount, nearbyEnemyBase, nearbyEnemy) = resourceMapModule.GetNearbyIndicesThreat(i);
|
var (indiceCount, nearbyEnemy, nearbyEnemyBase) = resourceMapModule.GetNearbyIndicesThreat(i);
|
||||||
if (nearbyEnemyBase + nearbyEnemy > 0)
|
if (nearbyEnemyBase + nearbyEnemy > 0)
|
||||||
attraction -= indiceSideLengthSquare >> 5;
|
attraction -= indiceSideLengthSquare >> 5;
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -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.
|
* 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.
|
* 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 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 indiceEnemyBaseThreat = Math.Max(baseIndice.EnemyBaseCount - baseIndice.FriendlyBaseCount, 0);
|
||||||
|
|
||||||
var indiceEnemyUnitThreat = Math.Max(baseIndice.EnemyUnitCount - baseIndice.FriendlyUnitCount, 0);
|
var indiceEnemyUnitThreat = Math.Max(baseIndice.EnemyUnitCount - baseIndice.FriendlyUnitCount, 0);
|
||||||
|
|
||||||
if (indiceCount == 0)
|
if (indiceCount == 0)
|
||||||
return (indiceEnemyUnitThreat * indiceSideLengthSquare >> 6) + (indiceEnemyBaseThreat * indiceSideLengthSquare << 4);
|
return (indiceEnemyUnitThreat * indiceSideLengthSquare >> 6) + (indiceEnemyBaseThreat * indiceSideLengthSquare << 3);
|
||||||
|
|
||||||
return ((indiceEnemyUnitThreat + nearbyEnemyThreat / indiceCount) * indiceSideLengthSquare >> 6) +
|
return ((indiceEnemyUnitThreat * indiceSideLengthSquare + nearbyEnemyThreat * indiceSideLengthSquare / indiceCount) >> 6) +
|
||||||
((indiceEnemyBaseThreat + nearbyEnemyBaseThreat / indiceCount) * indiceSideLengthSquare << 4);
|
((indiceEnemyBaseThreat * indiceSideLengthSquare + nearbyEnemyBaseThreat * indiceSideLengthSquare / indiceCount) << 3);
|
||||||
}
|
}
|
||||||
|
|
||||||
void IBotTick.BotTick(IBot bot)
|
void IBotTick.BotTick(IBot bot)
|
||||||
|
|||||||
Reference in New Issue
Block a user