public Planet releasePlanet(int id) { for (int x = 0; x < planets.size(); x++) { if (planets.get(x).getID() == id) { Planet p = planets.get(x); income = income - p.getIncome(); p.setOwner(null); planets.remove(x); return p; } } return null; }
public void addPlanet(Planet planet) { planet.setOwner(this); planets.add(planet); income = income + planet.getIncome(); }
public void addPlanet(Planet planet, Ship s) { ((Warship) s).collectPlanet(); planet.setOwner(this); planets.add(planet); income = income + planet.getIncome(); }