Untitled
unknown
plain_text
2 years ago
2.5 kB
5
Indexable
switch (Math.floor(Math.random() * 2) + 1) { case 0: hits(); break; case 1: stomp(); break; case 2: strongPunch(); break; } function hits() { var dataId = "-on-ability"; if (npc.hasTempData(dataId)) { event.setCancelled(true); return; } if (Math.random() * 100 > 15) { return; } var player = event.getSource(); if (player == null) return; var API = world.getTempData("API"); npc.setTempData(dataId, true); API.runTaskTime(function() { var newPos = { x: player.getX(), y: player.getY(), z: player.getZ(), } player.knockback(1, npc.getRotation()); npc.setPosition(newPos.x, newPos.y, newPos.z); world.spawnParticle("cloud", newPos.x, newPos.y, newPos.z, 0.2, 0.2, 0.2, 0.5, 20); npc.executeCommand("playsound minecraft:note.bassattack " + player.getName()); }, 5, 15); API.runLater(function() { player.knockback(8, npc.getRotation()); npc.removeTempData(dataId); }, 80); } function stomp() { if (Math.random() * 100 <= 15) { var nearbyEntities = npc.getSurroundingEntities(8, 1); world.spawnParticle("lava", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 50); world.spawnParticle("smoke", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 100); world.spawnParticle("flame", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 80); world.spawnParticle("cloud", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 100); npc.say("&c¡PISOTÓN!"); for (var i = 0; i < nearbyEntities.length; i++) { var player = nearbyEntities[i]; if (player == null) continue; world.explode(player.getX(), player.getY(), player.getZ(), 2, false, false); player.knockback(4, npc.getRotation()); } } } function strongPunch() { var player = event.getTarget(); if (player == null) return; if (Math.random() * 100 <= 20) { player.knockback(4, npc.getRotation()); world.spawnParticle("smoke", npc.getX(), npc.getY(), npc.getZ(), 0.2, 0.2, 0.2, 0.5, 150); npc.executeCommand("playsound jinryuudragonbc:DBC2.strongpunch " + player.getName()); } }
Editor is loading...