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); }
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; }