all repos — uStrat @ d398d667aca43d25519a4490042221cdaae76416

simple turn-based strategy game inspired by uCity, Super Robot Wars, C&C, Fire Emblem

add lose condition: half the cities are destroyed
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQJDBAABCAAtFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAl6zgjIPHG5pbGl4QG5p
bGZtLmNjAAoJEDt/vCIUTmOYs68QAI1RsNkkyBjsfZyaNHTmIvOjwk7jnuSSNjIj
KI4KdPCmPBpGD3QcnZkGzJr6nER9BuKV61VbQ1MfPQHC05qJ2o91zak7jPJzID0x
hOWxnnHhQN4Fz6gdoTkfRjhzYlPXBjYMybkJN3vcA7ExlWxD3XgtFrouSG1Do8TF
zXMS0M1qk2i68o74pp/g/IyITGHxPNcBRNoPowsMoWZmDkQ1/678Ccon6nOBCfUm
neGtIDmAnIsgH/eQdPQHzXcWvBCTQ8MlhxJ4AdgFHMWsf8DkbXsAIJi/BuJBYFX5
h0f4Qyp+hz2XgXJvA0ImF8+mQjnLqNATf/jbVfmROFJxT1olWB/1c+fnlp8gjsxR
XixcHlDKy/LxgMXxxT8Jt6m8dtn2jb/inCVjKlfv93DFWRhZ74eOERhpZroSPY6C
IA06YAxYZ2N6y806NhFewgD6y5o9hY4DMhP1Ag0Lyhl45nlkOFy4qgG1ogWGSN0Y
t7S0FXWCXw53fDFBSG9BQceXEYrpXlJZ1fuHf5r4Q+CmS9wvnezhuWdyVIV/t6fP
8zvjniCEYpWmOP6wrxlI+/vyiivD7F33lUl+wn5VbZUWDrmokiZjMn8QQ9qPOgkX
9P/fbYnLDpHslwKj9WCYO6xWsDXMsPxyv+rjLY8jb7EyVYWe5LhHZypP2FSP5chk
RbonVk0I
=ST0b
-----END PGP SIGNATURE-----
commit

d398d667aca43d25519a4490042221cdaae76416

parent

fd4f398043e5249ca07eb7e8bb0bf529376c26f8

1 files changed, 17 insertions(+), 1 deletions(-)

jump to
M Map.jsMap.js

@@ -3,6 +3,7 @@ // this file contains map, camera, and HUD data and functions

window.map = {}; map.sz = 64; +map.ogCities = 0; map.gfx = {};

@@ -246,6 +247,8 @@ break;

case "city": AI.targetReset(self); this.changeCell(self, "ruins"); + if (++gameState.ruin >= map.ogCities/2) + gameState.flow = "youLose"; break; default: break;

@@ -549,6 +552,19 @@

} } +map.countCities = function() +{ + var i, j; + for (i = 0; i < map.sz; i++) + { + for (j = 0; j < map.sz; j++) + { + if (map.data[i][j].type == "city") + map.ogCities++; + } + } +} + map.generate = function() { this.loadTiles();

@@ -557,6 +573,6 @@ this.fillPlains();

this.genForests(0.5); this.genMountains(Math.floor(Math.random()*this.sz/8), 10, 9); this.genCities(Math.floor(Math.random()*this.sz/7 + 3), 5, 4); - this.genRuins(0.02); this.fillOcean(8 + Math.floor(Math.random()*8), Math.floor(Math.random()*9) + 1); + this.countCities(); }