示例#1
0
 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;
 }
示例#2
0
 public void addPlanet(Planet planet) {
   planet.setOwner(this);
   planets.add(planet);
   income = income + planet.getIncome();
 }
示例#3
0
 public void addPlanet(Planet planet, Ship s) {
   ((Warship) s).collectPlanet();
   planet.setOwner(this);
   planets.add(planet);
   income = income + planet.getIncome();
 }