Models¶
Card¶
Player¶
- class pyscoundrel.models.player.Player(health: int = 20, max_health: int = 20, equipped_weapon: Weapon | None = None, potions_used_this_turn: int = 0)[source]¶
Bases:
objectPlayer state in Scoundrel.
Tracks health and equipped weapon.
- health: int = 20¶
- max_health: int = 20¶
- potions_used_this_turn: int = 0¶
- take_damage(damage: int) None[source]¶
Take damage, reducing health.
- Parameters:
damage – Amount of damage to take
- heal(amount: int) int[source]¶
Heal the player.
- Parameters:
amount – Amount to heal
- Returns:
Actual amount healed (capped at max_health)
- equip_weapon(weapon: Weapon) Weapon | None[source]¶
Equip a new weapon, replacing the current one.
- Parameters:
weapon – The weapon to equip
- Returns:
The previously equipped weapon, or None
- property is_alive: bool¶
Check if the player is still alive.
- property is_dead: bool¶
Check if the player is dead.
- property has_weapon: bool¶
Check if the player has a weapon equipped.
Weapon¶
- class pyscoundrel.models.weapon.Weapon(card: Card, slain_monsters: List[Card] = <factory>)[source]¶
Bases:
objectAn equipped weapon in Scoundrel.
Weapons have a unique mechanic: once used on a monster, they can only be used on monsters of equal or lower value than the last monster killed.
- property damage: int¶
Get the weapon’s damage value.
- property last_kill_value: int | None¶
Get the value of the last monster killed with this weapon.
Returns None if the weapon is unused.
- property max_kill_value: int | None¶
Get the maximum monster value this weapon can currently kill.
After first use, weapons can only kill monsters <= last kill value. If unused, returns None (can kill any monster).
- property is_used: bool¶
Check if the weapon has been used to kill a monster.
Deck¶
- class pyscoundrel.models.deck.Deck(dungeon: Dungeon, shuffle: bool = True, seed: int | None = None)[source]¶
Bases:
objectThe Dungeon deck for Scoundrel.
Built from a dungeon configuration via card definitions.
- draw() Card | None[source]¶
Draw a card from the top of the deck.
- Returns:
The drawn card, or None if deck is empty
- draw_multiple(count: int) List[Card][source]¶
Draw multiple cards from the deck.
- Parameters:
count – Number of cards to draw
- Returns:
List of drawn cards (may be fewer than requested if deck runs out)
- add_to_bottom(cards: List[Card]) None[source]¶
Add cards to the bottom of the deck (used when avoiding a room).
- Parameters:
cards – Cards to add to bottom of deck
- peek(count: int = 1) List[Card][source]¶
Peek at the top cards without drawing them.
- Parameters:
count – Number of cards to peek at
- Returns:
List of cards at the top of the deck
- property remaining: int¶
Get the number of cards remaining in the deck.
- property is_empty: bool¶
Check if the deck is empty.
Room¶
- class pyscoundrel.models.room.Room(cards: List[Card] = <factory>, cards_faced: List[Card] = <factory>)[source]¶
Bases:
objectA room in the dungeon containing 4 cards.
Players must face 3 of the 4 cards, leaving 1 for the next room.
- face_card(index: int) Card[source]¶
Face a card from the room by index.
- Parameters:
index – Index of card to face (0-3)
- Returns:
The faced card
- Raises:
IndexError – If index is invalid
ValueError – If trying to face more than 3 cards or card already faced
- get_remaining_card() Card | None[source]¶
Get the one remaining card that wasn’t faced.
- Returns:
The remaining card, or None if not exactly 1 card remains
- property is_full: bool¶
Check if room has 4 cards.
- property is_complete: bool¶
Check if 3 cards have been faced.
- property num_cards_remaining: int¶
Get number of cards not yet faced.