execute if predicate kiwi3:afflicted_with_any_debuff store result storage kiwi:bloodletter_damage x int 0.1 run attribute @s max_health get 1
execute if predicate kiwi3:afflicted_with_any_debuff run function kiwi3:relics/bloodletter/bloodletter_damage_macro with storage kiwi:bloodletter_damage

execute store result storage kiwi:bloodletter_duration x int 0.5 run attribute @s max_health get 1

execute if entity @a[nbt={active_effects:[{id:"minecraft:poison"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"💀 Poison","color": "green"},{"text":" effect and granted ","color": "gray"},{"text": "❣ Regeneration ","color": "red"},{"text": "effect!","color": "gray"}]
execute if entity @a[nbt={active_effects:[{id:"minecraft:poison"}]}] run tag @s add bloodletter_effect_clear_poison
execute if entity @a[nbt={active_effects:[{id:"minecraft:poison"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
effect clear @s[tag=bloodletter_effect_clear_poison] poison

execute unless entity @s[tag=bloodletter_effect_clear_poison] if entity @a[nbt={active_effects:[{id:"minecraft:wither"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"💔 Wither","color": "dark_gray"},{"text":" effect and granted ","color": "gray"},{"text": "❣ Regeneration ","color": "red"},{"text": "effect!","color": "gray"}]
execute unless entity @s[tag=bloodletter_effect_clear_poison] if entity @a[nbt={active_effects:[{id:"minecraft:wither"}]}] run tag @s add bloodletter_effect_clear_wither
execute unless entity @s[tag=bloodletter_effect_clear_poison] if entity @a[nbt={active_effects:[{id:"minecraft:wither"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
execute unless entity @s[tag=bloodletter_effect_clear_poison] run effect clear @s[tag=bloodletter_effect_clear_wither] wither

execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] if entity @a[nbt={active_effects:[{id:"minecraft:slowness"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"🐌 Slowness","color": "dark_blue"},{"text":" effect and granted ","color": "gray"},{"text": "➤ Speed ","color": "#56c5fd"},{"text": "effect!","color": "gray"}]
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] if entity @a[nbt={active_effects:[{id:"minecraft:slowness"}]}] run tag @s add bloodletter_clear_slowness
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] if entity @a[nbt={active_effects:[{id:"minecraft:slowness"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] run effect clear @s[tag=bloodletter_clear_slowness] slowness

execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] if entity @a[nbt={active_effects:[{id:"minecraft:weakness"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"🌿 Weakness","color": "#b7b4b0"},{"text":" effect and granted ","color": "gray"},{"text": "💪 Strength ","color": "#e29237"},{"text": "effect!","color": "gray"}]
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] if entity @a[nbt={active_effects:[{id:"minecraft:weakness"}]}] run tag @s add bloodletter_clear_weakness
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] if entity @a[nbt={active_effects:[{id:"minecraft:weakness"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] run effect clear @s[tag=bloodletter_clear_weakness] weakness

execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] if entity @a[nbt={active_effects:[{id:"minecraft:mining_fatigue"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"🥄 Mining Fatigue","color": "dark_gray"},{"text":" effect and granted ","color": "gray"},{"text": "⛏ Haste ","color": "yellow"},{"text": "effect!","color": "gray"}]
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] if entity @a[nbt={active_effects:[{id:"minecraft:mining_fatigue"}]}] run tag @s add bloodletter_clear_mining_fatigue
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] if entity @a[nbt={active_effects:[{id:"minecraft:mining_fatigue"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] run effect clear @s[tag=bloodletter_clear_mining_fatigue] mining_fatigue

execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] if entity @a[nbt={active_effects:[{id:"minecraft:nausea"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"≋ Nausea","color": "green"},{"text":" effect and granted ","color": "gray"},{"text": "👁 Night Vision ","color": "#5F53CF"},{"text": "effect!","color": "gray"}]
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] if entity @a[nbt={active_effects:[{id:"minecraft:nausea"}]}] run tag @s add bloodletter_clear_nausea
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] if entity @a[nbt={active_effects:[{id:"minecraft:nausea"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] run effect clear @s[tag=bloodletter_clear_nausea] nausea

execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] if entity @a[nbt={active_effects:[{id:"minecraft:blindness"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"◎ Blindness","color": "gray"},{"text":" effect and granted ","color": "gray"},{"text": "👁 Night Vision ","color": "#5F53CF"},{"text": "effect!","color": "gray"}]
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] if entity @a[nbt={active_effects:[{id:"minecraft:blindness"}]}] run tag @s add bloodletter_clear_blindness
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] if entity @a[nbt={active_effects:[{id:"minecraft:blindness"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] run effect clear @s[tag=bloodletter_clear_blindness] blindness

execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] unless entity @s[tag=bloodletter_clear_blindness] if entity @a[nbt={active_effects:[{id:"minecraft:hunger"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"🦴 Hunger","color": "yellow"},{"text":" effect and granted ","color": "gray"},{"text": "🍖 Saturation ","color": "gold"},{"text": "effect!","color": "gray"}]
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] unless entity @s[tag=bloodletter_clear_blindness] if entity @a[nbt={active_effects:[{id:"minecraft:hunger"}]}] run tag @s add bloodletter_clear_hunger
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] unless entity @s[tag=bloodletter_clear_blindness] if entity @a[nbt={active_effects:[{id:"minecraft:hunger"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] unless entity @s[tag=bloodletter_clear_blindness] run effect clear @s[tag=bloodletter_clear_hunger] hunger

execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] unless entity @s[tag=bloodletter_clear_blindness] unless entity @s[tag=bloodletter_clear_hunger] if entity @a[nbt={active_effects:[{id:"minecraft:darkness"}]}] run tellraw @s [{"text": "[Bloodletter] ","color": "dark_red"},{"text":"Completely removed the ","color": "gray"},{"text":"◆ Darkness","color": "dark_gray"},{"text":" effect and granted ","color": "gray"},{"text": "👁 Night Vision ","color": "#5F53CF"},{"text": "effect!","color": "gray"}]
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] unless entity @s[tag=bloodletter_clear_blindness] unless entity @s[tag=bloodletter_clear_hunger] if entity @a[nbt={active_effects:[{id:"minecraft:darkness"}]}] run tag @s add bloodletter_clear_darkness
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] unless entity @s[tag=bloodletter_clear_blindness] unless entity @s[tag=bloodletter_clear_hunger] if entity @a[nbt={active_effects:[{id:"minecraft:darkness"}]}] run function kiwi3:relics/bloodletter/bloodletter_grant_buff_macro with storage kiwi:bloodletter_duration
execute unless entity @s[tag=bloodletter_effect_clear_poison] unless entity @s[tag=bloodletter_effect_clear_wither] unless entity @s[tag=bloodletter_clear_slowness] unless entity @s[tag=bloodletter_clear_weakness] unless entity @s[tag=bloodletter_clear_mining_fatigue] unless entity @s[tag=bloodletter_clear_nausea] unless entity @s[tag=bloodletter_clear_blindness] unless entity @s[tag=bloodletter_clear_hunger] run effect clear @s[tag=bloodletter_clear_darkness] darkness

tag @s remove bloodletter_effect_clear_poison
tag @s remove bloodletter_effect_clear_wither
tag @s remove bloodletter_clear_slowness
tag @s remove bloodletter_clear_weakness
tag @s remove bloodletter_clear_mining_fatigue
tag @s remove bloodletter_clear_nausea
tag @s remove bloodletter_clear_blindness
tag @s remove bloodletter_clear_hunger
tag @s remove bloodletter_clear_darkness