@Test public void testFireNextTickWave() { GunDataManager gdm = newGunDataManager(); GunEnemy shadowData = gdm.newEnemy(_shadowSre, _enemyLocation, 0, 1, true); shadowData.lastWaveFired = null; gdm.fireNextTickWave(_myLocation, _enemyLocation, shadowData.botName, 1, 50, 3.0, 100, 0.0, 0, 0, 1); assertNotNull(shadowData.lastWaveFired); }
public void fireNextTickWave(Point2D.Double myNextLocation, Point2D.Double targetLocation, String targetName, int currentRound, long currentTime, double bulletPower, double myEnergy, double gunHeat, double myHeading, double myVelocity, int enemiesAlive) { GunEnemy gunData = getEnemyData(targetName); RobotState lastScanState = gunData.lastScanState; Point2D.Double enemyNextLocation = _battleField.translateToField( _predictor.nextLocation( targetLocation, lastScanState.heading, lastScanState.velocity)); double accel = DiaUtils.limit(-Rules.DECELERATION, DiaUtils.accel(lastScanState.velocity, gunData.previousVelocity), Rules.ACCELERATION); long fireTime = currentTime + 1; long lastWaveFireTime = gunData.getLastWaveFireTime(gunData.botName); RobotStateLog stateLog = gunData.stateLog; double dl8t = stateLog.getDisplacementDistance(targetLocation, currentTime, 8); double dl20t = stateLog.getDisplacementDistance(targetLocation, currentTime, 20); double dl40t = stateLog.getDisplacementDistance(targetLocation, currentTime, 40); Wave nextWave = gunData.newGunWave(myNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, myEnergy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, false); gunData.lastWaveFired = nextWave; for (GunEnemy altGunData : getAllEnemyData()) { if (altGunData.alive && !altGunData.botName.equals(targetName)) { Point2D.Double altNextLocation = _battleField.translateToField( _predictor.nextLocation(altGunData.lastScanState.location, altGunData.lastScanState.velocity, altGunData.lastScanState.heading)); gunData.newGunWave(altNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, altGunData.energy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, true); } } if (_duelEnemy != null && lastWaveFireTime > 0) { for (long time = lastWaveFireTime + 1; time < fireTime; time++) { gunData.interpolateGunWave( time, currentTime, myHeading, myVelocity, lastScanState); } } }
GunDataManager extends EnemyDataManager<GunEnemy> { public void fireNextTickWave(Point2D.Double myNextLocation, Point2D.Double targetLocation, String targetName, int currentRound, long currentTime, double bulletPower, double myEnergy, double gunHeat, double myHeading, double myVelocity, int enemiesAlive) { GunEnemy gunData = getEnemyData(targetName); RobotState lastScanState = gunData.lastScanState; Point2D.Double enemyNextLocation = _battleField.translateToField( _predictor.nextLocation( targetLocation, lastScanState.heading, lastScanState.velocity)); double accel = DiaUtils.limit(-Rules.DECELERATION, DiaUtils.accel(lastScanState.velocity, gunData.previousVelocity), Rules.ACCELERATION); long fireTime = currentTime + 1; long lastWaveFireTime = gunData.getLastWaveFireTime(gunData.botName); RobotStateLog stateLog = gunData.stateLog; double dl8t = stateLog.getDisplacementDistance(targetLocation, currentTime, 8); double dl20t = stateLog.getDisplacementDistance(targetLocation, currentTime, 20); double dl40t = stateLog.getDisplacementDistance(targetLocation, currentTime, 40); Wave nextWave = gunData.newGunWave(myNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, myEnergy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, false); gunData.lastWaveFired = nextWave; for (GunEnemy altGunData : getAllEnemyData()) { if (altGunData.alive && !altGunData.botName.equals(targetName)) { Point2D.Double altNextLocation = _battleField.translateToField( _predictor.nextLocation(altGunData.lastScanState.location, altGunData.lastScanState.velocity, altGunData.lastScanState.heading)); gunData.newGunWave(altNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, altGunData.energy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, true); } } if (_duelEnemy != null && lastWaveFireTime > 0) { for (long time = lastWaveFireTime + 1; time < fireTime; time++) { gunData.interpolateGunWave( time, currentTime, myHeading, myVelocity, lastScanState); } } } }
GunDataManager extends EnemyDataManager<GunEnemy> { public void fireNextTickWave(Point2D.Double myNextLocation, Point2D.Double targetLocation, String targetName, int currentRound, long currentTime, double bulletPower, double myEnergy, double gunHeat, double myHeading, double myVelocity, int enemiesAlive) { GunEnemy gunData = getEnemyData(targetName); RobotState lastScanState = gunData.lastScanState; Point2D.Double enemyNextLocation = _battleField.translateToField( _predictor.nextLocation( targetLocation, lastScanState.heading, lastScanState.velocity)); double accel = DiaUtils.limit(-Rules.DECELERATION, DiaUtils.accel(lastScanState.velocity, gunData.previousVelocity), Rules.ACCELERATION); long fireTime = currentTime + 1; long lastWaveFireTime = gunData.getLastWaveFireTime(gunData.botName); RobotStateLog stateLog = gunData.stateLog; double dl8t = stateLog.getDisplacementDistance(targetLocation, currentTime, 8); double dl20t = stateLog.getDisplacementDistance(targetLocation, currentTime, 20); double dl40t = stateLog.getDisplacementDistance(targetLocation, currentTime, 40); Wave nextWave = gunData.newGunWave(myNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, myEnergy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, false); gunData.lastWaveFired = nextWave; for (GunEnemy altGunData : getAllEnemyData()) { if (altGunData.alive && !altGunData.botName.equals(targetName)) { Point2D.Double altNextLocation = _battleField.translateToField( _predictor.nextLocation(altGunData.lastScanState.location, altGunData.lastScanState.velocity, altGunData.lastScanState.heading)); gunData.newGunWave(altNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, altGunData.energy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, true); } } if (_duelEnemy != null && lastWaveFireTime > 0) { for (long time = lastWaveFireTime + 1; time < fireTime; time++) { gunData.interpolateGunWave( time, currentTime, myHeading, myVelocity, lastScanState); } } } GunDataManager(int enemiesTotal, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out); }
GunDataManager extends EnemyDataManager<GunEnemy> { public void fireNextTickWave(Point2D.Double myNextLocation, Point2D.Double targetLocation, String targetName, int currentRound, long currentTime, double bulletPower, double myEnergy, double gunHeat, double myHeading, double myVelocity, int enemiesAlive) { GunEnemy gunData = getEnemyData(targetName); RobotState lastScanState = gunData.lastScanState; Point2D.Double enemyNextLocation = _battleField.translateToField( _predictor.nextLocation( targetLocation, lastScanState.heading, lastScanState.velocity)); double accel = DiaUtils.limit(-Rules.DECELERATION, DiaUtils.accel(lastScanState.velocity, gunData.previousVelocity), Rules.ACCELERATION); long fireTime = currentTime + 1; long lastWaveFireTime = gunData.getLastWaveFireTime(gunData.botName); RobotStateLog stateLog = gunData.stateLog; double dl8t = stateLog.getDisplacementDistance(targetLocation, currentTime, 8); double dl20t = stateLog.getDisplacementDistance(targetLocation, currentTime, 20); double dl40t = stateLog.getDisplacementDistance(targetLocation, currentTime, 40); Wave nextWave = gunData.newGunWave(myNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, myEnergy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, false); gunData.lastWaveFired = nextWave; for (GunEnemy altGunData : getAllEnemyData()) { if (altGunData.alive && !altGunData.botName.equals(targetName)) { Point2D.Double altNextLocation = _battleField.translateToField( _predictor.nextLocation(altGunData.lastScanState.location, altGunData.lastScanState.velocity, altGunData.lastScanState.heading)); gunData.newGunWave(altNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, altGunData.energy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, true); } } if (_duelEnemy != null && lastWaveFireTime > 0) { for (long time = lastWaveFireTime + 1; time < fireTime; time++) { gunData.interpolateGunWave( time, currentTime, myHeading, myVelocity, lastScanState); } } } GunDataManager(int enemiesTotal, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out); @Override void initRound(); void execute(int currentRound, long currentTime, double bulletPower,
      double currentGunHeat, Point2D.Double myLocation, boolean is1v1,
      boolean painting); GunEnemy newEnemy(ScannedRobotEvent e, Point2D.Double enemyLocation,
      double absBearing, int currentRound, boolean is1v1); GunEnemy updateEnemy(ScannedRobotEvent e, Point2D.Double enemyLocation,
      double absBearing, int currentRound, boolean is1v1); void onBulletHit(BulletHitEvent e, long currentTime); void onBulletHitBullet(BulletHitBulletEvent e, long currentTime); double getDamageGiven(); double getAverageEnergy(); void markFiringWaves(long currentTime, boolean is1v1); void fireNextTickWave(Point2D.Double myNextLocation,
      Point2D.Double targetLocation, String targetName, int currentRound,
      long currentTime, double bulletPower, double myEnergy, double gunHeat,
      double myHeading, double myVelocity, int enemiesAlive); void addListener(GunDataListener listener); int getEnemiesTotal(); int getDuelDataSize(); void drawVictory(long startTime); }
