Class Caretaker


  • public class Caretaker
    extends java.lang.Object
    The caretaker tracks the number of creatures still available and those dead. For each creature type the number of creatures still available for mustering and the number of creatures already dead is stored. The latter function means this version of a caretaker integrates what is called a 'graveyard' in a normal Titan game.
    • Field Detail

      • LOGGER

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

        private final java.util.Map<CreatureType,​java.lang.Integer> creatureAvailableCounts
        Map of creature types to the number of available creatures.
      • creatureDeadCounts

        private final java.util.Map<CreatureType,​java.lang.Integer> creatureDeadCounts
        Map of creature types to the number of dead creatures.
      • game

        private final Game game
        The game of which we manage the creatures.
      • listeners

        private final java.util.List<Caretaker.ChangeListener> listeners
        All parties interested in changes to our numbers.
    • Constructor Detail

      • Caretaker

        public Caretaker​(Game game)
    • Method Detail

      • resetAllCounts

        public void resetAllCounts()
      • setAvailableCount

        public void setAvailableCount​(CreatureType type,
                                      int availableCount)
      • setDeadCount

        public void setDeadCount​(CreatureType type,
                                 int deadCount)
      • getAvailableCount

        public int getAvailableCount​(CreatureType type)
      • adjustAvailableCount

        public void adjustAvailableCount​(CreatureType type)
      • getDeadCount

        public int getDeadCount​(CreatureType type)
      • getGame

        protected Game getGame()
      • triggerOneAvailabilityCount

        private void triggerOneAvailabilityCount​(CreatureType type,
                                                 int count)
      • triggerOneDeadCount

        private void triggerOneDeadCount​(CreatureType type,
                                         int count)
      • triggerOneCountUpdate

        private void triggerOneCountUpdate​(CreatureType type)
      • triggerFullUpdate

        private void triggerFullUpdate()
      • putOneBack

        public void putOneBack​(CreatureType type)
      • putDeadOne

        public void putDeadOne​(CreatureType type)
      • resurrectImmortals

        public void resurrectImmortals()
        Move dead non-Titan immortals back to stacks.