Class Variant

java.lang.Object
net.sf.colossus.variant.Variant

public class Variant extends Object
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
  • Field Details

    • LOGGER

      private static final Logger LOGGER
    • creatureTypes

      private final AllCreatureType creatureTypes
    • summonableCreatureTypes

      private final List<CreatureType> summonableCreatureTypes
    • terrains

      private final Collection<MasterBoardTerrain> terrains
    • acquirableList

      private final List<Variant.AcquirableData> acquirableList
    • masterBoard

      private final MasterBoard masterBoard
    • readme

      private final Document readme
    • variantName

      private final String variantName
    • titanImprove

      private final int titanImprove
    • titanTeleport

      private final int titanTeleport
    • creatureTypeByNameCache

      private final Map<String,CreatureType> 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

  • Method Details

    • getCreatureTypesAsList

      public List<CreatureType> getCreatureTypesAsList()
    • getCreatureTypes

      public SortedSet<CreatureType> getCreatureTypes()
    • getTerrains

      public Collection<MasterBoardTerrain> getTerrains()
    • getTerrainById

      public MasterBoardTerrain getTerrainById(String id)
      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

      public MasterBoard getMasterBoard()
    • getReadme

      public Document getReadme()
    • getName

      public String getName()
    • getCreatureByName

      public CreatureType getCreatureByName(String name)
      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

      public boolean isCreature(String name)
      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

      public List<CreatureType> getSummonableCreatureTypes()
    • getAcquirableList

      public List<String> 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

      public String 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

      public List<String> getRecruitableAcquirableList(MasterBoardTerrain t, int value)
      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

      private boolean isAcquirable(String name)
      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

      public boolean isAcquirable(CreatureType c)
      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()