Changeset View
Changeset View
Standalone View
Standalone View
ps/trunk/binaries/data/mods/public/maps/random/alpine_valley.js
Show First 20 Lines • Show All 245 Lines • ▼ Show 20 Lines | for (var i = 0; i < numPoints; ++i) | ||||
matrix.push([]); | matrix.push([]); | ||||
for (var j = 0; j < numPoints; ++j) | for (var j = 0; j < numPoints; ++j) | ||||
matrix[i].push(i < numPlayers && j < numPlayers && i != j && (i == j - 1 || i == j + 1)) | matrix[i].push(i < numPlayers && j < numPlayers && i != j && (i == j - 1 || i == j + 1)) | ||||
} | } | ||||
//find and place the edges | //find and place the edges | ||||
while (possibleEdges.length) | while (possibleEdges.length) | ||||
{ | { | ||||
var index = randInt(0, possibleEdges.length - 1); | var index = randIntExclusive(0, possibleEdges.length); | ||||
//ensure that a point is connected to a maximum of 3 others | //ensure that a point is connected to a maximum of 3 others | ||||
if (edgesConncetedToPoints[possibleEdges[index][0]] > 2 || edgesConncetedToPoints[possibleEdges[index][1]] > 2) | if (edgesConncetedToPoints[possibleEdges[index][0]] > 2 || edgesConncetedToPoints[possibleEdges[index][1]] > 2) | ||||
{ | { | ||||
possibleEdges.splice(index,1); | possibleEdges.splice(index,1); | ||||
continue; | continue; | ||||
} | } | ||||
▲ Show 20 Lines • Show All 299 Lines • ▼ Show 20 Lines | |||||
log("Creating berry bush..."); | log("Creating berry bush..."); | ||||
group = new SimpleGroup( | group = new SimpleGroup( | ||||
[new SimpleObject(oBerryBush, 5,7, 0,4)], | [new SimpleObject(oBerryBush, 5,7, 0,4)], | ||||
true, clFood | true, clFood | ||||
); | ); | ||||
createObjectGroups(group, 0, | createObjectGroups(group, 0, | ||||
avoidClasses(clForest, 0, clPlayer, 20, clHill, 1, clFood, 10), | avoidClasses(clForest, 0, clPlayer, 20, clHill, 1, clFood, 10), | ||||
randInt(1, 4) * numPlayers + 2, 50 | randIntInclusive(1, 4) * numPlayers + 2, 50 | ||||
); | ); | ||||
log("Creating rabbit..."); | log("Creating rabbit..."); | ||||
group = new SimpleGroup( | group = new SimpleGroup( | ||||
[new SimpleObject(oRabbit, 2,3, 0,2)], | [new SimpleObject(oRabbit, 2,3, 0,2)], | ||||
true, clFood | true, clFood | ||||
); | ); | ||||
createObjectGroups(group, 0, | createObjectGroups(group, 0, | ||||
▲ Show 20 Lines • Show All 61 Lines • Show Last 20 Lines |
Wildfire Games · Phabricator