@Test public void testOnBulletHit() { MoveDataManager manager = newMoveDataManager(); ScannedRobotEvent shadowSre = _eventHelper.newScannedRobotEvent("Shadow", 87, 0.15, 351, 1, 7.0); MoveEnemy shadowData = manager.newEnemy(shadowSre, newLocation(), 0.6, 1, true); shadowData.energy = 91; shadowData.damageGiven = 11; manager.onBulletHit( _eventHelper.newBulletHitEvent("Diamond", "Shadow", 3.0)); assertEquals(75, shadowData.energy, 0.01); assertEquals(27, shadowData.damageGiven, 0.01); }
public void onBulletHit(BulletHitEvent e) { String botName = e.getName(); try { MoveEnemy moveData = getEnemyData(botName); double bulletDamage = Rules.getBulletDamage(e.getBullet().getPower()); moveData.energy -= bulletDamage; moveData.damageGiven += bulletDamage; } catch (NullPointerException npe) { _out.println(warning() + "One of my bullets hit a bot that I never " + "knew existed! (" + botName + ")"); } }
MoveDataManager extends EnemyDataManager<MoveEnemy> { public void onBulletHit(BulletHitEvent e) { String botName = e.getName(); try { MoveEnemy moveData = getEnemyData(botName); double bulletDamage = Rules.getBulletDamage(e.getBullet().getPower()); moveData.energy -= bulletDamage; moveData.damageGiven += bulletDamage; } catch (NullPointerException npe) { _out.println(warning() + "One of my bullets hit a bot that I never " + "knew existed! (" + botName + ")"); } } }
MoveDataManager extends EnemyDataManager<MoveEnemy> { public void onBulletHit(BulletHitEvent e) { String botName = e.getName(); try { MoveEnemy moveData = getEnemyData(botName); double bulletDamage = Rules.getBulletDamage(e.getBullet().getPower()); moveData.energy -= bulletDamage; moveData.damageGiven += bulletDamage; } catch (NullPointerException npe) { _out.println(warning() + "One of my bullets hit a bot that I never " + "knew existed! (" + botName + ")"); } } protected  MoveDataManager(int enemiesTotal, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out); }
MoveDataManager extends EnemyDataManager<MoveEnemy> { public void onBulletHit(BulletHitEvent e) { String botName = e.getName(); try { MoveEnemy moveData = getEnemyData(botName); double bulletDamage = Rules.getBulletDamage(e.getBullet().getPower()); moveData.energy -= bulletDamage; moveData.damageGiven += bulletDamage; } catch (NullPointerException npe) { _out.println(warning() + "One of my bullets hit a bot that I never " + "knew existed! (" + botName + ")"); } } 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); }
MoveDataManager extends EnemyDataManager<MoveEnemy> { public void onBulletHit(BulletHitEvent e) { String botName = e.getName(); try { MoveEnemy moveData = getEnemyData(botName); double bulletDamage = Rules.getBulletDamage(e.getBullet().getPower()); moveData.energy -= bulletDamage; moveData.damageGiven += bulletDamage; } catch (NullPointerException npe) { _out.println(warning() + "One of my bullets hit a bot that I never " + "knew existed! (" + botName + ")"); } } 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);  }