Package net.sf.colossus.game
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 interface
Callback 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 Game
The 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 TypeMethodDescriptionvoid
addListener
(Caretaker.ChangeListener listener) void
int
int
getDeadCount
(CreatureType type) protected Game
getGame()
void
putDeadOne
(CreatureType type) void
putOneBack
(CreatureType type) void
removeListener
(Caretaker.ChangeListener listener) void
void
Move dead non-Titan immortals back to stacks.void
setAvailableCount
(CreatureType type, int availableCount) void
setDeadCount
(CreatureType type, int deadCount) void
takeOne
(CreatureType type) private void
private void
triggerOneAvailabilityCount
(CreatureType type, int count) private void
private void
triggerOneDeadCount
(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.
-