Fix Battle timeout

This commit is contained in:
Dragon Fire
2020-05-07 17:01:37 -04:00
parent 762e5de525
commit 418760a8cb
2 changed files with 5 additions and 5 deletions
+2
View File
@@ -6,6 +6,7 @@ module.exports = class Battle {
this.opponent = new Battler(this, opponent);
this.userTurn = false;
this.turn = 1;
this.lastTurnTimeout = false;
}
get attacker() {
@@ -25,6 +26,7 @@ module.exports = class Battle {
}
get winner() {
if (this.lastTurnTimeout) return 'time';
if (this.user.hp <= 0) return this.opponent;
if (this.opponent.hp <= 0) return this.user;
return null;