execute as @e[type=skeleton,tag=!plussed] run data remove entity @s equipment.mainhand.components."minecraft:enchantments"
execute as @e[type=skeleton,tag=!plussed] run data merge entity @s {DeathLootTable:"survivalplus:entities/skeleton"}
execute at @e[type=skeleton,tag=!plussed,predicate=survivalplus:100thchance,predicate=survivalplus:can_see_sky] unless entity @a[distance=..20] if score time time matches 13000..23400 run summon skeleton_horse ~ ~ ~ {SkeletonTrap:1b,Age:-9999}
execute as @e[type=skeleton,tag=!plussed,predicate=survivalplus:skeleton_type/skelhorserider] run function survivalplus:mobs/horsetrapskel
execute if score bloodmoon time matches 1 if score time time matches 13000..23400 run function survivalplus:mobs/living_armor

#execute unless entity @e[tag=skelmerchant] run execute as @e[type=skeleton,predicate=survivalplus:2chance,predicate=survivalplus:underground,predicate=survivalplus:overworld,tag=!plussed,limit=1] run data merge entity @s {CanPickUpLoot:0b,CustomName:{"text":"Skeleton Merchant"},Tags:[merchant_face,rare,plussed,spawnmerchant,skelmerchant,skelmerc,nopoly],equipment:{mainhand:{id:shield},legs:{id:leather_leggings},head:{id:golden_helmet}},drop_chances:{mainhand:0f,feet:0f,legs:0f,chest:0f,head:0f},attributes:[{id:"movement_speed",base:0.25f}],DeathLootTable:"survivalplus:entities/merchant"}
#execute at @e[type=skeleton,tag=spawnmerchant] run summon villager ~ ~ ~ {CustomName:"Skeleton Merchant",VillagerData:{type:plains,profession:nitwit,level:99},Offers:{Recipes:[{maxUses:2,buy:{id:coal,count:10},sell:{id:iron_pickaxe}},{maxUses:3,buy:{id:emerald,count:2},sell:{id:diamond}},{maxUses:16,buy:{id:bone,count:6},sell:{id:soul_torch,count:4}},{maxUses:6,buy:{id:rotten_flesh,count:14},sell:{id:bread,count:5}},{maxUses:12,buy:{id:cobbled_deepslate,count:32},sell:{id:emerald,count:3}},{maxUses:3,buy:{id:cobblestone,count:32},sell:{id:tnt,count:2}},{maxUses:10,buy:{id:tuff,count:20},sell:{id:"minecraft:barrel",components:{container_loot:{loot_table:"survivalplus:gameplay/crates/deep_cave"},item_name:{"text":"Deep Cave Crate","italic":false},enchantment_glint_override:1b,tooltip_display:{hidden_components:[container_loot]}}}},{maxUses:8,buy:{id:moss_block,count:12},sell:{id:lapis_lazuli,count:5}},{maxUses:8,buy:{id:amethyst_shard,count:4},sell:{id:raw_iron,count:4}},{maxUses:3,buy:{id:raw_gold,count:5},sell:{id:potion,components:{potion_contents:{custom_color:16776960,custom_effects:[{id:haste,duration:3600}]},custom_name:{"text":"Potion of Haste","italic":false}}}},{maxUses:2,buy:{id:gunpowder,count:16},sell:{id:potion,components:{potion_contents:{custom_color:16733440,custom_effects:[{id:absorption,duration:1200,amplifier:3}]},custom_name:{"text":"Potion of Absorption","italic":false}}}}]},CustomName:{"text":"Skeleton Merchant"},Invulnerable:1b,NoAI:1b,Silent:1b,Tags:[merchant,plussed,skelmerchant,skelmerc],Team:merchant,active_effects:[{id:invisibility,duration:-1,show_particles:0b}],equipment:{mainhand:{id:bundle},offhand:{id:torch}},drop_chances:{mainhand:0f,offhand:0f}}
#execute as @e[tag=spawnmerchant,type=skeleton] run tag @s remove spawnmerchant

#execute if score wither death matches 1 unless entity @e[tag=starmerchant] as @e[type=skeleton,predicate=survivalplus:can_see_sky,predicate=survivalplus:2chance,tag=!plussed,limit=1] at @s run function survivalplus:merchants/readystarmerchant

