-
Notifications
You must be signed in to change notification settings - Fork 0
/
card.py
28 lines (24 loc) · 1.02 KB
/
card.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
from card_dictionary import CARD_DICTIONARY
class Card:
"""
Cards live in player palettes and help determine which units the player can deploy.
Each card is closely associated with a unit type, so has the name, type, and cost of that unit. In addition, a Card
has a certain starting_amount, which is the total number of units of said type the player can deploy, and a
current_amount, which decreases as the player deploys and is the number the player currently has left to deploy.
"""
def __init__(self, unit_type, amount):
unit = CARD_DICTIONARY[unit_type]
self.name = unit.name
self.type = unit_type
self.cost = unit.cost
self.current_amount = amount
self.starting_amount = amount
def generate_dict(self):
dictionary = {
'name': self.name,
'type': self.type,
'cost': self.cost,
'current_amount': self.current_amount,
'starting_amount': self.starting_amount
}
return dictionary