Script golpes tapion

mail@pastecode.io avatar
unknown
javascript
2 years ago
4.0 kB
2
Indexable
Never
function onAttack(event) { 
    var player = event.getPlayer(); 
    var playerDBC = API.getDBCPlayer(player);
    var tiempoLimite = player.getName() + "-tiempo-limite-tapion";
    var contadorId = player.getName() + "-contador-tapion";
    var abilityCooldownId = player.getName() + "-golpes-tapion";
    var boostId = "BOOST_TAPION";

    if (API.isOnCooldown(abilityCooldownId)) {
        API.popUpmessage(player, "&c¡Espera " + API.getPendingSeconds(cooldownId) + "s!", 1);
        return;
    }

    if (!(API.containsTempData(contadorId))) {
        API.setTempData(contadorId, 1);
    }

    if (!(API.isOnCooldown(tiempoLimite))) {
        API.setCooldown(tiempoLimite, 600);
    }
         
    switch (contador) {
        case 1:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .05, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.popUpmessage(player, "&a¡Llegaste a 1 golpe!", 1);
            break;
        case 2:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .1, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 2 golpes!");
            break;
        case 3:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .15, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 3 golpes!");
            break;
        case 4:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .2, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 4 golpes!");
            break;
        case 5:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .25, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 5 golpes!");
            break;
        case 6:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .30, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 6 golpes!");
            break;
        case 7:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .35, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 7 golpes!");
            break;
        case 8:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .40, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 8 golpes!");
            break;
        case 9:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .45, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 9 golpes!");
            break;
        case 10:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .50, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 10 golpes!");
            break;
        case 11:
            playerDBC.addBonus(boostId, BonusType.MULTIPLY, .55, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
            API.setTempData(dataId, true);
            API.message(player, "&a¡Llegaste a 11 golpes!");
            break;
    }

    if (contador >= 12) {
        playerDBC.addBonus(boostId, BonusType.MULTIPLY, .6, Stat.STR, Stat.CON, Stat.WIL, Stat.DEX);
        API.message(player, "¡Llegaste a los 12 golpes!");        
    } else if (contador < 12 && !(API.isOnCooldown(tiempoLimite))) {
        playerDBC.removeBonus(boostId);
        API.message(player, "&c¡Bonus removido!");
        API.setCooldown(abilityCooldownId, ability.getCooldown());
        API.removeTempData(contadorId); 
    }
    return; 
}