public abstract class AbstractAI extends java.lang.Object implements AI
Modifier and Type | Class and Description |
---|---|
protected class |
AbstractAI.AbstractAIOracle |
protected class |
AbstractAI.CreatureValueConstants
Various constants used by the AIs code for creature evaluation.
|
protected class |
AbstractAI.MoveInfo
little helper to store info about possible moves
|
Modifier and Type | Field and Description |
---|---|
BattleEvalConstants |
bec |
protected Client |
client
The Client we're working for.
|
protected AbstractAI.CreatureValueConstants |
cvc |
private java.util.Set<BattleHex> |
duplicateHexChecker
Set of hex name, to check for duplicates.
|
protected java.util.List<IVariantHint.AIStyle> |
hintSectionUsed
For the Oracle Hint stuff, the play style we use.
|
private static java.util.logging.Logger |
LOGGER |
protected java.util.Random |
random
Our random source.
|
protected Variant |
variant |
Modifier | Constructor and Description |
---|---|
protected |
AbstractAI(Client client) |
Modifier and Type | Method and Description |
---|---|
protected java.util.Map<MasterHex,java.util.List<Legion>>[] |
buildEnemyAttackMap(Player player)
arrays and generics don't work well together -- TODO replace the
array with a list or model some intermediate classes
|
void |
cleanupBattle()
a Battle is finished
|
protected boolean |
couldRecruitUp(Legion legion,
MasterHex hex,
Legion enemy)
Return true if the legion could recruit or acquire something
better than its worst creature in hexLabel.
|
int |
countCreatureAccrossAllLegionFromPlayer(Creature creature) |
private boolean |
doesSetContainHexWithTerrain(java.util.Set<MasterHex> set,
java.lang.String terrainTypeName) |
java.util.Map<BattleHex,java.lang.Integer> |
findStrikeMap()
Return a map of target hex label to number
of friendly creatures that can strike it
|
protected java.util.Map<BattleCritter,java.lang.Double> |
generateDamageMap()
Create a map containing each target and the number of hits it would
likely take if all possible creatures attacked it.
|
protected java.util.Collection<LegionMove> |
generateLegionMoves(java.util.List<java.util.List<CritterMove>> allCritterMoves,
boolean forceAll)
allCritterMoves is a List of sorted MoveLists.
|
protected int |
getAcqStepValue()
Shortcut to ask for the acquirables basic value from the variant
|
BattleStrike |
getBattleStrike() |
protected BattleUnit |
getBattleUnit(BattleHex hex) |
Caretaker |
getCaretaker() |
protected int |
getHintedRecruitmentValue(CreatureType creature,
Legion legion,
java.util.List<IVariantHint.AIStyle> styles) |
int |
getHintedRecruitmentValueNonTitan(CreatureType creature) |
int |
getHintedRecruitmentValueNonTitan(CreatureType creature,
java.util.List<IVariantHint.AIStyle> styles) |
protected java.util.List<CreatureType> |
getInitialSplitHint(MasterHex hex)
Return which creature the variant suggest splitting at turn 1 when
starting in a specific hex.
|
int |
getKillValue(BattleCritter battleCritter,
MasterBoardTerrain terrain)
Get the 'kill value' of a creature on a specific terrain.
|
protected int |
getKillValue(CreatureType creature)
Get the 'kill value' of a creature on an unspecified terrain.
|
private int |
getKillValue(CreatureType creature,
MasterBoardTerrain terrain)
Get the 'kill value' of a creature on a specific terrain.
|
protected int |
getNumberOfWaysToTerrain(Legion legion,
MasterHex hex,
java.lang.String terrainTypeName) |
CreatureType |
getVariantRecruitHint(LegionClientSide legion,
MasterHex hex,
java.util.List<CreatureType> recruits) |
protected boolean |
hasOpponentNativeCreature(HazardTerrain terrain) |
void |
initBattle()
a Battle start
|
protected boolean |
isHumanLegion(Legion legion)
Test whether a Legion belongs to a Human player
|
static LegionMove |
makeLegionMove(int[] indexes,
java.util.List<java.util.List<CritterMove>> critterMoves)
critterMoves is a List of sorted MoveLists.
|
private void |
nestForLoop(int[] indexes,
int level,
java.util.List<java.util.List<CritterMove>> critterMoves,
java.util.List<LegionMove> legionMoves,
boolean forceAll)
Private helper for generateLegionMoves
If forceAll is true, generate all possible moves.
|
protected int |
rangeToClosestOpponent(BattleHex hex) |
void |
setVariant(Variant v) |
private boolean |
trimCritterMoves(java.util.List<java.util.List<CritterMove>> allCritterMoves)
Modify allCritterMoves in place, and return true if it changed.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
acquireAngel, battleMove, concede, flee, handleCarries, masterMove, muster, pickColor, pickEngagement, pickEntrySide, pickMarker, pickStrikePenalty, reinforce, retryFailedBattleMoves, split, splitCallback, strike, summonAngel
private static final java.util.logging.Logger LOGGER
public final BattleEvalConstants bec
protected final AbstractAI.CreatureValueConstants cvc
protected final Client client
protected Variant variant
protected final java.util.Random random
protected java.util.List<IVariantHint.AIStyle> hintSectionUsed
private final java.util.Set<BattleHex> duplicateHexChecker
protected AbstractAI(Client client)
public void setVariant(Variant v)
setVariant
in interface AI
public final CreatureType getVariantRecruitHint(LegionClientSide legion, MasterHex hex, java.util.List<CreatureType> recruits)
getVariantRecruitHint
in interface AI
protected final java.util.Map<MasterHex,java.util.List<Legion>>[] buildEnemyAttackMap(Player player)
protected final int getNumberOfWaysToTerrain(Legion legion, MasterHex hex, java.lang.String terrainTypeName)
private final boolean doesSetContainHexWithTerrain(java.util.Set<MasterHex> set, java.lang.String terrainTypeName)
public final java.util.Map<BattleHex,java.lang.Integer> findStrikeMap()
protected final java.util.Map<BattleCritter,java.lang.Double> generateDamageMap()
protected final java.util.List<CreatureType> getInitialSplitHint(MasterHex hex)
hex
- The masterboard hex where the split occurs.public int getKillValue(BattleCritter battleCritter, MasterBoardTerrain terrain)
battleCritter
- The BattleCritter whose value is requested.terrain
- The terrain on which the value is requested, or null.protected int getKillValue(CreatureType creature)
creature
- The CreatureType whose value is requested.private int getKillValue(CreatureType creature, MasterBoardTerrain terrain)
creature
- The CreatureType whose value is requested.terrain
- The terrain on which the value is requested, or nullprotected int getAcqStepValue()
protected final boolean couldRecruitUp(Legion legion, MasterHex hex, Legion enemy)
public int getHintedRecruitmentValueNonTitan(CreatureType creature)
public int getHintedRecruitmentValueNonTitan(CreatureType creature, java.util.List<IVariantHint.AIStyle> styles)
protected final int getHintedRecruitmentValue(CreatureType creature, Legion legion, java.util.List<IVariantHint.AIStyle> styles)
protected final boolean isHumanLegion(Legion legion)
protected final boolean hasOpponentNativeCreature(HazardTerrain terrain)
protected final int rangeToClosestOpponent(BattleHex hex)
protected final java.util.Collection<LegionMove> generateLegionMoves(java.util.List<java.util.List<CritterMove>> allCritterMoves, boolean forceAll)
private final void nestForLoop(int[] indexes, int level, java.util.List<java.util.List<CritterMove>> critterMoves, java.util.List<LegionMove> legionMoves, boolean forceAll)
public static final LegionMove makeLegionMove(int[] indexes, java.util.List<java.util.List<CritterMove>> critterMoves)
private final boolean trimCritterMoves(java.util.List<java.util.List<CritterMove>> allCritterMoves)
public void initBattle()
AI
initBattle
in interface AI
public void cleanupBattle()
AI
cleanupBattle
in interface AI
protected BattleUnit getBattleUnit(BattleHex hex)
public BattleStrike getBattleStrike()
public final int countCreatureAccrossAllLegionFromPlayer(Creature creature)
public Caretaker getCaretaker()
getCaretaker
in interface AI