@Test public void testOnScannedRobotUpdateEnemy() { DiamondFist gun = newGun(true, false); mock1v1(gun, _shadow); ScannedRobotEvent sre = _eventHelper.newScannedRobotEvent(_shadow); gun.onScannedRobot(sre); verify(gunDataManager).updateEnemy( eq(sre), (Point2D.Double) any(), anyDouble(), anyInt(), eq(true)); }
public void onScannedRobot(ScannedRobotEvent e) { String botName = e.getName(); double absBearing = e.getBearingRadians() + _robot.getHeadingRadians(); Point2D.Double enemyLocation = DiaUtils.project( myLocation(), Utils.normalAbsoluteAngle(absBearing), e.getDistance()); GunEnemy gunData; if (_gunDataManager.hasEnemy(botName)) { gunData = _gunDataManager.updateEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); } else { gunData = _gunDataManager.newEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); initGunViews(gunData); } _gunDataManager.fireNextTickWave(_predictor.nextLocation(_robot), enemyLocation, botName, _robot.getRoundNum(), _robot.getTime(), calculateBulletPower(), _robot.getEnergy(), _robot.getGunHeat(), _robot.getHeadingRadians(), _robot.getVelocity(), _robot.getOthers()); }
DiamondFist implements RoboPainter { public void onScannedRobot(ScannedRobotEvent e) { String botName = e.getName(); double absBearing = e.getBearingRadians() + _robot.getHeadingRadians(); Point2D.Double enemyLocation = DiaUtils.project( myLocation(), Utils.normalAbsoluteAngle(absBearing), e.getDistance()); GunEnemy gunData; if (_gunDataManager.hasEnemy(botName)) { gunData = _gunDataManager.updateEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); } else { gunData = _gunDataManager.newEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); initGunViews(gunData); } _gunDataManager.fireNextTickWave(_predictor.nextLocation(_robot), enemyLocation, botName, _robot.getRoundNum(), _robot.getTime(), calculateBulletPower(), _robot.getEnergy(), _robot.getGunHeat(), _robot.getHeadingRadians(), _robot.getVelocity(), _robot.getOthers()); } }
DiamondFist implements RoboPainter { public void onScannedRobot(ScannedRobotEvent e) { String botName = e.getName(); double absBearing = e.getBearingRadians() + _robot.getHeadingRadians(); Point2D.Double enemyLocation = DiaUtils.project( myLocation(), Utils.normalAbsoluteAngle(absBearing), e.getDistance()); GunEnemy gunData; if (_gunDataManager.hasEnemy(botName)) { gunData = _gunDataManager.updateEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); } else { gunData = _gunDataManager.newEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); initGunViews(gunData); } _gunDataManager.fireNextTickWave(_predictor.nextLocation(_robot), enemyLocation, botName, _robot.getRoundNum(), _robot.getTime(), calculateBulletPower(), _robot.getEnergy(), _robot.getGunHeat(), _robot.getHeadingRadians(), _robot.getVelocity(), _robot.getOthers()); } DiamondFist(Diamond robot, boolean isTcMode);   DiamondFist(Diamond robot, boolean isTcMode, BattleField battleField,
      Collection<RoboGraphic> renderables, OutputStream out);   DiamondFist(Diamond robot, boolean isTcMode, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out);   DiamondFist(Diamond robot, boolean isTcMode, GunDataManager gunDataManager,
      VirtualGunsManager<TimestampedFiringAngle> virtualGunsManager,
      BattleField battleField, Collection<RoboGraphic> renderables,
      OutputStream out); }
DiamondFist implements RoboPainter { public void onScannedRobot(ScannedRobotEvent e) { String botName = e.getName(); double absBearing = e.getBearingRadians() + _robot.getHeadingRadians(); Point2D.Double enemyLocation = DiaUtils.project( myLocation(), Utils.normalAbsoluteAngle(absBearing), e.getDistance()); GunEnemy gunData; if (_gunDataManager.hasEnemy(botName)) { gunData = _gunDataManager.updateEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); } else { gunData = _gunDataManager.newEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); initGunViews(gunData); } _gunDataManager.fireNextTickWave(_predictor.nextLocation(_robot), enemyLocation, botName, _robot.getRoundNum(), _robot.getTime(), calculateBulletPower(), _robot.getEnergy(), _robot.getGunHeat(), _robot.getHeadingRadians(), _robot.getVelocity(), _robot.getOthers()); } DiamondFist(Diamond robot, boolean isTcMode);   DiamondFist(Diamond robot, boolean isTcMode, BattleField battleField,
      Collection<RoboGraphic> renderables, OutputStream out);   DiamondFist(Diamond robot, boolean isTcMode, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out);   DiamondFist(Diamond robot, boolean isTcMode, GunDataManager gunDataManager,
      VirtualGunsManager<TimestampedFiringAngle> virtualGunsManager,
      BattleField battleField, Collection<RoboGraphic> renderables,
      OutputStream out); void initRound(Diamond robot); void execute(); void onScannedRobot(ScannedRobotEvent e); void onRobotDeath(RobotDeathEvent e); void onWin(WinEvent e); void onDeath(DeathEvent e); void onBulletHit(BulletHitEvent e); void onBulletHitBullet(BulletHitBulletEvent e); void onPaint(Graphics2D g); int getEnemiesAlive(); void addFireListener(FireListener listener); void paintOn(); void paintOff(); void robocodePaintOn(); void robocodePaintOff(); String paintLabel(); boolean paintStatus(); }
DiamondFist implements RoboPainter { public void onScannedRobot(ScannedRobotEvent e) { String botName = e.getName(); double absBearing = e.getBearingRadians() + _robot.getHeadingRadians(); Point2D.Double enemyLocation = DiaUtils.project( myLocation(), Utils.normalAbsoluteAngle(absBearing), e.getDistance()); GunEnemy gunData; if (_gunDataManager.hasEnemy(botName)) { gunData = _gunDataManager.updateEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); } else { gunData = _gunDataManager.newEnemy( e, enemyLocation, absBearing, _robot.getRoundNum(), is1v1()); initGunViews(gunData); } _gunDataManager.fireNextTickWave(_predictor.nextLocation(_robot), enemyLocation, botName, _robot.getRoundNum(), _robot.getTime(), calculateBulletPower(), _robot.getEnergy(), _robot.getGunHeat(), _robot.getHeadingRadians(), _robot.getVelocity(), _robot.getOthers()); } DiamondFist(Diamond robot, boolean isTcMode);   DiamondFist(Diamond robot, boolean isTcMode, BattleField battleField,
      Collection<RoboGraphic> renderables, OutputStream out);   DiamondFist(Diamond robot, boolean isTcMode, BattleField battleField,
      MovementPredictor predictor, Collection<RoboGraphic> renderables,
      OutputStream out);   DiamondFist(Diamond robot, boolean isTcMode, GunDataManager gunDataManager,
      VirtualGunsManager<TimestampedFiringAngle> virtualGunsManager,
      BattleField battleField, Collection<RoboGraphic> renderables,
      OutputStream out); void initRound(Diamond robot); void execute(); void onScannedRobot(ScannedRobotEvent e); void onRobotDeath(RobotDeathEvent e); void onWin(WinEvent e); void onDeath(DeathEvent e); void onBulletHit(BulletHitEvent e); void onBulletHitBullet(BulletHitBulletEvent e); void onPaint(Graphics2D g); int getEnemiesAlive(); void addFireListener(FireListener listener); void paintOn(); void paintOff(); void robocodePaintOn(); void robocodePaintOff(); String paintLabel(); boolean paintStatus();  }