#reset
execute as @a run scoreboard players set @s shield_total 0
execute as @a if score @s shield > @s shield_max run scoreboard players operation @s shield = @s shield_max
execute as @a if score @s shield matches ..-1 run scoreboard players set @s shield 0


#shield
execute as @a run function main:settings/stats/shield/absorption

#class
scoreboard players set @a[tag=classless] shield_max 100
scoreboard players set @a[tag=gunner] shield_max 200
scoreboard players set @a[tag=brawler] shield_max 150
scoreboard players set @a[tag=sniper] shield_max 300
scoreboard players set @a[tag=assassin] shield_max 300
scoreboard players set @a[tag=engineer] shield_max 350
scoreboard players set @a[tag=archer] shield_max 200
scoreboard players set @a[tag=knight] shield_max 900
scoreboard players set @a[tag=sorcerer] shield_max 200
scoreboard players set @a[tag=reaper] shield_max 100
#relics
execute if score .jelly_belly relics matches 1.. run scoreboard players add @a shield_max 20
execute if score .piece_of_cockpit relics matches 1.. run scoreboard players add @a shield_max 20
execute if score .broken_armor relics matches 1.. run scoreboard players add @a shield_max 20
execute if score .scentful_oil relics matches 1.. run scoreboard players add @a shield_max 15
execute if score .wooden_cross relics matches 1.. run scoreboard players add @a shield_max 7

#multiplier
scoreboard players set @a shield_multiplier 100

##items
#green
#id9
execute as @a if score .reptile_scale artifact matches 1.. run scoreboard players operation .reptile_scale artifact *= .10 number
execute as @a if score .reptile_scale artifact matches 1.. run scoreboard players operation @s shield_multiplier += .reptile_scale artifact
execute as @a if score .reptile_scale artifact matches 1.. run scoreboard players operation .reptile_scale artifact /= .10 number

#purple
#id1
execute as @a if score .field_generator artifact matches 1.. run scoreboard players remove @s shield_multiplier 20

execute as @a if score .fortified_offense artifact matches 1.. run scoreboard players add @s shield_multiplier 25

#set final
execute as @a run scoreboard players operation @s shield_max *= @a shield_multiplier
execute as @a run scoreboard players operation @s shield_max /= .100 number

#artifact
#id24
execute if score .beetle_juice artifact matches 1.. as @a run function main:mechanics/artifacts/id/purple/id24/calculation_1

execute if entity @a[scores={shield=..0}] run function main:mechanics/artifacts/inputs/shield_break

#20% and 80%
execute as @a run scoreboard players operation @s shield_1 = @s shield_max
execute as @a run scoreboard players operation @s shield_1 /= .100 number

execute as @a run scoreboard players operation @s shield_2 = @s shield_1
execute as @a run scoreboard players operation @s shield_2 *= .2 number

execute as @a run scoreboard players operation @s shield_3 = @s shield_1
execute as @a run scoreboard players operation @s shield_3 *= .3 number

execute as @a run scoreboard players operation @s shield_5 = @s shield_1
execute as @a run scoreboard players operation @s shield_5 *= .5 number

execute as @a run scoreboard players operation @s shield_10 = @s shield_max
execute as @a run scoreboard players operation @s shield_10 /= .10 number

execute as @a run scoreboard players operation @s shield_25 = @s shield_max
execute as @a run scoreboard players operation @s shield_25 /= .4 number

execute as @a run scoreboard players operation @s shield_50 = @s shield_max
execute as @a run scoreboard players operation @s shield_50 /= .2 number

execute as @a run scoreboard players operation @s shield_80 = @s shield_1
execute as @a run scoreboard players operation @s shield_80 *= .80 number

#base regen
execute as @a run scoreboard players operation @s shield_temp = @s shield_max

#end calcs
execute as @a run scoreboard players operation @s shield_temp *= @s shield_regen
execute as @a run scoreboard players operation @s shield_temp /= .100 number

#hp total
execute as @a run scoreboard players operation @s shield_total += @s shield
execute as @a run scoreboard players operation @s shield_total += @s health_absorption