Class Caretaker
java.lang.Object
net.sf.colossus.game.Caretaker
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.
-
Nested Class Summary
Nested ClassesModifier and TypeClassDescriptionstatic interfaceCallback interface for listening to changes to the numbers. -
Field Summary
FieldsModifier and TypeFieldDescriptionprivate final Map<CreatureType, Integer> Map of creature types to the number of available creatures.private final Map<CreatureType, Integer> Map of creature types to the number of dead creatures.private final GameThe game of which we manage the creatures.private final List<Caretaker.ChangeListener> All parties interested in changes to our numbers.private static final Logger -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionvoidaddListener(Caretaker.ChangeListener listener) voidintintgetDeadCount(CreatureType type) protected GamegetGame()voidputDeadOne(CreatureType type) voidputOneBack(CreatureType type) voidremoveListener(Caretaker.ChangeListener listener) voidvoidMove dead non-Titan immortals back to stacks.voidsetAvailableCount(CreatureType type, int availableCount) voidsetDeadCount(CreatureType type, int deadCount) voidtakeOne(CreatureType type) private voidprivate voidtriggerOneAvailabilityCount(CreatureType type, int count) private voidprivate voidtriggerOneDeadCount(CreatureType type, int count)
-
Field Details
-
LOGGER
-
creatureAvailableCounts
Map of creature types to the number of available creatures. -
creatureDeadCounts
Map of creature types to the number of dead creatures. -
game
The game of which we manage the creatures. -
listeners
All parties interested in changes to our numbers.
-
-
Constructor Details
-
Caretaker
-
-
Method Details
-
resetAllCounts
public void resetAllCounts() -
setAvailableCount
-
setDeadCount
-
getAvailableCount
-
adjustAvailableCount
-
getDeadCount
-
getGame
-
addListener
-
removeListener
-
triggerOneAvailabilityCount
-
triggerOneDeadCount
-
triggerOneCountUpdate
-
triggerFullUpdate
private void triggerFullUpdate() -
takeOne
-
putOneBack
-
putDeadOne
-
resurrectImmortals
public void resurrectImmortals()Move dead non-Titan immortals back to stacks.
-