boolean wantsToFallBack(final Entity entity) { return (entity.isCrippled() && getForcedWithdrawal()) || getFallBack(); }
protected double calculateSelfPreservationMod(Entity movingUnit, MovePath path, IGame game, StringBuilder formula) { if (getOwner().getFallBack() || movingUnit.isCrippled()) { int newDistanceToHome = distanceToHomeEdge(path.getFinalCoords(), getOwner().getHomeEdge(movingUnit), game); double selfPreservation = getOwner().getBehaviorSettings() .getSelfPreservationValue(); double selfPreservationMod = newDistanceToHome * selfPreservation; formula.append(" - selfPreservationMod [") .append(LOG_DECIMAL.format(selfPreservationMod)) .append(" = ").append(LOG_DECIMAL.format(newDistanceToHome)) .append(" * ") .append(LOG_DECIMAL.format(selfPreservation)).append("]"); return selfPreservationMod; } return 0.0; }
setFleeBoard(behaviorSettings.shouldAutoFlee(), "Flee Board Configuration."); if (getFallBack()) { return;
Mockito.when(mockPrincess.getFallBack()).thenReturn(false); Mockito.when(mockPrincess.getFleeBoard()).thenReturn(false); Mockito.when(mockPrincess.getFallBack()).thenReturn(true); Mockito.when(mockPrincess.getFallBack()).thenReturn(false); Mockito.when(mockPrincess.getFleeBoard()).thenReturn(true);
if (getFallBack()) { msg += " is falling back."; } else if (entity.isCrippled()) {
Mockito.doNothing().when(mockPrincess).sendChat(Matchers.anyString()); testChatProcessor.additionalPrincessCommands(mockChatEvent, mockPrincess); Assert.assertTrue(mockPrincess.getFallBack()); Mockito.doNothing().when(mockPrincess).sendChat(Matchers.anyString()); testChatProcessor.additionalPrincessCommands(mockChatEvent, mockPrincess); Assert.assertFalse(mockPrincess.getFallBack()); Mockito.doNothing().when(mockPrincess).sendChat(Matchers.anyString()); testChatProcessor.additionalPrincessCommands(mockChatEvent, mockPrincess); Assert.assertFalse(mockPrincess.getFallBack());