-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathskill.py
85 lines (82 loc) · 2.59 KB
/
skill.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
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
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
78
79
80
81
82
83
84
85
skills = {}
class Skill:
def __init__(self, name = 'Untitled', import_file = 'standard', parent = None, spcost = 0,
stats = None, restoration = None, effects = []):
self.name = str(name)
self.import_file = str(import_file)
self.parent = parent
self.spcost = int(spcost)
self.stats = {
'hp': 0, # Health Points
'sp': 0, #
###
'atk': 0, # Attack
'dfn': 0, # Defense
###
'spatk': 0, # Special Attack
'spdfn': 0, # Special Defense
###
'acc': 0, # Accuracy
'eva': 0, # Evasion
###
'crit': 0, # Critical Chance
'bless': 0, # Blessing
###
'pow': 100
}
if stats:
for n, v in stats.items():
self.stats[n] = v
self.requirements = {
'lvl': [1,-1],
}
self.restoration = {
# max is a percentage of the entity's max stat
# missing is a percentage of how much stat is missing from its max
# damage is a raw set value
'hp': {
'max': 0,
'missing': 0,
'damage': 0
}, # hp is changed upon use. Integer if > 1 < else Percent if >0 and <1
'sp': {
'max': 0,
'missing': 0,
'damage': 0
}, # sp is changed upon use.
'hunger': {
'max': 0,
'missing': 0,
'damage': 0
}, # hunger is changed upon use.
'targets': None
}
if restoration:
for n,v in restoration.iteritems():
if n != 'targets':
for m,x in v.iteritems():
self.restoration[n][m] = x
else:
self.restoration[n] = v
self.effects = [e for e in effects]
skills[GetNewId()] = self
def ChangeInfo(self, parent, name, spcost, stats, restoration, effects):
self.parent = parent
self.name = name
self.spcost = spcost
self.stats = stats
self.restoration = restoration
self.effects = effects
def Delete(self, list = False):
if list:
global skills
skills.remove(self)
self.parent.skills.remove(self)
del self
def GetNewId():
ids = skills.keys()
if ids == []:
return '0'
else:
ids = [str(a) for a in range(len(ids)+1) if str(a) not in ids]
return ids[0]