GunDataManager extends EnemyDataManager<GunEnemy> { public void fireNextTickWave(Point2D.Double myNextLocation, Point2D.Double targetLocation, String targetName, int currentRound, long currentTime, double bulletPower, double myEnergy, double gunHeat, double myHeading, double myVelocity, int enemiesAlive) { GunEnemy gunData = getEnemyData(targetName); RobotState lastScanState = gunData.lastScanState; Point2D.Double enemyNextLocation = _battleField.translateToField( _predictor.nextLocation( targetLocation, lastScanState.heading, lastScanState.velocity)); double accel = DiaUtils.limit(-Rules.DECELERATION, DiaUtils.accel(lastScanState.velocity, gunData.previousVelocity), Rules.ACCELERATION); long fireTime = currentTime + 1; long lastWaveFireTime = gunData.getLastWaveFireTime(gunData.botName); RobotStateLog stateLog = gunData.stateLog; double dl8t = stateLog.getDisplacementDistance(targetLocation, currentTime, 8); double dl20t = stateLog.getDisplacementDistance(targetLocation, currentTime, 20); double dl40t = stateLog.getDisplacementDistance(targetLocation, currentTime, 40); Wave nextWave = gunData.newGunWave(myNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, myEnergy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, false); gunData.lastWaveFired = nextWave; for (GunEnemy altGunData : getAllEnemyData()) { if (altGunData.alive && !altGunData.botName.equals(targetName)) { Point2D.Double altNextLocation = _battleField.translateToField( _predictor.nextLocation(altGunData.lastScanState.location, altGunData.lastScanState.velocity, altGunData.lastScanState.heading)); gunData.newGunWave(altNextLocation, enemyNextLocation, currentRound, fireTime, _lastBulletFiredTime, bulletPower, altGunData.energy, gunHeat, enemiesAlive, accel, dl8t, dl20t, dl40t, true); } } if (_duelEnemy != null && lastWaveFireTime > 0) { for (long time = lastWaveFireTime + 1; time < fireTime; time++) { gunData.interpolateGunWave( time, currentTime, myHeading, myVelocity, lastScanState); } } } GunDataManager(int enemiesTotal, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out); @Override void initRound(); void execute(int currentRound, long currentTime, double bulletPower,
      double currentGunHeat, Point2D.Double myLocation, boolean is1v1,
      boolean painting); GunEnemy newEnemy(ScannedRobotEvent e, Point2D.Double enemyLocation,
      double absBearing, int currentRound, boolean is1v1); GunEnemy updateEnemy(ScannedRobotEvent e, Point2D.Double enemyLocation,
      double absBearing, int currentRound, boolean is1v1); void onBulletHit(BulletHitEvent e, long currentTime); void onBulletHitBullet(BulletHitBulletEvent e, long currentTime); double getDamageGiven(); double getAverageEnergy(); void markFiringWaves(long currentTime, boolean is1v1); void fireNextTickWave(Point2D.Double myNextLocation,
      Point2D.Double targetLocation, String targetName, int currentRound,
      long currentTime, double bulletPower, double myEnergy, double gunHeat,
      double myHeading, double myVelocity, int enemiesAlive); void addListener(GunDataListener listener); int getEnemiesTotal(); int getDuelDataSize(); void drawVictory(long startTime);  }