###Builds the obelisk###
tp @s ~ ~3 ~
execute at @s run place template nitref:invasion/obelisk ~-4 ~ ~-4

###Summons hostile mobs###
execute at @s run summon magma_cube ~-1 ~4 ~-1 {Size:2b,Passengers:[{id:skeleton,PersistenceRequired:1,HandItems:[{Count:1,id:bow,tag:{Enchantments:[{id:flame,lvl:1},{id:infinity,lvl:1}]}},{}],CustomName:'{"text":"Tyrant\'s Invader"}',HandDropChances:[1.0f,0.0f],ArmorDropChances:[0.0f,0.0f,0.0f,1.0f],ActiveEffects:[{Id:12,Amplifier:0,Duration:999999}]}],Tags:[nitEntity,smithed.entity]}
execute at @s run summon magma_cube ~1 ~4 ~1 {Size:2b,Passengers:[{id:skeleton,PersistenceRequired:1,HandItems:[{Count:1,id:bow,tag:{Enchantments:[{id:flame,lvl:1},{id:infinity,lvl:1}]}},{}],CustomName:'{"text":"Tyrant\'s Invader"}',HandDropChances:[1.0f,0.0f],ArmorDropChances:[0.0f,0.0f,0.0f,1.0f],ActiveEffects:[{Id:12,Amplifier:0,Duration:999999}]}],Tags:[nitEntity,smithed.entity]}
execute at @s run summon wither_skeleton ~1 ~4 ~-1 {PersistenceRequired:1,HandItems:[{Count:1,id:netherite_sword,tag:{Enchantments:[{id:fire_aspect,lvl:1}]}},{}],CustomName:'{"text":"Tyrant\'s General"}',Tags:[smithed.entity,smithed.strict,nitInvadeGeneral,nitEntity],DeathLootTable:"nitk:entities/tyrant_general"}

###Progress the invasion score and performs cosmetics###
scoreboard players add @a[predicate=nitref:end_dimension] nitInvadeProg 1
summon minecraft:lightning_bolt

tellraw @a[predicate=nitref:end_dimension] [{"text":"[۩]","color":"green","bold":true},{"text":": ","color":"white","bold":false},{"text":"An obelisk has emerged with one of the Tyrant's generals!","color":"dark_red"}]