# summon area_effect_cloud 0 0 0 {Radius:0.0f,Duration:2147483647,Tags:["deathMessage","deathMessage1"],CustomName:"{\"text\":\"Dead: \",\"color\":\"red\"}"}
# summon area_effect_cloud 0 0 0 {Radius:0.0f,Duration:2147483647,Tags:["deathMessage","deathMessage2"],CustomName:"{\"text\":\" has died!\",\"color\":\"red\"}"}
scoreboard players set r Random 8
function mctsts:util/random
execute if score n Random matches 1..4 at @s positioned ~ ~-10 ~ run function mctsts:game/death/_basic
execute if score n Random matches 5..6 at @s positioned ~ ~-10 ~ run function mctsts:game/death/_personal
execute if score n Random matches 7 at @s positioned ~ ~-10 ~ run function mctsts:game/death/special
execute if score n Random matches 8 at @s positioned ~ ~-10 ~ run function mctsts:game/death/reference


execute at @s positioned ~ ~-10 ~ unless entity @e[tag=deathMessage,type=area_effect_cloud] run summon area_effect_cloud ~ ~ ~ {Radius:0.0f,Duration:2147483647,Tags:["deathMessage","deathMessage2"],CustomName:"{\"translate\":\"death.error\",\"color\":\"red\"}"}

tag @s add temp
execute at @s positioned ~ ~-10 ~ if entity @s[tag=temp,name=_tsts_] run summon area_effect_cloud ~ ~ ~ {Radius:0.0f,Duration:2147483647,Tags:["deathMessage","deathPlayer"],CustomName:"{\"text\":\"Ts\"}"}
execute at @s positioned ~ ~-10 ~ if entity @s[tag=temp,name=gibbsly] run summon area_effect_cloud ~ ~ ~ {Radius:0.0f,Duration:2147483647,Tags:["deathMessage","deathPlayer"],CustomName:"{\"text\":\"gibber\"}"}
execute at @s positioned ~ ~-10 ~ if entity @s[tag=temp,name=Asometric] run summon area_effect_cloud ~ ~ ~ {Radius:0.0f,Duration:2147483647,Tags:["deathMessage","deathPlayer"],CustomName:"{\"text\":\"Adri\"}"}
execute at @s positioned ~ ~-10 ~ if entity @s[tag=temp,name=Ds43m] run summon area_effect_cloud ~ ~ ~ {Radius:0.0f,Duration:2147483647,Tags:["deathMessage","deathPlayer"],CustomName:"{\"text\":\"Ds\"}"}
execute at @s positioned ~ ~-10 ~ if entity @s[tag=temp,name=5uso] run summon area_effect_cloud ~ ~ ~ {Radius:0.0f,Duration:2147483647,Tags:["deathMessage","deathPlayer"],CustomName:"{\"text\":\"Suso\"}"}
execute unless entity @e[tag=deathPlayer,type=area_effect_cloud] run tag @s add deathPlayer

tellraw @a ["",{"text":" |  ","color":"gray"},{"translate":"death.msg","color":"red","with":[{"nbt":"CustomName","entity":"@e[tag=deathMessage1,sort=random,limit=1]","interpret":true},{"selector":"@e[tag=deathPlayer,limit=1,sort=random]"},{"nbt":"CustomName","entity":"@e[tag=deathMessage2,sort=random,limit=1]","interpret":true},{"score":{"name":"@s","objective":"lives"},"color":"red","italic":true},{"score":{"name":"lives","objective":"Stats"},"color":"red","italic":true}]}]
kill @e[tag=deathMessage]
tag @a remove deathPlayer