public InfantryPathRanker(Princess princess) { super(princess); setFireControl(new InfantryFireControl(princess)); setPathEnumerator(princess.getPrecognition().getPathEnumerator()); }
@Override protected void checkMoral() { moralUtil.checkMoral(behaviorSettings.isForcedWithdrawal(), behaviorSettings.getBraveryIndex(), behaviorSettings.getSelfPreservationIndex(), getLocalPlayer(), game); }
/** * Princess's home edge. * * @param retreatEdge the index of the {@link CardinalEdge} princess should flee to. See {@link CardinalEdge#getIndex()} */ public void setRetreatEdge(final int retreatEdge) { setRetreatEdge(CardinalEdge.getCardinalEdge(retreatEdge)); }
ToHitData calcToHit() { return owner.getFireControl(getShooter()).guessToHitModifierForWeapon(getShooter(), getShooterState(), getTarget(), getTargetState(), getWeapon(), getGame()); }
private ToHitData calcToHit(final MovePath shooterPath, final boolean assumeUnderFlightPath) { return owner.getFireControl(getShooter()).guessAirToGroundStrikeToHitModifier(getShooter(), null, getTarget(), getTargetState(), shooterPath, getWeapon(), getGame(), assumeUnderFlightPath); }
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 getForcedWithdrawal() { return getBehaviorSettings().isForcedWithdrawal(); }
/** * Princess's home edge. * * @param destinationEdge the index of the {@link CardinalEdge} princess should flee to. See {@link CardinalEdge#getIndex()} */ public void setDestinationEdge(final int destinationEdge) { setDestinationEdge(CardinalEdge.getCardinalEdge(destinationEdge)); }
/** * Helper function to perform some modifications to a given path. * Intended to happen after we pick the best path. * @param path The ranked path to process * @return Altered move path */ private MovePath performPathPostProcessing(final RankedPath path) { return performPathPostProcessing(path.getPath(), path.getExpectedDamage()); }
private int calcDamageDirection() { return ((calcAttackDirection() - getTargetState().getFacing()) + 6) % 6; }
public Set<Integer> getPriorityUnitTargets() { return getBehaviorSettings().getPriorityUnitTargets(); }
/** * @return The amount of damage based on the damage of each weapon and their odds of hitting. */ synchronized double getExpectedDamage() { double expectedDamage = 0; for (WeaponFireInfo weaponFireInfo : this) { expectedDamage += weaponFireInfo.getExpectedDamageOnHit() * weaponFireInfo.getProbabilityToHit(); } return expectedDamage; }
private EntityState getShooterState() { if (null == shooterState) { shooterState = new EntityState(getShooter()); } return shooterState; }
@Override protected void initTargeting() { getArtilleryTargetingControl().initializeForTargetingPhase(); }
public void log(final Class<?> callingClass, final String methodName, final Throwable t) { log(callingClass, methodName, LogLevel.ERROR, t); }
Coords getClosestCoordsTo(int unitId, Coords location) { ConvexBoardArea box = pathEnumerator.getUnitMovableAreas().get(unitId); if (box == null) { return null; } return box.getClosestCoordsTo(location); }
/** * How quickly will I try to escape once damaged? * * @param index The index of the Bravery modifier to retrieve. * @return Bravery modifier value at given index. */ protected double getBraveryValue(final int index) { return BRAVERY[validateIndex(index)]; }
double getMaxDamageAtRange(InfantryFireControl fireControl, Entity shooter, MovePath movePath, int range, boolean useExtremeRange, boolean useLOSRange) { return fireControl.getMaxDamageAtRange(shooter, movePath, range, useExtremeRange, useLOSRange); } }
/** * How worried about enemy damage am I? * * @param selfPreservationIndex The index [0-10] of the self preservation value to be used. */ public void setSelfPreservationIndex(final int selfPreservationIndex) { this.selfPreservationIndex = validateIndex(selfPreservationIndex); }