Exemplo n.º 1
0
 @Override
 public String toString() {
   return statics.getShortName()
       + "("
       + (int) status.getEnergy()
       + ") X"
       + (int) status.getX()
       + " Y"
       + (int) status.getY();
 }
Exemplo n.º 2
0
  private final Bullet setFireImpl(double power) {
    if (Double.isNaN(power)) {
      println("SYSTEM: You cannot call fire(NaN)");
      return null;
    }
    if (getGunHeatImpl() > 0 || getEnergyImpl() == 0) {
      return null;
    }

    power = min(getEnergyImpl(), min(max(power, Rules.MIN_BULLET_POWER), Rules.MAX_BULLET_POWER));

    Bullet bullet;
    BulletCommand wrapper;
    Event currentTopEvent = eventManager.getCurrentTopEvent();

    nextBulletId++;

    if (currentTopEvent != null
        && currentTopEvent.getTime() == status.getTime()
        && !statics.isAdvancedRobot()
        && status.getGunHeadingRadians() == status.getRadarHeadingRadians()
        && ScannedRobotEvent.class.isAssignableFrom(currentTopEvent.getClass())) {
      // this is angle assisted bullet
      ScannedRobotEvent e = (ScannedRobotEvent) currentTopEvent;
      double fireAssistAngle =
          Utils.normalAbsoluteAngle(status.getHeadingRadians() + e.getBearingRadians());

      bullet =
          new Bullet(
              fireAssistAngle, getX(), getY(), power, statics.getName(), null, true, nextBulletId);
      wrapper = new BulletCommand(power, true, fireAssistAngle, nextBulletId);
    } else {
      // this is normal bullet
      bullet =
          new Bullet(
              status.getGunHeadingRadians(),
              getX(),
              getY(),
              power,
              statics.getName(),
              null,
              true,
              nextBulletId);
      wrapper = new BulletCommand(power, false, 0, nextBulletId);
    }

    firedEnergy += power;
    firedHeat += Rules.getGunHeat(power);

    commands.getBullets().add(wrapper);

    bullets.put(nextBulletId, bullet);

    return bullet;
  }
Exemplo n.º 3
0
 private final double getGunHeatImpl() {
   return status.getGunHeat() + firedHeat;
 }
Exemplo n.º 4
0
 public long getTimeImpl() {
   return status.getTime();
 }
Exemplo n.º 5
0
 private final double getEnergyImpl() {
   return status.getEnergy() - firedEnergy;
 }
Exemplo n.º 6
0
 public int getNumSentries() {
   getCall();
   return status.getNumSentries();
 }
Exemplo n.º 7
0
 public int getRoundNum() {
   getCall();
   return status.getRoundNum();
 }
Exemplo n.º 8
0
 public int getOthers() {
   getCall();
   return status.getOthers();
 }
Exemplo n.º 9
0
 public double getY() {
   getCall();
   return status.getY();
 }
Exemplo n.º 10
0
 public double getRadarHeading() {
   getCall();
   return status.getRadarHeadingRadians();
 }
Exemplo n.º 11
0
 public double getBodyHeading() {
   getCall();
   return status.getHeadingRadians();
 }
Exemplo n.º 12
0
 public double getVelocity() {
   getCall();
   return status.getVelocity();
 }