

execute as @s at @s positioned ~~~ unless block ~~-0.5~ air run scoreboard players set @s[scores={airborneTime=..20}] airborneTime 0

effect @e[tag=grab:airborne,scores={airborneTime=52..60}] levitation 1 0 true
effect @e[scores={airborneTime=20..},tag=grab:airborne] slow_falling 2 2 true

scoreboard players add globalTime worldTimer 1
scoreboard players operation @a worldTimer = globalTime worldTimer
execute as @p[scores={worldTimer=20..}] at @s run function combatCD
execute as @p[scores={worldTimer=20..}] at @s run function soultraits/tick
execute as @p[scores={worldTimer=20..}] at @s run function checkDmgRedctn
execute as @p[scores={worldTimer=20..}] at @s run function worldTimeReset

scoreboard players set @a[tag=combat:enabled] weaponTimer 2
scoreboard players remove @e[scores={weaponTimer=1..}] weaponTimer 1

scoreboard players set @e[scores={ignite_dur=1..,applyBurn=..2}] applyBurn 3

execute as @p[scores={worldTimer=5}] as @e[scores={statusBurn=1..}] at @s run particle status:burn
execute as @p[scores={worldTimer=10}] as @e[scores={statusBurn=1..}] at @s run particle status:burn
execute as @p[scores={worldTimer=15}] as @e[scores={statusBurn=1..}] at @s run particle status:burn
execute as @p[scores={worldTimer=20}] as @e[scores={statusBurn=1..}] at @s run particle status:burn

execute as @p[tag=!iframes,scores={worldTimer=4}] as @e[tag=!iframes,scores={statusBleed=1..,bleedDuration=1..}] at @s run damage @s 1 override
execute as @p[tag=!iframes,scores={worldTimer=14}] as @e[tag=!iframes,scores={statusBleed=1..,bleedDuration=1..}] at @s run damage @s 1 override

execute as @p[tag=!iframes,scores={worldTimer=5}] as @e[tag=!iframes,scores={statusBleed=1..,bleedDuration=1..}] at @s run particle status:bleed
execute as @p[tag=!iframes,scores={worldTimer=15}] as @e[tag=!iframes,scores={statusBleed=1..,bleedDuration=1..}] at @s run particle status:bleed

execute as @e[family=!summon,family=!summonprojectile,family=projectile,tag=!filler] at @s run function misc/projectileID
execute as @e[family=summon,family=!summonprojectile,family=!projectile,tag=!filler] at @s run function misc/summonID
execute as @e[family=!summon,family=summonprojectile,family=projectile,tag=!filler] at @s run function misc/summonprojectileID

tag @a[scores={evade_dur=1..}] add evasionEnabled
tag @a[scores={evade_dur=..0}] remove evasionEnabled

playanimation @e[type=misc:blockre] animation.creeper.swelling none 0 "v.xbasepos=v.xbasepos??0;v.ybasepos=v.ybasepos??0;v.zbasepos=v.zbasepos??0;v.xpos=v.xpos??0;v.ypos=v.ypos??0;v.zpos=v.zpos??0;v.xrot=v.xrot??0;v.yrot=v.yrot??0;v.zrot=v.zrot??0;v.scale=v.scale??1;v.xzscale=v.xzscale??1;v.yscale=v.yscale??1;v.swelling_scale1=2.1385*math.sqrt(v.xzscale)*math.sqrt(v.scale);v.swelling_scale2=2.1385*math.sqrt(v.yscale)*math.sqrt(v.scale);" anim2


execute as @e[scores={rumiaCurse=1..}] at @s run particle rumia:reachofthevoid ~~2.5~

