1
0
Fork 0
spacetac/src/scripts/game/actions/MoveAction.ts

18 lines
583 B
TypeScript
Raw Normal View History

module SpaceTac.Game {
2014-12-31 00:00:00 +00:00
// Action to move to a given location
export class MoveAction extends BaseAction {
constructor() {
super("move");
}
canBeUsed(battle: Battle, ship: Ship): boolean {
return ship.ap_current > 0;
}
checkLocationTarget(battle: Battle, ship: Ship, target: Target): Target {
// TODO Should forbid to move too much near another ship
var coords = ship.getLongestMove(target.x, target.y);
return Target.newFromLocation(coords[0], coords[1]);
}
}
}