-
Notifications
You must be signed in to change notification settings - Fork 0
/
pkb_moves.py
109 lines (83 loc) · 3.28 KB
/
pkb_moves.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
from pkb_xldata import *
def TypeOfQuickMove(strMove, strDefaultType = ""):
# return the Type entry for a quick move in the charge move table.
# Because of use in Excel Spreadsheet, return "" for ""
# As a last resort, return "Unknown"
if strMove == "":
return strDefaultType
rowData = TupleFromTable(xlf.tableQuickMoves, strMove)
if len(rowData) == 0:
return "Unknown"
else:
return rowData[1]
class QuickMove:
def __init__(self, strMove):
self.strMove = strMove
self.strType = ""
self.cTurnsToQuick = 0
self.tupleData = ()
self.valDamage = 0
self.valEnergy = 0
self.cTurnsToQuick = 0
self.valDamagePerTurns = 0
self.valEnergyPerTurn = 0
if strMove != "":
self.tupleData = TupleFromTable(xlf.tableQuickMoves, strMove)
if len(self.tupleData) == 0:
self.strType = "Unknown"
else:
self.strType = self.tupleData[1]
self.valDamage = self.tupleData[2]
self.valEnergy = self.tupleData[3]
self.cTurnsToQuick = self.tupleData[4]
self.valDamagePerTurn = self.tupleData[5]
self.valEnergyPerTurn = self.tupleData[6]
def RoundUpTurns(self, cTurns):
return RoundUp(cTurns / self.cTurnsToQuick) * self.cTurnsToQuick
def TypeOfChargeMove(strMove):
# return the Type entry for a charge move in the charge move table.
# Because of use in Excel Spreadsheet, return "" for ""
# As a last resort, return "Unknown"
if strMove == "":
return ""
tupleData = TupleFromTable(xlf.tableChargeMoves, strMove)
if len(tupleData) == 0:
return "Unknown"
else:
return tupleData[1]
class ChargeMove:
def __init__(self, strMove, qm):
self.tupleData = ()
self.strMove = strMove
self.strType = ""
self.valPower = 0
self.valEnergy = 0
self.valChanceOfBuff = 0
self.cTurnsToCharge = 0
if strMove != "":
self.tupleData = TupleFromTable(xlf.tableChargeMoves, strMove)
if len(self.tupleData) == 0:
self.strType = "Unknown"
else:
self.strType = self.tupleData[1]
self.valPower = self.tupleData[2]
self.valEnergy = self.tupleData[3]
self.valChanceOfBuff = self.tupleData[5]
if qm.valEnergyPerTurn != 0: # quick move might be type only, or invalid
self.cTurnsToCharge = qm.RoundUpTurns(self.valEnergy / qm.valEnergyPerTurn)
def ParseMoveName(csv, iMove):
# unlike in VBA version, this is zero based. Use 0 for the Quick Move
strMoveName = ParseSubstring(csv, iMove + 1, ",").title()
if strMoveName.find("_") >= 0:
strMoveName = strMoveName.replace("_", " ")
assert isinstance(strMoveName, str)
return strMoveName
def SymbolForType(strType):
# return a single unicode character which represents the type.
# Because of use in Excel Spreadsheet, return "" for ""
# if the type does not exist in the table, return "?"
if strType == "":
return ""
for rowData in xlf.tableTypeSymbols:
if rowData[0] == strType : return rowData[1]
return "?"