Area constructor

Area({
  1. required DeployedBase base,
  2. required UnitCard leader,
  3. List<PlayableCard> resources = const [],
  4. int? availableResources,
  5. List<PlayableCard> hand = const [],
  6. List<PlayableCard> deck = const [],
  7. List<PlayableCard> discard = const [],
  8. List<DeployedCard<TargetCard>> inPlay = const [],
})

Creates an area with the given properties.

If availableResources is not provided, it defaults to the length of resources (i.e. that no resources have been exhausted).

Errors

This class is not intended to be used with user-provided input, and as such does not provide any error handling. If any of the fields are invalid, an error will be thrown.

Implementation

factory Area({
  required DeployedBase base,
  required UnitCard leader,
  List<PlayableCard> resources = const [],
  int? availableResources,
  List<PlayableCard> hand = const [],
  List<PlayableCard> deck = const [],
  List<PlayableCard> discard = const [],
  List<DeployedCard> inPlay = const [],
}) {
  return Area._(
    totalResources: resources,
    availableResources: availableResources ?? resources.length,
    base: base,
    leader: leader,
    hand: hand,
    deck: deck,
    discard: discard,
    arena: inPlay,
  );
}