1
0
Fork 0

Fixed drones of dead ship never being destroyed

This commit is contained in:
Michaël Lemaire 2017-05-10 19:28:27 +02:00
parent 3fb2cf8e31
commit 962621c231
3 changed files with 14 additions and 7 deletions

1
TODO
View file

@ -1,4 +1,3 @@
* Drones of dead ships are never destroyed
* UI: Use a common component class, and a layer abstraction
* Character sheet: add initial character creation
* Character sheet: disable interaction during battle (except for loot screen)

View file

@ -320,6 +320,14 @@ module TS.SpaceTac.Specs {
expect(onTurnEnd).toHaveBeenCalledTimes(1);
expect(onTurnEnd).toHaveBeenCalledWith(ship);
expect(onShipMove).toHaveBeenCalledTimes(1);
ship.setDead();
ship.startTurn();
ship.endTurn();
expect(onTurnStart).toHaveBeenCalledTimes(2);
expect(onTurnEnd).toHaveBeenCalledTimes(2);
expect(onShipMove).toHaveBeenCalledTimes(1);
});
it("stores items in cargo space", function () {

View file

@ -360,10 +360,10 @@ module TS.SpaceTac {
// Apply sticky effects
this.sticky_effects.forEach(effect => effect.startTurn(this));
this.cleanStickyEffects();
// Broadcast to drones
this.forEachDrone(drone => drone.onTurnStart(this));
}
// Broadcast to drones
this.forEachDrone(drone => drone.onTurnStart(this));
}
// Method called at the end of this ship turn
@ -374,10 +374,10 @@ module TS.SpaceTac {
}
this.playing = false;
if (this.alive) {
// Broadcast to drones
this.forEachDrone(drone => drone.onTurnEnd(this));
// Broadcast to drones
this.forEachDrone(drone => drone.onTurnEnd(this));
if (this.alive) {
// Recover action points for next turn
this.updateAttributes();
this.recoverActionPoints();