-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcharacter.py
More file actions
61 lines (46 loc) · 1.79 KB
/
Copy pathcharacter.py
File metadata and controls
61 lines (46 loc) · 1.79 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
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
import random
import json
from card import Deck
class AttackRange:
isRanged = True
class Character:
def __init__(self, maxHealth = 0, moveDistance = 2, attackType = AttackRange.isRanged, name = "", specialAbility = ""):
self.health = maxHealth
self.maxHealth = maxHealth
self.moveDistance = moveDistance
self.attackType = attackType
self.name = name
self.specialAbility = specialAbility
self.deck = None
self.hasScheme = False
self.mapNode = None
def loseHealth(self, damageTaken):
self.health -= damageTaken
def gainHealth(self, lifeGained):
self.health += lifeGained
def assignCharacter(jsonFile):
with open(jsonFile) as json_file:
characterData = json.load(json_file)
newCharacter = Character(
maxHealth= characterData['hero']['hp'],
moveDistance= characterData['hero']['move'],
attackType= characterData['hero']['isRanged'],
name= characterData['hero']['name'],
specialAbility= characterData['hero']['specialAbility']
)
newCharacter.deck = Deck.assignDeck('characters/phineasFerb.json')
# print(newCharacter.name)
# print(newCharacter.health)
# print(newCharacter.moveDistance)
# print(newCharacter.attackType)
# print(newCharacter.specialAbility)
return newCharacter
#Taking turns
def takeTurn(self):
turns = 2
while (turns > 0):
# TODO: Options are movement (boostable), scheme, or attack (if player in range)
# Actions may be cancelled before fully performed (before revealed)
turns -= 1
def boostMovement(self, boostValue):
self.moveDistance += boostValue