summon2.mcfunction 1.7 KB

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