damage_taken_with_full_set.mcfunction

advancement revoke @s only armor_re:thorns/damage_taken_with_full_set

execute unless score @s thorns.stored_damage matches 0..100 run playsound minecraft:block.amethyst_block.break player @a ~ ~ ~ 1 0.5
execute unless score @s thorns.stored_damage matches 0..100 run playsound minecraft:block.amethyst_block.break player @a ~ ~ ~ 1 0.5
execute unless score @s thorns.stored_damage matches 0..100 run playsound minecraft:block.amethyst_block.break player @a ~ ~ ~ 1 0.5

effect give @s[scores={thorns.stored_damage=290..}] weakness 2

function armor_re:count_total_thorns
execute store result score val rand run random value 1..120
execute unless score val rand <= val temp run return fail

execute if score @s thorns.stored_damage matches 300.. run return fail
scoreboard players add @s thorns.stored_damage 7
execute if predicate {condition:random_chance,chance:0.3333} run scoreboard players add @s thorns.stored_damage 8
execute if predicate {condition:random_chance,chance:0.5} run scoreboard players add @s thorns.stored_damage 8