Пример #1
0
  @Override
  public void execute(Unit unit, Action action) {
    LinkedList<Parameter> parameters = action.getParameters();
    UpgradeType upgradeType = getUpgradeType(((Identifier) parameters.get(0)).getValue());

    unit.upgrade(upgradeType);
  }
Пример #2
0
  @Override
  public void execute(Unit unit, Action action) {
    LinkedList<Parameter> parameters = action.getParameters();
    int targetId = ((Numeral) parameters.get(0)).getValue().intValue();
    Unit target = api.getUnit(targetId);

    unit.follow(target, false);
  }
Пример #3
0
  @Override
  public void execute(Unit unit, Action action) {
    LinkedList<Parameter> parameters = action.getParameters();
    int xpos = ((Numeral) parameters.get(0)).getValue().intValue();
    int ypos = ((Numeral) parameters.get(1)).getValue().intValue();

    Position pos = new Position(xpos, ypos, Position.PosType.BUILD);
    unit.move(pos, false);
  }
Пример #4
0
 @Override
 public boolean isValid(Action action) {
   LinkedList<Parameter> parameters = action.getParameters();
   if (parameters.size() == 1) {
     return parameters.get(0) instanceof Identifier
         && getUpgradeType(((Identifier) parameters.get(0)).getValue()) != null;
   }
   return false;
 }
Пример #5
0
  /** Initialize mocks. */
  @Before
  public void start() {
    MockitoAnnotations.initMocks(this);
    action = new Skip(bwapi);

    params = new LinkedList<>();
    params.add(new Identifier("Working"));

    when(act.getParameters()).thenReturn(params);
    when(unit.getType()).thenReturn(unitType);
  }
Пример #6
0
  /** Initialize mocks. */
  @Before
  public void start() {
    MockitoAnnotations.initMocks(this);
    action = new Morph(bwapi);

    params = new LinkedList<>();
    params.add(new Identifier("Zerg Hydralisk"));
    params.add(new Numeral(2));

    when(act.getParameters()).thenReturn(params);
    when(unit.getType()).thenReturn(unitType);
    when(bwapi.getSelf()).thenReturn(player);
  }
Пример #7
0
 @Override
 public boolean isValid(Action action) {
   LinkedList<Parameter> parameters = action.getParameters();
   return parameters.size() == 1 && parameters.get(0) instanceof Numeral;
 }