private void checkForBrokenEnemies() { // If the Forced Withdrawal rule is not turned on, then it's a fight // to the death anyway. if (!getForcedWithdrawal()) { return; } for (final Entity entity : getEnemyEntities()) { getHonorUtil().checkEnemyBroken(entity, getForcedWithdrawal()); } }
private double calcCivilianTargetDisutility(final Targetable target) { if (!(target instanceof Entity)) { return 0; } final Entity entity = (Entity) target; if (entity.isMilitary()) { return 0; } if (owner.getPriorityUnitTargets().contains(entity.getId())) { return 0; } if (owner.getHonorUtil().isEnemyDishonored(entity.getOwnerId())) { return 0; } return CIVILIAN_TARGET_DISUTILITY; }
if (getHonorUtil().isEnemyBroken(entity.getTargetId(), entity.getOwnerId(), getForcedWithdrawal()) || msg.append("fleeing."); getHonorUtil().setEnemyDishonored(entity.getOwnerId()); continue; .append(mine.getDisplayName()) .append(")."); getHonorUtil().setEnemyDishonored(entity.getOwnerId()); attackedWhileFleeing.add(mine.getId());
@Before public void setUp() { final BehaviorSettings mockBehavior = Mockito.mock(BehaviorSettings.class); Mockito.when(mockBehavior.getFallShameValue()).thenReturn(BehaviorSettings.FALL_SHAME_VALUES[5]); Mockito.when(mockBehavior.getBraveryValue()).thenReturn(BehaviorSettings.BRAVERY[5]); Mockito.when(mockBehavior.getHyperAggressionValue()).thenReturn(BehaviorSettings.HYPER_AGGRESSION_VALUES[5]); Mockito.when(mockBehavior.getHerdMentalityValue()).thenReturn(BehaviorSettings.HERD_MENTALITY_VALUES[5]); Mockito.when(mockBehavior.getSelfPreservationValue()).thenReturn(BehaviorSettings.SELF_PRESERVATION_VALUES[5]); mockFireControl = Mockito.mock(FireControl.class); final IHonorUtil mockHonorUtil = Mockito.mock(IHonorUtil.class); Mockito.when(mockHonorUtil.isEnemyBroken(Mockito.anyInt(), Mockito.anyInt(), Mockito.anyBoolean())) .thenReturn(false); final List<Targetable> testAdditionalTargets = new ArrayList<>(); mockFireControlState = Mockito.mock(FireControlState.class); Mockito.when(mockFireControlState.getAdditionalTargets()).thenReturn(testAdditionalTargets); final Map<MovePath.Key, Double> testSuccessProbabilities = new HashMap<>(); mockPathRankerState = Mockito.mock(PathRankerState.class); Mockito.when(mockPathRankerState.getPathSuccessProbabilities()).thenReturn(testSuccessProbabilities); mockPrincess = Mockito.mock(Princess.class); Mockito.when(mockPrincess.getBehaviorSettings()).thenReturn(mockBehavior); Mockito.when(mockPrincess.getFireControl(FireControlType.Basic)).thenReturn(mockFireControl); Mockito.when(mockPrincess.getHomeEdge(Mockito.any(Entity.class))).thenReturn(CardinalEdge.NORTH); Mockito.when(mockPrincess.getHonorUtil()).thenReturn(mockHonorUtil); Mockito.when(mockPrincess.getLogger()).thenReturn(fakeLogger); Mockito.when(mockPrincess.getFireControlState()).thenReturn(mockFireControlState); Mockito.when(mockPrincess.getPathRankerState()).thenReturn(mockPathRankerState); }
boolean enemyUnitBroken = owner.getHonorUtil().isEnemyBroken(entity.getId(), shooter.getOwnerId(), owner.getBehaviorSettings().isForcedWithdrawal()); boolean enemyDishonored = owner.getHonorUtil().isEnemyDishonored(entity.getOwnerId());
if (getOwner().getHonorUtil().isEnemyBroken(enemy.getId(), enemy.getOwnerId(), getOwner().getForcedWithdrawal())) { continue;
getHonorUtil(), game, ammoConservation);
Mockito.when(mockPrincess.getHonorUtil()).thenReturn(mockHonorUtil);
if (getOwner().getHonorUtil().isEnemyBroken(enemy.getId(), enemy.getOwnerId(), getOwner().getForcedWithdrawal())) { continue;
continue; if (getHonorUtil().isEnemyBroken(e.getTargetId(), e.getOwnerId(), getForcedWithdrawal())) {
for (Entity e : enemies) { if (getOwner().getHonorUtil().isEnemyBroken(e.getTargetId(), e.getOwnerId(), getOwner().getForcedWithdrawal())) { continue;
getOwner().getHonorUtil().isEnemyBroken(e.getTargetId(), e.getOwnerId(), getOwner().getForcedWithdrawal())) { continue;