#class
scoreboard players set @s damage_resistance 0

#characters
#engineer
execute as @s[tag=engineer,scores={shift_duration_t=1..}] run scoreboard players add @s damage_resistance 30
#assassin
# execute as @s[tag=assassin,scores={q_special_4=1..}] run scoreboard players add @s damage_resistance 30
#knight
scoreboard players add @s[tag=knight,tag=upgrade_3_level_2] damage_resistance 5
scoreboard players add @s[tag=knight,tag=upgrade_3_level_4] damage_resistance 10

##artifacts
execute if score .armor_plating artifact matches 1.. run scoreboard players operation .armor_plating artifact *= .5 number
execute if score .armor_plating artifact matches 1.. run scoreboard players operation @s damage_resistance += .armor_plating artifact
execute if score .armor_plating artifact matches 1.. run scoreboard players operation .armor_plating artifact /= .5 number

execute if score .feral_claw artifact matches 1.. if score .feral_claw_tick artifact matches ..0 run scoreboard players add @s damage_resistance 30

execute if score .arm_buckler_t artifact matches 1.. run scoreboard players add @s damage_resistance 20

execute if score @s damage_resistance matches 61.. run scoreboard players set @s damage_resistance 60

#knight
execute as @s[tag=knight,scores={rc_duration_t=1..}] run scoreboard players add @s damage_resistance 100
#gunner
execute as @s[tag=gunner,scores={shift_duration_t=40..60}] run scoreboard players add @s damage_resistance 100

#enemies
execute as @s[tag=id1001_ability_dr] run scoreboard players remove @s damage_resistance 20