
# -> Reset adv trigger
advancement revoke @s only overly_realistic:player/player_get_hurt_blocked

# -> Add to blocked counter
scoreboard players add @s OverlyRealistic.Player.WisdomSpecialized.ShieldBlockAttack 1
execute if score @s OverlyRealistic.Player.WisdomSpecialized.ShieldBlockAttack matches 10.. run \
    function overly_realistic:players/wisdom/combat/add_to_skill_xp_c_shield_block_attack_10

# -> Do RNG
execute store result score #or.stamina_decrease_hurt_blocked OverlyRealistic.General.ArbitraryData run \
    random value -1..2

# -> If the RNG didn't pass then return
execute if score #or.stamina_decrease_hurt_blocked OverlyRealistic.General.ArbitraryData matches -1..0 run \
    return fail

# -> Altitude check
execute if entity @s[y=150,dy=9999] run \
    scoreboard players add #or.stamina_decrease_hurt_blocked OverlyRealistic.General.ArbitraryData 1

# -> If the player is skilled in combat and stamina loss is 2 then return
execute if score @s OverlyRealistic.Player.WisdomStats.Combat matches 5.. run \
    return fail

# -> If the player is skilled in combat and stamina loss is 2 then return
execute if score @s OverlyRealistic.Player.WisdomStats.Combat matches 2.. \
    if score #or.stamina_decrease_hurt_blocked OverlyRealistic.General.ArbitraryData matches 2 run \
        return fail

# -> Decrease stamina
scoreboard players operation @s OverlyRealistic.Player.Stats.Stamina -= #or.stamina_decrease_hurt_blocked OverlyRealistic.General.ArbitraryData
