Fix long battle rewind (#2561)

---------

Co-authored-by: Guangcong Luo <guangcongluo@gmail.com>
This commit is contained in:
boughtabigk1 2025-12-04 23:55:49 -05:00 committed by GitHub
parent 83acefb0dd
commit 871fa18898
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
4 changed files with 4 additions and 4 deletions

View File

@ -1244,7 +1244,7 @@
},
rewindTurn: function () {
if (this.battle.turn) {
this.battle.seekTurn(this.battle.turn - 1);
this.battle.seekBy(-1);
}
},
goToEnd: function () {

View File

@ -118,7 +118,7 @@ export class BattleLog {
const button = el.getElementsByTagName('button')[0];
button?.addEventListener?.('click', e => {
e.preventDefault();
this.scene?.battle.seekTurn(this.scene.battle.turn - 100);
this.scene?.battle.seekBy(-100);
});
this.addNode(el);
}

View File

@ -486,7 +486,7 @@ export class ChatRoom extends PSRoom {
let turnNum = Number(target);
if (target.startsWith('+') || turnNum < 0) {
turnNum += this.battle.turn;
turnNum += this.battle.seeking ?? this.battle.turn;
if (turnNum < 0) turnNum = 0;
} else if (target === 'end') {
turnNum = Infinity;

View File

@ -208,7 +208,7 @@ var ReplayPanel = Panels.StaticPanel.extend({
this.battle.skipTurn();
},
rewind: function() {
this.battle.seekTurn(this.battle.turn - 1);
this.battle.seekBy(-1);
},
ffto: function() {
var turn = prompt('Turn?');