Fix the two incorrect replacements in rP21434, refs #4950.
[0ad.git] / binaries / data / mods / public / maps / random / empire.js
blob1f852caf9b86cc4aa4a26ad140eae4bc6e90876b
1 Engine.LoadLibrary("rmgen");
2 Engine.LoadLibrary("rmgen-common");
3 Engine.LoadLibrary("rmgen2");
4 Engine.LoadLibrary("rmbiome");
6 setSelectedBiome();
8 var g_Map = new RandomMap(2, g_Terrains.mainTerrain);
10 initTileClasses();
12 createArea(
13         new MapBoundsPlacer(),
14         new TileClassPainter(g_TileClasses.land));
16 Engine.SetProgress(10);
18 const teamsArray = getTeamsArray();
19 const startAngle = randomAngle();
20 createBasesByPattern("stronghold", fractionToTiles(0.37), fractionToTiles(0.04), startAngle);
21 Engine.SetProgress(20);
23 // Change the starting angle and add the players again
24 var rotation = Math.PI;
26 if (teamsArray.length == 2)
27         rotation = Math.PI / 2;
29 if (teamsArray.length == 4)
30         rotation = 5/4 * Math.PI;
32 createBasesByPattern("stronghold", fractionToTiles(0.15), fractionToTiles(0.04), startAngle + rotation);
33 Engine.SetProgress(40);
35 addElements(shuffleArray([
36         {
37                 "func": addHills,
38                 "avoid": [
39                         g_TileClasses.bluff, 5,
40                         g_TileClasses.hill, 15,
41                         g_TileClasses.mountain, 2,
42                         g_TileClasses.plateau, 5,
43                         g_TileClasses.player, 20,
44                         g_TileClasses.valley, 2,
45                         g_TileClasses.water, 2
46                 ],
47                 "sizes": g_AllSizes,
48                 "mixes": g_AllMixes,
49                 "amounts": ["tons"]
50         },
51         {
52                 "func": addMountains,
53                 "avoid": [
54                         g_TileClasses.bluff, 20,
55                         g_TileClasses.mountain, 25,
56                         g_TileClasses.plateau, 20,
57                         g_TileClasses.player, 20,
58                         g_TileClasses.valley, 10,
59                         g_TileClasses.water, 15
60                 ],
61                 "sizes": ["huge"],
62                 "mixes": ["same", "similar"],
63                 "amounts": ["tons"]
64         },
65         {
66                 "func": addPlateaus,
67                 "avoid": [
68                         g_TileClasses.bluff, 20,
69                         g_TileClasses.mountain, 25,
70                         g_TileClasses.plateau, 20,
71                         g_TileClasses.player, 40,
72                         g_TileClasses.valley, 10,
73                         g_TileClasses.water, 15
74                 ],
75                 "sizes": ["huge"],
76                 "mixes": ["same", "similar"],
77                 "amounts": ["tons"]
78         }
79 ]));
80 Engine.SetProgress(50);
82 addElements([
83         {
84                 "func": addLayeredPatches,
85                 "avoid": [
86                         g_TileClasses.bluff, 2,
87                         g_TileClasses.dirt, 5,
88                         g_TileClasses.forest, 2,
89                         g_TileClasses.mountain, 2,
90                         g_TileClasses.plateau, 2,
91                         g_TileClasses.player, 12,
92                         g_TileClasses.water, 3
93                 ],
94                 "sizes": ["normal"],
95                 "mixes": ["normal"],
96                 "amounts": ["normal"]
97         },
98         {
99                 "func": addDecoration,
100                 "avoid": [
101                         g_TileClasses.bluff, 2,
102                         g_TileClasses.forest, 2,
103                         g_TileClasses.mountain, 2,
104                         g_TileClasses.plateau, 2,
105                         g_TileClasses.player, 12,
106                         g_TileClasses.water, 3
107                 ],
108                 "sizes": ["normal"],
109                 "mixes": ["normal"],
110                 "amounts": ["normal"]
111         }
113 Engine.SetProgress(60);
115 addElements(shuffleArray([
116         {
117                 "func": addMetal,
118                 "avoid": [
119                         g_TileClasses.berries, 5,
120                         g_TileClasses.bluff, 5,
121                         g_TileClasses.forest, 3,
122                         g_TileClasses.mountain, 2,
123                         g_TileClasses.player, 30,
124                         g_TileClasses.rock, 10,
125                         g_TileClasses.metal, 20,
126                         g_TileClasses.plateau, 2,
127                         g_TileClasses.water, 3
128                 ],
129                 "sizes": ["normal"],
130                 "mixes": ["same"],
131                 "amounts": g_AllAmounts
132         },
133         {
134                 "func": addStone,
135                 "avoid": [g_TileClasses.berries, 5,
136                         g_TileClasses.bluff, 5,
137                         g_TileClasses.forest, 3,
138                         g_TileClasses.mountain, 2,
139                         g_TileClasses.player, 30,
140                         g_TileClasses.rock, 20,
141                         g_TileClasses.metal, 10,
142                         g_TileClasses.plateau, 2,
143                         g_TileClasses.water, 3
144                 ],
145                 "sizes": ["normal"],
146                 "mixes": ["same"],
147                 "amounts": g_AllAmounts
148         },
149         {
150                 "func": addForests,
151                 "avoid": [
152                         g_TileClasses.berries, 5,
153                         g_TileClasses.bluff, 5,
154                         g_TileClasses.forest, 18,
155                         g_TileClasses.metal, 3,
156                         g_TileClasses.mountain, 5,
157                         g_TileClasses.plateau, 2,
158                         g_TileClasses.player, 20,
159                         g_TileClasses.rock, 3,
160                         g_TileClasses.water, 2
161                 ],
162                 "sizes": g_AllSizes,
163                 "mixes": g_AllMixes,
164                 "amounts": ["few", "normal", "many", "tons"]
165         }
166 ]));
167 Engine.SetProgress(80);
169 addElements(shuffleArray([
170         {
171                 "func": addBerries,
172                 "avoid": [
173                         g_TileClasses.berries, 30,
174                         g_TileClasses.bluff, 5,
175                         g_TileClasses.forest, 5,
176                         g_TileClasses.metal, 10,
177                         g_TileClasses.mountain, 2,
178                         g_TileClasses.plateau, 2,
179                         g_TileClasses.player, 20,
180                         g_TileClasses.rock, 10,
181                         g_TileClasses.water, 3
182                 ],
183                 "sizes": g_AllSizes,
184                 "mixes": g_AllMixes,
185                 "amounts": g_AllAmounts
186         },
187         {
188                 "func": addAnimals,
189                 "avoid": [
190                         g_TileClasses.animals, 20,
191                         g_TileClasses.bluff, 5,
192                         g_TileClasses.forest, 2,
193                         g_TileClasses.metal, 2,
194                         g_TileClasses.mountain, 1,
195                         g_TileClasses.plateau, 2,
196                         g_TileClasses.player, 20,
197                         g_TileClasses.rock, 2,
198                         g_TileClasses.water, 3
199                 ],
200                 "sizes": g_AllSizes,
201                 "mixes": g_AllMixes,
202                 "amounts": g_AllAmounts
203         },
204         {
205                 "func": addStragglerTrees,
206                 "avoid": [
207                         g_TileClasses.berries, 5,
208                         g_TileClasses.bluff, 5,
209                         g_TileClasses.forest, 7,
210                         g_TileClasses.metal, 2,
211                         g_TileClasses.mountain, 1,
212                         g_TileClasses.plateau, 2,
213                         g_TileClasses.player, 12,
214                         g_TileClasses.rock, 2,
215                         g_TileClasses.water, 5
216                 ],
217                 "sizes": g_AllSizes,
218                 "mixes": g_AllMixes,
219                 "amounts": g_AllAmounts
220         }
221 ]));
222 Engine.SetProgress(90);
224 placePlayersNomad(
225         g_TileClasses.player,
226         avoidClasses(
227                 g_TileClasses.plateau, 4,
228                 g_TileClasses.forest, 1,
229                 g_TileClasses.metal, 4,
230                 g_TileClasses.rock, 4,
231                 g_TileClasses.mountain, 4,
232                 g_TileClasses.animals, 2));
234 g_Map.ExportMap();