WIP
This commit is contained in:
parent
2c31ee8579
commit
53a99dae54
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
|
@ -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;
|
||||
|
|
|
@ -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);
|
||||
});
|
||||
|
|
|
@ -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[] {
|
||||
|
|
|
@ -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 [
|
||||
|
|
Loading…
Reference in a new issue