Пример #1
0
 @Override
 public Task getNextStep(Faction faction) {
   Task task = getFlavorMatchTask(faction);
   if (!world.hasSpy(faction)) {
     if (new PlantSpyFromPlanetTask(world, this).canPerform(faction))
       return new PlantSpyFromPlanetTask(world, this);
     if (new PlantSpyByGateTask(faction.getHomeWorld(), world, this).canPerform(faction))
       return new PlantSpyByGateTask(faction.getHomeWorld(), world, this);
     if (new PlantSpyByShipTask(faction.getHomeWorld(), world, this).canPerform(faction))
       return new PlantSpyByShipTask(faction.getHomeWorld(), world, this);
   } else if (world.hasSpy(faction)) return task;
   return null;
 }
Пример #2
0
 @Override
 public int stepsToCompletion(Faction faction) {
   Task task = getFlavorMatchTask(faction);
   return new TransportTroopsTask(faction.getHomeWorld(), world, 1, this)
           .stepsToCompletion(faction)
       + task.stepsToCompletion(faction);
 }
Пример #3
0
 @Override
 public boolean canPerform(Faction faction) {
   Task task = getFlavorMatchTask(faction);
   if (!world.hasSpy(faction) && world.getTroopCount(faction) == 0)
     return new TransportTroopsTask(faction.getHomeWorld(), world, 1, this).canPerform(faction);
   if (!world.hasSpy(faction) && world.getTroopCount(faction) > 0)
     return new PlantSpyFromPlanetTask(world, this).canPerform(faction);
   else return task.canPerform(faction);
 }