MoveDataManager extends EnemyDataManager<MoveEnemy> { public void onHitByBullet(HitByBulletEvent e, int currentRound, long currentTime, boolean painting) { String botName = e.getName(); if (hasEnemy(botName)) { MoveEnemy moveData = getEnemyData(botName); moveData.lastTimeHit = currentTime; moveData.damageTaken += Rules.getBulletDamage(e.getBullet().getPower()); moveData.totalBulletPower += e.getBullet().getPower(); moveData.totalTimesHit++; moveData.energy += Rules.getBulletHitBonus(e.getBullet().getPower()); Wave hitWave = moveData.processBullet( e.getBullet(), currentRound, currentTime, painting); if (hitWave != null) { hitWave.hitByBullet = true; } } else { _out.println(warning() + "A bot shot me that I never knew existed! (" + botName + ")"); } if (_duelEnemy != null) { _duelEnemy.clearNeighborCache(); } } protected  MoveDataManager(int enemiesTotal, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out); void execute(int round, long time, Point2D.Double myLocation,
      double heading, double velocity); @Override void initRound(); MoveEnemy newEnemy(ScannedRobotEvent e, Point2D.Double enemyLocation,
      double absBearing, int currentRound, boolean is1v1); MoveEnemy updateEnemy(ScannedRobotEvent e,
      Point2D.Double enemyLocation, double absBearing, int currentRound,
      boolean is1v1); void onHitByBullet(HitByBulletEvent e, int currentRound,
      long currentTime, boolean painting); void onBulletHitBullet(BulletHitBulletEvent e, int currentRound,
      long currentTime, boolean painting); void onBulletHit(BulletHitEvent e); void updateEnemyWaves(Point2D.Double myLocation,
      double previousEnemyEnergy, String botName, int currentRound,
      long currentTime, double myEnergy, double myHeading, double myVelocity,
      int wavesToSurf); RobotStateLog myStateLog(); void addFiredBullet(FiredBullet bullet);  }
@Test public void testOnHitByBulletUnknownEnemy() { MoveDataManager manager = newMoveDataManager(); manager.onHitByBullet(_eventHelper.newHitByBulletEvent( 0, _eventHelper.newBullet("Shadow", "Portia", 3.0)), 1, 50L, false); assertTrue(_out.toString().contains(WARNING_HIT_BY_BULLET_UNKNOWN)); }
@Test public void testOnHitByBullet() { MoveDataManager manager = newMoveDataManager(); MoveEnemy shadowData = manager.newEnemy(_shadowSre, newLocation(), 0, 1, true); shadowData.energy = 94.0; manager.onHitByBullet(_eventHelper.newHitByBulletEvent( 0, _eventHelper.newBullet("Shadow", "Portia", 3.0)), 1, 50L, false); assertEquals(50L, shadowData.lastTimeHit); assertEquals(16, shadowData.damageTaken, 0.01); assertEquals(3.0, shadowData.totalBulletPower, 0.01); assertEquals(1, shadowData.totalTimesHit); assertEquals(103, shadowData.energy, 0.01); }