Пример #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;
  }