
# --> Incremental checks

# -> (@NOTE: This can be replaced with an 'if function' line!)

# -> Reset var
scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 0

# -> Player is on comforting blocks check
execute if predicate overly_realistic:player/misc/is_on_comforting_blocks run \
    scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1

# -> High stats check
execute if score @s OverlyRealistic.Player.Stats.Temperature matches 20..85 \
    if score @s OverlyRealistic.Player.Stats.Thirst matches 73.. \
    if score @s OverlyRealistic.Player.Health matches 10.. \
    if score @s OverlyRealistic.Player.Hunger matches 17.. run \
        scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1

# -> Players-nearby check
tag @s add OverlyRealistic.Player.TempPlayer
execute if entity @p[tag=!OverlyRealistic.Player.TempPlayer,distance=..16] run \
    scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1
tag @s remove OverlyRealistic.Player.TempPlayer

# -> Inside check
execute if predicate overly_realistic:player/misc/is_inside run \
    scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1

# -> Function tag
function #overly_realistic:mechanics/player_sanity_add

# -> Add to mental health value
execute if score #or.global OverlyRealistic.General.ArbitraryData matches 1 run \
    function overly_realistic:players/mental_health/add_to_mental_health {amount: 1i}


# --> Detrimental checks

# -> (@NOTE: This can be replaced with an 'if function' line!)

# -> Reset var
scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 0

# -> Low stats check
execute unless score @s OverlyRealistic.Player.Stats.Temperature matches 20..85 \
    if score @s OverlyRealistic.Player.Stats.Thirst matches ..30 \
    if score @s OverlyRealistic.Player.Hunger matches ..10 run \
        scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1

# -> Low health check
execute unless score @s OverlyRealistic.Player.Health matches 7.. run \
    scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1

# -> Players-nearby check
execute unless entity @p[distance=..16] run \
    scoreboard players set #or.global OverlyRealistic.General.ArbitraryData 1

# -> Function tag
function #overly_realistic:mechanics/player_sanity_remove

# -> Remove from mental health value
execute if score #or.global OverlyRealistic.General.ArbitraryData matches 1 run \
    function overly_realistic:players/mental_health/decrease_mental_health {amount: 1i}
