diff --git a/data/json/snippets/health_msgs.json b/data/json/snippets/health_msgs.json index 9ade8a81653f6..a70ea9e0db995 100644 --- a/data/json/snippets/health_msgs.json +++ b/data/json/snippets/health_msgs.json @@ -148,5 +148,45 @@ "type": "snippet", "category": "health_horrible", "text": "Awareness seems to only come with a battle… and your body seem to be on its side." + }, + { + "type": "snippet", + "category": "empty_starving", + "text": "You're too weak to be hungry anymore. Is this what starving to death feels like?" + }, + { + "type": "snippet", + "category": "starving", + "text": "Even though you've eaten not too long ago you still feel drained of energy. It will take more than that to get you back up." + }, + { + "type": "snippet", + "category": "empty_emaciated", + "text": "Your empty stomach gnaws at you. You really need something to eat." + }, + { + "type": "snippet", + "category": "emaciated", + "text": "You are EMACIATED!" + }, + { + "type": "snippet", + "category": "empty_malnutrition", + "text": "You feel weak due to malnutrition." + }, + { + "type": "snippet", + "category": "malnutrition", + "text": "Despite having something in your stomach, you still feel like you haven't eaten in days…" + }, + { + "type": "snippet", + "category": "empty_low_cal", + "text": "You've lost quite a bit of weight recently. You might want to eat richer food." + }, + { + "type": "snippet", + "category": "low_cal", + "text": "You feel that your body needs more nutritious food." } ] diff --git a/src/character.cpp b/src/character.cpp index aa7b4a99a2be7..483e2bc178cd8 100644 --- a/src/character.cpp +++ b/src/character.cpp @@ -4128,29 +4128,33 @@ void Character::check_needs_extremes() hp_cur[hp_torso] = 0; } else { if( calendar::once_every( 1_hours ) ) { - std::string message; + std::string category; if( stomach.contains() <= stomach.capacity( *this ) / 4 ) { if( get_kcal_percent() < 0.1f ) { - message = _( "Food…" ); + category = "starving"; } else if( get_kcal_percent() < 0.25f ) { - message = _( "Due to insufficient nutrition, your body is suffering from starvation." ); + category = "emaciated"; } else if( get_kcal_percent() < 0.5f ) { - message = _( "Despite having something in your stomach, you still feel like you haven't eaten in days…" ); + category = "malnutrition"; } else if( get_kcal_percent() < 0.8f ) { - message = _( "Your stomach feels so empty…" ); + category = "low_cal"; } } else { if( get_kcal_percent() < 0.1f ) { - message = _( "Food…" ); + category = "empty_starving"; } else if( get_kcal_percent() < 0.25f ) { - message = _( "You are EMACIATED!" ); + category = "empty_emaciated"; } else if( get_kcal_percent() < 0.5f ) { - message = _( "You feel weak due to malnutrition." ); + category = "empty_malnutrition"; } else if( get_kcal_percent() < 0.8f ) { - message = _( "You feel that your body needs more nutritious food." ); + category = "empty_low_cal"; } } - add_msg_if_player( m_warning, message ); + if( !category.empty() ) { + const translation message = SNIPPET.random_from_category( category ).value_or( translation() ); + add_msg_if_player( m_warning, message ); + } + } } }