예제 #1
0
  public void add(Fighter fighter) {
    if (!isAvailable() || fighters.containsKey(fighter.getId())) return;

    fighter.setFight(fight);
    fighter.setTeam(this);
    fighter.setCurrentCell(fight.firstAvailableStartCell(type));
    fighter.setCurrentOrientation(OrientationEnum.SOUTH_WEST);

    fighters.put(fighter.getId(), fighter);
  }
예제 #2
0
  public Fighter remove(Integer id) {
    if (leader.getId().equals(id)) {
      throw new RuntimeException("you can't remove the leader from his team");
    }

    Fighter fighter = fighters.remove(id);
    if (fighter != null) {
      fighter.setTeam(null);

      return fighter;
    }
    return null;
  }
예제 #3
0
 public boolean remove(Fighter fighter) {
   return remove(fighter.getId()) != null;
 }