execute as @e[scores={domainclash=1}] at @s run particle combat:domainclash ~~1.5~
execute as @e[scores={domainclash=1}] at @s run camerashake add @a[r=15,rm=10] 0.05 0.5 positional
execute as @e[scores={domainclash=1}] at @s run camerashake add @a[r=10,rm=5] 0.15 0.5 positional
execute as @e[scores={domainclash=1}] at @s run camerashake add @a[r=5,rm=0.1] 0.25 0.5 positional
execute as @e[tag=domain:clashing,scores={domainclash=1}] at @s run function domain/clashingDomain

scoreboard players set @e[tag=!grab:entityA,tag=grab:entityB] inGrab 1
scoreboard players set @e[scores={stun=1..},tag=!grab:entityB] inGrab 0

execute as @e[type=!projectile:needlearrow,type=!item] at @s run execute as @e[c=1,type=projectile:needlearrow,r=5] at @s run function attacks/projectiles/needlearrow
execute as @e[type=!projectile:bullet_rifle,type=!item] at @s run execute as @e[c=1,type=projectile:bullet_rifle,r=15] at @s run function attacks/projectiles/bullet_rifle
execute as @e[type=!projectile:bullet,type=!item] at @s run execute as @e[c=1,type=projectile:bullet,r=5] at @s run function attacks/projectiles/bullet
execute as @e[type=!projectile:manaorb,type=!item] at @s run execute as @e[c=1,type=projectile:manaorb,r=5] at @s run function attacks/projectiles/manaorb
execute as @e[type=!projectile:manaorbv2,type=!item] at @s run execute as @e[c=1,type=projectile:manaorbv2,r=5] at @s run function attacks/projectiles/manaorbv2
execute as @e[type=!projectile:arrowv2,type=!item] at @s run execute as @e[c=1,type=projectile:arrowv2,r=5] at @s run function attacks/projectiles/arrowv2
execute as @e[type=!projectile:rumble1,type=!item] at @s run execute as @e[c=1,type=projectile:rumble1,r=5] at @s run function attacks/projectiles/rumble1
execute as @e[type=!projectile:rumble2,type=!item] at @s run execute as @e[c=1,type=projectile:rumble2,r=5] at @s run function attacks/projectiles/rumble2
execute as @e[type=!projectile:dirtthrow,type=!item] at @s run execute as @e[c=1,type=projectile:dirtthrow,r=5] at @s run function attacks/projectiles/dirtthrow
execute as @e[type=projectile:rumianightbird,r=5] at @s run function attacks/rumia/slash
execute as @e[type=projectile:slash] at @s run function attacks/regsword/slash

execute as @e[tag=grab:entityB] at @s if score @s grabID = @e[c=1,tag=grab:entityA] grabID run ride @s start_riding @e[c=1,tag=grab:entityA] teleport_rider until_full

effect @a[tag=combat:enabled] weakness 1 255 true
tag @e[scores={stun=1..},tag=!autoDodge] add stun
tag @e[scores={stun=0},tag=stun] remove stun
execute as @a at @e[c=2,scores={parry=1..,stun=0,has_skill=0},tag=!basicAttack] run particle combat:parryv2
execute as @a at @e[c=2,tag=!blockstrong,tag=!dashing,scores={block=1..,parry=0}] run particle combat:block
execute as @a at @e[c=2,tag=blockstrong,tag=!dashing,scores={block=1..,parry=0}] run particle combat:blockstrong

execute as @e[tag=!stunImmune,tag=!evasionEnabled,family=!misc,scores={stun=1..100,stamina=0..}] at @s run particle combat:stunned1
execute as @e[tag=!stunImmune,tag=!evasionEnabled,family=!misc,scores={stun=101..200,stamina=0..}] at @s run particle combat:stunned1
execute as @e[tag=!stunImmune,tag=!evasionEnabled,family=!misc,scores={stun=201..300,stamina=0..}] at @s run particle combat:stunned2
execute as @e[tag=!stunImmune,tag=!evasionEnabled,family=!misc,scores={stun=301..,stamina=0..}] at @s run particle combat:stunned3

