/**
   * Remove the creature in position i in the legion. Return the removed creature. Put immortal
   * creatures back on the stack and others to the Graveyard if returnImmortalToStack is true.
   */
  CreatureType removeCreature(int i, boolean returnToStack, boolean disbandIfEmpty) {
    Creature critter = getCreatures().remove(i);

    // If the creature is an immortal, put it back in the stacks.
    if (returnToStack) {
      if (critter.isImmortal()) {
        game.getCaretaker().putOneBack(critter.getType());
      } else {
        game.getCaretaker().putDeadOne(critter.getType());
      }
    }

    // If there are no critters left, disband the legion.
    if (disbandIfEmpty && getHeight() == 0) {
      remove(false, true);
    }
    // return a Creature, not a Critter
    return critter.getType();
  }
  /**
   * Recombine this legion into another legion. Only remove this legion from the Player if remove is
   * true. If it's false, the caller is responsible for removing this legion, which can avoid
   * concurrent access problems. Someone needs to call MasterBoard.alignLegions() on the remaining
   * legion's hexLabel after the recombined legion is actually removed.
   */
  void recombine(Legion legion, boolean remove) {
    // Sanity check
    if (legion == this) {
      LOGGER.log(Level.WARNING, "Tried to recombine a legion with itself!");
      return;
    }
    for (Creature critter : getCreatures()) {
      ((LegionServerSide) legion).addCreature(critter.getType(), false);
    }

    if (remove) {
      remove(false, false);
    } else {
      prepareToRemove(false, false);
    }

    LOGGER.log(Level.INFO, "Legion " + this + " recombined into legion " + legion);

    sortCritters();

    // Let the clients know that the legions have recombined.
    game.getServer().undidSplit(this, legion, true, game.getTurnNumber());
  }
 void remove() {
   remove(true, true);
 }