scoreboard players set .chef chef.add.rating 10
scoreboard players operation .chef chef.add.rating += .chef chef.rating

execute if score @e[tag=chef.display,limit=1] chef.random matches 1 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 2 run scoreboard players set .chef chef.capital 6
execute if score @e[tag=chef.display,limit=1] chef.random matches 3 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 4 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 5 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 6 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 7 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 8 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 9 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 10 run scoreboard players set .chef chef.capital 5
execute if score @e[tag=chef.display,limit=1] chef.random matches 11 run scoreboard players set .chef chef.capital 2
execute if score @e[tag=chef.display,limit=1] chef.random matches 12 run scoreboard players set .chef chef.capital 15
execute if score @e[tag=chef.display,limit=1] chef.random matches 13 run scoreboard players set .chef chef.capital 5
execute if score @e[tag=chef.display,limit=1] chef.random matches 14 run scoreboard players set .chef chef.capital 4
execute if score @e[tag=chef.display,limit=1] chef.random matches 15 run scoreboard players set .chef chef.capital 6
execute if score @e[tag=chef.display,limit=1] chef.random matches 16 run scoreboard players set .chef chef.capital 12
execute if score @e[tag=chef.display,limit=1] chef.random matches 17 run scoreboard players set .chef chef.capital 5
execute if score @e[tag=chef.display,limit=1] chef.random matches 18 run scoreboard players set .chef chef.capital 10
execute if score @e[tag=chef.display,limit=1] chef.random matches 19 run scoreboard players set .chef chef.capital 6
execute if score @e[tag=chef.display,limit=1] chef.random matches 20 run scoreboard players set .chef chef.capital 1

$execute store result score .chef chef.extra.item run clear @a[team=povar] $(id)[custom_data~{donot:1}]
clear @a[team=povar] *[custom_data~{donot:1}]
scoreboard players remove .chef chef.extra.item 1
scoreboard players operation .chef chef.capital += .chef chef.extra.item

scoreboard players set .chef chef.extra.item 1
execute if score .eventor eventchoose matches 10..12 run scoreboard players set .chef chef.extra.item 4
scoreboard players operation .chef chef.capital *= .chef chef.extra.item

scoreboard players operation .chef chef.capital *= .chef chef.add.rating
scoreboard players set .chef chef.add.rating 10
scoreboard players operation .chef chef.capital /= .chef chef.add.rating

execute as @a[tag=haven,team=!povar] run function ws:misc/business/haven/bonus

execute store result score .chef chef.players if entity @a[team=povar]
execute if score .chef chef.players matches 2.. run scoreboard players operation .chef chef.capital /= .chef chef.players

scoreboard players operation @a[team=povar] pay += .chef chef.capital
execute as @a[team=povar,scores={starterbonus.chef=1..}] run function ws:work/misc/chef/starterbonus

execute store result storage ws:temp chef int 1 run scoreboard players get .chef chef.capital
execute at @a[team=povar] run function ws:work/misc/chef/display with storage ws:temp
scoreboard players reset .chef chef.capital

execute if score .chef chef.rating matches 10.. run scoreboard players add @a[team=povar] chef.adv 1
execute unless score .chef chef.rating matches 10.. run scoreboard players reset @a[team=povar] chef.adv

function ws:work/misc/chef/random