#predetermined
execute if entity @a[tag=fountain] unless score .room_number room matches -4 run return run function main:game/wave/reward/fountain_not_used

execute if score .room_count room matches 7 unless score .room_number room matches -3 at @s[tag=choice_5] run return run function main:game/wave/reward/5
execute if score .room_count room matches 8 at @s run return run function main:game/wave/reward/boss

#workshop
execute if score .room_count room matches 2.. store result score @s room run random value 1..5
execute if score .stage arena matches 2 if score .room_count room matches 3.. run scoreboard players set @s room 1
execute if entity @a[advancements={main:progression/other/workshop=true}] unless score .room_number room matches -2 if score .workshop_has room matches 0 if score @s room matches 1 at @s[tag=choice_4] run return run function main:game/wave/reward/4

#semi-random
execute if score .room_count room matches 3.. store result score @s room run random value 1..3
execute if score .room_count room matches 3.. if entity @a[tag=!fountain_room] if score @s room matches 1 unless score .room_number room matches -4 at @s[tag=choice_6] run return run function main:game/wave/reward/6
execute if score .room_count room matches 3.. store result score @s room run random value 1..4
execute if entity @a[advancements={main:progression/other/reroll=true}] if score .room_count room matches 3.. unless score .room_reroll_limit room matches ..0 if score @s room matches 1 at @s[tag=choice_8] run return run function main:game/wave/reward/8

#random
execute store result score @s room run random value 1..7
execute unless score .room_artifact_limit room matches ..0 if score @s[tag=choice_1] room matches 1..2 at @s run return run function main:game/wave/reward/1
execute if score @s[tag=choice_2] room matches 3..4 at @s run return run function main:game/wave/reward/2
execute if entity @a[advancements={main:progression/other/workshop=true}] if score @s[tag=choice_3] room matches 5..6 at @s run return run function main:game/wave/reward/3
execute if score @s[tag=choice_7] room matches 7 at @s run return run function main:game/wave/reward/7
# execute unless score .room_count room matches ..5 if score @s[tag=choice_4] room matches 4 at @s run return run function main:game/wave/reward/4

function main:game/wave/reward/random
execute if score .room_number room matches -1 if score .starts progression matches 1 run function main:dialog/start {"folder":"","allow_skip":"1",id:200002}