summon2.mcfunction 1.7 KB

123456789101112131415161718192021222324252627282930
  1. execute as @e[tag=new_phantom] at @s run tp @s ~ 33 ~
  2. # 设置攻击力与随机生命值
  3. attribute @e[tag=new_phantom,limit=1] generic.attack_damage base set 4
  4. scoreboard players set $random_min mem 1
  5. scoreboard players set $random_max mem 2
  6. function lib:random
  7. execute if score $random mem matches 1 run attribute @e[tag=new_phantom,limit=1] generic.max_health base set 2
  8. execute if score $random mem matches 2 run attribute @e[tag=new_phantom,limit=1] generic.max_health base set 5
  9. # 如果满足条件(在 tick20 中检查),则刷出奖励幻翼
  10. execute if score #new_item mem matches 0 run tellraw @a ["\n",{"text": ">> ","color":"red","bold": true},{"text": "击杀红色幻翼, 获取奖励物资!\n","color":"red"}]
  11. execute if score #new_item mem matches 0 run title @a times 1 80 3
  12. execute if score #new_item mem matches 0 run title @a title ""
  13. execute if score #new_item mem matches 0 run playsound minecraft:entity.player.levelup player @a 0 1000000 0 1000000 2
  14. execute if score #new_item mem matches 0 run tag @e[tag=new_phantom] add bonus_phantom
  15. execute if score #new_item mem matches 0 run scoreboard players set $new_item_cd mem 0
  16. # 修改奖励幻翼的属性
  17. team join red @e[tag=bonus_phantom,tag=new_phantom,limit=1]
  18. effect give @e[tag=bonus_phantom,tag=new_phantom,limit=1] glowing 1000000 0 true
  19. data merge entity @e[tag=bonus_phantom,tag=new_phantom,limit=1] {Size:7,DeathLootTable:"mini:phantom"}
  20. attribute @e[tag=bonus_phantom,tag=new_phantom,limit=1] generic.attack_damage base set 8
  21. attribute @e[tag=bonus_phantom,tag=new_phantom,limit=1] generic.max_health base set 20
  22. # 确认属性修改
  23. effect give @e[tag=new_phantom] instant_damage 1 10 true
  24. tag @e[tag=new_phantom] remove new_phantom