From 3a311c8bb619cbeb57f24fd7b6822d46a29bab77 Mon Sep 17 00:00:00 2001 From: shni Date: Thu, 9 Oct 2025 01:57:58 -0500 Subject: [PATCH] =?UTF-8?q?feat:=20agregar=20l=C3=B3gica=20de=20penalizaci?= =?UTF-8?q?=C3=B3n=20por=20fatiga=20en=20recompensas;=20actualizar=20tipos?= =?UTF-8?q?=20de=20recompensa=20para=20incluir=20monedas=20base=20y=20mone?= =?UTF-8?q?das=20despu=C3=A9s=20de=20la=20penalizaci=C3=B3n?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- src/commands/messages/game/mina.ts | 20 ++++++++++++-------- src/commands/messages/game/pelear.ts | 20 ++++++++++++-------- src/commands/messages/game/pescar.ts | 20 ++++++++++++-------- src/game/minigames/types.ts | 2 ++ 4 files changed, 38 insertions(+), 24 deletions(-) diff --git a/src/commands/messages/game/mina.ts b/src/commands/messages/game/mina.ts index d13fb9e..4f347ab 100644 --- a/src/commands/messages/game/mina.ts +++ b/src/commands/messages/game/mina.ts @@ -103,14 +103,18 @@ export const command: CommandMessage = { }) .join("\n") : "• —"; - if ( - result.rewardModifiers?.fatigueCoinMultiplier != null && - result.rewardModifiers.fatigueCoinMultiplier < 1 - ) { - const pct = Math.round( - (1 - result.rewardModifiers.fatigueCoinMultiplier) * 100 - ); - rewardLines += `\n (⚠️ Fatiga -${pct}% monedas)`; + if (result.rewardModifiers?.baseCoinsAwarded != null) { + const { baseCoinsAwarded, coinsAfterPenalty, fatigueCoinMultiplier } = + result.rewardModifiers; + if ( + fatigueCoinMultiplier != null && + fatigueCoinMultiplier < 1 && + baseCoinsAwarded != null && + coinsAfterPenalty != null + ) { + const pct = Math.round((1 - fatigueCoinMultiplier) * 100); + rewardLines += `\n (⚠️ Fatiga: monedas base ${baseCoinsAwarded} → ${coinsAfterPenalty} (-${pct}%) )`; + } } const mobsLines = result.mobs.length ? result.mobs.map((m) => `• ${m}`).join("\n") diff --git a/src/commands/messages/game/pelear.ts b/src/commands/messages/game/pelear.ts index 472d4f8..abc53c3 100644 --- a/src/commands/messages/game/pelear.ts +++ b/src/commands/messages/game/pelear.ts @@ -113,14 +113,18 @@ export const command: CommandMessage = { }) .join("\n") : "• —"; - if ( - result.rewardModifiers?.fatigueCoinMultiplier != null && - result.rewardModifiers.fatigueCoinMultiplier < 1 - ) { - const pct = Math.round( - (1 - result.rewardModifiers.fatigueCoinMultiplier) * 100 - ); - rewardLines += `\n (⚠️ Fatiga -${pct}% monedas)`; + if (result.rewardModifiers?.baseCoinsAwarded != null) { + const { baseCoinsAwarded, coinsAfterPenalty, fatigueCoinMultiplier } = + result.rewardModifiers; + if ( + fatigueCoinMultiplier != null && + fatigueCoinMultiplier < 1 && + baseCoinsAwarded != null && + coinsAfterPenalty != null + ) { + const pct = Math.round((1 - fatigueCoinMultiplier) * 100); + rewardLines += `\n (⚠️ Fatiga: monedas base ${baseCoinsAwarded} → ${coinsAfterPenalty} (-${pct}%) )`; + } } const mobsLines = result.mobs.length ? result.mobs.map((m) => `• ${m}`).join("\n") diff --git a/src/commands/messages/game/pescar.ts b/src/commands/messages/game/pescar.ts index 1041d2b..b454cdf 100644 --- a/src/commands/messages/game/pescar.ts +++ b/src/commands/messages/game/pescar.ts @@ -99,14 +99,18 @@ export const command: CommandMessage = { }) .join("\n") : "• —"; - if ( - result.rewardModifiers?.fatigueCoinMultiplier != null && - result.rewardModifiers.fatigueCoinMultiplier < 1 - ) { - const pct = Math.round( - (1 - result.rewardModifiers.fatigueCoinMultiplier) * 100 - ); - rewardLines += `\n (⚠️ Fatiga -${pct}% monedas)`; + if (result.rewardModifiers?.baseCoinsAwarded != null) { + const { baseCoinsAwarded, coinsAfterPenalty, fatigueCoinMultiplier } = + result.rewardModifiers; + if ( + fatigueCoinMultiplier != null && + fatigueCoinMultiplier < 1 && + baseCoinsAwarded != null && + coinsAfterPenalty != null + ) { + const pct = Math.round((1 - fatigueCoinMultiplier) * 100); + rewardLines += `\n (⚠️ Fatiga: monedas base ${baseCoinsAwarded} → ${coinsAfterPenalty} (-${pct}%) )`; + } } const mobsLines = result.mobs.length ? result.mobs.map((m) => `• ${m}`).join("\n") diff --git a/src/game/minigames/types.ts b/src/game/minigames/types.ts index 7e43e02..73cdce3 100644 --- a/src/game/minigames/types.ts +++ b/src/game/minigames/types.ts @@ -66,6 +66,8 @@ export type RunResult = { rewardModifiers?: { fatigueCoinMultiplier?: number; // 0.85 si hay -15% fatigueMagnitude?: number; // magnitud original del efecto + baseCoinsAwarded?: number; // suma antes de aplicar multiplicador de fatiga + coinsAfterPenalty?: number; // suma final depositada en wallet }; };