added card types
This commit is contained in:
22
Game_Client/Classes/System/Objects/Cards/Card.py
Normal file
22
Game_Client/Classes/System/Objects/Cards/Card.py
Normal file
@ -0,0 +1,22 @@
|
||||
import pygame
|
||||
|
||||
|
||||
class Card:
|
||||
__name:str
|
||||
__artwork:pygame.image
|
||||
|
||||
def __init__(self, name:str, imagePath:str):
|
||||
|
||||
if name == "":
|
||||
return ValueError.add_note("Card: name cannot be empty")
|
||||
if imagePath == "":
|
||||
return ValueError.add_note("Card: imagePath cannot be empty")
|
||||
|
||||
self.__name = name
|
||||
self.__image = pygame.image.load(imagePath)
|
||||
|
||||
def getName(self) -> str:
|
||||
return self.__name
|
||||
|
||||
def getArtwork(self) -> pygame.image:
|
||||
return self.__image
|
14
Game_Client/Classes/System/Objects/Cards/MonsterCard.py
Normal file
14
Game_Client/Classes/System/Objects/Cards/MonsterCard.py
Normal file
@ -0,0 +1,14 @@
|
||||
import json
|
||||
from Game_Client.Classes.System.Objects.Cards.Card import Card
|
||||
|
||||
class MonsterCard(Card):
|
||||
__attacks:[]
|
||||
|
||||
def __init__(self, asset:str):
|
||||
data = json.load(open(asset))
|
||||
|
||||
for attack in range(data["attacks"]):
|
||||
self.__attacks.add(attack)
|
||||
|
||||
def attacks(self):
|
||||
return self.__attacks
|
17
Game_Client/Classes/System/Objects/Cards/SpellCard.py
Normal file
17
Game_Client/Classes/System/Objects/Cards/SpellCard.py
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
import json
|
||||
from Game_Client.Classes.System.Objects.Cards.Card import Card
|
||||
|
||||
|
||||
class SpellCard(Card):
|
||||
__description:str
|
||||
|
||||
def __init__(self, asset:str):
|
||||
data = json.load(open(asset))
|
||||
|
||||
super.__init__(data["name"], data["image"])
|
||||
self.__description = data["description"]
|
||||
|
||||
def getDescription(self):
|
||||
return self.__description
|
17
Game_Client/Classes/System/Objects/Cards/TrapCard.py
Normal file
17
Game_Client/Classes/System/Objects/Cards/TrapCard.py
Normal file
@ -0,0 +1,17 @@
|
||||
|
||||
|
||||
from Game_Client.Classes.System.Objects.Cards.Card import Card
|
||||
import json
|
||||
|
||||
class SpellCard(Card):
|
||||
__description:str
|
||||
|
||||
def __init__(self, asset:str):
|
||||
|
||||
data = json.load(open(asset))
|
||||
|
||||
super.__init__(data["name"], data["image"])
|
||||
self.__description = data["description"]
|
||||
|
||||
def getDescription(self):
|
||||
return self.__description
|
Reference in New Issue
Block a user