
# -> Make sure no value is null
execute unless score @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_1 matches 1.. run \
    scoreboard players set @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_1 0
execute unless score @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_2 matches 1.. run \
    scoreboard players set @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_2 0
execute unless score @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_3 matches 1.. run \
    scoreboard players set @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_3 0

# -> Globalize & store ingredient IDs
execute store result storage overly_realistic:items basket_mushroom_base_items.ingredient_1 byte 1 \
    store result score #or.sus_stew_ingredient_id_1 OverlyRealistic.General.ArbitraryData run \
        scoreboard players get @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_1
execute store result storage overly_realistic:items basket_mushroom_base_items.ingredient_2 byte 1 \
    store result score #or.sus_stew_ingredient_id_2 OverlyRealistic.General.ArbitraryData run \
        scoreboard players get @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_2
execute store result storage overly_realistic:items basket_mushroom_base_items.ingredient_3 byte 1 \
    store result score #or.sus_stew_ingredient_id_3 OverlyRealistic.General.ArbitraryData run \
        scoreboard players get @s OverlyRealistic.World.BasketMushroomAdditionalIngredientId_3

# -> Globalize player's healthcare level
execute store result score #or.basket_user_healthcare_level OverlyRealistic.General.ArbitraryData \
    on target run \
        scoreboard players get @s OverlyRealistic.Player.WisdomStats.Healthcare

# -> Get probability of success
scoreboard players set #or.sus_stew_success_probability OverlyRealistic.General.ArbitraryData 0
execute unless score #or.basket_user_healthcare_level OverlyRealistic.General.ArbitraryData matches 1.. run \
    data merge storage overly_realistic:items {basket_mushroom_base_items:{probability_id:0b,probability_percentage:1b,probability_percentage_float:0.01f,quality_string:"badly_made"}}
execute if score #or.basket_user_healthcare_level OverlyRealistic.General.ArbitraryData matches 1 run \
    data merge storage overly_realistic:items {basket_mushroom_base_items:{probability_id:1b,probability_percentage:12b,probability_percentage_float:0.12f,quality_string:"adequately_made"}}
execute if score #or.basket_user_healthcare_level OverlyRealistic.General.ArbitraryData matches 2 run \
    data merge storage overly_realistic:items {basket_mushroom_base_items:{probability_id:2b,probability_percentage:25b,probability_percentage_float:0.25f,quality_string:"decently_made"}}
execute if score #or.basket_user_healthcare_level OverlyRealistic.General.ArbitraryData matches 3 run \
    data merge storage overly_realistic:items {basket_mushroom_base_items:{probability_id:3b,probability_percentage:60b,probability_percentage_float:0.6f,quality_string:"well_made"}}
execute if score #or.basket_user_healthcare_level OverlyRealistic.General.ArbitraryData matches 4 run \
    data merge storage overly_realistic:items {basket_mushroom_base_items:{probability_id:4b,probability_percentage:80b,probability_percentage_float:0.8f,quality_string:"delightfully_made"}}
execute if score #or.basket_user_healthcare_level OverlyRealistic.General.ArbitraryData matches 5 run \
    data merge storage overly_realistic:items {basket_mushroom_base_items:{probability_id:5b,probability_percentage:100b,probability_percentage_float:1.0f,quality_string:"excellently_made"}}

# -> Create item
function overly_realistic:general/custom_blocks/basket/interactions/get_sus_stew/create_stew with storage overly_realistic:items basket_mushroom_base_items

# -> Operate on player
execute on target run \
    function overly_realistic:general/custom_blocks/basket/interactions/get_sus_stew/int_get_stew_local

# -> Remove items
function overly_realistic:general/custom_blocks/basket/interactions/int_remove_all_items_include_additionals_harsh

# -> Remove liquid
function overly_realistic:general/custom_blocks/basket/interactions/set_liquid/remove_liquid
