added server communication between client and server

This commit is contained in:
2024-01-07 19:26:41 +01:00
parent fab79061ea
commit 6adea1730e
31 changed files with 173 additions and 129 deletions

View File

@ -3,11 +3,13 @@ import pygame
class Player:
__id:int
__hp:int
__mana:int
__name:str
__handCards:pygame.Sprite.Group
__handCards:pygame.sprite.Group
def __init__(self, hp:int, name:str):
def __init__(self, hp:int, mana:int, name:str):
self.__hp = hp
self.__mana = mana
self.__name = name
def setID(self, id:int):
@ -21,17 +23,21 @@ class Player:
def getHP(self) -> int:
return self.__hp
def getMana(self) -> int:
return self.__mana
def adjustHP(self, hp:int) -> int:
self.__hp = self.__hp + hp
def getHand(self) -> pygame.Sprite.Group:
def getHand(self) -> pygame.sprite.Group:
return self.__handCards
def AddToHand(self, card) -> pygame.Sprite.Group:
def AddToHand(self, card) -> pygame.sprite.Group:
self.__handCards.add(card)
return self.__handCards
def removeFromHand(self, pos:int) -> pygame.Sprite.Group:
def removeFromHand(self, pos:int) -> pygame.sprite.Group:
self.__handCards.remove(pos)
return self.__handCards
return self.__handCards