Index: binaries/data/mods/public/maps/random/african_plains.js =================================================================== --- binaries/data/mods/public/maps/random/african_plains.js +++ binaries/data/mods/public/maps/random/african_plains.js @@ -39,8 +39,10 @@ var oElephant2 = "gaia/fauna_elephant_african_infant"; var oCrocodile = "gaia/fauna_crocodile_nile"; var oFish = g_Gaia.fish; +var oStoneLarge = g_Gaia.stoneLarge; var oStoneSmall = g_Gaia.stoneSmall; var oMetalLarge = g_Gaia.metalLarge; +var oMetalSmall = g_Gaia.metalSmall; var aBush = g_Decoratives.bushMedium; var aRock = g_Decoratives.rockMedium; @@ -167,22 +169,21 @@ Engine.SetProgress(65); g_Map.log("Creating stone mines"); -createMines( - [ - [new SimpleObject(oStoneSmall, 0, 2, 0, 4)], - [new SimpleObject(oStoneSmall, 2, 5, 1, 3)] - ], - avoidClasses(clWater, 4, clForest, 4, clPlayer, 20, clRock, 10, clHill, 4), - clRock); +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + avoidClasses(clWater, 4, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1) +); g_Map.log("Creating metal mines"); -createMines( - [ - [new SimpleObject(oMetalLarge, 1,1, 0,4)] - ], - avoidClasses(clWater, 4, clForest, 4, clPlayer, 20, clMetal, 18, clRock, 5, clHill, 4), - clMetal +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + avoidClasses(clWater, 4, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clRock, 10) ); + Engine.SetProgress(70); createDecoration( Index: binaries/data/mods/public/maps/random/ardennes_forest.js =================================================================== --- binaries/data/mods/public/maps/random/ardennes_forest.js +++ binaries/data/mods/public/maps/random/ardennes_forest.js @@ -72,6 +72,7 @@ var clFood = g_Map.createTileClass(); var clBaseResource = g_Map.createTileClass(); var clHillDeco = g_Map.createTileClass(); +var clExplorable = g_Map.createTileClass(); g_Map.log("Creating the central dip"); createArea( @@ -279,6 +280,8 @@ avoidClasses(clPlayer, 1) ]); +new TileClassPainter(clExplorable).paint(explorableArea); + Engine.SetProgress(55); // Add some general noise - after placing height dependant trees @@ -350,39 +353,25 @@ Engine.SetProgress(75); g_Map.log("Creating stone mines"); -createObjectGroupsByAreasDeprecated( - new SimpleGroup( - [ - new SimpleObject(oStoneSmall, 1, 2, 0, 4, 0, 2 * Math.PI, 1), - new SimpleObject(oStoneLarge, 0, 1, 0, 4, 0, 2 * Math.PI, 4) - ], - true, - clRock), - 0, - [avoidClasses(clHill, 4, clForest, 2, clPlayer, 20, clRock, 10)], - scaleByMapSize(6,20), 100, - [explorableArea]); - -g_Map.log("Creating small stone mines"); -var group = new SimpleGroup([new SimpleObject(oStoneSmall, 2, 5, 1, 3)], true, clRock); -createObjectGroupsByAreasDeprecated(group, 0, - [avoidClasses(clHill, 4, clForest, 2, clPlayer, 20, clRock, 10)], - scaleByMapSize(6,20), 100, - [explorableArea] +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + [stayClasses(clExplorable, 1), avoidClasses(clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1)] ); g_Map.log("Creating metal mines"); -group = new SimpleGroup([new SimpleObject(oMetalSmall, 1,2, 0,4), new SimpleObject(oMetalLarge, 1,1, 0,4)], true, clMetal); -createObjectGroupsByAreasDeprecated(group, 0, - [avoidClasses(clHill, 4, clForest, 2, clPlayer, 20, clMetal, 10, clRock, 5)], - scaleByMapSize(6,20), 100, - [explorableArea] +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + [stayClasses(clExplorable, 1), avoidClasses(clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1, clRock, 10)] ); Engine.SetProgress(80); g_Map.log("Creating wildlife"); -group = new SimpleGroup( +let group = new SimpleGroup( [new SimpleObject(oDeer, 5,7, 0,4)], true, clFood ); Index: binaries/data/mods/public/maps/random/cantabrian_highlands.js =================================================================== --- binaries/data/mods/public/maps/random/cantabrian_highlands.js +++ binaries/data/mods/public/maps/random/cantabrian_highlands.js @@ -33,6 +33,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; +const oMetalSmall = g_Gaia.metalSmall; const aGrass = g_Decoratives.grass; const aGrassShort = g_Decoratives.grassShort; @@ -197,22 +198,19 @@ Engine.SetProgress(50); g_Map.log("Creating stone mines"); -createMines( - [ - [new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], - [new SimpleObject(oStoneSmall, 2,5, 1,3)] - ], - avoidClasses(clWater, 0, clForest, 1, clPlayer, 5, clRock, 10, clHill, 1), - clRock); -Engine.SetProgress(55); +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + avoidClasses(clWater, 0, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1) +); g_Map.log("Creating metal mines"); -createMines( - [ - [new SimpleObject(oMetalLarge, 1,1, 0,4)] - ], - avoidClasses(clWater, 0, clForest, 1, clPlayer, 5, clMetal, 10, clRock, 5, clHill, 1), - clMetal +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + avoidClasses(clWater, 0, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1, clRock, 10) ); Engine.SetProgress(60); Index: binaries/data/mods/public/maps/random/continent.js =================================================================== --- binaries/data/mods/public/maps/random/continent.js +++ binaries/data/mods/public/maps/random/continent.js @@ -30,6 +30,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; +const oMetalSmall = g_Gaia.metalSmall; const aGrass = g_Decoratives.grass; const aGrassShort = g_Decoratives.grassShort; @@ -163,21 +164,19 @@ Engine.SetProgress(55); g_Map.log("Creating stone mines"); -createMines( - [ - [new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], - [new SimpleObject(oStoneSmall, 2,5, 1,3)] - ], - [avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), stayClasses(clLand, 6)], - clRock); +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + [stayClasses(clLand, 6), avoidClasses(clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1)] +); g_Map.log("Creating metal mines"); -createMines( - [ - [new SimpleObject(oMetalLarge, 1,1, 0,4)] - ], - [avoidClasses(clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1), stayClasses(clLand, 6)], - clMetal +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + [stayClasses(clLand, 6), avoidClasses(clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clRock, 10)], ); Engine.SetProgress(65); Index: binaries/data/mods/public/maps/random/corinthian_isthmus.js =================================================================== --- binaries/data/mods/public/maps/random/corinthian_isthmus.js +++ binaries/data/mods/public/maps/random/corinthian_isthmus.js @@ -30,6 +30,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; +const oMetalSmall = g_Gaia.metalSmall; const oDatePalm = g_Gaia.tree1; const oSDatePalm = g_Gaia.tree2; const oCarob = g_Gaia.tree3; @@ -229,13 +230,12 @@ ); g_Map.log("Creating metal mines"); -createMines( - [ - [new SimpleObject(oMetalLarge, 1, 1, 0, 4)] - ], - avoidClasses(clForest, 4, clPassageway, 10, clPlayer, 15, clMetal, 10, clRock, 5, clWater, 4, clHill, 4), +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, clMetal, - scaleByMapSize(5, 20) + avoidClasses(clPassageway, 1, clWater, 0, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1, clRock, 10), + 0.9 // less available area -> slightly less metal ); Engine.SetProgress(65); Index: binaries/data/mods/public/maps/random/gulf_of_bothnia.js =================================================================== --- binaries/data/mods/public/maps/random/gulf_of_bothnia.js +++ binaries/data/mods/public/maps/random/gulf_of_bothnia.js @@ -26,6 +26,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; +const oMetalSmall = g_Gaia.metalSmall; const oDeer = g_Gaia.mainHuntableAnimal; const oRabbit = g_Gaia.secondaryHuntableAnimal; const oFish = g_Gaia.fish; @@ -175,21 +176,21 @@ Engine.SetProgress(65); g_Map.log("Creating stone mines"); -createMines( - [ - [new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], - [new SimpleObject(oStoneSmall, 2,5, 1,3)] - ], - avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), - clRock); +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + avoidClasses(clWater, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1), + 0.9 +); g_Map.log("Creating metal mines"); -createMines( - [ - [new SimpleObject(oMetalLarge, 1,1, 0,4)] - ], - avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1), - clMetal +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + avoidClasses(clWater, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill, 1, clRock, 10), + 0.9 ); Engine.SetProgress(70); Index: binaries/data/mods/public/maps/random/lake.js =================================================================== --- binaries/data/mods/public/maps/random/lake.js +++ binaries/data/mods/public/maps/random/lake.js @@ -30,6 +30,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; +const oMetalSmall = g_Gaia.metalSmall; const aGrass = g_Decoratives.grass; const aGrassShort = g_Decoratives.grassShort; @@ -162,21 +163,19 @@ Engine.SetProgress(55); g_Map.log("Creating stone mines"); -createMines( - [ - [new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], - [new SimpleObject(oStoneSmall, 2,5, 1,3)] - ], - avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), - clRock); +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + avoidClasses(clWater, 3, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1) +); g_Map.log("Creating metal mines"); -createMines( - [ - [new SimpleObject(oMetalLarge, 1,1, 0,4)] - ], - avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1), - clMetal +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + avoidClasses(clWater, 3, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clRock, 10) ); Engine.SetProgress(65); Index: binaries/data/mods/public/maps/random/mainland.js =================================================================== --- binaries/data/mods/public/maps/random/mainland.js +++ binaries/data/mods/public/maps/random/mainland.js @@ -27,6 +27,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; +const oMetalSmall = g_Gaia.metalSmall; const aGrass = g_Decoratives.grass; const aGrassShort = g_Decoratives.grassShort; @@ -117,21 +118,19 @@ Engine.SetProgress(55); g_Map.log("Creating stone mines"); -createMines( - [ - [new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], - [new SimpleObject(oStoneSmall, 2, 5, 1, 3, 0, 2 * Math.PI, 1)] - ], - avoidClasses(clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), - clRock); +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + avoidClasses(clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1) +); g_Map.log("Creating metal mines"); -createMines( - [ - [new SimpleObject(oMetalLarge, 1,1, 0,4)] - ], - avoidClasses(clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1), - clMetal +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + avoidClasses(clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clRock, 10) ); Engine.SetProgress(65); Index: binaries/data/mods/public/maps/random/neareastern_badlands.js =================================================================== --- binaries/data/mods/public/maps/random/neareastern_badlands.js +++ binaries/data/mods/public/maps/random/neareastern_badlands.js @@ -32,6 +32,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; +const oMetalSmall = g_Gaia.metalSmall; const oOasisTree = "gaia/tree/senegal_date_palm"; const oDatePalm = g_Gaia.tree1; const oSDatePalm = g_Gaia.tree2; @@ -288,31 +289,25 @@ 50); Engine.SetProgress(70); - g_Map.log("Creating stone mines"); -var group = new SimpleGroup([new SimpleObject(oStoneSmall, 0, 2, 0, 4), new SimpleObject(oStoneLarge, 1, 1, 0, 4), new RandomObject(aBushes, 2, 4, 0, 2)], true, clRock); -createObjectGroupsDeprecated(group, 0, - [avoidClasses(clOasis, 1, clForest, 1, clPlayer, 10, clRock, 10, clHill1, 1)], - scaleByMapSize(4,16), 100 -); - -group = new SimpleGroup([new SimpleObject(oStoneSmall, 2,5, 1,3), new RandomObject(aBushes, 2,4, 0,2)], true, clRock); -createObjectGroupsDeprecated(group, 0, - [avoidClasses(clOasis, 1, clForest, 1, clPlayer, 10, clRock, 10, clHill1, 1)], - scaleByMapSize(4,16), 100 +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + avoidClasses(clOasis, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill1, 1) ); g_Map.log("Creating metal mines"); -group = new SimpleGroup([new SimpleObject(oMetalLarge, 1,1, 0,4), new RandomObject(aBushes, 2,4, 0,2)], true, clMetal); -createObjectGroupsDeprecated(group, 0, - [avoidClasses(clOasis, 1, clForest, 1, clPlayer, 10, clMetal, 10, clRock, 5, clHill1, 1)], - scaleByMapSize(4,16), 100 +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + avoidClasses(clOasis, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clHill1, 1, clRock, 10) ); - Engine.SetProgress(80); g_Map.log("Creating gazelles"); -group = new SimpleGroup([new SimpleObject(oGazelle, 5,7, 0,4)], true, clFood); +let group = new SimpleGroup([new SimpleObject(oGazelle, 5,7, 0,4)], true, clFood); createObjectGroupsDeprecated(group, 0, avoidClasses(clOasis, 1, clForest, 0, clPlayer, 5, clHill1, 1, clFood, 10), scaleByMapSize(5,20), 50 Index: binaries/data/mods/public/maps/random/pyrenean_sierra.js =================================================================== --- binaries/data/mods/public/maps/random/pyrenean_sierra.js +++ binaries/data/mods/public/maps/random/pyrenean_sierra.js @@ -32,6 +32,7 @@ const oStoneLarge = "gaia/rock/alpine_large"; const oStoneSmall = "gaia/rock/alpine_small"; const oMetalLarge = "gaia/ore/alpine_large"; +const oMetalSmall = "gaia/ore/alpine_small"; const aGrass = "actor|props/flora/grass_soft_small_tall.xml"; const aGrassShort = "actor|props/flora/grass_soft_large.xml"; @@ -405,16 +406,22 @@ Engine.SetProgress(80); g_Map.log("Creating stone mines"); -group = new SimpleGroup([new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], true, clRock); -createObjectGroupsDeprecated(group, 0, avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 8, clPyrenneans, 1), scaleByMapSize(4,16), 100 ); - -g_Map.log("Creating small stone quarries"); -group = new SimpleGroup([new SimpleObject(oStoneSmall, 2,5, 1,3)], true, clRock); -createObjectGroupsDeprecated(group, 0, avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 8, clPyrenneans, 1), scaleByMapSize(4,16), 100 ); +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + avoidClasses(clWater, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clPyrenneans, 3), + 0.9 +); g_Map.log("Creating metal mines"); -group = new SimpleGroup([new SimpleObject(oMetalLarge, 1,1, 0,4)], true, clMetal); -createObjectGroupsDeprecated(group, 0, avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clMetal, 8, clRock, 5, clPyrenneans, 1), scaleByMapSize(4,16), 100 ); +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + avoidClasses(clWater, 2, clForest, 0, clPlayer, scaleByMapSize(15, 25), clPyrenneans, 3, clRock, 10), + 0.9 +); Engine.SetProgress(85); Index: binaries/data/mods/public/maps/random/rivers.js =================================================================== --- binaries/data/mods/public/maps/random/rivers.js +++ binaries/data/mods/public/maps/random/rivers.js @@ -34,6 +34,7 @@ const oStoneLarge = g_Gaia.stoneLarge; const oStoneSmall = g_Gaia.stoneSmall; const oMetalLarge = g_Gaia.metalLarge; +const oMetalSmall = g_Gaia.metalSmall; const aGrass = g_Decoratives.grass; const aGrassShort = g_Decoratives.grassShort; @@ -188,21 +189,19 @@ Engine.SetProgress(55); g_Map.log("Creating stone mines"); -createMines( - [ - [new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)], - [new SimpleObject(oStoneSmall, 2,5, 1,3)] - ], - avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clRock, 10, clHill, 1), - clRock); +createBalancedStoneMines( + oStoneSmall, + oStoneLarge, + clRock, + avoidClasses(clWater, 3, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1) +); g_Map.log("Creating metal mines"); -createMines( - [ - [new SimpleObject(oMetalLarge, 1,1, 0,4)] - ], - avoidClasses(clWater, 3, clForest, 1, clPlayer, 20, clMetal, 10, clRock, 5, clHill, 1), - clMetal +createBalancedMetalMines( + oMetalSmall, + oMetalLarge, + clMetal, + avoidClasses(clWater, 3, clForest, 1, clPlayer, scaleByMapSize(20, 35), clHill, 1, clRock, 10) ); Engine.SetProgress(65); Index: binaries/data/mods/public/maps/random/rmgen-common/gaia_entities.js =================================================================== --- binaries/data/mods/public/maps/random/rmgen-common/gaia_entities.js +++ binaries/data/mods/public/maps/random/rmgen-common/gaia_entities.js @@ -119,6 +119,95 @@ 70); } +/** + * Place large/small mines on the map in such a way that it should be relatively fair. + * @param oSmall - the small mine object + * @param oLarge - the large mine object + * @param clMine - the 'mine' class to paint. + * @param constraints - Custom constraints. Note that the function automatically avoids clMine as well. + * @param counts - optional, either a single number acting as multiplier to the defaults + * or a dict of numbers{ "largeCount": 0, "smallCount": 1, "randomSmallCount": 2 } + * @param randomness - randomize counts by a random multiplier between [1 - randomness, 1 + randomness] + */ +function createBalancedMines(oSmall, oLarge, clMine, constraints, counts = 1.0, randomness = 0.1) +{ + let largeCount = counts.largeCount || (getNumPlayers() * 2 + scaleByMapSize(1, 8)) * counts; + let smallCount = counts.smallCount || (scaleByMapSize(2, 16)) * counts; + let randomSmallCount = counts.randomSmallCount || (numPlayers) * counts; + + if (randomness > 0 && randomness < 1) + { + largeCount *= randFloat(1 - randomness, 1 + randomness); + smallCount *= randFloat(1 - randomness, 1 + randomness); + randomSmallCount *= randFloat(1 - randomness, 1 + randomness); + } + + const arrayConstraints = Array.isArray(constraints) ? constraints : [constraints]; + + // Plop large mines far away from each other. + createObjectGroups( + new SimpleGroup([new SimpleObject(oLarge, 1, 1, 0, 1)], true, clMine), + 0, + new AndConstraint([avoidClasses(clMine, scaleByMapSize(25, 50)), ...arrayConstraints]), + largeCount, + 100); + + // Plop smaller clusters of small mines, also somewhat farther away. + createObjectGroups( + new SimpleGroup([new SimpleObject(oSmall, 2, 3, 0, 2)], true, clMine), + 0, + new AndConstraint([avoidClasses(clMine, scaleByMapSize(18, 35)), ...arrayConstraints]), + smallCount, + 50); + + // Plop a few smaller clusters in a random fashion, occasionally making very good dropsites spots. + createObjectGroups( + new SimpleGroup([new SimpleObject(oSmall, 1, 2, 0, 2)], true, clMine), + 0, + new AndConstraint([avoidClasses(clMine, 5), ...arrayConstraints]), + randomSmallCount, + 50); +} + +/** + * Helper for createBalancedMines with default metal counts. + */ +function createBalancedMetalMines(oSmall, oLarge, clMine, constraints, counts = 1.0, randomness = 0.1) +{ + return createBalancedMines( + oSmall, + oLarge, + clMine, + constraints, + { + "largeCount": (getNumPlayers() * 1.5 + scaleByMapSize(1, 8)) * counts, + "smallCount": (scaleByMapSize(2, 16)) * counts, + "randomSmallCount": (numPlayers) * counts, + }, + randomness + ); +} + +/** + * Helper for createBalancedMines with default stone counts. + */ +function createBalancedStoneMines(oSmall, oLarge, clMine, constraints, counts = 1.0, randomness = 0.1) +{ + return createBalancedMines( + oSmall, + oLarge, + clMine, + constraints, + { + "largeCount": (getNumPlayers() + scaleByMapSize(1, 8)) * counts, + "smallCount": (scaleByMapSize(1.5, 12)) * counts, + "randomSmallCount": (numPlayers) * counts, + }, + randomness + ); +} + + /** * Places Entities of the given templateName in a circular pattern (leaving out a quarter of the circle). */