From 18d7d65d068c44987142c0dec1ec79dae9b38b8e Mon Sep 17 00:00:00 2001 From: Viss Valdyr <33199510+Lamandus@users.noreply.github.com> Date: Fri, 15 Mar 2024 12:39:11 +0100 Subject: [PATCH] fix(balance): changes in perishables (#4357) * fix(balance): changes in perishables * test change * another test. * style(autofix.ci): automated formatting --------- Co-authored-by: autofix-ci[bot] <114827586+autofix-ci[bot]@users.noreply.github.com> --- data/json/items/comestibles/bread.json | 2 +- data/json/items/comestibles/drink.json | 4 +-- data/json/items/comestibles/drink_other.json | 5 ++- data/json/items/comestibles/junkfood.json | 2 -- data/json/items/comestibles/nuts.json | 3 -- data/json/items/comestibles/other.json | 2 -- data/json/items/comestibles/raw_fruit.json | 8 ++--- data/json/items/comestibles/raw_veggy.json | 1 - data/json/items/comestibles/veggy_dishes.json | 3 +- data/json/items/comestibles/wheat.json | 2 +- tests/char_edible_rating_test.cpp | 31 ++++++++++--------- tests/modify_morale_test.cpp | 28 ++++++++--------- 12 files changed, 40 insertions(+), 51 deletions(-) diff --git a/data/json/items/comestibles/bread.json b/data/json/items/comestibles/bread.json index d4add6178a41..fc73968d0bcc 100644 --- a/data/json/items/comestibles/bread.json +++ b/data/json/items/comestibles/bread.json @@ -288,7 +288,7 @@ "name": "wastebread", "weight": "60 g", "color": "white", - "spoils_in": 990, + "spoils_in": "30 days", "comestible_type": "FOOD", "symbol": "%", "quench": -3, diff --git a/data/json/items/comestibles/drink.json b/data/json/items/comestibles/drink.json index 4e017287bc44..3b6d22201b26 100644 --- a/data/json/items/comestibles/drink.json +++ b/data/json/items/comestibles/drink.json @@ -334,7 +334,7 @@ "name": "cranberry juice", "weight": "250 g", "color": "magenta", - "spoils_in": "20 d", + "spoils_in": "20 days", "container": "bottle_plastic", "comestible_type": "DRINK", "symbol": "~", @@ -663,7 +663,7 @@ "name": { "str_sp": "milk" }, "weight": "258 g", "color": "white", - "spoils_in": "1 d", + "spoils_in": "1 day", "container": "jug_plastic", "comestible_type": "DRINK", "symbol": "~", diff --git a/data/json/items/comestibles/drink_other.json b/data/json/items/comestibles/drink_other.json index 303ab3619a9a..33088d72ad17 100644 --- a/data/json/items/comestibles/drink_other.json +++ b/data/json/items/comestibles/drink_other.json @@ -81,7 +81,7 @@ "comestible_type": "DRINK", "container": "condiment_bottle_unsealed", "calories": 21, - "spoils_in": 600, + "spoils_in": "15 days", "charges": 16, "fun": -1, "phase": "liquid" @@ -102,7 +102,7 @@ "container": "condiment_bottle_unsealed", "fun": -1, "calories": 10, - "spoils_in": 600, + "spoils_in": "15 days", "charges": 48, "phase": "liquid", "vitamins": [ [ "iron", 2 ] ] @@ -134,7 +134,6 @@ "type": "COMESTIBLE", "symbol": "~", "color": "brown", - "spoils_in": "180 days", "name": "peanut butter", "description": "A brown goo that tastes very little like its namesake. It's not bad, but it'll stick to the roof of your mouth.", "price": "195 cent", diff --git a/data/json/items/comestibles/junkfood.json b/data/json/items/comestibles/junkfood.json index 8d53c261745f..d90db92406fa 100644 --- a/data/json/items/comestibles/junkfood.json +++ b/data/json/items/comestibles/junkfood.json @@ -5,7 +5,6 @@ "name": "toast-em", "weight": "50 g", "color": "red", - "spoils_in": "90 days", "container": "box_small", "comestible_type": "FOOD", "symbol": "%", @@ -228,7 +227,6 @@ "name": { "str_sp": "s'mores" }, "weight": "180 g", "color": "brown", - "spoils_in": "90 days", "container": "bag_plastic", "comestible_type": "FOOD", "symbol": "%", diff --git a/data/json/items/comestibles/nuts.json b/data/json/items/comestibles/nuts.json index 4be8870f804d..7e890b49ca36 100644 --- a/data/json/items/comestibles/nuts.json +++ b/data/json/items/comestibles/nuts.json @@ -104,7 +104,6 @@ "looks_like": "granola", "weight": "30 g", "color": "brown", - "spoils_in": "300 days", "comestible_type": "FOOD", "symbol": "%", "calories": 184, @@ -318,7 +317,6 @@ "name": { "str_sp": "roasted edamame" }, "weight": "30 g", "color": "brown", - "spoils_in": "240 days", "comestible_type": "FOOD", "symbol": "%", "healthy": 2, @@ -340,7 +338,6 @@ "name": { "str_sp": "roasted soy nuts" }, "weight": "30 g", "color": "brown", - "spoils_in": "240 days", "comestible_type": "FOOD", "symbol": "%", "healthy": 2, diff --git a/data/json/items/comestibles/other.json b/data/json/items/comestibles/other.json index 71c4fc613d23..b7430a402cec 100644 --- a/data/json/items/comestibles/other.json +++ b/data/json/items/comestibles/other.json @@ -380,7 +380,6 @@ "symbol": ".", "color": "yellow", "healthy": -5, - "spoils_in": "364 days", "calories": 56, "description": "Light brown beans, they have many uses, mildly toxic and not recommended, but you could eat them raw.", "price": "90 cent", @@ -590,7 +589,6 @@ "vitamins": [ [ "vitA", 20 ], [ "vitC", 45 ], [ "calcium", 5 ], [ "iron", 5 ] ], "fun": 5, "color": "brown", - "spoils_in": "730 days", "flags": [ "INEDIBLE", "CATTLE" ], "use_action": "CATTLEFODDER" }, diff --git a/data/json/items/comestibles/raw_fruit.json b/data/json/items/comestibles/raw_fruit.json index 1a0a3b0ea7a4..955ff00197a7 100644 --- a/data/json/items/comestibles/raw_fruit.json +++ b/data/json/items/comestibles/raw_fruit.json @@ -48,7 +48,6 @@ "name": { "str_sp": "cacao pod" }, "weight": "508 g", "color": "yellow_yellow", - "spoils_in": "360 days", "comestible_type": "FOOD", "symbol": "%", "quench": 2, @@ -160,7 +159,7 @@ "name": { "str_sp": "cranberries" }, "weight": "116 g", "color": "red", - "spoils_in": 640, + "spoils_in": "12 days", "comestible_type": "FOOD", "symbol": "%", "quench": 2, @@ -336,7 +335,7 @@ "name": "grapefruit", "weight": "246 g", "color": "yellow", - "spoils_in": 336, + "spoils_in": "5 days", "comestible_type": "FOOD", "symbol": "%", "quench": 18, @@ -448,7 +447,6 @@ "name": "coconut", "weight": "84 g", "color": "brown", - "spoils_in": "360 days", "comestible_type": "FOOD", "symbol": "%", "quench": 2, @@ -587,7 +585,7 @@ "name": "pomegranate", "weight": "184 g", "color": "red", - "spoils_in": 336, + "spoils_in": "5 days", "comestible_type": "FOOD", "symbol": "%", "quench": 12, diff --git a/data/json/items/comestibles/raw_veggy.json b/data/json/items/comestibles/raw_veggy.json index b0e68452d24e..90d2de6f0147 100644 --- a/data/json/items/comestibles/raw_veggy.json +++ b/data/json/items/comestibles/raw_veggy.json @@ -700,7 +700,6 @@ "name": "sugar beet", "weight": "143 g", "color": "brown", - "spoils_in": "95 days", "comestible_type": "FOOD", "symbol": "%", "calories": 62, diff --git a/data/json/items/comestibles/veggy_dishes.json b/data/json/items/comestibles/veggy_dishes.json index 652950a57512..88f6e8d97f01 100644 --- a/data/json/items/comestibles/veggy_dishes.json +++ b/data/json/items/comestibles/veggy_dishes.json @@ -39,7 +39,6 @@ "name": { "str_sp": "roasted garlic" }, "weight": "18 g", "color": "white", - "spoils_in": "180 days", "comestible_type": "FOOD", "symbol": "%", "quench": -1, @@ -513,7 +512,7 @@ "name": { "str_sp": "pesto" }, "weight": "65 g", "color": "light_green", - "spoils_in": 144, + "spoils_in": "3 days", "container": "jar_glass_sealed", "comestible_type": "FOOD", "symbol": "%", diff --git a/data/json/items/comestibles/wheat.json b/data/json/items/comestibles/wheat.json index 948bde3c6e0c..d9ea9f2d75c0 100644 --- a/data/json/items/comestibles/wheat.json +++ b/data/json/items/comestibles/wheat.json @@ -554,7 +554,7 @@ "color": "brown", "calories": 278, "fun": 4, - "spoils_in": 420, + "spoils_in": "14 days", "vitamins": [ [ "vitA", 8 ], [ "calcium", 2 ], [ "iron", 5 ] ], "flags": [ "EATEN_HOT" ] }, diff --git a/tests/char_edible_rating_test.cpp b/tests/char_edible_rating_test.cpp index 044261e45539..a277b91bdb88 100644 --- a/tests/char_edible_rating_test.cpp +++ b/tests/char_edible_rating_test.cpp @@ -280,11 +280,11 @@ TEST_CASE( "what you can drink with a proboscis", "[can_eat][edible_rating][prob } GIVEN( "food that must be chewed" ) { - item &toastem = *item::spawn_temporary( "toastem" ); - REQUIRE( toastem.get_comestible()->comesttype == "FOOD" ); + item &jihelucake = *item::spawn_temporary( "jihelucake" ); + REQUIRE( jihelucake.get_comestible()->comesttype == "FOOD" ); THEN( "they cannot drink it" ) { - expect_cannot_eat( dummy, toastem, expect_reason, edible_rating::inedible_mutation ); + expect_cannot_eat( dummy, jihelucake, expect_reason, edible_rating::inedible_mutation ); } } @@ -314,7 +314,7 @@ TEST_CASE( "can eat with nausea", "[will_eat][edible_rating][nausea]" ) { clear_all_state(); avatar dummy = prepare_avatar(); - item &toastem = *item::spawn_temporary( "toastem" ); + item &jihelucake = *item::spawn_temporary( "jihelucake" ); const efftype_id effect_nausea( "nausea" ); GIVEN( "character has nausea" ) { @@ -322,8 +322,9 @@ TEST_CASE( "can eat with nausea", "[will_eat][edible_rating][nausea]" ) REQUIRE( dummy.has_effect( effect_nausea ) ); THEN( "they can eat food, but it nauseates them" ) { - expect_can_eat( dummy, toastem ); - expect_will_eat( dummy, toastem, "You still feel nauseous and will probably puke it all up again.", + expect_can_eat( dummy, jihelucake ); + expect_will_eat( dummy, jihelucake, + "You still feel nauseous and will probably puke it all up again.", edible_rating::nausea ); } } @@ -353,18 +354,18 @@ TEST_CASE( "who will eat rotten food", "[will_eat][edible_rating][rotten]" ) avatar dummy = prepare_avatar(); GIVEN( "food just barely rotten" ) { - item &toastem_rotten = *item::spawn_temporary( "toastem" ); - toastem_rotten.set_relative_rot( 1.01 ); - REQUIRE( toastem_rotten.rotten() ); + item &jihelucake_rotten = *item::spawn_temporary( "jihelucake" ); + jihelucake_rotten.set_relative_rot( 1.01 ); + REQUIRE( jihelucake_rotten.rotten() ); WHEN( "character is normal" ) { REQUIRE_FALSE( dummy.has_trait( trait_id( "SAPROPHAGE" ) ) ); REQUIRE_FALSE( dummy.has_trait( trait_id( "SAPROVORE" ) ) ); THEN( "they can eat it, though they are disgusted by it" ) { - expect_can_eat( dummy, toastem_rotten ); + expect_can_eat( dummy, jihelucake_rotten ); - auto conseq = dummy.will_eat( toastem_rotten, false ); + auto conseq = dummy.will_eat( jihelucake_rotten, false ); CHECK( conseq.value() == edible_rating::rotten ); CHECK( conseq.str() == "This is rotten and smells awful!" ); } @@ -375,9 +376,9 @@ TEST_CASE( "who will eat rotten food", "[will_eat][edible_rating][rotten]" ) REQUIRE( dummy.has_trait( trait_id( "SAPROVORE" ) ) ); THEN( "they can eat it, and don't mind that it is rotten" ) { - expect_can_eat( dummy, toastem_rotten ); + expect_can_eat( dummy, jihelucake_rotten ); - auto conseq = dummy.will_eat( toastem_rotten, false ); + auto conseq = dummy.will_eat( jihelucake_rotten, false ); CHECK( conseq.value() == edible_rating::edible ); CHECK( conseq.str().empty() ); } @@ -388,9 +389,9 @@ TEST_CASE( "who will eat rotten food", "[will_eat][edible_rating][rotten]" ) REQUIRE( dummy.has_trait( trait_id( "SAPROPHAGE" ) ) ); THEN( "they can eat it, but would prefer it to be more rotten" ) { - expect_can_eat( dummy, toastem_rotten ); + expect_can_eat( dummy, jihelucake_rotten ); - auto conseq = dummy.will_eat( toastem_rotten, false ); + auto conseq = dummy.will_eat( jihelucake_rotten, false ); CHECK( conseq.value() == edible_rating::allergy_weak ); CHECK( conseq.str() == "Your stomach won't be happy (not rotten enough)." ); } diff --git a/tests/modify_morale_test.cpp b/tests/modify_morale_test.cpp index 2458b42710f2..53fc1044fc5a 100644 --- a/tests/modify_morale_test.cpp +++ b/tests/modify_morale_test.cpp @@ -47,15 +47,15 @@ TEST_CASE( "food enjoyability", "[food][modify_morale][fun]" ) std::pair fun; GIVEN( "food with positive fun" ) { - detached_ptr det = item::spawn( "toastem", calendar::start_of_cataclysm, + detached_ptr det = item::spawn( "jihelucake", calendar::start_of_cataclysm, item::default_charges_tag{} ); - item &toastem = *det; + item &jihelucake = *det; dummy.i_add( std::move( det ) ); - fun = dummy.fun_for( toastem ); + fun = dummy.fun_for( jihelucake ); REQUIRE( fun.first > 0 ); THEN( "character gets a morale bonus becase it tastes good" ) { - dummy.modify_morale( toastem ); + dummy.modify_morale( jihelucake ); CHECK( dummy.get_morale( MORALE_FOOD_GOOD ) >= fun.first ); } } @@ -389,31 +389,31 @@ TEST_CASE( "saprophage character", "[food][modify_morale][saprophage]" ) REQUIRE( dummy.has_trait( trait_SAPROPHAGE ) ); AND_GIVEN( "some rotten chewable food" ) { - detached_ptr det = item::spawn( "toastem", calendar::start_of_cataclysm, + detached_ptr det = item::spawn( "jihelucake", calendar::start_of_cataclysm, item::default_charges_tag{} ); - item &toastem = *det; + item &jihelucake = *det; dummy.i_add( std::move( det ) ); // food rot > 1.0 is rotten - toastem.set_relative_rot( 1.5 ); - REQUIRE( toastem.rotten() ); + jihelucake.set_relative_rot( 1.5 ); + REQUIRE( jihelucake.rotten() ); THEN( "they enjoy it" ) { - dummy.modify_morale( toastem ); + dummy.modify_morale( jihelucake ); CHECK( dummy.get_morale( MORALE_FOOD_GOOD ) > 10 ); } } AND_GIVEN( "some fresh chewable food" ) { - detached_ptr det = item::spawn( "toastem", calendar::start_of_cataclysm, + detached_ptr det = item::spawn( "jihelucake", calendar::start_of_cataclysm, item::default_charges_tag{} ); - item &toastem = *det; + item &jihelucake = *det; dummy.i_add( std::move( det ) ); // food rot < 0.1 is fresh - toastem.set_relative_rot( 0.0 ); - REQUIRE( toastem.is_fresh() ); + jihelucake.set_relative_rot( 0.0 ); + REQUIRE( jihelucake.is_fresh() ); THEN( "they get a morale penalty due to indigestion" ) { - dummy.modify_morale( toastem ); + dummy.modify_morale( jihelucake ); CHECK( dummy.get_morale( MORALE_NO_DIGEST ) <= -25 ); } }