@SuppressWarnings("unchecked") @Test public void testExecute() { GunDataManager gdm = newGunDataManager(2); GunEnemy shadowData = mock(GunEnemy.class); shadowData.alive = true; shadowData.lastScanState = RobotState.newBuilder() .setLocation(newLocation()) .setTime(1) .build(); GunEnemy phoenixData = mock(GunEnemy.class); phoenixData.alive = true; phoenixData.lastScanState = RobotState.newBuilder() .setLocation(newLocation()) .setTime(1) .build(); GunEnemy portiaData = mock(GunEnemy.class); portiaData.alive = true; portiaData.lastScanState = RobotState.newBuilder() .setLocation(newLocation()) .setTime(1) .build(); gdm.saveEnemy("Shadow", shadowData); gdm.saveEnemy("Phoenix", phoenixData); gdm.saveEnemy("Portia", portiaData); gdm.execute(1, 50, 3.0, 1.0, _myLocation, false, false); verify(shadowData).execute(eq(50L), anyLong(), eq(3.0), eq(1.0), eq(_myLocation), eq(false), eq(2), (List<GunDataListener>) any(), eq(false)); verify(phoenixData).execute(eq(50L), anyLong(), eq(3.0), eq(1.0), eq(_myLocation), eq(false), eq(2), (List<GunDataListener>) any(), eq(false)); verify(portiaData, never()).execute(eq(50L), anyLong(), eq(1.0), eq(3.0), eq(_myLocation), eq(false), eq(2), (List<GunDataListener>) any(), eq(false)); }
public void execute(int currentRound, long currentTime, double bulletPower, double currentGunHeat, Point2D.Double myLocation, boolean is1v1, boolean painting) { updateBotDistances(myLocation); for (GunEnemy gunData : getAllEnemyData()) { if (gunData.alive) { gunData.execute(currentTime, _lastBulletFiredTime, bulletPower, currentGunHeat, myLocation, is1v1, _enemiesTotal, _listeners, painting); } } if (painting && _victoryGraphics.containsKey(currentTime)) { for (RoboGraphic graphic : _victoryGraphics.get(currentTime)) { _renderables.add(graphic); } } }
GunDataManager extends EnemyDataManager<GunEnemy> { public void execute(int currentRound, long currentTime, double bulletPower, double currentGunHeat, Point2D.Double myLocation, boolean is1v1, boolean painting) { updateBotDistances(myLocation); for (GunEnemy gunData : getAllEnemyData()) { if (gunData.alive) { gunData.execute(currentTime, _lastBulletFiredTime, bulletPower, currentGunHeat, myLocation, is1v1, _enemiesTotal, _listeners, painting); } } if (painting && _victoryGraphics.containsKey(currentTime)) { for (RoboGraphic graphic : _victoryGraphics.get(currentTime)) { _renderables.add(graphic); } } } }
GunDataManager extends EnemyDataManager<GunEnemy> { public void execute(int currentRound, long currentTime, double bulletPower, double currentGunHeat, Point2D.Double myLocation, boolean is1v1, boolean painting) { updateBotDistances(myLocation); for (GunEnemy gunData : getAllEnemyData()) { if (gunData.alive) { gunData.execute(currentTime, _lastBulletFiredTime, bulletPower, currentGunHeat, myLocation, is1v1, _enemiesTotal, _listeners, painting); } } if (painting && _victoryGraphics.containsKey(currentTime)) { for (RoboGraphic graphic : _victoryGraphics.get(currentTime)) { _renderables.add(graphic); } } } GunDataManager(int enemiesTotal, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out); }
GunDataManager extends EnemyDataManager<GunEnemy> { public void execute(int currentRound, long currentTime, double bulletPower, double currentGunHeat, Point2D.Double myLocation, boolean is1v1, boolean painting) { updateBotDistances(myLocation); for (GunEnemy gunData : getAllEnemyData()) { if (gunData.alive) { gunData.execute(currentTime, _lastBulletFiredTime, bulletPower, currentGunHeat, myLocation, is1v1, _enemiesTotal, _listeners, painting); } } if (painting && _victoryGraphics.containsKey(currentTime)) { for (RoboGraphic graphic : _victoryGraphics.get(currentTime)) { _renderables.add(graphic); } } } 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 execute(int currentRound, long currentTime, double bulletPower, double currentGunHeat, Point2D.Double myLocation, boolean is1v1, boolean painting) { updateBotDistances(myLocation); for (GunEnemy gunData : getAllEnemyData()) { if (gunData.alive) { gunData.execute(currentTime, _lastBulletFiredTime, bulletPower, currentGunHeat, myLocation, is1v1, _enemiesTotal, _listeners, painting); } } if (painting && _victoryGraphics.containsKey(currentTime)) { for (RoboGraphic graphic : _victoryGraphics.get(currentTime)) { _renderables.add(graphic); } } } 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);  }