Skip to content

Commit

Permalink
Added colour to the units based on team
Browse files Browse the repository at this point in the history
  • Loading branch information
nikos committed Feb 17, 2013
1 parent 1231799 commit ceee374
Show file tree
Hide file tree
Showing 18 changed files with 1,567 additions and 647 deletions.
23 changes: 1 addition & 22 deletions ai.js
Original file line number Diff line number Diff line change
Expand Up @@ -114,26 +114,5 @@ Ai.prototype.Turn =
pq.insert(m);
}

/*
* Execute moves in order of score.
*/
console.log('AI has '+this.game.getCurrentArmy().getTracker().wits+' wits.');

var move = pq.pop();
while (move != undefined)
{
/* Moves and attacks won't happen if there aren't enough wits */
this.game.selectUnit(move.unit.id);
if (move.doMove)
{
this.game.MoveCurrentUnit(move.x, move.y);
}

if (move.target != undefined)
{
this.game.attackWithCurrentUnit(move.target.id);
}

move = pq.pop();
}
return pq;
}
12 changes: 8 additions & 4 deletions army.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,14 @@ function Army(colour, game)
this.colour = colour;
this.units = Array(4);

this.units[0] = new Unit(0, new Sprite("heavy", colour), 2, 4, 3, 1, game);
this.units[1] = new Unit(1, new Sprite("soldier", colour), 3, 3, 2, 1, game);
this.units[2] = new Unit(2, new Sprite("runner", colour), 5, 1, 1, 1, game);
this.units[3] = new Unit(3, new Sprite("archer", colour), 1, 1, 3, 3, game);
/*
* FIXME: proper army generation
* This is currently just a hack.
*/
this.units[0] = new Unit(0, new Sprite("heavy_"+colour, colour), 2, 4, 3, 1, game);
this.units[1] = new Unit(1, new Sprite("spearman_"+colour, colour), 3, 3, 2, 1, game);
this.units[2] = new Unit(2, new Sprite("runner_"+colour, colour), 5, 1, 1, 1, game);
this.units[3] = new Unit(3, new Sprite("archer_"+colour, colour), 1, 1, 3, 3, game);

this.num_units = this.units.length;

Expand Down
Loading

0 comments on commit ceee374

Please sign in to comment.