
# --> Store 

# -> Copper plate
execute store result storage overly_realistic:lay_figure_menus resource_cost_copper_plate int 1 run \
    scoreboard players get @s OverlyRealistic.World.LayFigure_ResourceRequirement_CopperPlate



# -> Pay resource cost
function overly_realistic:players/non_setting_triggers/events/event_100029/build_cost_pay with storage overly_realistic:lay_figure_menus

# --> Build item

# BITS
# 0 sleeves

# --> Get bits

# -> Sleeves
execute if score #or.lay_figure_data_button_0 OverlyRealistic.General.ArbitraryData matches 1 run \
    data modify storage overly_realistic:lay_figure_menus armor_item_build_bit_0 set value 0b
execute if score #or.lay_figure_data_button_1 OverlyRealistic.General.ArbitraryData matches 1 run \
    data modify storage overly_realistic:lay_figure_menus armor_item_build_bit_0 set value 1b

# --> Get speed decrease

# -> Base speed decrease
scoreboard players set #or.lay_figure_armor_speed OverlyRealistic.General.ArbitraryData 10

# -> Sleeves
execute if score #or.lay_figure_data_button_0 OverlyRealistic.General.ArbitraryData matches 1 run \
    scoreboard players add #or.lay_figure_armor_speed OverlyRealistic.General.ArbitraryData 2
execute if score #or.lay_figure_data_button_1 OverlyRealistic.General.ArbitraryData matches 1 run \
    scoreboard players add #or.lay_figure_armor_speed OverlyRealistic.General.ArbitraryData 5

# -> Store final result
execute store result storage overly_realistic:lay_figure_menus armor_final_speed_decrease int 1 run \
    scoreboard players get #or.lay_figure_armor_speed OverlyRealistic.General.ArbitraryData


# --> Get armor increase

# -> Base armor stat
scoreboard players set #or.lay_figure_armor_armor OverlyRealistic.General.ArbitraryData 200

# -> Sleeves
execute if score #or.lay_figure_data_button_0 OverlyRealistic.General.ArbitraryData matches 1 run \
    scoreboard players add #or.lay_figure_armor_armor OverlyRealistic.General.ArbitraryData 200
execute if score #or.lay_figure_data_button_1 OverlyRealistic.General.ArbitraryData matches 1 run \
    scoreboard players add #or.lay_figure_armor_armor OverlyRealistic.General.ArbitraryData 400

# -> Store final result
execute store result storage overly_realistic:lay_figure_menus armor_final_armor int 0.01 run \
    scoreboard players get #or.lay_figure_armor_armor OverlyRealistic.General.ArbitraryData


# -> Create item
function overly_realistic:general/custom_blocks/lay_figure/give_armor/chestplate/copper_chestplate with storage overly_realistic:lay_figure_menus

# -> Open success UI
dialog show @s overly_realistic:lay_figure/success_screens/build_armor_success

# -> Increase blacksmithing XP
function overly_realistic:players/wisdom/blacksmithing/add_to_skill_xp_c_craft_equipment
