示例#1
0
 public void achieve(int playerID, int gameID, int achievementID) {
   if (players.containsKey(playerID) && achievements.containsKey(achievementID)) {
     Player p = players.get(playerID);
     Achievement a = achievements.get(achievementID);
     if (p.games.containsKey(gameID)
         && !p.games.get(gameID).achievements.contains(achievementID)) {
       Playing playerInfo = p.games.get(gameID);
       int pointsEarned = a.points;
       playerInfo.achievements.add(achievementID);
       playerInfo.addPoints(pointsEarned);
       p.addPoints(pointsEarned);
       a.players.add(playerID);
     } else {
       // System.out.println("player does not play this game or already has this achievement");
     }
   } else {
     // System.out.println("player or achievement does not exist");
   }
 }