execute as @s[predicate=survivalplus:20chance,tag=!RanEn] unless data entity @s equipment.chest.components."minecraft:enchantments" run item modify entity @s armor.head survivalplus:enchant22
execute as @s[predicate=survivalplus:25chance,tag=!RanEn] unless data entity @s equipment.chest.components."minecraft:enchantments" run item modify entity @s armor.head survivalplus:enchant16

execute as @s[predicate=survivalplus:20chance,tag=!RanEn] unless data entity @s equipment.chest.components."minecraft:enchantments" run item modify entity @s armor.chest survivalplus:enchant22
execute as @s[predicate=survivalplus:25chance,tag=!RanEn] unless data entity @s equipment.chest.components."minecraft:enchantments" run item modify entity @s armor.chest survivalplus:enchant16

execute as @s[predicate=survivalplus:20chance,tag=!RanEn] unless data entity @s equipment.legs.components."minecraft:enchantments" run item modify entity @s armor.legs survivalplus:enchant22
execute as @s[predicate=survivalplus:25chance,tag=!RanEn] unless data entity @s equipment.legs.components."minecraft:enchantments" run item modify entity @s armor.legs survivalplus:enchant16

execute as @s[predicate=survivalplus:20chance,tag=!RanEn] unless data entity @s equipment.feet.components."minecraft:enchantments" run item modify entity @s armor.feet survivalplus:enchant22
execute as @s[predicate=survivalplus:25chance,tag=!RanEn] unless data entity @s equipment.feet.components."minecraft:enchantments" run item modify entity @s armor.feet survivalplus:enchant16

execute as @s[predicate=survivalplus:20chance,tag=!RanEn] unless data entity @s equipment.mainhand.components."minecraft:enchantments" run item modify entity @s weapon.mainhand survivalplus:enchant22
execute as @s[predicate=survivalplus:25chance,tag=!RanEn] unless data entity @s equipment.mainhand.components."minecraft:enchantments" run item modify entity @s weapon.mainhand survivalplus:enchant16

execute if score hardmode hardmode matches 1 as @e[type=#survivalplus:can_wear_armor,tag=!RanEn,tag=!boss] run function survivalplus:tools/armor/random_enchanthm
tag @s add RanEn