57 lines
1.2 KiB
Python
57 lines
1.2 KiB
Python
import random
|
|
|
|
|
|
class Player:
|
|
__id:int
|
|
__hp:int
|
|
__mana:int
|
|
__name:str
|
|
__handCards:list
|
|
__deck:list
|
|
|
|
def __init__(self, name:str, deck:list, hp:int=1000, mana:int=0):
|
|
self.__hp = hp
|
|
self.__mana = mana
|
|
self.__name = name
|
|
self.__handCards = []
|
|
self.__deck = deck
|
|
self.__id = random.randint(3, 99999)
|
|
|
|
def shuffleDeck(self):
|
|
self.__deck = random.shuffle(self.__deck)
|
|
|
|
def getDeck(self) -> list:
|
|
return self.__deck
|
|
|
|
def getName(self) -> str:
|
|
return self.__name
|
|
|
|
def getHP(self) -> int:
|
|
return self.__hp
|
|
|
|
def adjustHP(self, hp:int) -> int:
|
|
self.__hp = self.__hp + hp
|
|
|
|
def getID(self) -> int:
|
|
return self.__id
|
|
|
|
def getHand(self) -> list:
|
|
return self.__handCards
|
|
|
|
def getMana(self) -> int:
|
|
return self.__mana
|
|
|
|
def addMana(self, amount) -> int:
|
|
self.__mana + amount
|
|
return self.__mana
|
|
|
|
def AddToHand(self, card) -> list:
|
|
self.__handCards.append(card)
|
|
return self.__handCards
|
|
|
|
def setHand(self, hand:list):
|
|
self.__handCards = hand
|
|
|
|
def removeFromHand(self, pos:int) -> list:
|
|
self.__handCards.remove(pos)
|
|
return self.__handCards |