Untitled

 avatar
unknown
javascript
12 days ago
1.6 kB
5
Indexable
var player = event.getSource();

var REWARD = 75;
var CRITICAL_CHANCE = Math.random();

var current;

if (player != null) {
  if (CRITICAL_CHANCE > 0.02 && CRITICAL_CHANCE <= 0.07) {
    current = Math.round(REWARD * 0.4);

    player.sendMessage("&4 ¡Crítico! +" + current + " Tps");
    npc.executeCommand("playsound jinryuudragonbc:DBC2.strongpunch " + player.getName());
    world.spawnParticle("lava", npc.x, npc.y, npc.z, 1, 1, 1, 0.5, 20);

    giveReward();
  } else if (CRITICAL_CHANCE > 0.001 && CRITICAL_CHANCE <= 0.02) {
    current = Math.round(REWARD * 2.5);

    player.sendMessage("&b ¡Super Crítico! +" + current + " Tps");
    npc.executeCommand("playsound jinryuudragonbc:DBC2.strongpunch " + player.getName());
    npc.executeCommand("playsound minecraft:ambient.weather.thunder " + player.getName());
    world.spawnParticle("reddust", npc.x, npc.y, npc.z, 1, 1, 1, 0.9, 40);

    giveReward();
  } else if (CRITICAL_CHANCE <= 0.001) {
    current = Math.round(REWARD * 9);

    player.sendMessage("&5 ¡Ultra Crítico! +" + current + " Tps");
    npc.executeCommand("playsound jinryuudragonbc:DBC2.strongpunch " + player.getName());
    npc.executeCommand("playsound minecraft:ambient.weather.thunder " + player.getName());
    world.spawnParticle("reddust", npc.x, npc.y, npc.z, 1, 1, 1, 0.3, 140);
    
    giveReward();

    player.setTempData("ultra", 1);
    world.spawnClone(npc.x, npc.y + 1, npc.z + 1, 1, "T1 - Especial", 0);
  }
}

function giveReward() {
  npc.executeCommand("dbcadmin givetps " + player.getName() + " " + current);
}
Leave a Comment