예제 #1
0
 @Override
 public double getFlavorMatch(Faction faction) {
   return (((Globals.MAX_REPUTATION - faction.getReputationNumber(world.getControllingFaction()))
           / Globals.MAX_REPUTATION)
       * (faction.getDiplomacy() + faction.getAggression())
       / 2.0);
 }
예제 #2
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;
 }
예제 #3
0
 @Override
 public int stepsToCompletion(Faction faction) {
   Task task = getFlavorMatchTask(faction);
   return new TransportTroopsTask(faction.getHomeWorld(), world, 1, this)
           .stepsToCompletion(faction)
       + task.stepsToCompletion(faction);
 }
예제 #4
0
 public void perform(Faction faction) {
   System.out.println("Doing " + name);
   if (random.nextBoolean()) // Spy was caught
   world.exposeSpy(faction);
   else {
     target.reduceTechLevel();
     if (parent != null) parent.reportFinished(this);
   }
 }
예제 #5
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);
 }
예제 #6
0
 @Override
 public double getFlavorMatch(Faction faction) {
   return ((target.getTechLevel().getTotalTechLevel() / Globals.MAX_TECH_LEVEL)
       * (faction.getDiplomacy() + faction.getAggression())
       / 2.0);
 }
예제 #7
0
 @Override
 public boolean canPerform(Faction faction) {
   return world.hasSpy(faction) && !target.getTechLevel().isMinimum();
 }