@Test public void testUpdateWave() { GunEnemy gunData = newGunEnemy(); Wave w = gunData.newGunWave(newLocation(), newLocation(), 1, 100, 87, 3.0, 100.0, 0.1, 1, 0, 50, 100, 200, false); GunDataListener mockListener = mock(GunDataListener.class); gunData.updateWave( w, newLocation(), 3.0, 87, 0.0, true, Arrays.asList(mockListener)); assertEquals(0.0, w.gunHeat, 0.01); assertEquals(87, w.lastBulletFiredTime); assertEquals(3.0, w.bulletPower(), 0.01); }
void updateWave(Wave w, Point2D.Double myLocation, double bulletPower, long lastBulletFiredTime, double gunHeat, boolean is1v1, List<GunDataListener> gunDataListeners) { if (!w.altWave) { w.gunHeat = gunHeat; w.lastBulletFiredTime = lastBulletFiredTime; if (lastScanState.time == w.fireTime) { w.sourceLocation = myLocation; w.targetLocation = lastScanState.location; w.absBearing = DiaUtils.absoluteBearing(myLocation, lastScanState.location); } } }
GunEnemy extends Enemy<TimestampedFiringAngle> { void updateWave(Wave w, Point2D.Double myLocation, double bulletPower, long lastBulletFiredTime, double gunHeat, boolean is1v1, List<GunDataListener> gunDataListeners) { if (!w.altWave) { w.gunHeat = gunHeat; w.lastBulletFiredTime = lastBulletFiredTime; if (lastScanState.time == w.fireTime) { w.sourceLocation = myLocation; w.targetLocation = lastScanState.location; w.absBearing = DiaUtils.absoluteBearing(myLocation, lastScanState.location); } } } }
GunEnemy extends Enemy<TimestampedFiringAngle> { void updateWave(Wave w, Point2D.Double myLocation, double bulletPower, long lastBulletFiredTime, double gunHeat, boolean is1v1, List<GunDataListener> gunDataListeners) { if (!w.altWave) { w.gunHeat = gunHeat; w.lastBulletFiredTime = lastBulletFiredTime; if (lastScanState.time == w.fireTime) { w.sourceLocation = myLocation; w.targetLocation = lastScanState.location; w.absBearing = DiaUtils.absoluteBearing(myLocation, lastScanState.location); } } } GunEnemy(String botName, double distance, double energy,
      Point2D.Double location, int round, long time, double heading,
      double velocity, double absBearing, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables);   GunEnemy(String botName, double distance, double energy,
      Point2D.Double location, int round, long time, double heading,
      double velocity, double absBearing, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      WaveManager waveManager); }
GunEnemy extends Enemy<TimestampedFiringAngle> { void updateWave(Wave w, Point2D.Double myLocation, double bulletPower, long lastBulletFiredTime, double gunHeat, boolean is1v1, List<GunDataListener> gunDataListeners) { if (!w.altWave) { w.gunHeat = gunHeat; w.lastBulletFiredTime = lastBulletFiredTime; if (lastScanState.time == w.fireTime) { w.sourceLocation = myLocation; w.targetLocation = lastScanState.location; w.absBearing = DiaUtils.absoluteBearing(myLocation, lastScanState.location); } } } GunEnemy(String botName, double distance, double energy,
      Point2D.Double location, int round, long time, double heading,
      double velocity, double absBearing, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables);   GunEnemy(String botName, double distance, double energy,
      Point2D.Double location, int round, long time, double heading,
      double velocity, double absBearing, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      WaveManager waveManager); @Override void initRound(); void execute(final long currentTime, long lastBulletFiredTime,
      double bulletPower, double currentGunHeat, Point2D.Double myLocation,
      final boolean is1v1, final int enemiesTotal,
      final List<GunDataListener> gunDataListeners, final boolean painting); Wave processBulletHit(Bullet bullet, long currentTime,
      boolean is1v1Battle, boolean logHitWave); void logBulletHitLocation(Bullet bullet); Wave newGunWave(Point2D.Double sourceLocation,
      Point2D.Double targetLocation, int fireRound, long fireTime,
      long lastBulletFiredTime, double bulletPower, double myEnergy,
      double gunHeat, int enemiesAlive, double accel, double dl8t, double dl20t,
      double dl40t, boolean altWave); void markFiringWaves(
      long currentTime, boolean is1v1, List<GunDataListener> gunDataListeners); Wave findSurfableWave(Wave aimWave, int surfIndex); void updateTimers(double velocity); long getLastWaveFireTime(String botName); Wave interpolateGunWave(long fireTime, long currentTime,
      double myHeading, double myVelocity, RobotState enemyState); double advancingVelocity(); boolean isRammer(); int getWaveBreaks(); }
GunEnemy extends Enemy<TimestampedFiringAngle> { void updateWave(Wave w, Point2D.Double myLocation, double bulletPower, long lastBulletFiredTime, double gunHeat, boolean is1v1, List<GunDataListener> gunDataListeners) { if (!w.altWave) { w.gunHeat = gunHeat; w.lastBulletFiredTime = lastBulletFiredTime; if (lastScanState.time == w.fireTime) { w.sourceLocation = myLocation; w.targetLocation = lastScanState.location; w.absBearing = DiaUtils.absoluteBearing(myLocation, lastScanState.location); } } } GunEnemy(String botName, double distance, double energy,
      Point2D.Double location, int round, long time, double heading,
      double velocity, double absBearing, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables);   GunEnemy(String botName, double distance, double energy,
      Point2D.Double location, int round, long time, double heading,
      double velocity, double absBearing, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      WaveManager waveManager); @Override void initRound(); void execute(final long currentTime, long lastBulletFiredTime,
      double bulletPower, double currentGunHeat, Point2D.Double myLocation,
      final boolean is1v1, final int enemiesTotal,
      final List<GunDataListener> gunDataListeners, final boolean painting); Wave processBulletHit(Bullet bullet, long currentTime,
      boolean is1v1Battle, boolean logHitWave); void logBulletHitLocation(Bullet bullet); Wave newGunWave(Point2D.Double sourceLocation,
      Point2D.Double targetLocation, int fireRound, long fireTime,
      long lastBulletFiredTime, double bulletPower, double myEnergy,
      double gunHeat, int enemiesAlive, double accel, double dl8t, double dl20t,
      double dl40t, boolean altWave); void markFiringWaves(
      long currentTime, boolean is1v1, List<GunDataListener> gunDataListeners); Wave findSurfableWave(Wave aimWave, int surfIndex); void updateTimers(double velocity); long getLastWaveFireTime(String botName); Wave interpolateGunWave(long fireTime, long currentTime,
      double myHeading, double myVelocity, RobotState enemyState); double advancingVelocity(); boolean isRammer(); int getWaveBreaks(); public double previousVelocity; public double lastNonZeroVelocity; public long timeSinceDirectionChange; public long timeSinceVelocityChange; public long timeMovingAtMe; public Wave lastWaveFired; public List<Point2D.Double> hitLocations; }