Skip to content

Commit

Permalink
Ask for confirmation on eating raw meat
Browse files Browse the repository at this point in the history
  • Loading branch information
RipleyTom authored and kevingranade committed May 4, 2020
1 parent 3928c8f commit 2d5cca7
Show file tree
Hide file tree
Showing 4 changed files with 11 additions and 3 deletions.
2 changes: 2 additions & 0 deletions src/character.h
Original file line number Diff line number Diff line change
Expand Up @@ -148,6 +148,8 @@ enum edible_rating {
ALLERGY_WEAK,
// Cannibalism (unless psycho/cannibal)
CANNIBALISM,
// This has parasites
PARASITES,
// Rotten or not rotten enough (for saprophages)
ROTTEN,
// Can provoke vomiting if you already feel nauseous.
Expand Down
5 changes: 5 additions & 0 deletions src/consumption.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -757,6 +757,11 @@ ret_val<edible_rating> Character::will_eat( const item &food, bool interactive )
add_consequence( _( "The thought of eating human flesh makes you feel sick." ), CANNIBALISM );
}

if( food.get_comestible()->parasites > 0 && !food.has_flag( flag_NO_PARASITES ) &&
!( has_bionic( bio_digestion ) || has_trait( trait_PARAIMMUNE ) ) ) {
add_consequence( _( "Eating this raw meat probably isn't very healthy." ), PARASITES );
}

const bool edible = comest->comesttype == comesttype_FOOD || food.has_flag( flag_USE_EAT_VERB );

if( edible && has_effect( effect_nausea ) ) {
Expand Down
1 change: 1 addition & 0 deletions src/item.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -3895,6 +3895,7 @@ nc_color item::color_in_inventory() const
case ALLERGY:
case ALLERGY_WEAK:
case CANNIBALISM:
case PARASITES:
ret = c_red;
break;
case ROTTEN:
Expand Down
6 changes: 3 additions & 3 deletions tests/char_edible_rating_test.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -477,12 +477,12 @@ TEST_CASE( "who will eat rotten food", "[will_eat][edible_rating][rotten]" )
}
}

TEST_CASE( "who will eat human flesh", "[will_eat][edible_rating][cannibal]" )
TEST_CASE( "who will eat cooked human flesh", "[will_eat][edible_rating][cannibal]" )
{
avatar dummy;

GIVEN( "some human flesh" ) {
item flesh( "human_flesh" );
GIVEN( "some cooked human flesh" ) {
item flesh( "human_cooked" );
REQUIRE( flesh.has_flag( "CANNIBALISM" ) );

WHEN( "character is not a cannibal" ) {
Expand Down

0 comments on commit 2d5cca7

Please sign in to comment.