Fixed "end turn" action not cooling down equipment
This commit is contained in:
parent
763551a360
commit
3bbafcaf57
1
TODO.md
1
TODO.md
|
@ -66,6 +66,7 @@ Battle
|
|||
Ships models and equipments
|
||||
---------------------------
|
||||
|
||||
* Toggle actions should stay activated and restitute power when turned off
|
||||
* Add permanent effects and actions to ship models
|
||||
* Add critical hit/miss
|
||||
* Add damage over time effect (tricky to make intuitive)
|
||||
|
|
|
@ -34,8 +34,6 @@ module TK.SpaceTac.Specs {
|
|||
});
|
||||
|
||||
test.case("generates power for previous ship", check => {
|
||||
check.patch(console, "warn", null);
|
||||
|
||||
let battle = TestTools.createBattle(1, 0);
|
||||
let ship = battle.play_order[0];
|
||||
TestTools.setShipAP(ship, 10, 3);
|
||||
|
@ -60,5 +58,46 @@ module TK.SpaceTac.Specs {
|
|||
}
|
||||
]);
|
||||
});
|
||||
|
||||
test.case("cools down equipment for previous ship", check => {
|
||||
let battle = TestTools.createBattle(1, 0);
|
||||
let ship = battle.play_order[0];
|
||||
|
||||
let equ1 = TestTools.addWeapon(ship);
|
||||
equ1.cooldown.configure(1, 3);
|
||||
equ1.cooldown.use();
|
||||
let equ2 = TestTools.addWeapon(ship);
|
||||
equ2.cooldown.configure(1, 2);
|
||||
equ2.cooldown.use();
|
||||
let equ3 = TestTools.addWeapon(ship);
|
||||
equ3.cooldown.use();
|
||||
|
||||
TestTools.actionChain(check, battle, [
|
||||
[ship, EndTurnAction.SINGLETON, Target.newFromShip(ship)],
|
||||
[ship, EndTurnAction.SINGLETON, Target.newFromShip(ship)],
|
||||
[ship, EndTurnAction.SINGLETON, Target.newFromShip(ship)],
|
||||
], [
|
||||
check => {
|
||||
check.equals(equ1.cooldown.heat, 3, "equ1 heat");
|
||||
check.equals(equ2.cooldown.heat, 2, "equ2 heat");
|
||||
check.equals(equ3.cooldown.heat, 0, "equ3 heat");
|
||||
},
|
||||
check => {
|
||||
check.equals(equ1.cooldown.heat, 2, "equ1 heat");
|
||||
check.equals(equ2.cooldown.heat, 1, "equ2 heat");
|
||||
check.equals(equ3.cooldown.heat, 0, "equ3 heat");
|
||||
},
|
||||
check => {
|
||||
check.equals(equ1.cooldown.heat, 1, "equ1 heat");
|
||||
check.equals(equ2.cooldown.heat, 0, "equ2 heat");
|
||||
check.equals(equ3.cooldown.heat, 0, "equ3 heat");
|
||||
},
|
||||
check => {
|
||||
check.equals(equ1.cooldown.heat, 0, "equ1 heat");
|
||||
check.equals(equ2.cooldown.heat, 0, "equ2 heat");
|
||||
check.equals(equ3.cooldown.heat, 0, "equ3 heat");
|
||||
}
|
||||
]);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -22,11 +22,12 @@ module TK.SpaceTac {
|
|||
// Generate power
|
||||
result = result.concat(ship.getValueDiffs("power", ship.getAttribute("power_generation"), true));
|
||||
|
||||
// TODO previous: apply sticky effects
|
||||
// TODO previous: cool down equipment
|
||||
// Cool down equipment
|
||||
ship.listEquipment().filter(equ => equ.cooldown.heat > 0).forEach(equ => {
|
||||
result.push(new ShipCooldownDiff(ship, equ, 1));
|
||||
});
|
||||
|
||||
// TODO new: apply sticky effects
|
||||
// TODO new: reset toggle actions
|
||||
// TODO sticky effects
|
||||
|
||||
let cycle_diff = (battle.play_order.indexOf(new_ship) == 0) ? 1 : 0;
|
||||
result.push(new ShipChangeDiff(ship, new_ship, cycle_diff));
|
||||
|
|
Loading…
Reference in a new issue