mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-03-13 20:56:54 +01:00
20 lines
463 B
Python
20 lines
463 B
Python
from abc import ABC, abstractmethod
|
|
|
|
|
|
class Card(ABC):
|
|
def __init__(self, name: str, cost: int, rarity: str) -> None:
|
|
self.name = name
|
|
self.cost = cost
|
|
self.rarity = rarity
|
|
|
|
@abstractmethod
|
|
def play(self, game_state: dict) -> dict:
|
|
pass
|
|
|
|
def get_card_info(self) -> dict:
|
|
res = dict(self.__dict__)
|
|
return res
|
|
|
|
def is_playable(self, available_mana: int) -> bool:
|
|
return available_mana > 5
|