execute if block ~ ~ ~ air unless block ~ ~ ~ light run setblock ~ ~ ~ light[level=7]

execute if score #anniR_global anniR_difficulty matches 0 run summon bat ~ ~ ~ {OnGround:1b,NoGravity:0b,Silent:1b,Invulnerable:1b,DeathLootTable:"minecraft:empty",PersistenceRequired:1b,NoAI:1b,CanPickUpLoot:0b,Tags:["anni_immune","eye_plat","anni_summoned"],Passengers:[{id:"minecraft:skeleton",NoGravity:1b,DeathLootTable:"minecraft:empty",PersistenceRequired:1b,Health:20f,Tags:["anni_immune","anni_summoned"],HandItems:[{id:"minecraft:bow",Count:1b,tag:{Enchantments:[{id:"minecraft:power",lvl:7s},{id:"minecraft:flame",lvl:2s}]}},{}],HandDropChances:[0.000F,0.085F],ArmorItems:[{},{},{},{id:"minecraft:player_head",Count:1b,tag:{SkullOwner:{Id:[I;1058920221,1405175447,-2141444793,293571166],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzc0YTNiODEyYmNhM2FhYjQ0NTQ5NzAyYWQ1NmYzMmY0Mzk1MjIwNzMyMjBkODU0NTBlNDQyZGMyZTE3MzMzIn19fQ=="}]}}}}],ArmorDropChances:[0.085F,0.085F,0.085F,0.000F],active_effects:[{id:"minecraft:fire_resistance",amplifier:5b,duration:-1,show_particles:0b},{id:"minecraft:invisibility",amplifier:1b,duration:-1,show_particles:0b}],Attributes:[{Name:generic.max_health,Base:20},{Name:generic.follow_range,Base:100}]}],active_effects:[{id:"minecraft:invisibility",amplifier:1b,duration:-1,show_particles:0b}]}
execute if score #anniR_global anniR_difficulty matches 1 run summon bat ~ ~ ~ {OnGround:1b,NoGravity:0b,Silent:1b,Invulnerable:1b,DeathLootTable:"minecraft:empty",PersistenceRequired:1b,NoAI:1b,CanPickUpLoot:0b,Tags:["anni_immune","eye_plat","anni_summoned"],Passengers:[{id:"minecraft:skeleton",NoGravity:1b,DeathLootTable:"minecraft:empty",PersistenceRequired:1b,Health:28f,Tags:["anni_immune","anni_summoned"],HandItems:[{id:"minecraft:bow",Count:1b,tag:{Enchantments:[{id:"minecraft:power",lvl:12s},{id:"minecraft:flame",lvl:2s}]}},{}],HandDropChances:[0.000F,0.085F],ArmorItems:[{},{},{},{id:"minecraft:player_head",Count:1b,tag:{SkullOwner:{Id:[I;1058920221,1405175447,-2141444793,293571166],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzc0YTNiODEyYmNhM2FhYjQ0NTQ5NzAyYWQ1NmYzMmY0Mzk1MjIwNzMyMjBkODU0NTBlNDQyZGMyZTE3MzMzIn19fQ=="}]}}}}],ArmorDropChances:[0.085F,0.085F,0.085F,0.000F],active_effects:[{id:"minecraft:fire_resistance",amplifier:5b,duration:-1,show_particles:0b},{id:"minecraft:invisibility",amplifier:1b,duration:-1,show_particles:0b}],Attributes:[{Name:generic.max_health,Base:28},{Name:generic.follow_range,Base:100}]}],active_effects:[{id:"minecraft:invisibility",amplifier:1b,duration:-1,show_particles:0b}]}
execute if score #anniR_global anniR_difficulty matches 2 run summon bat ~ ~ ~ {OnGround:1b,NoGravity:0b,Silent:1b,Invulnerable:1b,DeathLootTable:"minecraft:empty",PersistenceRequired:1b,NoAI:1b,CanPickUpLoot:0b,Tags:["anni_immune","eye_plat","anni_summoned"],Passengers:[{id:"minecraft:skeleton",NoGravity:1b,DeathLootTable:"minecraft:empty",PersistenceRequired:1b,Health:37f,Tags:["anni_immune","anni_summoned"],HandItems:[{id:"minecraft:bow",Count:1b,tag:{Enchantments:[{id:"minecraft:power",lvl:19s},{id:"minecraft:flame",lvl:2s}]}},{}],HandDropChances:[0.000F,0.085F],ArmorItems:[{},{},{},{id:"minecraft:player_head",Count:1b,tag:{SkullOwner:{Id:[I;1058920221,1405175447,-2141444793,293571166],Properties:{textures:[{Value:"eyJ0ZXh0dXJlcyI6eyJTS0lOIjp7InVybCI6Imh0dHA6Ly90ZXh0dXJlcy5taW5lY3JhZnQubmV0L3RleHR1cmUvNzc0YTNiODEyYmNhM2FhYjQ0NTQ5NzAyYWQ1NmYzMmY0Mzk1MjIwNzMyMjBkODU0NTBlNDQyZGMyZTE3MzMzIn19fQ=="}]}}}}],ArmorDropChances:[0.085F,0.085F,0.085F,0.000F],active_effects:[{id:"minecraft:fire_resistance",amplifier:5b,duration:-1,show_particles:0b},{id:"minecraft:invisibility",amplifier:1b,duration:-1,show_particles:0b}],Attributes:[{Name:generic.max_health,Base:37},{Name:generic.follow_range,Base:100}]}],active_effects:[{id:"minecraft:invisibility",amplifier:1b,duration:-1,show_particles:0b}]}

execute if score #anniR_global anniR_team matches 1 run team join annihilation_team @e[type=bat,tag=anni_immune,tag=anni_summoned,distance=..0,limit=1,sort=nearest]
execute if score #anniR_global anniR_team matches 1 run team join annihilation_team @e[type=skeleton,tag=anni_immune,tag=anni_summoned,distance=..1,limit=1,sort=nearest]