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()); } }
boolean wantsToFallBack(final Entity entity) { return (entity.isCrippled() && getForcedWithdrawal()) || getFallBack(); }
/** * Load the list of units considered crippled at the time the bot was loaded or the beginning of the turn, * whichever is the more recent. */ public void refreshCrippledUnits() { // if we're not following 'forced withdrawal' rules, there's no need for this if(!getForcedWithdrawal()) { return; } // this approach is a little bit inefficient, but the running time is only O(n) where n is the number // of princess owned units, so it shouldn't be a big deal. crippledUnits.clear(); for(Entity e : this.getEntitiesOwned()) { if(e.isCrippled(true)) { crippledUnits.add(e.getId()); } } }
if (!getForcedWithdrawal()) { msg.append("\n\tForced withdrawal turned off."); return; getForcedWithdrawal()) || !entity.isMilitary()) {
Mockito.when(mockPrincess.getForcedWithdrawal()).thenReturn(true); Mockito.when(mockPrincess.getFallBack()).thenReturn(false); Mockito.when(mockPrincess.getFleeBoard()).thenReturn(false); Mockito.when(mockPrincess.getForcedWithdrawal()).thenReturn(false);
Mockito.when(mockPrincess.getForcedWithdrawal()).thenReturn(true); Assert.assertTrue(mockPrincess.mustFleeBoard(mockMech));
enemy.getOwnerId(), getOwner().getForcedWithdrawal())) { continue;
boolean mustFleeBoard(final Entity entity) { if (!isFallingBack(entity)) { return false; } if (!entity.canFlee()) { return false; } if (0 < getPathRanker(entity).distanceToHomeEdge(entity.getPosition(), getHomeEdge(entity), getGame())) { return false; } //noinspection RedundantIfStatement if (!getFleeBoard() && !(entity.isCrippled() && getForcedWithdrawal())) { return false; } return true; }
if (getForcedWithdrawal() && shooter.isCrippled()) { final StringBuilder msg = new StringBuilder(shooter.getDisplayName()) .append(" is crippled and withdrawing.");
owner.getForcedWithdrawal())) { owner.log(getClass(), METHOD_NAME, LogLevel.INFO, enemy.getDisplayName() + " is broken - ignoring"); continue;
enemy.getOwnerId(), getOwner().getForcedWithdrawal())) { continue;
if (getForcedWithdrawal() && attacker.isCrippled()) { final StringBuilder msg = new StringBuilder(attacker.getDisplayName()) getForcedWithdrawal())) { continue;
if(getForcedWithdrawal() && getEntity(entityNum).isCrippled()) { log(getClass(), METHOD_NAME,
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;