-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathcreature.py
More file actions
39 lines (35 loc) · 1.07 KB
/
Copy pathcreature.py
File metadata and controls
39 lines (35 loc) · 1.07 KB
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
29
30
31
32
33
34
35
36
37
38
39
import player
import ability
class Creature:
def __init__(self, owner, card, id):
self.card = card
self.id = id
self.hunger = 1
self.food = 0
self.fat = 0
self.abilities = []
serf.owner = owner
#print("{} has spawned a new creature (ID: {})".format(self.owner, self.id))
def __init__(self, json):
self.id == json["id"]
self.hunger = json["hunger"]
self.food = json["food"]
self.fat = json["fat"]
self.abilities = []
for ability in json["abilities"]:
self.abilities.append(ability)
serf.owner = json["owner"]
def add_ability(self, card):
self.abilities.append(card)
def json(self):
json = {}
json["id"] = self.id
json["hunger"] = self.hunger
json["food"] = self.food
json["fat"] = self.fat
json["owner"] = self.owner
json["abilities"] = {}
for ability in self.abilities:
json["abilities"].append(ability)
json["card"] = card.id
return json