execute unless entity @e[tag=player2] run execute as @e[type=skeleton,tag=!plussed,predicate=survivalplus:2chance,predicate=survivalplus:underground,limit=1] at @s unless entity @a[distance=..20] run function survivalplus:mobs/player/player2
execute as @e[type=skeleton,tag=!plussed,predicate=survivalplus:1chance,predicate=survivalplus:deep_cave] run data merge entity @s {CustomName:{"text":"Tim"},CanPickUpLoot:0b,Tags:[tim,rare,plussed,upgradeable,armorable,nopoly],drop_chances:{mainhand:0f,legs:0f,chest:0f,head:1f},equipment:{mainhand:{id:bow,components:{enchantments:{"survivalplus:teleport_bolt":1}}},legs:{id:leather_leggings,components:{trim:{pattern:vex,material:amethyst},dyed_color:3949738}},chest:{id:leather_chestplate,components:{trim:{pattern:vex,material:amethyst},dyed_color:3949738}},head:{id:leather_helmet,components:{custom_data:{wizardhat:tag},trim:{pattern:rib,material:copper},attribute_modifiers:[{type:"armor",amount:3,slot:head,id:"-12321231013232240-62026",operation:add_value}],item_name:{"text":"Wizard Hat","italic":false},lore:[{"text":"Chance to get +1 XP level on kill","italic":false,"color":"light_purple"}],tooltip_display:{hidden_components:[dyed_color,trim]}}}},attributes:[{id:"movement_speed",base:0.4f}]}
execute as @e[type=skeleton,tag=!plussed,predicate=survivalplus:2chance] run data merge entity @s {CanPickUpLoot:0b,Health:25,Tags:[plussed,rare,upgradeable,gold_skel,armorable,speedgoldme],equipment:{mainhand:{id:golden_axe},feet:{id:golden_boots},legs:{id:golden_leggings},chest:{id:golden_chestplate},head:{id:golden_helmet}},drop_chances:{mainhand:0.25f},attributes:[{id:"max_health",base:25f},{id:"attack_knockback",base:1f},{id:"knockback_resistance",base:0.3f},{id:"armor",base:6f},{id:"attack_damage",base:-2f}]}
execute as @e[tag=speedgoldme] run function survivalplus:mobs/gear/gold_skel
execute if score hardmode hardmode matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:5chance,predicate=survivalplus:nether] run data merge entity @s {Health:35,Tags:[plussed,healwiz,rare,dmgreduce,fastregen],CanPickUpLoot:0b,equipment:{mainhand:{id:blaze_rod,components:{custom_data:{healwand:tag},attribute_modifiers:[{type:"attack_speed",amount:-3,slot:mainhand,id:"-123101435687174329-71374",operation:add_value},{type:"max_health",amount:0.1,slot:mainhand,operation:add_multiplied_base,id:"-123101435787174329-71574"}],item_name:{"text":"Hot Wand","italic":false,"color":"dark_purple"},lore:[{"text":"Inflicts healing on hit","italic":false,"color":"light_purple"}],enchantments:{fire_aspect:1}}},chest:{id:golden_chestplate},head:{id:honey_block}},attributes:[{id:"armor",base:5f},{id:"knockback_resistance",base:0.3f},{id:"attack_knockback",base:2f},{id:"max_health",base:35f},{id:"armor_toughness",base:4f},{id:"movement_speed",base:0.25f},{id:"attack_damage",base:6f}],drop_chances:{mainhand:.3f,feet:0f,legs:0f,chest:0f,head:0f}}
execute if score hardmode hardmode matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:1chance,predicate=survivalplus:underground] run data merge entity @s {Health:40,Tags:[plussed,spawner,rare,lowregen],CanPickUpLoot:0b,equipment:{legs:{id:stick,components:{enchantments:{"survivalplus:spawner":1},custom_data:{del:tag}}},head:{id:spawner},mainhand:{id:bow}},attributes:[{id:"armor",base:10f},{id:"knockback_resistance",base:0.7f},{id:"attack_knockback",base:2f},{id:"max_health",base:40f},{id:"armor_toughness",base:4f},{id:"movement_speed",base:0.23f},{id:"attack_damage",base:4f}],drop_chances:{legs:0f,head:0f},DeathLootTable:"survivalplus:entities/spawner_mob"}
execute if score hardmode hardmode matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:5chance,predicate=survivalplus:aboveground] run data merge entity @s {Tags:[plussed,swapper_mage,armorable],CustomName:{"text":"Swapper"},Health:25,CanPickUpLoot:0b,equipment:{mainhand:{id:bow,components:{enchantments:{punch:1}}},feet:{id:leather_boots,components:{trim:{pattern:vex,material:diamond},dyed_color:7982310}},legs:{id:leather_leggings,components:{trim:{pattern:vex,material:diamond},dyed_color:7982310}},chest:{id:leather_chestplate,components:{trim:{pattern:vex,material:diamond},dyed_color:7982310}},head:{id:diamond_helmet,components:{dyed_color:7982310}}},drop_chances:{mainhand:0f,feet:0f,legs:0f,chest:0f,head:0f},attributes:[{id:"knockback_resistance",base:0.4f},{id:"max_health",base:25f},{id:"armor_toughness",base:8f},{id:"armor",base:10f},{id:"movement_speed",base:0.3f}],DeathLootTable:"survivalplus:entities/swap_mage"}
execute if score hardmode hardmode matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:2chance] run data merge entity @s {Tags:[plussed,poly_mage,rare,upgradeable,nopoly],CustomName:{"text":"Polymorpher"},Health:28,CanPickUpLoot:0b,equipment:{mainhand:{id:bow,components:{max_damage:1000,enchantments:{"survivalplus:polymorph":1}}},feet:{id:leather_boots,components:{trim:{pattern:sentry,material:amethyst},dyed_color:11289023}},legs:{id:leather_leggings,components:{trim:{pattern:sentry,material:amethyst},dyed_color:11289023}},chest:{id:leather_chestplate,components:{dyed_color:11289023}},head:{id:leather_helmet,components:{trim:{pattern:sentry,material:amethyst},dyed_color:11289023}}},drop_chances:{mainhand:0f,feet:0f,legs:0f,chest:0f,head:0f},attributes:[{id:"knockback_resistance",base:0.4f},{id:"max_health",base:28f},{id:"armor_toughness",base:2f},{id:"armor",base:5f},{id:"movement_speed",base:0.3f}],DeathLootTable:"minecraft:entities/skeleton"}
execute if score hardmode hardmode matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:1chance] run data merge entity @s {Health:20,Tags:[plussed,limitammo,special,setammo],equipment:{mainhand:{id:bow},feet:{id:"minecraft:iron_boots",components:{trim:{material:"minecraft:netherite",pattern:"minecraft:tide"}}},legs:{id:"minecraft:iron_leggings",components:{trim:{material:"minecraft:netherite",pattern:"minecraft:vex"}}},chest:{id:"minecraft:netherite_chestplate",components:{trim:{material:"minecraft:quartz",pattern:"minecraft:wild"}}},head:{id:"minecraft:netherite_helmet",components:{trim:{material:"minecraft:quartz",pattern:"minecraft:raiser"}}}},drop_chances:{feet:0f,legs:0f,chest:0f,head:0f},attributes:[{id:"knockback_resistance",base:0.3f},{id:"max_health",base:20f},{id:"movement_speed",base:0.23f}],DeathLootTable:"survivalplus:entities/limitammo"}
execute as @e[tag=setammo] run scoreboard players set @s burst 10
execute as @e[tag=setammo] run tag @e remove setammo
execute if score hardmode hardmode matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:1chance] run data merge entity @s {Health:20,Tags:[plussed,stealthskel,special,invisme],equipment:{mainhand:{id:bow,components:{item_model:air,enchantments:{punch:3,power:2}}},feet:{},legs:{},chest:{id:"minecraft:chainmail_chestplate",components:{trim:{material:"minecraft:iron",pattern:"minecraft:rib"},item_model:air,equippable:{slot:chest}}},head:{id:"minecraft:chainmail_helmet",components:{trim:{material:"minecraft:iron",pattern:"minecraft:shaper"},item_model:air,equippable:{slot:head}}}},attributes:[{id:"knockback_resistance",base:0.3f},{id:"max_health",base:20f},{id:"movement_speed",base:0.1f}],DeathLootTable:"minecraft:entities/skeleton",Silent:1b}
execute as @e[type=skeleton,tag=!plussed,predicate=survivalplus:25chance] run data merge entity @s {Health:30,Tags:[plussed],CanPickUpLoot:0b,equipment:{mainhand:{id:iron_sword},feet:{id:chainmail_boots},legs:{id:chainmail_leggings},chest:{id:iron_chestplate},head:{id:iron_helmet}},drop_chances:{feet:0f,legs:0f,chest:0f,head:0f},attributes:[{id:"movement_speed",base:0.26f},{id:"knockback_resistance",base:0.5f},{id:"max_health",base:30f},{id:"armor_toughness",base:6f}]}
execute if score hardmode hardmode matches 1 as @e[type=skeleton,nbt={equipment:{mainhand:{id:"minecraft:iron_sword"}}},tag=!weakcheck] run function survivalplus:mobs/enchantweak
#execute if score hardmode hardmode matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:20chance] run data merge entity @s {Health:35,Tags:[plussed,weakener],equipment:{mainhand:{id:iron_sword,components:{enchantments:{"survivalplus:weakening":1}}},feet:{id:iron_boots,components:{trim:{pattern:shaper,material:iron}}},legs:{id:iron_leggings},chest:{id:chainmail_chestplate,components:{trim:{pattern:shaper,material:iron}}},head:{id:chainmail_helmet}},drop_chances:{mainhand:0.25f,feet:0f,legs:0f,chest:0f,head:0f},attributes:[{id:"movement_speed",base:0.3f},{id:"knockback_resistance",base:0.5f},{id:"max_health",base:35f}]}
execute if score hardmode hardmode matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:deep_cave,predicate=survivalplus:2chance,predicate=survivalplus:overworld] run data merge entity @s {CanPickUpLoot:0b,CustomName:{"text":"Skeleton Commando"},Health:25,Tags:[plussed,rare,commander,loading,upgradeable],equipment:{mainhand:{id:bow,components:{enchantments:{"survivalplus:explosive":1}}},feet:{id:leather_boots,components:{trim:{pattern:snout,material:netherite},dyed_color:5263440,enchantments:{blast_protection:2,projectile_protection:2}}},legs:{id:iron_leggings},chest:{id:leather_chestplate,components:{trim:{pattern:snout,material:netherite},dyed_color:5263440,enchantments:{blast_protection:2,projectile_protection:2}}},head:{id:turtle_helmet,components:{trim:{pattern:rib,material:emerald},enchantments:{blast_protection:4}}}},attributes:[{id:"armor",base:-8f},{id:"max_health",base:25f},{id:"knockback_resistance",base:0.5f}],drop_chances:{mainhand:0f,feet:0f,legs:0f,chest:0f,head:0f}}
execute if score warden death matches 1 as @e[type=skeleton,tag=!plussed,predicate=survivalplus:2chance,predicate=survivalplus:deep_cave] run data merge entity @s {Health:30,Tags:[plussed,special,sculkskel,sculk,rare],CanBreakDoors:0b,CanPickUpLoot:0b,equipment:{mainhand:{id:bow},feet:{id:leather_boots,components:{dyed_color:0}},feet:{id:leather_leggings,components:{dyed_color:0}},chest:{id:leather_chestplate,components:{dyed_color:0}},head:{id:sculk}},attributes:[{id:"attack_damage",base:6f},{id:"movement_speed",base:0.26f},{id:"knockback_resistance",base:0.5f},{id:"max_health",base:30f},{id:"armor_toughness",base:2f}],drop_chances:{feet:0f,lesg:0f,chest:0f,head:1f},DeathLootTable:"survivalplus:entities/sculk_mob"}
execute as @e[type=skeleton,tag=!plussed,predicate=survivalplus:10chance] run data merge entity @s {Health:25,Tags:[plussed],CanPickUpLoot:0b,LeftHanded:1b,equipment:{mainhand:{id:bow,components:{enchantments:{"survivalplus:long_shot":1}}}},drop_chances:{mainhand:0.25f},attributes:[{id:"knockback_resistance",base:0.5f},{id:"movement_speed",base:0.3f},{id:"max_health",base:25f},{id:"armor_toughness",base:2f}]}
execute as @e[type=skeleton,tag=!plussed] run data merge entity @s {CanPickUpLoot:1b,Health:25,attributes:[{id:"knockback_resistance",base:0.5f},{id:"movement_speed",base:0.3f},{id:"max_health",base:25f},{id:"armor_toughness",base:4f}],equipment:{mainhand:{id:bow,components:{enchantments:{power:5}}}},drop_chances:{mainhand:0f}}
execute as @e[type=skeleton,tag=!plussed] run tag @s add plussed