@Test public void testFireIfGunTurnedGunHot() { DiamondFist gun = newGun(); Mockito.when(diamond.getGunHeat()).thenReturn(1.0); Mockito.when(diamond.getTurnRemaining()).thenReturn(0.0); Mockito.when(diamond.getTurnRemainingRadians()).thenReturn(0.0); gun.fireIfGunTurned(3.0); verify(diamond, never()).setFire(anyDouble()); verify(diamond, never()).setFireBullet(anyDouble()); }
void fireIfGunTurned(double bulletPower) { if (_robot.getGunHeat() == 0 && _robot.getGunTurnRemaining() == 0) { Bullet realBullet = null; if (_tcMode) { realBullet = _robot.setFireBullet(3); } else if (_robot.getEnergy() > bulletPower) { realBullet = setFireBulletLogged(bulletPower); } if (realBullet != null) { _gunDataManager.markFiringWaves(_robot.getTime(), is1v1()); } } }
DiamondFist implements RoboPainter { void fireIfGunTurned(double bulletPower) { if (_robot.getGunHeat() == 0 && _robot.getGunTurnRemaining() == 0) { Bullet realBullet = null; if (_tcMode) { realBullet = _robot.setFireBullet(3); } else if (_robot.getEnergy() > bulletPower) { realBullet = setFireBulletLogged(bulletPower); } if (realBullet != null) { _gunDataManager.markFiringWaves(_robot.getTime(), is1v1()); } } } }
DiamondFist implements RoboPainter { void fireIfGunTurned(double bulletPower) { if (_robot.getGunHeat() == 0 && _robot.getGunTurnRemaining() == 0) { Bullet realBullet = null; if (_tcMode) { realBullet = _robot.setFireBullet(3); } else if (_robot.getEnergy() > bulletPower) { realBullet = setFireBulletLogged(bulletPower); } if (realBullet != null) { _gunDataManager.markFiringWaves(_robot.getTime(), is1v1()); } } } 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 { void fireIfGunTurned(double bulletPower) { if (_robot.getGunHeat() == 0 && _robot.getGunTurnRemaining() == 0) { Bullet realBullet = null; if (_tcMode) { realBullet = _robot.setFireBullet(3); } else if (_robot.getEnergy() > bulletPower) { realBullet = setFireBulletLogged(bulletPower); } if (realBullet != null) { _gunDataManager.markFiringWaves(_robot.getTime(), is1v1()); } } } 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 { void fireIfGunTurned(double bulletPower) { if (_robot.getGunHeat() == 0 && _robot.getGunTurnRemaining() == 0) { Bullet realBullet = null; if (_tcMode) { realBullet = _robot.setFireBullet(3); } else if (_robot.getEnergy() > bulletPower) { realBullet = setFireBulletLogged(bulletPower); } if (realBullet != null) { _gunDataManager.markFiringWaves(_robot.getTime(), is1v1()); } } } 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();  }