From 0a0b0e20d541154e83e6bf03de9160850489229d Mon Sep 17 00:00:00 2001 From: Kent Rasmussen Date: Sun, 30 Mar 2025 17:19:29 +0900 Subject: [PATCH] have fear affect heal, too --- node/server.js | 26 +++++++++++++++----------- 1 file changed, 15 insertions(+), 11 deletions(-) diff --git a/node/server.js b/node/server.js index 13504bc..4349f78 100644 --- a/node/server.js +++ b/node/server.js @@ -1418,20 +1418,24 @@ function calculate_player_stats(player) { (player.level > 20 && 0.04) || 0.05; - var excess = max( + player.fear = Math.max( 0, - max(player.targets_p - player.courage, max(player.targets_m - player.mcourage, player.targets_u - player.pcourage)), + player.targets_p - player.courage, + player.targets_m - player.mcourage, + player.targets_u - player.pcourage, ); - var sredux = [0, 20, 40, 70, 80, 90, 100]; - player.speed -= sredux[min(sredux.length - 1, excess)]; - if (excess > 2) { - player.attack = round(player.attack * 0.2); - } else if (excess > 1) { - player.attack = round(player.attack * 0.4); - } else if (excess) { - player.attack = round(player.attack * 0.6); + const sredux = [0, 20, 40, 70, 80, 90, 100]; + player.speed -= sredux[Math.min(sredux.length - 1, player.fear)]; + if (player.fear > 2) { + player.attack = Math.round(player.attack * 0.2); + player.heal = Math.round(player.heal * 0.2); + } else if (player.fear > 1) { + player.attack = Math.round(player.attack * 0.4); + player.heal = Math.round(player.heal * 0.4); + } else if (player.fear) { + player.attack = Math.round(player.attack * 0.6); + player.heal = Math.round(player.heal * 0.6); } - player.fear = excess; if (player.map == "winterland") { player.speed *= 0.95;