
# -> If player is a ghost then return
execute if entity @s[tag=OverlyRealistic.Player.IsGhost] run \
    return fail

# -> Null values patch
execute unless score @s OverlyRealistic.Player.Stats.Thirst matches -2147483648..2147483647 run \
    scoreboard players set @s OverlyRealistic.Player.Stats.Thirst 100

# -> Low hunger debuffs
attribute @s block_break_speed modifier remove overly_realistic:player_low_hunger_block_break_speed
execute if score @s OverlyRealistic.Player.Hunger matches ..9 run \
    attribute @s block_break_speed modifier add overly_realistic:player_low_hunger_block_break_speed -0.10 add_multiplied_total

# -> If player is low on carb then give them nausea
execute if score @s OverlyRealistic.Player.Stats.Carbs matches ..0 run \
    effect give @s nausea 8 0 true

# -> If player is not on 0 thirst then return and reset no-thirst timer
execute if score @s OverlyRealistic.Player.Stats.Thirst matches 1.. run \
    return run \
        scoreboard players reset @s OverlyRealistic.Player.NoThirstTimer

# -> If player has no thirst then increase no-thirst timer
execute if score @s OverlyRealistic.Player.Stats.Thirst matches ..0 run \
    scoreboard players add @s OverlyRealistic.Player.NoThirstTimer 1

# -> If no-thirst timer is less than 40 then return
execute unless score @s OverlyRealistic.Player.NoThirstTimer matches 40.. run \
    return fail

# -> Give player nausea
effect give @s nausea 10 0 true

# -> If no-thirst timer is less than 100 then return
execute unless score @s OverlyRealistic.Player.NoThirstTimer matches 100.. run \
    return fail

# -> Damage player
damage @s 0.85 generic

# -> Cap no-thirst timer
execute if score @s OverlyRealistic.Player.NoThirstTimer matches 150.. run \
    scoreboard players set @s OverlyRealistic.Player.NoThirstTimer 150
