public static double getSpecialMeleeHit(Player p, Entity target, int weapon) { double targetDefence = getMeleeDefence(p, target); double attackerAttack = getMeleeAttack(p) * getSpecialAttackBonus(weapon); double hit = misc.randomDouble(getPlayerMaxHit(p, 0)); double playerMaxHit = getPlayerMaxHit(p, 0); if (misc.randomDouble(attackerAttack) < misc.randomDouble(targetDefence)) { p.setLastHit(0); return 0; } if (hit < (playerMaxHit * 0.50)) { if (p.getLastHit() == 0) { if (misc.random(6) == 0) { hit = (playerMaxHit * 0.50) + misc.randomDouble(playerMaxHit * 0.50); } } else if (p.getLastHit() > misc.random(6)) { if (misc.random(6) == 0) { hit = (playerMaxHit * 0.50) + misc.randomDouble(playerMaxHit * 0.50); } } } return hit; }
public static double getMeleeHit(Player p, Entity target) { double targetDefence = getMeleeDefence(p, target); double attack = getMeleeAttack(p); double hit = misc.randomDouble(getPlayerMaxHit(p, 0)); if (misc.randomDouble(attack) < misc.randomDouble(targetDefence)) { p.setLastHit(0); return 0; } if (hit < (p.getMaxHit() * 0.50)) { if (p.getLastHit() == 0) { if (misc.random(6) == 0) { hit = (getPlayerMaxHit(p, 0) * 0.50) + misc.randomDouble(getPlayerMaxHit(p, 0) * 0.50); } } else if (p.getLastHit() > misc.randomDouble(6)) { if (misc.random(6) == 0) { hit = (getPlayerMaxHit(p, 0) * 0.50) + misc.randomDouble(getPlayerMaxHit(p, 0) * 0.50); } } } p.setLastHit(hit); return hit; }