
# -> Tag player
tag @s add OverlyRealistic.Player.IsSick

# -> Advancement
advancement grant @s only overly_realistic:advancements/livelyhood/sickening

# -> Set vars
scoreboard players set @s OverlyRealistic.Player.IllnessTimer 0
execute store result score @s OverlyRealistic.Player.MaxIllnessTimer run \
    random value 30..520

# -> On RNG, do light illness RNG
execute if predicate overly_realistic:player/illness/light_illness_rng run \
    tag @s add OverlyRealistic.Player.IsLightlySick

# -> Effects
effect give @s hunger 4 0 true
effect give @s[tag=!OverlyRealistic.Player.IsLightlySick] poison 4 0 true
effect give @s[tag=OverlyRealistic.Player.IsLightlySick] nausea 10 0 true

# -> If player has a light sickness then return
execute if entity @s[tag=OverlyRealistic.Player.IsLightlySick] run \
    return fail

# -> Unless RNG passes, return
execute unless predicate overly_realistic:player/illness/harsh_illness_rng run \
    return fail

# -> Get a random effect
execute store result storage overly_realistic:temp_values generic_value_0 int 1 run \
    random value 1..5

# -> Call on a harsh illness function
function overly_realistic:players/illness/harsh_illnesses/harsh_illness_call with storage overly_realistic:temp_values