@Test public void testOnBulletHit() { GunDataManager gdm = newGunDataManager(); GunEnemy shadowData = gdm.newEnemy(_shadowSre, _enemyLocation, 0, 1, true); assertTrue(shadowData.energy > 16.0); verifyBulletHit(gdm, shadowData, 16.0); }
public void onBulletHit(BulletHitEvent e, long currentTime) { String botName = e.getName(); if (hasEnemy(botName)) { GunEnemy gunData = getEnemyData(e.getName()); double bulletDamage = Math.min( Rules.getBulletDamage(e.getBullet().getPower()), gunData.energy); gunData.damageGiven += bulletDamage; gunData.logBulletHitLocation(e.getBullet()); } else { _out.println(warning() + WARNING_BULLET_HIT_UNKNOWN + " (" + botName + ")"); } for (GunEnemy gunData : getAllEnemyData()) { Wave hitWave = gunData.processBulletHit( e.getBullet(), currentTime, (_enemiesTotal == 1), true); if (hitWave != null) { hitWave.hitByBullet = true; } } }
GunDataManager extends EnemyDataManager<GunEnemy> { public void onBulletHit(BulletHitEvent e, long currentTime) { String botName = e.getName(); if (hasEnemy(botName)) { GunEnemy gunData = getEnemyData(e.getName()); double bulletDamage = Math.min( Rules.getBulletDamage(e.getBullet().getPower()), gunData.energy); gunData.damageGiven += bulletDamage; gunData.logBulletHitLocation(e.getBullet()); } else { _out.println(warning() + WARNING_BULLET_HIT_UNKNOWN + " (" + botName + ")"); } for (GunEnemy gunData : getAllEnemyData()) { Wave hitWave = gunData.processBulletHit( e.getBullet(), currentTime, (_enemiesTotal == 1), true); if (hitWave != null) { hitWave.hitByBullet = true; } } } }
GunDataManager extends EnemyDataManager<GunEnemy> { public void onBulletHit(BulletHitEvent e, long currentTime) { String botName = e.getName(); if (hasEnemy(botName)) { GunEnemy gunData = getEnemyData(e.getName()); double bulletDamage = Math.min( Rules.getBulletDamage(e.getBullet().getPower()), gunData.energy); gunData.damageGiven += bulletDamage; gunData.logBulletHitLocation(e.getBullet()); } else { _out.println(warning() + WARNING_BULLET_HIT_UNKNOWN + " (" + botName + ")"); } for (GunEnemy gunData : getAllEnemyData()) { Wave hitWave = gunData.processBulletHit( e.getBullet(), currentTime, (_enemiesTotal == 1), true); if (hitWave != null) { hitWave.hitByBullet = true; } } } GunDataManager(int enemiesTotal, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out); }
GunDataManager extends EnemyDataManager<GunEnemy> { public void onBulletHit(BulletHitEvent e, long currentTime) { String botName = e.getName(); if (hasEnemy(botName)) { GunEnemy gunData = getEnemyData(e.getName()); double bulletDamage = Math.min( Rules.getBulletDamage(e.getBullet().getPower()), gunData.energy); gunData.damageGiven += bulletDamage; gunData.logBulletHitLocation(e.getBullet()); } else { _out.println(warning() + WARNING_BULLET_HIT_UNKNOWN + " (" + botName + ")"); } for (GunEnemy gunData : getAllEnemyData()) { Wave hitWave = gunData.processBulletHit( e.getBullet(), currentTime, (_enemiesTotal == 1), true); if (hitWave != null) { hitWave.hitByBullet = true; } } } 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 onBulletHit(BulletHitEvent e, long currentTime) { String botName = e.getName(); if (hasEnemy(botName)) { GunEnemy gunData = getEnemyData(e.getName()); double bulletDamage = Math.min( Rules.getBulletDamage(e.getBullet().getPower()), gunData.energy); gunData.damageGiven += bulletDamage; gunData.logBulletHitLocation(e.getBullet()); } else { _out.println(warning() + WARNING_BULLET_HIT_UNKNOWN + " (" + botName + ")"); } for (GunEnemy gunData : getAllEnemyData()) { Wave hitWave = gunData.processBulletHit( e.getBullet(), currentTime, (_enemiesTotal == 1), true); if (hitWave != null) { hitWave.hitByBullet = true; } } } 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);  }