Card

Card class is the base of all implemented cards.

Card usually doesn’t get instantialised, and are stored as type[Card]. Its class methods are called when needed.

from dgisim import Card
class Card
classmethod action_generator(game_state: gs.GameState, pid: Pid) None | acg.ActionGenerator
Returns:

the action generator if the card is strictly_usable otherwise None.

classmethod base_dice_cost() AbstractDice
Returns:

the basic cost of the card without any discount.

classmethod effects(game_state: gs.GameState, pid: Pid, instruction: act.Instruction) tuple[eft.Effect, ...]
Parameters:
  • game_state – the state of the game when the card is played.

  • pid – the card-player’s pid.

  • instruction – additional information on how card should be played.

Returns the effects of the card when played.

static is_combat_action() bool
Returns:

if playing the card is a combat action.

classmethod just_preprocessed_dice_cost(game_state: gs.GameState, pid: Pid) AbstractDice
Returns:

the actual cost of the card for pid at game_state.

classmethod loosely_usable(game_state: gs.GameState, pid: Pid) bool
Returns:

True if the card can be played by the player pid provided they have the card.

classmethod name() str
Returns:

the name of the card without space.

classmethod preprocessed_dice_cost(game_state: gs.GameState, pid: Pid) tuple[gs.GameState, AbstractDice]
Returns:

a tuple of GameState and AbstractDice.

The returned game_state is the game_state after preprocessing the usage of the card.

The returned abstract_dice are the actual cost of using the card at the provided game_state.

classmethod strictly_usable(game_state: gs.GameState, pid: Pid) bool
Returns:

True if the card can be played by the player pid, and they have the card and they have the dice to pay for the card.

classmethod usable(game_state: gs.GameState, pid: Pid) bool
Returns:

True if the card can be played by the player pid and they have the card.

classmethod valid_in_deck(deck: Deck) bool
Returns:

if this card can be added to the deck.

classmethod valid_instruction(game_state: gs.GameState, pid: Pid, instruction: act.Instruction) None | gs.GameState
Returns:

the preprocessed game-state if instruction is valid, otherwise return None.