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

# -> Armor checks
execute if items entity @s armor.head chainmail_helmet run \
    scoreboard players add #or.head_hit_event_rng OverlyRealistic.General.ArbitraryData 20
execute if items entity @s armor.head iron_helmet run \
    scoreboard players add #or.head_hit_event_rng OverlyRealistic.General.ArbitraryData 50

# -> Extra damage
attribute @s knockback_resistance modifier add overly_realistic:temp_no_kb 100.0 add_value
damage @s 3.0 overly_realistic:player_head_hit
attribute @s knockback_resistance modifier remove overly_realistic:temp_no_kb

# -> Random event
execute if score #or.head_hit_event_rng OverlyRealistic.General.ArbitraryData matches 0..15 run \
    return run \
        effect give @s blindness 2 0 true
execute if score #or.head_hit_event_rng OverlyRealistic.General.ArbitraryData matches 16..36 run \
    return run \
        effect give @s nausea 10 0 true
execute if score #or.head_hit_event_rng OverlyRealistic.General.ArbitraryData matches 37..42 run \
    return run \
        function overly_realistic:players/mental_health/decrease_mental_health {amount:2i}

#say HIT HEAD