帮Bet写的群体回复技能
设计思路:监听玩家使用物品后,获取周围实体,如果实体是玩家,就进行加血和加查克拉操作
function startItem(event) {
var player = event.player;
var item = event.item;
var lore = item.getLore();
for (var j = 0; j < lore.length; j++) {
if (lore[j].contains("你被强化了")) {
xc(player);
}
}
}
function xc(ply) {
var world = ply.world;
var livs = ply.getSurroundingEntities(8, 5);
world.spawnParticle("note", ply.getX(), ply.getY() + 1, ply.getZ(), 10, 0, 10, 0, 100);
for (var i = 0; i < livs.length; i++) {
if (livs[i].getType() == 1) {
livs[i].addPotionEffect(10, 5, 10, true);
var player = livs[i].getMCEntity();
var EntityPlayer = Java.type("net.minecraft.entity.player.EntityPlayer");
if (player instanceof EntityPlayer) {
var props = Java.type("alcoholmod.Mathioks.ExtendedPlayer").get(player);
props.setCurrentMana(props.getCurrentMana() + 50);
}
}
}
}
最后更新于