Package net.sf.colossus.variant
Class Variant
java.lang.Object
net.sf.colossus.variant.Variant
Hub for all variant-specific information.
This class is meant to give access to all the information about a Colossus
game in the static sense: the master board layout, the battle board layouts,
available creatures, rules, etc. The information about a game in progress is
in the
Game
class.
Instances of this class are immutable.
TODO add access to the markers by having a class for them
TODO same thing for the colors/markersets-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic class
Used internally to record the Acquirable name, points needed for recruiting, and the list of terrains in which the Acquirable dwells. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final List
<Variant.AcquirableData> private final Map
<String, CreatureType> A map for fast lookup of creatures by their name.private final AllCreatureType
private static final Logger
private final MasterBoard
private final Document
private final List
<CreatureType> private final Collection
<MasterBoardTerrain> private final int
private final int
private final String
-
Constructor Summary
ConstructorsConstructorDescriptionVariant
(IVariantInitializer variantInitializer, AllCreatureType creatureTypes, MasterBoard masterBoard, Document readme, String name) -
Method Summary
Modifier and TypeMethodDescriptionTo obtain all the Creature that can be Acquired.int
To obtain the base amount of points needed for Acquirement.getCreatureByName
(String name) Look up a creature type by its name.int
getName()
To obtain the first Acquirable (aka 'primary') Creature name.getRecruitableAcquirableList
(MasterBoardTerrain t, int value) To obtain all the Creature that can be acquired at the given amount of points in the given terrain.int[]
getTerrainById
(String id) Retrieves the terrain with the given identifier.int
To obtain the base amount of points needed for Titan improvement.int
To obtain the amount of points needed for Titan teleport.private void
private boolean
isAcquirable
(String name) Check if the Creature whose name is in parameter is an Acquirable creature or not.boolean
Check if the Creature in parameter is an Acquirable creature or not.boolean
isCreature
(String name) Checks if a creature with the given name exists.
-
Field Details
-
LOGGER
-
creatureTypes
-
summonableCreatureTypes
-
terrains
-
acquirableList
-
masterBoard
-
readme
-
variantName
-
titanImprove
private final int titanImprove -
titanTeleport
private final int titanTeleport -
creatureTypeByNameCache
A map for fast lookup of creatures by their name. This is a cache to find creatures by their case-insensitive name quickly.
-
-
Constructor Details
-
Variant
public Variant(IVariantInitializer variantInitializer, AllCreatureType creatureTypes, MasterBoard masterBoard, Document readme, String name)
-
-
Method Details
-
getCreatureTypesAsList
-
getCreatureTypes
-
getTerrains
-
getTerrainById
Retrieves the terrain with the given identifier.- Parameters:
id
- The identifier for the terrain. Must be a valid for this variant.- Returns:
- The matching terrain.
- Throws:
IllegalArgumentException
- iff the identifier does not refer to an existing terrain in this variant.
-
getMasterBoard
-
getReadme
-
getName
-
getCreatureByName
Look up a creature type by its name. The lookup is case-insensitive at the moment (TODO: check if that makes sense at all). TODO in the long run noone should really need this since the names shouldn't be passed around by themselves ... except for resolving name that came over network... (Clemens)- Parameters:
name
- Name of a creature type. Not null.- Returns:
- CreatureType with the given name, null no such creature type.
-
initCreatureNameCache
private void initCreatureNameCache() -
isCreature
Checks if a creature with the given name exists.- Parameters:
name
- (case insensitive) name of a creature, must not be null.- Returns:
- true if this names represents a creature
-
getSummonableCreatureTypes
-
getAcquirableList
To obtain all the Creature that can be Acquired.- Returns:
- The list of name (as String) that can be Acquired
-
getAcquirableRecruitmentsValue
public int getAcquirableRecruitmentsValue()To obtain the base amount of points needed for Acquirement. All Acquirements must occur at integer multiple of this.- Returns:
- The base amount of points needed for Acquirement.
-
getPrimaryAcquirable
To obtain the first Acquirable (aka 'primary') Creature name. This one is the starting Lord with the Titan.- Returns:
- The name of the primary Acquirable Creature.
-
getRecruitableAcquirableList
To obtain all the Creature that can be acquired at the given amount of points in the given terrain. TODO should return List- Parameters:
t
- The Terrain in which the recruitment occurs.value
- The number of points at which the recruitment occurs. Valid values are constrained.- Returns:
- The list of name (as String) that can be acquired in this terrain, for this amount of points.
- See Also:
-
isAcquirable
Check if the Creature whose name is in parameter is an Acquirable creature or not.- Parameters:
name
- The name of the Creature inquired.- Returns:
- If the creature is Acquirable.
-
isAcquirable
Check if the Creature in parameter is an Acquirable creature or not.- Parameters:
c
- The Creature inquired.- Returns:
- If the creature is Acquirable.
-
getTitanImprovementValue
public int getTitanImprovementValue()To obtain the base amount of points needed for Titan improvement.- Returns:
- The base amount of points needed for Titan improvement.
-
getTitanTeleportValue
public int getTitanTeleportValue()To obtain the amount of points needed for Titan teleport.- Returns:
- The amount of points needed for Titan teleport.
-
getReinforcementTurns
public int[] getReinforcementTurns() -
getMaxBattleTurns
public int getMaxBattleTurns()
-