Class Variant


  • public class Variant
    extends java.lang.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 Detail

      • LOGGER

        private static final java.util.logging.Logger LOGGER
      • summonableCreatureTypes

        private final java.util.List<CreatureType> summonableCreatureTypes
      • readme

        private final javax.swing.text.Document readme
      • variantName

        private final java.lang.String variantName
      • titanImprove

        private final int titanImprove
      • titanTeleport

        private final int titanTeleport
      • creatureTypeByNameCache

        private final java.util.Map<java.lang.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.
    • Method Detail

      • getCreatureTypesAsList

        public java.util.List<CreatureType> getCreatureTypesAsList()
      • getCreatureTypes

        public java.util.SortedSet<CreatureType> getCreatureTypes()
      • getTerrainById

        public MasterBoardTerrain getTerrainById​(java.lang.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:
        java.lang.IllegalArgumentException - iff the identifier does not refer to an existing terrain in this variant.
      • getReadme

        public javax.swing.text.Document getReadme()
      • getName

        public java.lang.String getName()
      • getCreatureByName

        public CreatureType getCreatureByName​(java.lang.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​(java.lang.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 java.util.List<CreatureType> getSummonableCreatureTypes()
      • getAcquirableList

        public java.util.List<java.lang.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 java.lang.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 java.util.List<java.lang.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:
        getAcquirableRecruitmentsValue()
      • isAcquirable

        private boolean isAcquirable​(java.lang.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()