-
Notifications
You must be signed in to change notification settings - Fork 8
/
Copy pathleaderskill.py
167 lines (127 loc) · 6.06 KB
/
leaderskill.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
86
87
88
89
90
91
92
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
from util import *
def parse_elements_buffed(process_info):
buffs = dict()
if process_info[0] != '0':
buffs['elements buffed'] = buffs.get('elements buffed', []) + [
elements[process_info[0]]]
if process_info[1] != '0':
buffs['elements buffed'] = buffs.get('elements buffed', []) + [
elements[process_info[1]]]
return buffs
def crit_elem_weakness(x):
return float(x)*100
genders = {'0': 'genderless', '1': 'male', '2': 'female'}
ls_process_format = {
'1': ((0, 'atk% buff', int, not_zero),
(1, 'def% buff', int, not_zero),
(2, 'rec% buff', int, not_zero),
(3, 'crit% buff', int, not_zero),
(4, 'hp% buff', int, not_zero)),
'2': (parse_elements_buffed,
(2, 'atk% buff', int, not_zero),
(3, 'def% buff', int, not_zero),
(4, 'rec% buff', int, not_zero),
(5, 'crit% buff', int, not_zero),
(6, 'hp% buff', int, not_zero)),
'4': ((0, 'poison resist%', int, not_zero),
(1, 'weaken resist%', int, not_zero),
(2, 'sick resist%', int, not_zero),
(3, 'injury resist%', int, not_zero),
(4, 'curse resist%', int, not_zero),
(5, 'paralysis resist%', int, not_zero)),
'5': (([0, 1], lambda el: '%s resist%%' % elements[el], second_int),),
'9': ((0, 'bc fill per turn', bb_gauge),),
'10': ((0, 'hc effectiveness%', int),),
'11': ((0, 'atk% buff', int, not_zero),
(1, 'def% buff', int, not_zero),
(2, 'rec% buff', int, not_zero),
(3, 'crit% buff', int, not_zero),
([5, 4], lambda s: 'hp %s %% buff requirement' %
('above' if int(s) == 1 else 'below'), second_int, not_zero)),
'14': ((0, 'dmg reduction%', int),
(1, 'dmg reduction chance%', int)),
'17': ((0, 'hp drain% low', int),
(1, 'hp drain% high', int),
(2, 'hp drain chance%', int)),
'19': ((0, 'bc production%', int, not_zero),
(1, 'hc production%', int, not_zero),
(2, 'item production%', int, not_zero),
(3, 'zel production%', int, not_zero),
(4, 'karma production%', int, not_zero)),
'20': (([0, 1], ailments.get, second_int, not_zero),
([2, 3], ailments.get, second_int, not_zero),
([4, 5], ailments.get, second_int, not_zero),
([6, 7], ailments.get, second_int, not_zero)),
'21': ((0, 'first x turns atk%', int, not_zero),
(1, 'first x turns def%', int, not_zero),
(2, 'first x turns rec% GUESSED', int, not_zero),
(3, 'first x turns crit% GUESSED', int, not_zero),
(4, 'first x turns', int)),
'23': ((0, 'battle end bc fill low', bb_gauge),
(1, 'battle end bc fill high', bb_gauge)),
'25': ((0, 'bc fill when attacked low', bb_gauge),
(1, 'bc fill when attacked high', bb_gauge),
(2, 'bc fill when attacked%', int)),
'29': ((0, 'ignore def%', int),),
'30': ((0, 'atk% buff', int, not_zero),
(1, 'def% buff', int, not_zero),
(2, 'rec% buff', int, not_zero),
(3, 'crit% buff', int, not_zero),
([5, 4], lambda s: 'bb gauge %s %% buff requirement' %
('above' if int(s) == 1 else 'below'), int, not_zero)),
'31': ((0, 'damage% for spark', int, not_zero),
(1, 'bc drop% for spark', int, not_zero),
(2, 'hc drop% for spark', int, not_zero),
(3, 'item drop% for spark GUESSED', int, not_zero),
(4, 'zel drop% for spark', int, not_zero),
(5, 'karma drop% for spark', int, not_zero)),
'32': ((0, 'bb gauge fill rate%', int),),
'34': ((0, 'dmg% for crits', crit_elem_weakness),),
'35': ((0, 'bc fill when attacking low', bb_gauge),
(1, 'bc fill when attacking high', bb_gauge),
(2, 'bc fill when attacking%', int)),
'41': ((0, 'unique elements required', int),
(1, 'atk% buff', int, not_zero),
(2, 'def% buff', int, not_zero),
(3, 'rec% buff', int, not_zero),
(4, 'crit% buff', int, not_zero),
(5, 'hp% buff', int, not_zero)),
'42': ((0, 'gender required', lambda s: genders[s[0]]),
(1, 'atk% buff', int, not_zero),
(2, 'def% buff', int, not_zero),
(3, 'rec% buff', int, not_zero),
(4, 'crit% buff', int, not_zero),
(5, 'hp% buff', int, not_zero)),
'43': ((0, 'take 1 dmg%', int),),
'48': ((0, 'reduced bb bc cost%', int),),
'50': ((0, lambda el: '%s units do extra elemental weakness dmg' %
elements[el], True, not_zero),
(1, lambda el: '%s units do extra elemental weakness dmg' %
elements[el], True, not_zero),
(2, lambda el: '%s units do extra elemental weakness dmg' %
elements[el], True, not_zero),
(3, lambda el: '%s units do extra elemental weakness dmg' %
elements[el], True, not_zero),
(4, lambda el: '%s units do extra elemental weakness dmg' %
elements[el], True, not_zero),
(5, lambda el: '%s units do extra elemental weakness dmg' %
elements[el], True, not_zero),
(6, 'dmg% for elemental weakness', crit_elem_weakness)),
}
def parse_ls_process(process_type, process_info):
if process_type in ls_process_format:
return handle_format(ls_process_format[process_type],
process_info.split(','))
return {}
def parse_leader_skill(unit_data, leader_skill, dictionary):
data = dict()
data['name'] = dictionary.get(leader_skill[LS_NAME], leader_skill[LS_NAME])
data['desc'] = dictionary.get(leader_skill[DESC], leader_skill[DESC])
for process_type, process_info in zip(
leader_skill[PROCESS_TYPE].split('@'),
leader_skill[LS_PROCESS].split('@')):
process_data = parse_ls_process(process_type, process_info)
if 'elements buffed' in process_data and 'elements buffed' in data:
data['elements buffed'] += process_data.pop('elements buffed')
data.update(process_data)
return data