Team.js (raw)
1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 |
function defTeams() { this.p1 = {}; this.cpu = {}; this.data = new Array(2); this.data[0] = this.p1; this.data[1] = this.cpu; var i; for (i = 0; i < 2; i++) { this.data[i].units = new Array(); this.data[i].structs = new Array(); this.data[i].energy = 35; switch (i) { case 0: this.data[i].structs.push(mkHQ("p1")); break; case 1: this.data[i].structs.push(mkHQ("cpu")); break; } } } function subtractCost(player, item) { switch (player) { case "p1": teams.p1.energy -= item.cost; break; case "cpu": teams.cpu.energy -= item.cost; break; } } |