forked from mirrors/0ad
Steadily increase strongholds size with team size
`groupedDistance` is the "distance between neighboring players" but it was used as the radius. Then there was a special case when the team size is big and the `groupedDistance` was to small. With this commit the `groupedDistance` is actually used as "distance between neighboring players" and removes the special casing.
This commit is contained in:
@@ -609,7 +609,7 @@ function playerPlacementByPattern(patternName, distance = undefined, groupedDist
|
||||
case "groupedLines":
|
||||
return placeLine(getTeamsArray(), distance, groupedDistance, angle);
|
||||
case "stronghold":
|
||||
return placeStronghold(getTeamsArray(), distance, groupedDistance, angle);
|
||||
return placeStronghold(getTeamsArray(), distance, groupedDistance * 1.4, angle);
|
||||
case "randomGroup":
|
||||
return playerPlacementRandom(getPlayerIDs(), undefined);
|
||||
default:
|
||||
@@ -789,11 +789,7 @@ function placeStronghold(teamsArray, distance, groupedDistance, startAngle)
|
||||
if (team.length == 1)
|
||||
return 0;
|
||||
|
||||
// If we have a team of above average size, make sure they're spread out
|
||||
if (team.length > 4)
|
||||
return Math.max(fractionToTiles(0.08), groupedDistance);
|
||||
|
||||
return groupedDistance * 1.2;
|
||||
return groupedDistance / 2 / Math.sin(Math.PI / team.length);
|
||||
});
|
||||
|
||||
const distanceBetweenStrongholds = (distance * 2 * Math.PI -
|
||||
|
||||
@@ -82,7 +82,8 @@ export const playerbaseTypes = {
|
||||
"walls": true
|
||||
},
|
||||
"stronghold": {
|
||||
"getPosition": (distance, groupedDistance, startAngle) => placeStronghold(getTeamsArray(), distance, groupedDistance, startAngle),
|
||||
"getPosition": (distance, groupedDistance, startAngle) =>
|
||||
placeStronghold(getTeamsArray(), distance, groupedDistance * 1.7, startAngle),
|
||||
"distance": fractionToTiles(randFloat(0.2, 0.35)),
|
||||
"groupedDistance": fractionToTiles(randFloat(0.08, 0.1)),
|
||||
"walls": false
|
||||
|
||||
Reference in New Issue
Block a user