From e57de7f983b9b1ea49baf1d330eea252979ec858 Mon Sep 17 00:00:00 2001 From: "Torsten Schulz (local)" Date: Tue, 2 Dec 2025 13:05:39 +0100 Subject: [PATCH] Fix typo in healthDrunkOfLife method and enhance health change logic in FalukantService; refactor health measures localization structure in English and German JSON files for better organization. --- backend/services/falukantService.js | 17 ++++++++++++++--- frontend/src/i18n/locales/de/falukant.json | 12 +++++++----- frontend/src/i18n/locales/en/falukant.json | 12 +++++++----- 3 files changed, 28 insertions(+), 13 deletions(-) diff --git a/backend/services/falukantService.js b/backend/services/falukantService.js index d6abcfd..ed7421f 100644 --- a/backend/services/falukantService.js +++ b/backend/services/falukantService.js @@ -213,7 +213,7 @@ class FalukantService extends BaseService { { tr: "doctor", method: "healthDoctor", cost: 50 }, { tr: "witch", method: "healthWitch", cost: 500 }, { tr: "pill", method: "healthPill", cost: 5000 }, - { tr: "drunkOfLife", method: "healthDruckOfLife", cost: 5000000 } + { tr: "drunkOfLife", method: "healthDrunkOfLife", cost: 5000000 } ]; static RECURSIVE_REGION_SEARCH = ` @@ -3189,8 +3189,19 @@ class FalukantService extends BaseService { } async healthDrunkOfLife(user) { - const raw = Math.floor(Math.random() * 26); - return this.healthChange(user, raw); + // Erfolgschance: 90% + const success = Math.random() < 0.9; + + let delta; + if (success) { + // Bei Erfolg: Gesundheit um 5-35% verbessern + delta = Math.floor(Math.random() * 31) + 5; // 5-35 + } else { + // Bei Misserfolg: Gesundheit um 1-10% verschlechtern + delta = -(Math.floor(Math.random() * 10) + 1); // -1 bis -10 + } + + return this.healthChange(user, delta); } async getPoliticsOverview(hashedUserId) { diff --git a/frontend/src/i18n/locales/de/falukant.json b/frontend/src/i18n/locales/de/falukant.json index 8248318..4dd7afe 100644 --- a/frontend/src/i18n/locales/de/falukant.json +++ b/frontend/src/i18n/locales/de/falukant.json @@ -439,11 +439,13 @@ "new nobility title": "Neuer Adelstitel", "partyOrder": "Fest bestellt", "renovation_all": "Haus komplett renoviert", - "health.pill": "Gesundheitsmaßnahme: Tablette", - "health.doctor": "Gesundheitsmaßnahme: Arztbesuch", - "health.witch": "Gesundheitsmaßnahme: Hexe", - "health.drunkOfLife": "Gesundheitsmaßnahme: Trunk des Lebens", - "health.barber": "Gesundheitsmaßnahme: Barbier" + "health": { + "pill": "Gesundheitsmaßnahme: Tablette", + "doctor": "Gesundheitsmaßnahme: Arztbesuch", + "witch": "Gesundheitsmaßnahme: Hexe", + "drunkOfLife": "Gesundheitsmaßnahme: Trunk des Lebens", + "barber": "Gesundheitsmaßnahme: Barbier" + } } }, "newdirector": { diff --git a/frontend/src/i18n/locales/en/falukant.json b/frontend/src/i18n/locales/en/falukant.json index e6552f7..a0703ea 100644 --- a/frontend/src/i18n/locales/en/falukant.json +++ b/frontend/src/i18n/locales/en/falukant.json @@ -71,11 +71,13 @@ "new nobility title": "New title of nobility", "partyOrder": "Party ordered", "renovation_all": "House fully renovated", - "health.pill": "Health measure: pill", - "health.doctor": "Health measure: doctor", - "health.witch": "Health measure: witch", - "health.drunkOfLife": "Health measure: elixir of life", - "health.barber": "Health measure: barber" + "health": { + "pill": "Health measure: pill", + "doctor": "Health measure: doctor", + "witch": "Health measure: witch", + "drunkOfLife": "Health measure: elixir of life", + "barber": "Health measure: barber" + } } }, "newdirector": {