Originally Posted by
Ultimate_
what about if the number actually is 55
?
You can use this if you want 55 to be a lose:
Code:
int random = (int) (Math.random()*100);
if (random > 55) {
player.sendMessage("You win!");
player.addInventory().addItem(item, item.getAmount() * 2);
} else if (random <= 55) {
player.sendMessage("You Lose!");
player.getInventory().deleteItem(item);
}
}
Or this if you want it to be a win:
Code:
int random = (int) (Math.random()*100);
if (random >= 55) {
player.sendMessage("You win!");
player.addInventory().addItem(item, item.getAmount() * 2);
} else if (random < 55) {
player.sendMessage("You Lose!");
player.getInventory().deleteItem(item);
}
}