
# -> Add to PlayedForSeconds
execute unless score @s OverlyRealistic.Player.PlayedForSeconds_InGame matches 2147483646.. run \
    scoreboard players add @s OverlyRealistic.Player.PlayedForSeconds_InGame 2

# -> If player does not have their max stamina set then reset it
execute unless score @s OverlyRealistic.Player.Stats.MaxStamina matches 0.. run \
    scoreboard players set @s OverlyRealistic.Player.Stats.MaxStamina 80

# -> If player has hot items in their inventory and is holding tongs then damage the tongs
execute if items entity @s weapon.* *[custom_data~{or_is_tongs:1b}] \
    if items entity @s container.* *[custom_data~{or_requires_tongs:1b}] run \
        function overly_realistic:players/items/hot_items/player_has_hot_items

# --> Bleeding-vitality operations

# -> If player does not have vitality stat then give it to them
# -> (@NOTE: TEMPORARY)
execute unless score @s OverlyRealistic.Player.Stats.Vitality matches 0.. run \
    scoreboard players set @s OverlyRealistic.Player.Stats.Vitality 100

# -> If player is bleeding then vitality
scoreboard players remove @s[scores={OverlyRealistic.Player.BleedingTimer=1..}] OverlyRealistic.Player.Stats.Vitality 1

# -> Remove vitality debuff
attribute @s max_health modifier remove overly_realistic:vitality_max_health_manage

# -> If player is full enough vitality then return
execute if score @s OverlyRealistic.Player.Stats.Vitality matches 90.. run \
    return fail

# -> Debuff 0 (60-89 vitality) (10% less health)
execute if score @s OverlyRealistic.Player.Stats.Vitality matches 60..89 run \
    return run \
        attribute @s max_health modifier add overly_realistic:vitality_max_health_manage -0.1 add_multiplied_total

# -> Debuff 1 (40-59 vitality) (20% less health)
execute if score @s OverlyRealistic.Player.Stats.Vitality matches 40..59 run \
    return run \
        attribute @s max_health modifier add overly_realistic:vitality_max_health_manage -0.2 add_multiplied_total

# -> Debuff 2 (20-49 vitality) (30% less health)
execute if score @s OverlyRealistic.Player.Stats.Vitality matches 20..39 run \
    return run \
        attribute @s max_health modifier add overly_realistic:vitality_max_health_manage -0.3 add_multiplied_total

# -> Debuff 3 (0-19 vitality) (50% less health)
execute if score @s OverlyRealistic.Player.Stats.Vitality matches ..19 run \
    return run \
        attribute @s max_health modifier add overly_realistic:vitality_max_health_manage -0.5 add_multiplied_total
