コード例 #1
0
ファイル: WolfVictory.java プロジェクト: egelmex/Werewolf
 @Override
 public String getVictoryMessage(PlayerList players) {
   if (players.wolfCount() == 1) {
     return String.format(
         "After turning on the last remaining %svillager%s, %s prowls on to terrorize somewhere else.",
         Team.Villagers.getColor(),
         Colors.NORMAL,
         StringHandler.listToString(players.getWolves()));
   } else {
     return String.format(
         "%s turn on the last villagers. With all food depleted, "
             + "they leave the village behind to find fresh meat elsewhere.",
         bold(StringHandler.listToString(players.getWolves())));
   }
 }
コード例 #2
0
ファイル: BodyGuard.java プロジェクト: egelmex/Werewolf
 @Override
 public String nightAction(String message, PlayerList players) {
   String[] args = message.trim().split(" ", 2); // $NON-NLS-1$
   if (args[0].equals("!bane")) { // $NON-NLS-1$
     if (args.length != 2) return Messages.getString("BodyGuard.correctUsage"); // $NON-NLS-1$
     Player target = players.getPlayer(args[1]);
     if (target == null) return targetNotFound(args[1]);
     else if (target == lastTarget) {
       return Messages.getString("BodyGuard.sameTarget");
     } else {
       if (target.isAlive()) {
         vote(target);
         lastTarget = target;
         isReady = true;
         if (target.equals(this)) return Messages.getString("BodyGuard.selfGuard"); // $NON-NLS-1$
         else return Messages.getString("BodyGuard.guard", new Object[] {target}); // $NON-NLS-1$
       } else return Messages.getString("BodyGuard.tooLate", new Object[] {target}); // $NON-NLS-1$
     }
   } else if (args[0].equals("!rest")) { // $NON-NLS-1$
     lastTarget = null;
     isReady = true;
     vote = null;
     return Messages.getString("BodyGuard.rest"); // $NON-NLS-1$
   } else return null;
 }
コード例 #3
0
ファイル: WolfVictory.java プロジェクト: egelmex/Werewolf
 @Override
 public boolean isVictory(PlayerList players) {
   return players.wolfCount() * 2 >= players.playerCount();
 }