Example #1
0
  public void onDeath(Narrator n) {
    if (toReveal == null) System.out.println(n.getHappenings());
    if (toReveal.isEmpty()) return;

    Announcement a;
    HTString htc;
    Role r;
    Team t;
    for (Player revealed : toReveal) {
      if (revealed.isDead() && !revealed.isCleaned()) continue;
      if (revealed.isDetectable()) {
        r = revealed.getRole();
        t = revealed.getTeam();
      } else {
        t = getCitizenTeam(n);
        if (t == null) {
          t = revealed.getTeam();
          r = revealed.getRole();
        } else {
          r = new Citizen();
        }
      }
      htc = new HTString(r, t);
      a = new Announcement(n);
      a.add("A reliable source has revealed ", revealed.getName(), " to be a ", htc, ".");
      n.announcement(a);
    }
  }
Example #2
0
 private Team getCitizenTeam(Narrator n) {
   Member m;
   Role citizen = new Citizen();
   for (Team t : n.getAllTeams()) {
     m = new Member(citizen, t.getColor());
     if (n.getAllRoles().contains(m)) return t;
   }
   return null;
 }