Fix the two incorrect replacements in rP21434, refs #4950.
[0ad.git] / binaries / data / mods / public / maps / random / arctic_summer.js
blob3927c2ed49cec282b0e99d1e818ac002c839ac49
1 Engine.LoadLibrary("rmgen");
2 Engine.LoadLibrary("rmgen-common");
4 setFogThickness(0.46);
5 setFogFactor(0.5);
7 setPPEffect("hdr");
8 setPPSaturation(0.48);
9 setPPContrast(0.53);
10 setPPBloom(0.12);
12 var tPrimary = ["alpine_grass_rocky"];
13 var tForestFloor = "alpine_grass";
14 var tCliff = ["polar_cliff_a", "polar_cliff_b", "polar_cliff_snow"];
15 var tSecondary = "alpine_grass";
16 var tHalfSnow = ["polar_grass_snow", "ice_dirt"];
17 var tSnowLimited = ["polar_snow_rocks", "polar_ice"];
18 var tDirt = "ice_dirt";
19 var tShore = "alpine_shore_rocks";
20 var tWater = "polar_ice_b";
21 var tHill = "polar_ice_cracked";
23 var oBush = "gaia/flora_bush_badlands";
24 var oBush2 = "gaia/flora_bush_temperate";
25 var oBerryBush = "gaia/flora_bush_berry";
26 var oRabbit = "gaia/fauna_rabbit";
27 var oMuskox = "gaia/fauna_muskox";
28 var oDeer = "gaia/fauna_deer";
29 var oWolf = "gaia/fauna_wolf";
30 var oWhaleFin = "gaia/fauna_whale_fin";
31 var oWhaleHumpback = "gaia/fauna_whale_humpback";
32 var oFish = "gaia/fauna_fish";
33 var oStoneLarge = "gaia/geology_stonemine_alpine_quarry";
34 var oStoneSmall = "gaia/geology_stone_alpine_a";
35 var oMetalLarge = "gaia/geology_metal_alpine_slabs";
36 var oWoodTreasure = "gaia/treasure/wood";
38 var aRockLarge = "actor|geology/stone_granite_med.xml";
39 var aRockMedium = "actor|geology/stone_granite_med.xml";
41 const pForest = [tForestFloor + TERRAIN_SEPARATOR + oBush, tForestFloor + TERRAIN_SEPARATOR + oBush2, tForestFloor];
43 var heightSeaGround = -5;
44 var heightLand = 2;
46 var g_Map = new RandomMap(heightLand, tPrimary);
48 const numPlayers = getNumPlayers();
50 var clPlayer = g_Map.createTileClass();
51 var clHill = g_Map.createTileClass();
52 var clForest = g_Map.createTileClass();
53 var clWater = g_Map.createTileClass();
54 var clDirt = g_Map.createTileClass();
55 var clRock = g_Map.createTileClass();
56 var clMetal = g_Map.createTileClass();
57 var clFood = g_Map.createTileClass();
58 var clBaseResource = g_Map.createTileClass();
60 placePlayerBases({
61         "PlayerPlacement": playerPlacementCircle(fractionToTiles(0.35)),
62         "PlayerTileClass": clPlayer,
63         "BaseResourceClass": clBaseResource,
64         "CityPatch": {
65                 "outerTerrain": tPrimary,
66                 "innerTerrain": tSecondary
67         },
68         "Chicken": {
69                 "template": oRabbit
70         },
71         "Berries": {
72                 "template": oBerryBush
73         },
74         "Mines": {
75                 "types": [
76                         { "template": oMetalLarge },
77                         { "template": oStoneLarge }
78                 ]
79         },
80         "Treasures": {
81                 "types": [
82                         {
83                                 "template": oWoodTreasure,
84                                 "count": 10
85                         }
86                 ]
87         },
88         "Trees": {
89                 "template": oBush,
90                 "count": 20,
91                 "maxDistGroup": 3
92         }
93         // No decoratives
94 });
95 Engine.SetProgress(20);
97 createHills(
98         [tPrimary, tCliff, tHill],
99         avoidClasses(
100                 clPlayer, 35,
101                 clForest, 20,
102                 clHill, 50,
103                 clWater, 2),
104         clHill,
105         scaleByMapSize(1, 240));
107 Engine.SetProgress(30);
109 g_Map.log("Creating lakes");
110 createAreas(
111         new ChainPlacer(
112                 1,
113                 Math.floor(scaleByMapSize(4, 8)),
114                 Math.floor(scaleByMapSize(40, 180)),
115                 Infinity),
116         [
117                 new LayeredPainter([tShore, tWater], [1]),
118                 new SmoothElevationPainter(ELEVATION_SET, heightSeaGround, 5),
119                 new TileClassPainter(clWater)
120         ],
121         avoidClasses(clPlayer, 15),
122         scaleByMapSize(1, 20));
124 Engine.SetProgress(45);
126 createBumps(avoidClasses(clPlayer, 6, clWater, 2), scaleByMapSize(30, 300), 1, 8, 4, 0, 3);
128 paintTerrainBasedOnHeight(4, 15, 0, tCliff);
129 paintTerrainBasedOnHeight(15, 100, 3, tSnowLimited);
131 var [forestTrees, stragglerTrees] = getTreeCounts(500, 3000, 0.7);
132 createForests(
133         [tSecondary, tForestFloor, tForestFloor, pForest, pForest],
134         avoidClasses(
135                 clPlayer, 20,
136                 clForest, 14,
137                 clHill, 20,
138                 clWater, 2),
139         clForest,
140         forestTrees);
141 Engine.SetProgress(60);
143 g_Map.log("Creating dirt patches");
144 createLayeredPatches(
145         [scaleByMapSize(3, 6), scaleByMapSize(5, 10), scaleByMapSize(8, 21)],
146         [[tDirt,tHalfSnow], [tHalfSnow,tSnowLimited]],
147         [2],
148         avoidClasses(
149                 clWater, 3,
150                 clForest, 0,
151                 clHill, 0,
152                 clDirt, 5,
153                 clPlayer, 12),
154         scaleByMapSize(15, 45),
155         clDirt);
157 g_Map.log("Creating shrubs");
158 createPatches(
159         [scaleByMapSize(2, 4), scaleByMapSize(3, 7), scaleByMapSize(5, 15)],
160         tSecondary,
161         avoidClasses(
162                 clWater, 3,
163                 clForest, 0,
164                 clHill, 0,
165                 clDirt, 5,
166                 clPlayer, 12),
167         scaleByMapSize(15, 45),
168         clDirt);
170 g_Map.log("Creating grass patches");
171 createPatches(
172         [scaleByMapSize(2, 4), scaleByMapSize(3, 7), scaleByMapSize(5, 15)],
173         tSecondary,
174         avoidClasses(
175                 clWater, 3,
176                 clForest, 0,
177                 clHill, 0,
178                 clDirt, 5,
179                 clPlayer, 12),
180         scaleByMapSize(15, 45),
181         clDirt);
182 Engine.SetProgress(65);
184 g_Map.log("Creating stone mines");
185 createMines(
186         [
187                 [new SimpleObject(oStoneSmall, 0, 2, 0, 4, 0, 2 * Math.PI, 1), new SimpleObject(oStoneLarge, 1, 1, 0, 4, 0, 2 * Math.PI, 4)],
188                 [new SimpleObject(oStoneSmall, 2, 5, 1, 3)]
189         ],
190         avoidClasses(
191                 clWater, 3,
192                 clForest, 1,
193                 clPlayer, 20,
194                 clRock, 18,
195                 clHill, 1),
196         clRock);
198 g_Map.log("Creating metal mines");
199 createMines(
200         [
201                 [new SimpleObject(oMetalLarge, 1, 1, 0, 4)]
202         ],
203         avoidClasses(
204                 clWater, 3,
205                 clForest, 1,
206                 clPlayer, 20,
207                 clMetal, 18,
208                 clRock, 5,
209                 clHill, 1),
210         clMetal);
211 Engine.SetProgress(70);
213 createDecoration(
214         [
215                 [
216                         new SimpleObject(aRockMedium, 1, 3, 0, 1)
217                 ],
218                 [
219                         new SimpleObject(aRockLarge, 1, 2, 0, 1),
220                         new SimpleObject(aRockMedium, 1, 3, 0, 1)
221                 ]
222         ],
223         [
224                 scaleByMapSize(16, 262),
225                 scaleByMapSize(8, 131),
226         ],
227         avoidClasses(
228                 clWater, 0,
229                 clForest, 0,
230                 clPlayer, 0,
231                 clHill, 0));
232 Engine.SetProgress(75);
234 createFood(
235         [
236                 [new SimpleObject(oWolf, 3, 5, 0, 3)],
237                 [new SimpleObject(oRabbit, 6, 8, 0, 6)],
238                 [new SimpleObject(oDeer, 3, 4, 0, 3)],
239                 [new SimpleObject(oMuskox, 3, 4, 0, 3)]
240         ],
241         [
242                 3 * numPlayers,
243                 3 * numPlayers,
244                 3 * numPlayers,
245                 3 * numPlayers
246         ],
247         avoidClasses(
248                 clFood, 20,
249                 clHill, 5,
250                 clWater, 5),
251         clFood);
253 createFood(
254         [
255                 [new SimpleObject(oWhaleFin, 1, 1, 0, 3)],
256                 [new SimpleObject(oWhaleHumpback, 1, 1, 0, 3)]
257         ],
258         [
259                 3 * numPlayers,
260                 3 * numPlayers
261         ],
262         [
263                 avoidClasses(clFood, 20),
264                 stayClasses(clWater, 6)
265         ],
266         clFood);
268 createFood(
269         [
270                 [new SimpleObject(oBerryBush, 5, 7, 0, 4)]
271         ],
272         [
273                 randIntInclusive(1, 4) * numPlayers + 2
274         ],
275         avoidClasses(
276                 clWater, 3,
277                 clForest, 0,
278                 clPlayer, 20,
279                 clHill, 1,
280                 clFood, 10),
281         clFood);
283 createFood(
284         [
285                 [new SimpleObject(oFish, 2, 3, 0, 2)]
286         ],
287         [
288                 15 * numPlayers
289         ],
290         [
291                 avoidClasses(clFood, 20),
292                 stayClasses(clWater, 6)
293         ],
294         clFood);
296 Engine.SetProgress(85);
298 createStragglerTrees(
299         [oBush, oBush2],
300         avoidClasses(
301                 clWater, 5,
302                 clForest, 3,
303                 clHill, 1,
304                 clPlayer, 12,
305                 clMetal, 4,
306                 clRock, 4),
307         clForest,
308         stragglerTrees);
310 placePlayersNomad(clPlayer, avoidClasses(clForest, 1, clWater, 4, clMetal, 4, clRock, 4, clHill, 4, clFood, 2));
312 setSkySet("sunset 1");
313 setSunRotation(randomAngle());
314 setSunColor(0.8, 0.7, 0.6);
315 setTerrainAmbientColor(0.7, 0.6, 0.7);
316 setUnitsAmbientColor(0.6, 0.5, 0.6);
317 setSunElevation(Math.PI * randFloat(1/12, 1/7));
318 setWaterColor(0, 0.047, 0.286);
319 setWaterTint(0.462, 0.756, 0.866);
320 setWaterMurkiness(0.92);
321 setWaterWaviness(1);
322 setWaterType("clap");
324 g_Map.ExportMap();