Пример #1
0
 private static void processSignals() throws GameActionException {
   IdAndMapLocation newDefend = null, newMove = null;
   int clearDefend = -1;
   newDefend = Radio.getDefendLocation();
   newMove = Radio.getMoveLocation();
   clearDefend = Radio.getClearDefend();
   IdAndMapLocation newHQ = Radio.getMoveCampLocation();
   if (newHQ != null) {
     personalHQ = newHQ.location;
   }
   while (newDefend != null) {
     if (teamMemberNeedsHelp[newDefend.id] == 0) {
       defendQueue.add(newDefend.id);
       teamMemberNeedsHelp[newDefend.id] = rc.getRoundNum();
     }
     teamLocations[newDefend.id] = newDefend.location;
     newDefend = Radio.getDefendLocation();
   }
   while (newMove != null) {
     moveQueue.add(newMove.location);
     newMove = Radio.getMoveLocation();
   }
   while (clearDefend != -1) {
     teamMemberNeedsHelp[clearDefend] = 0;
     clearDefend = Radio.getClearDefend();
   }
 }
  public void updateRound() {
    ListIterator<Action> actionIterator = actions.listIterator();
    while (actionIterator.hasNext()) {
      Action a = actionIterator.next();
      if (currentRound >= (a.roundStarted + a.length)) {
        actionIterator.remove();
      }
    }

    aliveRounds += 1;

    updateDrawLoc();

    broadcast = (broadcast << 1) & 0x000FFFFF;
    if (regen > 0) regen--;

    Iterator<Map.Entry<Animation.AnimationType, Animation>> it = animations.entrySet().iterator();
    Map.Entry<Animation.AnimationType, Animation> entry;
    while (it.hasNext()) {
      entry = it.next();
      entry.getValue().updateRound();
      if (!entry.getValue().isAlive()) {
        if (entry.getKey() != DEATH_EXPLOSION) it.remove();
      }
    }
    currentRound++;
  }
Пример #3
0
 private static void moveSomewhere() throws GameActionException {
   while (!defendQueue.isEmpty()) {
     int next = defendQueue.element();
     if (teamMemberNeedsHelp[next] > 0 && rc.getRoundNum() - teamMemberNeedsHelp[next] < 200) {
       if (rc.isCoreReady()) {
         Nav.goTo(teamLocations[next]);
       }
       return;
     }
     defendQueue.remove();
   }
   if (!moveQueue.isEmpty()) {
     MapLocation next = moveQueue.element();
     if (rc.isCoreReady()) {
       Nav.goTo(next);
     }
     if (rc.canSense(next) && rc.senseRobotAtLocation(next) == null) {
       moveQueue.remove();
     }
     return;
   }
   if (rc.isCoreReady()) {
     Nav.goTo(personalHQ);
     return;
   }
 }
 public void setAction(int totalrounds, ActionType type) {
   actions.add(new Action(type, currentRound, totalrounds));
 }
 public void setMoving(int delay) {
   actions.add(new Action(ActionType.MOVING, currentRound, delay));
   moving = 1;
   updateDrawLoc();
 }
 public void setAttacking(MapLocation target) {
   actions.add(
       new Action(ActionType.ATTACKING, currentRound, (int) info.type.attackDelay, target));
 }