I have 6 players, each player has a stat called Karma. Karma can go from -1000 to 1000. If the player has 0 karma, their chances are normal, 1000 is very likely. Here is my current method of picking a special player. List<String> players = new ArrayList<String>(); for (Player p : getOnlinePlayers() { players.add(p.getName()); } Player p = getPlayer(players.get(new Random().nextInt(players .size()))); while (sherrifs.contains(p.getName())) { p = Bukkit.getPlayer(players.get(new Random().nextInt(players .size()))); } special = p;
This currently does not include the karma but I was thinking of adding the player 1 time for each karma they have, but that would be really inefficient if all 6 players had 1000 karma which would mean, each name is entered 1000 times. Also this wouldn't work with -1000 karma since the name has to be entered atleast once.
samedi 20 juin 2015
Increasing Chances
Inscription à :
Publier les commentaires (Atom)
Aucun commentaire:
Enregistrer un commentaire