Class Caretaker

java.lang.Object
net.sf.colossus.game.Caretaker

public class Caretaker extends 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 Details

    • LOGGER

      private static final Logger LOGGER
    • creatureAvailableCounts

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

      private final Map<CreatureType,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 List<Caretaker.ChangeListener> listeners
      All parties interested in changes to our numbers.
  • Constructor Details

    • Caretaker

      public Caretaker(Game game)
  • Method Details

    • 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()
    • addListener

      public void addListener(Caretaker.ChangeListener listener)
    • removeListener

      public void removeListener(Caretaker.ChangeListener listener)
    • 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()
    • takeOne

      public void takeOne(CreatureType type)
    • putOneBack

      public void putOneBack(CreatureType type)
    • putDeadOne

      public void putDeadOne(CreatureType type)
    • resurrectImmortals

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