示例#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);
 }
 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);
 }
 @Override
 public double getFlavorMatch(Faction faction) {
   return ((target.getTechLevel().getTotalTechLevel() / Globals.MAX_TECH_LEVEL)
       * (faction.getDiplomacy() + faction.getAggression())
       / 2.0);
 }
 @Override
 public boolean canPerform(Faction faction) {
   return world.hasSpy(faction) && !target.getTechLevel().isMinimum();
 }