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

# -> Particles
particle minecraft:block{block_state:"minecraft:redstone_block"} ~ ~ ~ 0 0 0 0.001 20 normal @a

# -> Mental health decrease RNG
execute if predicate overly_realistic:player/damage/potent_direct_damage_rng run \
    function overly_realistic:players/mental_health/edit_mental_health {type:"remove",value:2}

# -> Bleeding RNG
execute if predicate overly_realistic:player/damage/direct_damage_bleeding_rng run \
    function overly_realistic:players/bleeding/start_bleeding

# -> If player is on ground then create blood splatter
execute if score #or.setting.generate_blood_splatters OverlyRealistic.Settings.ArbitrarySetting matches 1 \
    at @s \
    if score @s OverlyRealistic.PredicateValue.IsOnGround matches 1 \
    unless block ~ ~-1 ~ glass run \
        function overly_realistic:players/misc/ground_markings/blood/create_blood_splatter

# -> Breaking bone sound
playsound minecraft:entity.player.big_fall player @a ~ ~ ~ 0.85 0

# -> Crack blocks underneath
fill ~ ~-1 ~ ~ ~-1 ~ cracked_stone_bricks replace stone_bricks
fill ~ ~-1 ~ ~ ~-1 ~ cracked_deepslate_bricks replace deepslate_bricks
fill ~ ~-1 ~ ~ ~-1 ~ cracked_deepslate_tiles replace deepslate_tiles
fill ~ ~-1 ~ ~ ~-1 ~ cracked_nether_bricks replace nether_bricks
fill ~ ~-1 ~ ~ ~-1 ~ cracked_polished_blackstone_bricks replace polished_blackstone_bricks
fill ~-0.5 ~-1 ~-0.5 ~0.5 ~-1 ~0.5 air replace glass destroy

# -> Do RNG for physical trauma, if RNG does not pass then return
execute if predicate overly_realistic:player/damage/potent_direct_damage_rng run \
    return fail

# -> Apply HasPhysicalTrauma data
tag @s add OverlyRealistic.Player.HasPhysicalTrauma
tag @s add OverlyRealistic.Player.HasPhysicalTrauma_Type_PotentFallDamage_MovementSpeed
tag @s add OverlyRealistic.Player.HasPhysicalTrauma_Type_PotentFallDamage_JumpStrength

# -> Apply attribute
attribute @s movement_speed modifier add overly_realistic:physical_trauma_potent_fall_damage_movement -0.06 add_value
attribute @s minecraft:jump_strength modifier add overly_realistic:physical_trauma_potent_fall_damage_jump -0.06 add_value

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