Ejemplo n.º 1
0
 protected void sendSpam() throws GameActionException {
   Message m = new Message();
   m.ints = new int[1];
   m.locations = new MapLocation[1];
   m.locations[0] = new MapLocation(0, 0);
   m.strings = new String[1];
   m.strings[0] = "MQ_ATTACK";
   myRC.broadcast(m);
 }
Ejemplo n.º 2
0
  protected void sendEnemyLocation() throws GameActionException {
    enemyLocations = findEnemy();

    if (enemyLocations.length > 0) {
      Message m = new Message();
      m.ints = new int[1];
      m.ints[0] = MessageType.ENEMY_LOCATIONS.ordinal();
      m.locations = enemyLocations;
      // myRC.broadcast(m);
      sendMessage(m);
    } else {
      enemyDistance = Integer.MAX_VALUE;
    }
  }
Ejemplo n.º 3
0
  /** Calculates the order in which the archons were spawned. */
  public void senseArchonNumber() {
    Message[] messages = controller.getAllMessages();
    int min = 1;
    for (Message m : messages) {
      if (m.ints[0] >= min) {
        min = m.ints[0] + 1;
      }
    }

    archonNumber = min;

    Message m = new Message();
    m.ints = new int[] {min};
    try {
      controller.broadcast(m);
    } catch (Exception e) {
      System.out.println("----Caught Exception in senseArchonNumber.  Exception: " + e.toString());
    }
    System.out.println("Number: " + min);
  }