Skip to content

Deck

Warning

scooze decks are still under construction...

scooze.deck

Deck

Bases: ComparableObject

A class to represent a deck of Magic: the Gathering cards.

Attributes:

Name Type Description
archetype str | None

The archetype of this Deck.

format Format

The format legality of the cards in this Deck.

main CardList

The main deck. Typically 60 cards minimum.

side CardList

The sideboard. Typically 15 cards maximum.

cmdr CardList

The command zone. Typically 1 or 2 cards in Commander formats.

attractions CardList

The attraction deck.

stickers CardList

The sticker deck.

companion Card | None

This deck's companion (if applicable).

cards: Counter[Card] property

Get this Deck as a collection of cards.

average_cmc() -> float

The average mana value of cards in this Deck.

average_words() -> float

The average number of words across all oracle text on all cards in this Deck (excludes reminder text).

total_cards() -> int

The number of cards in this Deck.

total_cmc() -> float

The total mana value of cards in this Deck.

count_pips() -> Counter[CostSymbol]

A mapping of Colors to how many times they appear as mana symbols in costs of cards in this Deck.

total_words() -> int

The number of words across all oracle text on all cards in this Deck (excludes reminder text).

diff(other: Self) -> DeckDiff

Generate a diff between this Deck and another.

Parameters:

Name Type Description Default
other Self

The other Deck.

required

Returns:

Type Description
DeckDiff

A DeckDiff with keys for each deck part. Each contains a dict of each card in both decks and their counts.

decklist_equals(other: Self) -> bool

Determine if this Deck contains exactly the same cards as another.

Parameters:

Name Type Description Default
other Self

The other Deck.

required

Returns:

Type Description
bool

True if this Deck contains exactly the same cards as another, else False.

export(export_format: DecklistFormatter = None) -> str

Export this Deck as a string with the given DecklistFormatter.

Parameters:

Name Type Description Default
export_format DecklistFormatter

The format of the exported Deck.

None

Returns:

Type Description
str

A string containing the names and quantities of the cards in this Deck.

Determine if this Deck is legal in the given format.

Default checks against self.Format. If self.Format is unset, checks against Format.NONE.

  • For cards with Legality.RESTRICTED, only 1 or fewer may be present throughout all deck parts.
  • For cards with Legality.LEGAL, only N or fewer may be present throughout all deck parts where N is determined by the max quantity of a single cards allowed by the given format.
  • For cards with Legality.BANNED or Legality.NOT_LEGAL, none may be present throughout all deck parts.

Parameters:

Name Type Description Default
format Format

The format to check against.

None

add_card(card: Card, quantity: int = 1, in_the: InThe = InThe.MAIN) -> None

Add a given quantity of a given card to this Deck.

Parameters:

Name Type Description Default
card Card

The card to add.

required
quantity int

The number of copies of the card to be added.

1
in_the InThe

Where to add the card (main, side, etc.)

MAIN

add_cards(cards: Counter[Card], in_the: InThe = InThe.MAIN) -> None

Add the given cards to this Deck.

Parameters:

Name Type Description Default
cards Counter[Card]

The cards to add.

required
in_the InThe

Where to add the cards (main, side, etc.)

MAIN

remove_card(card: Card, quantity: int = maxsize, in_the: InThe = InThe.MAIN) -> None

Remove a given quantity of a given card from this Deck. If quantity is not provided, removes all copies.

Parameters:

Name Type Description Default
card Card

The card to remove.

required
quantity int

The number of copies of the card to be removed.

maxsize
in_the InThe

Where to remove the cards from (main, side, etc.)

MAIN

remove_cards(cards: Counter[Card], in_the: InThe = InThe.MAIN) -> None

Remove the given cards from this Deck.

Parameters:

Name Type Description Default
cards Counter[Card]

The cards to remove.

required
in_the InThe

Where to remove the cards from (main, side, etc.)

MAIN

DeckDiff

Bases: ComparableObject

A class to represent a diff between two decks.

Attributes:

Name Type Description
main DictDiff

The diff between the main decks of two Decks.

side DictDiff

The diff between the sideboards of two Decks.

cmdr DictDiff

The diff between the command zones of two Decks.

attractions DictDiff

The diff between the attractions of the two Decks.

stickers DictDiff

The diff between the stickers of the two Decks.

total() -> int

The number of cards in this DeckDiff.

DecklistFormatter

Bases: ExtendedEnum, StrEnum

A method of formatting a decklist for external systems.

InThe

Bases: ExtendedEnum, StrEnum

The location of a Card in a Deck.

scooze.cardlist

CardList

Bases: ComparableObject

A class to represent a list of cards, generally as a part of a deck.

Attributes:

Name Type Description
cards Counter[Card]

The cards in this CardList.

total() -> int

The number of cards in this CardList.

count_pips() -> Counter[CostSymbol]

A mapping of Colors to how many times they appear as mana symbols in costs of cards in this CardList.

diff(other: Self) -> DictDiff

Generate a diff between this CardList and another.

Parameters:

Name Type Description Default
other Self

The other CardList.

required

Returns:

Type Description
DictDiff

A DictDiff with every card in both CardLists and their counts.

add_card(card: Card, quantity: int = 1) -> None

Add a given quantity of a given card to this CardList.

Parameters:

Name Type Description Default
card Card

The card to add.

required
quantity int

The number of copies of the card to be added.

1

add_cards(cards: Counter[Card]) -> None

Add the given cards to this CardList.

Parameters:

Name Type Description Default
cards Counter[Card]

The cards to add.

required

remove_card(card: Card, quantity: int = maxsize) -> None

Remove a given quantity of a given card from this Deck. If quantity is not provided, removes all copies.

Parameters:

Name Type Description Default
card Card

The card to remove.

required
quantity int

The number of copies of the card to be removed.

maxsize

remove_cards(cards: Counter[Card]) -> None

Remove the given cards from this CardList.

Parameters:

Name Type Description Default
cards Counter[Card]

The cards to remove.

required