1
0
Fork 0

AP consumption is now done by BaseAction

This commit is contained in:
Michaël Lemaire 2015-02-26 01:00:00 +01:00
parent 9814f08883
commit f01a9059e9
3 changed files with 10 additions and 8 deletions

View file

@ -79,7 +79,16 @@ module SpaceTac.Game {
if (!target && this.needs_target) {
return false;
}
return this.customApply(battle, ship, target);
var cost = this.getActionPointsUsage(battle, ship, target);
if (this.customApply(battle, ship, target)) {
if (cost > 0) {
ship.useActionPoints(cost);
}
return true;
} else {
return false;
}
} else {
return false;
}

View file

@ -49,11 +49,6 @@ module SpaceTac.Game {
result = result || eff_result;
});
// Consume AP
if (result) {
ship.useActionPoints(this.equipment.ap_usage);
}
return result;
} else {
// TODO target in space (=> apply blast radius)

View file

@ -35,9 +35,7 @@ module SpaceTac.Game {
}
protected customApply(battle: Battle, ship: Ship, target: Target): boolean {
var cost = this.getActionPointsUsage(battle, ship, target);
ship.moveTo(target.x, target.y);
ship.useActionPoints(cost);
return true;
}
}