Example #1
0
 @Override
 public String toString() {
   return statics.getShortName()
       + "("
       + (int) status.getEnergy()
       + ") X"
       + (int) status.getX()
       + " Y"
       + (int) status.getY();
 }
Example #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;
  }
Example #3
0
 private final double getGunHeatImpl() {
   return status.getGunHeat() + firedHeat;
 }
Example #4
0
 public long getTimeImpl() {
   return status.getTime();
 }
Example #5
0
 private final double getEnergyImpl() {
   return status.getEnergy() - firedEnergy;
 }
Example #6
0
 public int getNumSentries() {
   getCall();
   return status.getNumSentries();
 }
Example #7
0
 public int getRoundNum() {
   getCall();
   return status.getRoundNum();
 }
Example #8
0
 public int getOthers() {
   getCall();
   return status.getOthers();
 }
Example #9
0
 public double getY() {
   getCall();
   return status.getY();
 }
Example #10
0
 public double getRadarHeading() {
   getCall();
   return status.getRadarHeadingRadians();
 }
Example #11
0
 public double getBodyHeading() {
   getCall();
   return status.getHeadingRadians();
 }
Example #12
0
 public double getVelocity() {
   getCall();
   return status.getVelocity();
 }