/** * Test to make sure that Princess will choose a FiringPlan that shots at * a MechWarrior, instead of choosing to do nothing. */ @Test public void testCalcFiringPlansAtMechwarrior() { mockTarget = Mockito.mock(MechWarrior.class); Mockito.when(mockPPCFireInfo.getProbabilityToHit()).thenReturn(0.6); Mockito.when(mockPPCFireInfo.getHeat()).thenReturn(10); Mockito.when(mockPPCFireInfo.getExpectedDamageOnHit()).thenReturn(10.0); Mockito.when(mockMLFireInfo.getProbabilityToHit()).thenReturn(0.6); Mockito.when(mockMLFireInfo.getHeat()).thenReturn(3); Mockito.when(mockMLFireInfo.getExpectedDamageOnHit()).thenReturn(5.0); Mockito.when(mockLRMFireInfo.getProbabilityToHit()).thenReturn(0.6); Mockito.when(mockLRMFireInfo.getHeat()).thenReturn(1); Mockito.when(mockLRMFireInfo.getExpectedDamageOnHit()).thenReturn(3.0); Mockito.doReturn(0.0).when(testFireControl).calcDamageAllocationUtility(Mockito.any(Targetable.class), Mockito.anyDouble()); Mockito.when(mockShooter.getPosition()).thenReturn(mockShooterCoords); Mockito.when(mockTarget.getPosition()).thenReturn(mockTargetCoords); Mockito.when(mockShooter.getWeaponList()).thenReturn(shooterWeapons); final FiringPlan plan = testFireControl.getBestFiringPlan(mockShooter, mockTarget, mockGame, testToHitThreshold); Assert.assertFalse("Expected not 0.0. Got " + plan.getUtility(), 0.00001 > Math.abs(0 - plan.getUtility())); } }
final FiringPlan plan = getFireControl(shooter).getBestFiringPlan(shooter, getHonorUtil(), game,
noTwistPlan = getBestFiringPlan(shooter, target, owner.getGame(), ammoConservation); break; case GUESS: switch (params.getCalculationType()) { case GET: twistPlan = getBestFiringPlan(shooter, target, owner.getGame(), ammoConservation); break; case GUESS: