Fixed restoring from saved battle
This commit is contained in:
parent
29ea205d36
commit
13b6c13ef4
1
TODO
1
TODO
|
@ -4,7 +4,6 @@
|
|||
* Do not focus on ship while targetting for area effects (dissociate hover and target)
|
||||
* Active effects are not enough visible in ship list (maybe better in arena ?)
|
||||
* Discrete power display, instead of the continuous power bar
|
||||
* When actions are inavailable at turn start, icon border is faded but not the icon itself (as it is when it fades during turn)
|
||||
* Changing active view does not cancel pending "setTimeout"s.
|
||||
* Drones: add tooltip
|
||||
* Drones: add hull points and take area damage
|
||||
|
|
|
@ -252,5 +252,21 @@ module TS.SpaceTac {
|
|||
expected.initial = true;
|
||||
expect(battle.log.events).toEqual([expected]);
|
||||
});
|
||||
|
||||
it("checks if a player is able to play", function () {
|
||||
let battle = new Battle();
|
||||
let player = new Player();
|
||||
|
||||
expect(battle.canPlay(player)).toBe(false);
|
||||
|
||||
let ship = new Ship();
|
||||
battle.playing_ship = ship;
|
||||
|
||||
expect(battle.canPlay(player)).toBe(false);
|
||||
|
||||
ship.fleet.player = player;
|
||||
|
||||
expect(battle.canPlay(player)).toBe(true);
|
||||
});
|
||||
});
|
||||
}
|
||||
|
|
|
@ -63,8 +63,8 @@ module TS.SpaceTac {
|
|||
canPlay(player: Player): boolean {
|
||||
if (this.ended) {
|
||||
return false;
|
||||
} else if (this.playing_ship.getPlayer() === player) {
|
||||
return this.playing_ship.isAbleToPlay();
|
||||
} else if (this.playing_ship && this.playing_ship.getPlayer() == player) {
|
||||
return this.playing_ship.isAbleToPlay(false);
|
||||
} else {
|
||||
return false;
|
||||
}
|
||||
|
|
|
@ -80,7 +80,7 @@ module TS.SpaceTac.UI {
|
|||
Tools.setHoverClick(this, show_info, hide_info, () => this.processClick());
|
||||
|
||||
// Initialize
|
||||
this.updateActiveStatus();
|
||||
this.updateActiveStatus(true);
|
||||
}
|
||||
|
||||
// Process a click event on the action icon
|
||||
|
@ -157,10 +157,10 @@ module TS.SpaceTac.UI {
|
|||
}
|
||||
|
||||
// Update the active status, from the action canBeUsed result
|
||||
updateActiveStatus(): void {
|
||||
updateActiveStatus(force = false): void {
|
||||
var old_active = this.active;
|
||||
this.active = this.action.canBeUsed(this.battleview.battle, this.ship);
|
||||
if (this.active != old_active) {
|
||||
if (force || (this.active != old_active)) {
|
||||
Animation.setVisibility(this.game, this.layer_active, this.active, 500);
|
||||
this.game.tweens.create(this.layer_icon).to({ alpha: this.active ? 1 : 0.3 }, 500).start();
|
||||
this.input.useHandCursor = this.active;
|
||||
|
|
Loading…
Reference in a new issue