/** * Add a creature to this legion. If takeFromStack is true, then do this only if such a creature * remains in the stacks, and decrement the number of this creature type remaining. */ boolean addCreature(CreatureType creature, boolean takeFromStack) { assert getHeight() < 7 || (getHeight() == 7 && game.getTurnNumber() == 1) : "Tried " + "to add to 7-high legion!"; if (takeFromStack) { Caretaker caretaker = game.getCaretaker(); if (caretaker.getAvailableCount(creature) > 0) { caretaker.takeOne(creature); int count = caretaker.getAvailableCount(creature); LOGGER.log( Level.INFO, "Added " + creature.toString() + " to " + getMarkerId() + " - now there are " + count + " left."); } else { LOGGER.log( Level.SEVERE, "Tried to addCreature " + creature.toString() + " to legion " + getMarkerId() + " when there were none of those left!"); return false; } } getCreatures().add(new CreatureServerSide(creature, this, game)); return true; }