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