From 509eb8dbc9be90b4bd14b5523fd00177116ecd14 Mon Sep 17 00:00:00 2001 From: Zinix Date: Fri, 12 Jan 2024 16:12:24 +0300 Subject: [PATCH] saga bugs fixed --- rpgsaga/saga/src/game.ts | 10 ++++------ rpgsaga/saga/src/index.ts | 2 +- 2 files changed, 5 insertions(+), 7 deletions(-) diff --git a/rpgsaga/saga/src/game.ts b/rpgsaga/saga/src/game.ts index 0a236b0..9fbbd2d 100644 --- a/rpgsaga/saga/src/game.ts +++ b/rpgsaga/saga/src/game.ts @@ -38,8 +38,10 @@ export class Game { const winners: Player[] = [] console.log(`Кон ${count}.`) for (let i = 0; i < shuffledPlayers.length - 1; i += 2) { - shuffledPlayers[i].health =shuffledPlayers[i].full_health - shuffledPlayers[i + 1].health =shuffledPlayers[i + 1].full_health + shuffledPlayers[i].health = shuffledPlayers[i].full_health + shuffledPlayers[i].abilityAbsense = false + shuffledPlayers[i + 1].health = shuffledPlayers[i + 1].full_health + shuffledPlayers[i + 1].abilityAbsense = false winners.push(this.fight(shuffledPlayers[i], shuffledPlayers[i + 1])) console.log() } @@ -61,7 +63,6 @@ export class Game { if (randomInt(0, 1)){ // если применяется способность if (attackingPlayer.abilityAbsense){ // если стрелы уже использовались let damage = attackingPlayer.dealDmg(defendingPlayer) - damage += defendingPlayer.tickDamage Logger.makeDamage(attackingPlayer, defendingPlayer, damage) if (defendingPlayer.health <= 0) { // если у защищающегося закончилось хп Logger.death(defendingPlayer) @@ -77,9 +78,6 @@ export class Game { } } else { // если способность не применяется let damage = attackingPlayer.dealDmg(defendingPlayer) - if (defendingPlayer.tickDamage){ // если на защищающемся тик дмг - damage += defendingPlayer.tickDamage - } Logger.makeDamage(attackingPlayer, defendingPlayer, damage) if (defendingPlayer.health <= 0) { // если у защищающегося закончилось хп Logger.death(defendingPlayer) diff --git a/rpgsaga/saga/src/index.ts b/rpgsaga/saga/src/index.ts index b288054..4113a41 100644 --- a/rpgsaga/saga/src/index.ts +++ b/rpgsaga/saga/src/index.ts @@ -1,4 +1,4 @@ import { Game } from "./game"; -const game = new Game(6) +const game = new Game(8) game.start() \ No newline at end of file