diff --git a/src/scripts/game/actions/BaseAction.ts b/src/scripts/game/actions/BaseAction.ts index c886b98..40f8f14 100644 --- a/src/scripts/game/actions/BaseAction.ts +++ b/src/scripts/game/actions/BaseAction.ts @@ -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; } diff --git a/src/scripts/game/actions/FireWeaponAction.ts b/src/scripts/game/actions/FireWeaponAction.ts index 96048e4..8776d4b 100644 --- a/src/scripts/game/actions/FireWeaponAction.ts +++ b/src/scripts/game/actions/FireWeaponAction.ts @@ -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) diff --git a/src/scripts/game/actions/MoveAction.ts b/src/scripts/game/actions/MoveAction.ts index 639fe59..576b95e 100644 --- a/src/scripts/game/actions/MoveAction.ts +++ b/src/scripts/game/actions/MoveAction.ts @@ -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; } }