diff --git a/data/json/vitamin.json b/data/json/vitamin.json index d724eb2457ab3..f3dd1c7d6300a 100644 --- a/data/json/vitamin.json +++ b/data/json/vitamin.json @@ -517,6 +517,7 @@ "type": "vitamin", "vit_type": "counter", "name": { "str": "Consumed human flesh" }, + "flags": [ "NO_SELL" ], "min": 0, "max": 10000, "rate": "1 h" diff --git a/src/item.cpp b/src/item.cpp index 9b791a9a7e605..25270e5c6bf2d 100644 --- a/src/item.cpp +++ b/src/item.cpp @@ -229,6 +229,7 @@ static const vitamin_id vitamin_human_flesh_vitamin( "human_flesh_vitamin" ); // vitamin flags static const std::string flag_NO_DISPLAY( "NO_DISPLAY" ); +static const std::string flag_NO_SELL( "NO_SELL" ); // fault flags static const std::string flag_BLACKPOWDER_FOULING_DAMAGE( "BLACKPOWDER_FOULING_DAMAGE" ); @@ -7120,6 +7121,16 @@ int item::price_no_contents( bool practical, std::optional price_override ) price *= fault->price_mod(); } + if( is_food() && get_comestible() ) { + const nutrients &nutrients_value = default_character_compute_effective_nutrients( *this ); + for( const std::pair &vit_pair : nutrients_value.vitamins() ) { + if( vit_pair.first->has_flag( flag_NO_SELL ) ) { + price = 0.0; + } + } + } + + return price; }