execute as @e[tag=stunImmune,family=!misc,family=!projectile] at @s run particle combat:stun_immunity
execute as @e[tag=iframes,family=!misc,family=!projectile,type=!item] at @s run particle combat:iframes
execute as @e[tag=!superarmor,tag=!evasionEnabled,family=!misc,scores={stamina=..-1}] at @s run particle combat:exhausted
execute as @e[tag=!stunImmune,tag=!evasionEnabled,family=!misc,scores={stamina=-100..-1}] at @s run particle combat:stunned1
execute as @e[tag=!stunImmune,tag=!evasionEnabled,family=!misc,scores={stamina=-200..-101}] at @s run particle combat:stunned1
execute as @e[tag=!stunImmune,tag=!evasionEnabled,family=!misc,scores={stamina=-300..-201}] at @s run particle combat:stunned2
execute as @e[tag=!stunImmune,tag=!evasionEnabled,family=!misc,scores={stamina=..-301}] at @s run particle combat:stunned3

effect @e[type=!player,type=!xp_orb,type=!item,family=!misc,scores={stun=1..}] slowness 1 255 true

tag @e[type=!xp_orb,type=!item,family=!misc,scores={superarmor=1..}] add stunImmune

scoreboard players add @e[type=!xp_orb,type=!item,family=!misc,scores={stamina=..-1,stun=..2}] stun 3
scoreboard players set @e[type=!xp_orb,type=!item,family=custom_mob,scores={stamina=..0}] emotionP 0
scoreboard players set @e[type=!xp_orb,type=!item,family=!misc,scores={emotionP=..-51}] emotionP -50
scoreboard players set @e[type=!xp_orb,type=!item,family=!misc,scores={emotionP=51..}] emotionP 50
scoreboard players add @e[tag=mana:regen,type=!xp_orb,type=!item,family=custom_mob,scores={magicule=..498}] magicule 2
scoreboard players remove @e[type=!xp_orb,type=!item,family=!misc,scores={superarmor=1..}] superarmor 1

scoreboard players add @e[type=!xp_orb,type=!item,family=!misc,tag=sprintClick] sprintClick 1
scoreboard players add @e[type=!xp_orb,type=!item,family=!misc,tag=sneakClick] sneakClick 1
scoreboard players add @e[type=!xp_orb,type=!item,family=!misc,tag=rightClick] rightClick 1
scoreboard players add @e[type=!xp_orb,type=!item,family=!misc,tag=leftClick] leftClick 1
scoreboard players add @e[type=!xp_orb,type=!item,family=!misc,tag=jumpClick] jumpClick 1
scoreboard players remove @e[type=!xp_orb,type=!item,family=!misc,scores={potentialTick=1..}] potentialTick 1

scoreboard players add @e[type=!xp_orb,type=!item,family=custom_mob,scores={stamina=..99},type=!player] stamina 1
scoreboard players add @e[type=!xp_orb,type=!item,type=player,scores={stamina=..99,block=0..,sprintClick=0,has_skill=0}] stamina 1
scoreboard players remove @e[type=!xp_orb,type=!item,type=player,scores={stamina=26..,has_skill=1..},tag=!basicAttack] stamina 1
scoreboard players remove @e[type=!xp_orb,type=!item,type=player,scores={stamina=26..,has_skill=0},tag=basicAttack] stamina 1
scoreboard players remove @e[scores={evadingDamage=1..}] evadingDamage 1
scoreboard players remove @e[scores={takingHit=1..}] takingHit 1
scoreboard players remove @e[scores={takingHitContact=1..}] takingHitContact 1
scoreboard players remove @e[scores={takingHitThorns=1..}] takingHitThorns 1
scoreboard players remove @e[scores={takingHitMagic=1..}] takingHitMagic 1
scoreboard players remove @e[scores={takingHitProj=1..}] takingHitProj 1
scoreboard players remove @e[scores={stun=1..}] stun 1
scoreboard players remove @e[scores={parry=1..}] parry 1