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 that an arena location is on a grid vertex
|
||||||
*/
|
*/
|
||||||
check(loc: IArenaLocation): boolean {
|
check(loc: IArenaLocation): boolean {
|
||||||
|
console.log(loc, this.snap(loc), arenaDistance(loc, this.snap(loc)));
|
||||||
return arenaDistance(loc, this.snap(loc)) < 1e-8;
|
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
|
* 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 {
|
protected checkLocationTarget(ship: Ship, target: Target): boolean {
|
||||||
return false;
|
return false;
|
||||||
|
@ -257,6 +259,8 @@ module TK.SpaceTac {
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Method to reimplement to check if a ship target is suitable
|
* 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 {
|
protected checkShipTarget(ship: Ship, target: Target): boolean {
|
||||||
return false;
|
return false;
|
||||||
|
|
|
@ -1,21 +1,20 @@
|
||||||
module TK.SpaceTac.Specs {
|
module TK.SpaceTac.Specs {
|
||||||
testing("MoveAction", test => {
|
testing("MoveAction", test => {
|
||||||
test.case("checks movement against remaining AP", check => {
|
test.case("checks target is on the grid", check => {
|
||||||
var ship = new Ship();
|
let ship = new Ship();
|
||||||
var battle = new Battle(ship.fleet);
|
let battle = new Battle(ship.fleet);
|
||||||
battle.grid = new PixelGrid();
|
battle.grid = new PixelGrid();
|
||||||
TestTools.setShipPlaying(battle, ship);
|
TestTools.setShipPlaying(battle, ship);
|
||||||
ship.setValue("power", 6);
|
TestTools.setShipModel(ship, 1, 0, 1);
|
||||||
ship.setArenaPosition(0, 0);
|
let action = new MoveAction("Engine", { distance_per_power: 1 });
|
||||||
var action = new MoveAction("Engine", { distance_per_power: 10 });
|
|
||||||
ship.actions.addCustom(action);
|
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);
|
check.equals(result, true);
|
||||||
|
result = action.checkTarget(ship, Target.newFromLocation(0, 5.5));
|
||||||
result = action.checkTarget(ship, Target.newFromLocation(0, 80));
|
check.equals(result, false);
|
||||||
|
result = action.checkTarget(ship, Target.newFromShip(ship));
|
||||||
check.equals(result, false);
|
check.equals(result, false);
|
||||||
|
|
||||||
result = action.checkTarget(ship, Target.newFromLocation(0, 0));
|
result = action.checkTarget(ship, Target.newFromLocation(0, 0));
|
||||||
check.equals(result, false);
|
check.equals(result, false);
|
||||||
});
|
});
|
||||||
|
|
|
@ -97,7 +97,7 @@ module TK.SpaceTac {
|
||||||
|
|
||||||
// TODO Check the space is not occupied
|
// 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[] {
|
protected getSpecificDiffs(ship: Ship, battle: Battle, target: Target): BaseBattleDiff[] {
|
||||||
|
|
|
@ -34,7 +34,7 @@ module TK.SpaceTac {
|
||||||
let missile = new TriggerAction("Defense Missiles", {
|
let missile = new TriggerAction("Defense Missiles", {
|
||||||
effects: [new DamageEffect(3, DamageEffectMode.SHIELD_THEN_HULL)],
|
effects: [new DamageEffect(3, DamageEffectMode.SHIELD_THEN_HULL)],
|
||||||
power: 3,
|
power: 3,
|
||||||
range: 4, blast: 4,
|
range: 4, blast: 3,
|
||||||
}, "submunitionmissile");
|
}, "submunitionmissile");
|
||||||
|
|
||||||
return [
|
return [
|
||||||
|
|
Loading…
Reference in a new issue