From 8d55c0d621e6c9a5f6e759102caba77efb605a66 Mon Sep 17 00:00:00 2001 From: Yrahcaz7 Date: Sat, 18 Nov 2023 18:48:53 -0500 Subject: [PATCH] more fixes & balancing --- js/cards.js | 4 ++-- js/functions.js | 14 ++++++-------- js/game.js | 12 +++++------- js/graphics.js | 4 +--- 4 files changed, 14 insertions(+), 20 deletions(-) diff --git a/js/cards.js b/js/cards.js index 04e0475..2c949c8 100644 --- a/js/cards.js +++ b/js/cards.js @@ -39,11 +39,11 @@ const attributes = { }, 1001: { name: "heat wave", - desc: "Deal 8 damage to\nan enemy, and apply\n2 burn to all\nenemies.", + desc: "Deal 7 damage to\nan enemy, and apply\n2 burn to all\nenemies.", rarity: 2, cost: 2, anim: "attack", - damage: 8, + damage: 7, attack() { for (let index = 0; index < game.enemies.length; index++) { if (game.enemies[index].eff.burn) game.enemies[index].eff.burn += 2; diff --git a/js/functions.js b/js/functions.js index 168a266..0ffb5ac 100644 --- a/js/functions.js +++ b/js/functions.js @@ -171,16 +171,14 @@ function discardHand() { const AURA_BLADE = 200; -function dealDamage(amount, exMod = 1, enemy = game.enemyAtt[1]) { - // extra damage - let exDamage = get.extraDamage(); - if (exMod) { - exDamage = Math.floor(exDamage * exMod); - }; - let damage = amount + exDamage; +function dealDamage(amount, exMod = 1, enemy = +game.enemyAtt[1], attacking = true) { + // setup + let damage = amount; + // increase damage + if (attacking) damage += get.extraDamage() * exMod; // multiply damage let mulDamage = 1; - if (game.eff.weakness) mulDamage = 0.75; + if (game.eff.weakness && attacking) mulDamage = 0.75; damage = Math.floor(damage * mulDamage); // damage enemy if (damage < game.enemies[enemy].shield) { diff --git a/js/game.js b/js/game.js index a1acaf9..375073e 100644 --- a/js/game.js +++ b/js/game.js @@ -100,7 +100,7 @@ function startTurn() { // end of enemy turn effects for (let index = 0; index < game.enemies.length; index++) { if (game.enemies[index].eff.burn) { - dealDamage(game.enemies[index].eff.burn, NaN, index); + dealDamage(game.enemies[index].eff.burn, 0, index, false); game.enemies[index].eff.burn--; }; }; @@ -226,13 +226,11 @@ function playerTurn() { }; function enemyTurn() { - if (game.enemyNum >= game.enemies.length) { - game.enemyNum = 0; - startTurn(); + if (game.enemyNum < game.enemies.length) { + if (game.enemyStage === ENDING) game.enemies[game.enemyNum].finishAction(); + else if (game.enemyStage === MIDDLE) game.enemies[game.enemyNum].middleAction(); + else if (game.enemyStage !== PENDING) game.enemies[game.enemyNum].startAction(); }; - if (game.enemyStage === ENDING) game.enemies[game.enemyNum].finishAction(); - else if (game.enemyStage === MIDDLE) game.enemies[game.enemyNum].middleAction(); - else if (game.enemyStage !== PENDING) game.enemies[game.enemyNum].startAction(); }; function selection() { diff --git a/js/graphics.js b/js/graphics.js index 5a1d936..895e781 100644 --- a/js/graphics.js +++ b/js/graphics.js @@ -621,9 +621,7 @@ function enemyGraphics() { if (tempAnim[0] >= 7) { tempAnim = [0, -1, STARTING, -1]; game.enemyStage = ENDING; - } else if (game.enemyStage === MIDDLE) { - game.enemyStage = PENDING; - } else if (tempAnim[0] >= 4) { + } else if (tempAnim[0] == 4) { game.enemyStage = MIDDLE; } else { game.enemyStage = PENDING;