Adjust event probabilities in EventsWorker: Reduce the occurrence rates of various random events to 25% of their original values for better game balance. Update character health change effects to limit maximum health reduction based on user feedback. Enhance notification structure to include money change details for improved frontend access.
This commit is contained in:
@@ -162,7 +162,7 @@ impl EventsWorker {
|
|||||||
vec![
|
vec![
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "windfall".to_string(),
|
id: "windfall".to_string(),
|
||||||
probability_per_minute: 0.01, // 1% pro Minute
|
probability_per_minute: 0.0025, // 0.25% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Personal,
|
event_type: EventType::Personal,
|
||||||
title: "Unerwarteter Geldsegen".to_string(),
|
title: "Unerwarteter Geldsegen".to_string(),
|
||||||
description: "Du findest eine vergessene Geldbörse auf der Straße.".to_string(),
|
description: "Du findest eine vergessene Geldbörse auf der Straße.".to_string(),
|
||||||
@@ -176,7 +176,7 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "theft".to_string(),
|
id: "theft".to_string(),
|
||||||
probability_per_minute: 0.008, // 0.8% pro Minute
|
probability_per_minute: 0.002, // 0.2% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Personal,
|
event_type: EventType::Personal,
|
||||||
title: "Diebstahl".to_string(),
|
title: "Diebstahl".to_string(),
|
||||||
description: "Ein Dieb hat einen Teil deines Geldes gestohlen.".to_string(),
|
description: "Ein Dieb hat einen Teil deines Geldes gestohlen.".to_string(),
|
||||||
@@ -190,7 +190,7 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "regional_storm".to_string(),
|
id: "regional_storm".to_string(),
|
||||||
probability_per_minute: 0.005, // 0.5% pro Minute
|
probability_per_minute: 0.00125, // 0.125% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Regional,
|
event_type: EventType::Regional,
|
||||||
title: "Sturm in der Region".to_string(),
|
title: "Sturm in der Region".to_string(),
|
||||||
description: "Ein schwerer Sturm hat die Region getroffen.".to_string(),
|
description: "Ein schwerer Sturm hat die Region getroffen.".to_string(),
|
||||||
@@ -234,7 +234,7 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "regional_festival".to_string(),
|
id: "regional_festival".to_string(),
|
||||||
probability_per_minute: 0.003, // 0.3% pro Minute
|
probability_per_minute: 0.00075, // 0.075% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Regional,
|
event_type: EventType::Regional,
|
||||||
title: "Regionales Fest".to_string(),
|
title: "Regionales Fest".to_string(),
|
||||||
description: "Ein großes Fest findet in der Region statt.".to_string(),
|
description: "Ein großes Fest findet in der Region statt.".to_string(),
|
||||||
@@ -253,7 +253,7 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "warehouse_fire".to_string(),
|
id: "warehouse_fire".to_string(),
|
||||||
probability_per_minute: 0.002, // 0.2% pro Minute
|
probability_per_minute: 0.0005, // 0.05% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Personal,
|
event_type: EventType::Personal,
|
||||||
title: "Lagerbrand".to_string(),
|
title: "Lagerbrand".to_string(),
|
||||||
description: "Ein Feuer hat Teile deines Lagers beschädigt.".to_string(),
|
description: "Ein Feuer hat Teile deines Lagers beschädigt.".to_string(),
|
||||||
@@ -286,21 +286,22 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "character_illness".to_string(),
|
id: "character_illness".to_string(),
|
||||||
probability_per_minute: 0.01, // 1% pro Minute
|
probability_per_minute: 0.0025, // 0.25% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Personal,
|
event_type: EventType::Personal,
|
||||||
title: "Krankheit".to_string(),
|
title: "Krankheit".to_string(),
|
||||||
description: "Ein Charakter ist erkrankt und hat an Gesundheit verloren.".to_string(),
|
description: "Ein Charakter ist erkrankt und hat an Gesundheit verloren.".to_string(),
|
||||||
effects: vec![
|
effects: vec![
|
||||||
EventEffect::CharacterHealthChange {
|
EventEffect::CharacterHealthChange {
|
||||||
probability: 1.0,
|
probability: 1.0,
|
||||||
min_change: -20,
|
// Soll nur leicht reduzieren: maximal -12 (User-Wunsch)
|
||||||
max_change: -5,
|
min_change: -12,
|
||||||
|
max_change: -3,
|
||||||
},
|
},
|
||||||
],
|
],
|
||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "character_recovery".to_string(),
|
id: "character_recovery".to_string(),
|
||||||
probability_per_minute: 0.008, // 0.8% pro Minute
|
probability_per_minute: 0.002, // 0.2% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Personal,
|
event_type: EventType::Personal,
|
||||||
title: "Genesung".to_string(),
|
title: "Genesung".to_string(),
|
||||||
description: "Ein Charakter hat sich von einer Krankheit erholt.".to_string(),
|
description: "Ein Charakter hat sich von einer Krankheit erholt.".to_string(),
|
||||||
@@ -314,7 +315,7 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "character_accident".to_string(),
|
id: "character_accident".to_string(),
|
||||||
probability_per_minute: 0.003, // 0.3% pro Minute
|
probability_per_minute: 0.00075, // 0.075% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Personal,
|
event_type: EventType::Personal,
|
||||||
title: "Unfall".to_string(),
|
title: "Unfall".to_string(),
|
||||||
description: "Ein schwerer Unfall hat einen Charakter schwer verletzt.".to_string(),
|
description: "Ein schwerer Unfall hat einen Charakter schwer verletzt.".to_string(),
|
||||||
@@ -331,7 +332,7 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "regional_epidemic".to_string(),
|
id: "regional_epidemic".to_string(),
|
||||||
probability_per_minute: 0.002, // 0.2% pro Minute
|
probability_per_minute: 0.0005, // 0.05% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Regional,
|
event_type: EventType::Regional,
|
||||||
title: "Epidemie".to_string(),
|
title: "Epidemie".to_string(),
|
||||||
description: "Eine Seuche hat die Region erfasst.".to_string(),
|
description: "Eine Seuche hat die Region erfasst.".to_string(),
|
||||||
@@ -348,11 +349,11 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "sudden_infant_death".to_string(),
|
id: "sudden_infant_death".to_string(),
|
||||||
// Wahrscheinlichkeit pro Minute: 0.0005 (0.05%)
|
// Wahrscheinlichkeit pro Minute: 0.000125 (0.0125%) - reduziert auf 25% der ursprünglichen Rate
|
||||||
// Im Mittelalter starben etwa 30-40% der Kinder vor dem 2. Geburtstag
|
// Im Mittelalter starben etwa 30-40% der Kinder vor dem 2. Geburtstag
|
||||||
// Diese Wahrscheinlichkeit führt bei regelmäßiger Prüfung zu einer
|
// Diese Wahrscheinlichkeit führt bei regelmäßiger Prüfung zu einer
|
||||||
// realistischen mittelalterlichen Säuglingssterblichkeit
|
// realistischen mittelalterlichen Säuglingssterblichkeit
|
||||||
probability_per_minute: 0.0005,
|
probability_per_minute: 0.000125,
|
||||||
event_type: EventType::Personal,
|
event_type: EventType::Personal,
|
||||||
title: "Plötzlicher Kindstod".to_string(),
|
title: "Plötzlicher Kindstod".to_string(),
|
||||||
description: "Ein Kleinkind ist plötzlich verstorben.".to_string(),
|
description: "Ein Kleinkind ist plötzlich verstorben.".to_string(),
|
||||||
@@ -364,7 +365,7 @@ impl EventsWorker {
|
|||||||
},
|
},
|
||||||
RandomEvent {
|
RandomEvent {
|
||||||
id: "earthquake".to_string(),
|
id: "earthquake".to_string(),
|
||||||
probability_per_minute: 0.001, // 0.1% pro Minute (sehr selten)
|
probability_per_minute: 0.00025, // 0.025% pro Minute (reduziert auf 25% der ursprünglichen Rate)
|
||||||
event_type: EventType::Regional,
|
event_type: EventType::Regional,
|
||||||
title: "Erdbeben".to_string(),
|
title: "Erdbeben".to_string(),
|
||||||
description: "Ein Erdbeben hat die Region erschüttert.".to_string(),
|
description: "Ein Erdbeben hat die Region erschüttert.".to_string(),
|
||||||
@@ -703,6 +704,11 @@ impl EventsWorker {
|
|||||||
(None, None)
|
(None, None)
|
||||||
};
|
};
|
||||||
|
|
||||||
|
// Extrahiere Geld-Beträge aus Effekten (für Diebstahl/Geldsegen)
|
||||||
|
let money_change_info = effect_results.iter().find(|e| e.get("type") == Some(&json!("money_change")));
|
||||||
|
let money_percent = money_change_info.and_then(|e| e.get("percent").and_then(|v| v.as_f64()));
|
||||||
|
let money_absolute = money_change_info.and_then(|e| e.get("absolute").and_then(|v| v.as_f64()));
|
||||||
|
|
||||||
// Frontend: `tr` ist der i18n-Key, Details liegen in `value` (Interpolation/Detailansicht)
|
// Frontend: `tr` ist der i18n-Key, Details liegen in `value` (Interpolation/Detailansicht)
|
||||||
let mut notification_json = serde_json::json!({
|
let mut notification_json = serde_json::json!({
|
||||||
"tr": format!("random_event.{}", event.id),
|
"tr": format!("random_event.{}", event.id),
|
||||||
@@ -724,6 +730,13 @@ impl EventsWorker {
|
|||||||
if let Some(ln_) = top_last_name {
|
if let Some(ln_) = top_last_name {
|
||||||
notification_json["value"]["character_last_name"] = serde_json::json!(ln_);
|
notification_json["value"]["character_last_name"] = serde_json::json!(ln_);
|
||||||
}
|
}
|
||||||
|
// Geld-Beträge direkt im value-Objekt für einfachen Frontend-Zugriff
|
||||||
|
if let Some(percent) = money_percent {
|
||||||
|
notification_json["value"]["money_change_percent"] = serde_json::json!(percent);
|
||||||
|
}
|
||||||
|
if let Some(absolute) = money_absolute {
|
||||||
|
notification_json["value"]["money_change_absolute"] = serde_json::json!(absolute);
|
||||||
|
}
|
||||||
|
|
||||||
Self::notify_user(
|
Self::notify_user(
|
||||||
pool,
|
pool,
|
||||||
|
|||||||
Reference in New Issue
Block a user