Add immediate handling for deceased characters in health update: Implement logic to check if a character's health is less than or equal to zero and handle their death accordingly, improving character state management.
This commit is contained in:
@@ -175,6 +175,12 @@ impl UserCharacterWorker {
|
||||
}
|
||||
|
||||
fn update_character_health(&mut self, character: &mut Character) -> Result<(), DbError> {
|
||||
// Bereits verstorbene Charaktere (health <= 0) sofort behandeln
|
||||
if character.health <= 0 {
|
||||
self.handle_character_death(character.id)?;
|
||||
return Ok(());
|
||||
}
|
||||
|
||||
let health_change = self.calculate_health_change(character.age);
|
||||
if health_change == 0 {
|
||||
return Ok(());
|
||||
|
||||
Reference in New Issue
Block a user