diff --git a/src/core/ArenaGrid.ts b/src/core/ArenaGrid.ts index 31255c3..0172b86 100644 --- a/src/core/ArenaGrid.ts +++ b/src/core/ArenaGrid.ts @@ -18,6 +18,7 @@ module TK.SpaceTac { * Check that an arena location is on a grid vertex */ check(loc: IArenaLocation): boolean { + console.log(loc, this.snap(loc), arenaDistance(loc, this.snap(loc))); return arenaDistance(loc, this.snap(loc)) < 1e-8; } diff --git a/src/core/actions/BaseAction.ts b/src/core/actions/BaseAction.ts index 9c763ea..0d1aafd 100644 --- a/src/core/actions/BaseAction.ts +++ b/src/core/actions/BaseAction.ts @@ -250,6 +250,8 @@ module TK.SpaceTac { /** * Method to reimplement to check if a space target is suitable + * + * Should not check for power or action availability, only whether the target is valid */ protected checkLocationTarget(ship: Ship, target: Target): boolean { return false; @@ -257,6 +259,8 @@ module TK.SpaceTac { /** * Method to reimplement to check if a ship target is suitable + * + * Should not check for power or action availability, only whether the target is valid */ protected checkShipTarget(ship: Ship, target: Target): boolean { return false; diff --git a/src/core/actions/MoveAction.spec.ts b/src/core/actions/MoveAction.spec.ts index 1ab9caa..08fe110 100644 --- a/src/core/actions/MoveAction.spec.ts +++ b/src/core/actions/MoveAction.spec.ts @@ -1,21 +1,20 @@ module TK.SpaceTac.Specs { testing("MoveAction", test => { - test.case("checks movement against remaining AP", check => { - var ship = new Ship(); - var battle = new Battle(ship.fleet); + test.case("checks target is on the grid", check => { + let ship = new Ship(); + let battle = new Battle(ship.fleet); battle.grid = new PixelGrid(); TestTools.setShipPlaying(battle, ship); - ship.setValue("power", 6); - ship.setArenaPosition(0, 0); - var action = new MoveAction("Engine", { distance_per_power: 10 }); + TestTools.setShipModel(ship, 1, 0, 1); + let action = new MoveAction("Engine", { distance_per_power: 1 }); ship.actions.addCustom(action); - var result = action.checkTarget(ship, Target.newFromLocation(0, 20)); + let result = action.checkTarget(ship, Target.newFromLocation(0, 20)); check.equals(result, true); - - result = action.checkTarget(ship, Target.newFromLocation(0, 80)); + result = action.checkTarget(ship, Target.newFromLocation(0, 5.5)); + check.equals(result, false); + result = action.checkTarget(ship, Target.newFromShip(ship)); check.equals(result, false); - result = action.checkTarget(ship, Target.newFromLocation(0, 0)); check.equals(result, false); }); diff --git a/src/core/actions/MoveAction.ts b/src/core/actions/MoveAction.ts index ff468ba..8f9fedf 100644 --- a/src/core/actions/MoveAction.ts +++ b/src/core/actions/MoveAction.ts @@ -97,7 +97,7 @@ module TK.SpaceTac { // TODO Check the space is not occupied - return ship.getValue("power") >= this.getPowerUsage(ship, target); + return true; } protected getSpecificDiffs(ship: Ship, battle: Battle, target: Target): BaseBattleDiff[] { diff --git a/src/core/models/ModelTrapper.ts b/src/core/models/ModelTrapper.ts index 493f2c2..caf87ec 100644 --- a/src/core/models/ModelTrapper.ts +++ b/src/core/models/ModelTrapper.ts @@ -34,7 +34,7 @@ module TK.SpaceTac { let missile = new TriggerAction("Defense Missiles", { effects: [new DamageEffect(3, DamageEffectMode.SHIELD_THEN_HULL)], power: 3, - range: 4, blast: 4, + range: 4, blast: 3, }, "submunitionmissile"); return [