
# -> Random event RNG
execute store result score #or.torso_hit_event_rng OverlyRealistic.General.ArbitraryData run \
    random value 0..100

# -> Armor checks
execute if items entity @s armor.head chainmail_leggings run \
    scoreboard players add #or.head_hit_event_rng OverlyRealistic.General.ArbitraryData 25
execute if items entity @s armor.head iron_leggings run \
    scoreboard players add #or.head_hit_event_rng OverlyRealistic.General.ArbitraryData 55

# -> Stamina decrease
execute store result storage overly_realistic:temp_values generic_value_0 int 0.1 run \
    scoreboard players get @s OverlyRealistic.Player.Stats.MaxStamina
execute store result score #or.percentage_value OverlyRealistic.General.ArbitraryData run \
    data get storage overly_realistic:temp_values generic_value_0
scoreboard players operation @s OverlyRealistic.Player.Stats.Stamina -= #or.percentage_value OverlyRealistic.General.ArbitraryData

# -> Random event
execute if score #or.torso_hit_event_rng OverlyRealistic.General.ArbitraryData matches 0..33 run \
    return run \
        effect give @s slowness 2 0 true
execute if score #or.torso_hit_event_rng OverlyRealistic.General.ArbitraryData matches 34..44 run \
    scoreboard players remove @s OverlyRealistic.Player.Stats.Stamina 5

#say HIT LEGS