all repos — uStrat @ 1e80ddda361f59ceae8202610b113f742e77632b

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

bugfixes all over and make def come into play
Iris Lightshard nilix@nilfm.cc
PGP Signature
-----BEGIN PGP SIGNATURE-----

iQIzBAABCAAdFiEEkFh6dA+k/6CXFXU4O3+8IhROY5gFAmDRiVYACgkQO3+8IhRO
Y5if8g//TYELafD6ow1PHsY6n3vJ4tCoFWfWHHHuZAfs/HBgtMwu3wqcdQwepLEm
amrDjDp+aY/AQYNMOQ6Y8a6bC0GnPNxyTZHupyoRN3l+5ROGiaO1x2vvqDbUBOjY
gtKa2QFHVnAvz5hbmQunkVjsC9OxfzzrpoELz+VELJKoXtxXxhN/eI90GWKy14eV
tD7kSv+weNkHV/jPJohznNRggYVE1+WUFms4YWLVZ5s7/zk/sDMW858QenZHKu6o
L/vLM9nOCJclxjRwvkW8dgSDD6kTwDBngISemX+5Y+pguBOkQqBP2xe6NbjwcEHt
ckP6yw16IdlhJIsmtyS7L9ckPCTUXFsrdegyQkIwflb/XB720CKVLt5LGfV7KLU9
06kD6mttTpgILZVGFxRIsxdFpamRg8clATX3wsXofSJQx9nKysmtcwrE84BzyZbI
da6jaUVAaSJ4+8fncvQZlKSMxJc3YbatgexRdTl+yNvh6jo7Or1RMkkEVcXvxz6w
4yVNv0z19aVze8QkgmEsE7H5PtNeC7t59b1jlAGTvm/+BFoUGBB4MFP88Xm4g0Ae
UBwvUosHhtudctALwJlgGIsb0zOsxwvAQVYN3KrwkWrY4Q02X3eu6A/QlywEZ8ls
bY8ahc9tCtsV5XUCzI91WoFHZnG9ORZzO7N552gPQmubl/h+jGo=
=nREC
-----END PGP SIGNATURE-----
commit

1e80ddda361f59ceae8202610b113f742e77632b

parent

691015a5043c8850a3fe6f9ac6c9d6289127e372

6 files changed, 21 insertions(+), 10 deletions(-)

jump to
M AI.jsAI.js

@@ -136,6 +136,9 @@ tmp = teams.p1.units[i];

if (dist(tmp,teams.cpu.units[AI.focus]) < teams.cpu.units[AI.focus].equipment.range) { return tmp; }; + if (dist(tmp,teams.cpu.units[AI.focus]) < teams.cpu.units[AI.focus].agi) { + return tmp; + }; if (tmp.equipment === null) k = tmp.hp*tmp.pow/tmp.def; else

@@ -340,10 +343,12 @@ {

equipOrUpgradeHellBomb(); } break; + default: break; } if (unit.equipment !== null) { - unit.target = null; + AI.setTargetType(); + AI.findTarget(); } }

@@ -369,6 +374,9 @@ return;

} for (;;) { + if (!movement.unit.target) { + movement.unit.target = AI.selectEnemyUnit() + } b = AI.getBearing(movement.chain[movement.chain.length -1], movement.unit.target); do { console.log(" trying to go directly to target");
M Engine.jsEngine.js

@@ -190,7 +190,7 @@ {

AI.incrementAttention(); if (teams.cpu.units[AI.focus].attentionSpan == 0) { - teams.cpu.units[AI.focus].target = {}; + teams.cpu.units[AI.focus].target = null; } if (teams.cpu.units[AI.focus].equipment === null) {
M Equipment.jsEquipment.js

@@ -56,7 +56,7 @@ function equipOrUpgradeBeamSabreMKI()

{ var unit = map.data[mapCursor.x][mapCursor.y].unit; var m = false; - if (unit.equipment === null || unit.equipment.name != "Beam Sabre mkI") + if (unit.equipment === null || unit.equipment.name != "Beam Sabre") { unit.equipment = beamSabreMKI(); }

@@ -103,7 +103,7 @@ function equipOrUpgradeRifleMKI()

{ var unit = map.data[mapCursor.x][mapCursor.y].unit; var m = false; - if (unit.equipment === null || unit.equipment.name != "Rifle mkI") + if (unit.equipment === null || unit.equipment.name != "Rifle") { unit.equipment = rifleMKI(); }
M Map.jsMap.js

@@ -243,6 +243,8 @@ switch (self.type)

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

@@ -275,12 +277,12 @@ self.defMod = 4;

self.sprite = map.gfx.mapTiles.mountain; break; case "city": - self.agiMod = 2; + self.agiMod = 1; self.defMod = 3; self.sprite = map.gfx.mapTiles.city; break; case "ruins": - self.agiMod = 1; + self.agiMod = 0; self.defMod = 2; self.sprite = map.gfx.mapTiles.ruins; gameState.ruin += 1;
M Unit.jsUnit.js

@@ -192,7 +192,8 @@ }

function damageUnit(x,y) { - if (map.data[x][y].unit !== null) + if (map.data[x][y].unit !== null + && attack.src.pow + attack.src.equipment.grade >= map.data[x][y].unit.def + map.data[x][y].defMod) { map.data[x][y].unit.hp = map.data[x][y].unit.hp - (attack.src.pow + attack.src.equipment.grade); if (map.data[x][y].unit.hp <= 0)