mirror of
https://github.com/DavidGailleton/42-Piscine_Python.git
synced 2026-03-14 05:06:55 +01:00
module 7 ex1 + 0
This commit is contained in:
22
07/ex0/Card.py
Normal file
22
07/ex0/Card.py
Normal file
@@ -0,0 +1,22 @@
|
||||
from abc import ABC, abstractmethod
|
||||
from typing import Union
|
||||
|
||||
|
||||
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:
|
||||
if available_mana > 5:
|
||||
return True
|
||||
return False
|
||||
Reference in New Issue
Block a user