diff --git a/TODO.md b/TODO.md index 40809a3..334d130 100644 --- a/TODO.md +++ b/TODO.md @@ -8,6 +8,7 @@ Phaser 3 migration * Fit the game in window size * Fix top-right messages positions * Fix valuebar requiring to be in root display list +* Fix tactical mode button not working * Restore unit tests about boundaries (in UITools) Menu/settings/saves @@ -50,7 +51,6 @@ Battle * Show a cooldown indicator on move action icon, if the simulation would cause the engine to overheat * Add an hexagonal grid (optional, may be enforced only on mobile) and work in units of this grid * Add engine trail effect, and sound -* Allow to skip animations, and allow no animation mode * Find incentives to move from starting position (permanent drones or anomalies?) * Mark targetting in error when target is refused by the action (there is already an arrow for this) * Allow to undo last moves diff --git a/src/ui/battle/BattleView.ts b/src/ui/battle/BattleView.ts index 3d9d211..9f75d19 100644 --- a/src/ui/battle/BattleView.ts +++ b/src/ui/battle/BattleView.ts @@ -135,8 +135,14 @@ module TK.SpaceTac.UI { this.inputs.bind("Escape", "Cancel action", () => this.action_bar.actionEnded()); range(10).forEach(i => this.inputs.bind(`Numpad${i % 10}`, `Action/target ${i}`, () => this.numberPressed(i))); range(10).forEach(i => this.inputs.bind(`Digit${i % 10}`, `Action/target ${i}`, () => this.numberPressed(i))); - this.inputs.bindCheat("w", "Win current battle", () => nn(this.player.getCheats()).win()); - this.inputs.bindCheat("x", "Lose current battle", () => nn(this.player.getCheats()).lose()); + this.inputs.bindCheat("w", "Win current battle", () => { + nn(this.player.getCheats()).win(); + this.log_processor.fastForward(); + }); + this.inputs.bindCheat("x", "Lose current battle", () => { + nn(this.player.getCheats()).lose(); + this.log_processor.fastForward(); + }); this.inputs.bindCheat("a", "Use AI to play", () => this.playAI()); // "Battle" animation, then start processing the log @@ -287,6 +293,8 @@ module TK.SpaceTac.UI { } else if (this.ship_hovered && this.player.is(this.ship_hovered.fleet.player) && this.interacting) { this.character_sheet.show(this.ship_hovered); this.setShipHovered(null); + } else { + this.log_processor.fastForward(); } } diff --git a/src/ui/battle/LogProcessor.ts b/src/ui/battle/LogProcessor.ts index 188c891..c67c4a3 100644 --- a/src/ui/battle/LogProcessor.ts +++ b/src/ui/battle/LogProcessor.ts @@ -17,6 +17,10 @@ module TK.SpaceTac.UI { // Background delegates promises private background_promises: Promise[] = [] + // Speed control + private speed = 1 + private temp_speed?: number + // Debug indicators private debug = false private ai_disabled = false @@ -57,6 +61,10 @@ module TK.SpaceTac.UI { } await this.processBattleDiff(diff); + + if (this.log.atEnd()) { + this.temp_speed = undefined; + } }); this.transferControl(); @@ -77,6 +85,15 @@ module TK.SpaceTac.UI { } } + /** + * Fast forward to the end of log, then resume normal speed + */ + fastForward(speed = 3): void { + if (!this.log.atEnd()) { + this.temp_speed = speed; + } + } + /** * Destroy the processor * @@ -175,7 +192,7 @@ module TK.SpaceTac.UI { if (this.debug) { console.log("Battle diff", diff); } - let speed = timed ? 1 : 0; + let speed = timed ? (typeof this.temp_speed == "undefined" ? this.speed : this.temp_speed) : 0; // TODO add priority to sort the delegates let delegates = this.subscriber.map(subscriber => subscriber(diff)); diff --git a/src/ui/battle/ShipList.ts b/src/ui/battle/ShipList.ts index d192a51..a5be6c9 100644 --- a/src/ui/battle/ShipList.ts +++ b/src/ui/battle/ShipList.ts @@ -115,7 +115,7 @@ module TK.SpaceTac.UI { * Update the locations of all items */ refresh(speed = 1): void { - let duration = speed ? 1000 / speed : 0; + let duration = speed ? (1000 / speed) : 0; this.items.forEach(item => { if (item.ship.alive) { let position = this.battle.getPlayOrder(item.ship); diff --git a/src/ui/battle/ShipTooltip.ts b/src/ui/battle/ShipTooltip.ts index b0658d5..b850f94 100644 --- a/src/ui/battle/ShipTooltip.ts +++ b/src/ui/battle/ShipTooltip.ts @@ -72,8 +72,8 @@ module TK.SpaceTac.UI { builder.text(ship.model.getDescription(), 0, iy + 4, { size: 14, color: "#999999", width: 540 }); } else { - builder.text("Emergency Stasis Protocol\nship disabled", 140, 36, - { color: "#a899db", size: 20, center: true, vcenter: true }); + builder.text("Emergency Stasis Protocol\nship disabled", 230, 36, + { color: "#a899db", size: 20, center: false, vcenter: false }); } return true;