// priority: 5

EntityEvents.spawned(event => {
    let entity = event.entity
    let eUUID = entity.nbt.UUID
    let type = entity.type
    //////////袭击//////////
    if (entity.nbt.getString('forge:spawn_type') === 'EVENT') {
        if (type === "takesapillage:archer") {
            entity.server.scheduleInTicks(2, () => {
                entity.server.runCommandSilent(`execute as ${entity.uuid.toString()} run team join hostile @s`)
            })
            SummonedCreature(event, entity, {
                spawned: true,
                requireGround: true,
                entityType: "hundred_years_war:archer",
                count: 1,
                minRadius: 2,
                radius: 4,
                name: "强盗弓手",
                maxHealth: entity.nbt.Health,
                nbt: `{
                OwnerUUID:${eUUID},
                FollowTargetUUID:${eUUID},
                HandItems:[
                {id:"minecraft:bow",Count:1b}
                ],
                ArmorItems:[
                {id:"minecraft:leather_boots",Count:1b},
                {id:"taxbt:armor_pillager_leggings",Count:1b},
                {id:"taxbt:armor_pillager_chestplate",Count:1b},
                {id:"taxbt:armor_pillager_helmet",Count:1b}
                ]}`
            })
        }
        if (
            type === "illagerinvasion:firecaller" ||
            type === "illagerinvasion:sorcerer"
        ) {
            entity.server.scheduleInTicks(2, () => {
                entity.server.runCommandSilent(`execute as ${entity.uuid.toString()} run team join hostile @s`)
            })
            SummonedCreature(event, entity, {
                spawned: true,
                requireGround: true,
                entityType: "hundred_years_war:springald",
                count: 1,
                minRadius: 2,
                radius: 6,
                maxHealth: 60,
                nbt: `{
                OwnerUUID:${eUUID},
                FollowTargetUUID:${eUUID},
                }`
            })
        }
        if (
            type === "illagerinvasion:necromancer" ||
            type === "minecraft:illusioner"
        ) {
            entity.server.scheduleInTicks(2, () => {
                entity.server.runCommandSilent(`execute as ${entity.uuid.toString()} run team join hostile @s`)
            })
            entity.addTag("snk_summoner")
            SummonedCreature(event, entity, {
                spawned: true,
                requireGround: true,
                entityType: "hundred_years_war:priest",
                count: 1,
                minRadius: 2,
                radius: 6,
                name: "侵蚀祭祀",
                maxHealth: 30,
                nbt: `{
                OwnerUUID:${eUUID},
                FollowTargetUUID:${eUUID},
                Skin:20,
                HandItems:[
                {id:"alexscaves:beholder",Count:1b},
                {id:"hundred_years_war:priest_cane_1",Count:1b}
                ],
                Attributes:[
                {Base:50.0d,Name:"hundred_years_war:ranged_attack_damage"},
                ]}`
            })
        }
        if (type === "born_in_chaos_v1:missionary_raider") {
            entity.server.scheduleInTicks(2, () => {
                entity.server.runCommandSilent(`execute as ${entity.uuid.toString()} run team join hostile @s`)
            })
            entity.addTag("snk_summoner")
            SummonedCreature(event, entity, {
                spawned: true,
                requireGround: true,
                entityType: "hundred_years_war:priest",
                count: 1,
                minRadius: 2,
                radius: 6,
                name: "侵蚀祭祀",
                maxHealth: 30,
                nbt: `{
                OwnerUUID:${eUUID},
                FollowTargetUUID:${eUUID},
                Skin:20,
                HandItems:[
                {id:"alexscaves:beholder",Count:1b},
                {id:"hundred_years_war:priest_cane_1",Count:1b}
                ],
                Attributes:[
                {Base:50.0d,Name:"hundred_years_war:ranged_attack_damage"},
                ]}`
            })
        }
    }
})