-
Notifications
You must be signed in to change notification settings - Fork 4
/
artifacts.py
97 lines (84 loc) · 3.12 KB
/
artifacts.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
class artifacts:
def __init__(self):
# 2-digit language code
self.id = 'en'
# 3-digit language code
self.code = 'eng'
# Unicode flag
self.flags = ['🇺🇸']
self.types = ['Flower', 'Plume', 'Sands', 'Goblet', 'Circlet']
self.sets = ['Adventurer',
'Lucky Dog',
'Traveling Doctor',
'Prayers for Wisdom',
'Prayers to Springtime',
'Prayers for Illumination',
'Prayers for Destiny',
'Instructor',
'Berserker',
'The Exile',
'Resolution of Sojourner',
'Martial Artist',
'Defender\'s Will',
'Tiny Miracle',
'Brave Heart',
'Gambler',
'Scholar',
'Gladiator\'s Finale',
'Maiden Beloved',
'Noblesse Oblige',
'Bloodstained Chivalry',
'Wanderer\'s Troupe',
'Viridescent Venerer',
'Thundering Fury',
'Thundersoother',
'Crimson Witch of Flames',
'Lavawalker',
'Archaic Petra',
'Retracing Bolide',
'Heart of Depth',
'Blizzard Strayer',
'Tenacity of the Millelith',
'Pale Flame'
]
# Get index through reverse dictionary
# 1 full iteration followed by 100 fast lookups
# is better than to do 100 half-iterations
self.types_dict = dict(zip(self.types,range(0,len(self.types))))
self.sets_dict = dict(zip(self.sets,range(0,len(self.sets))))
self.all = self.types + self.sets
class en(artifacts):
pass
class idn(artifacts):
# Placeholder
pass
# Class for an artifact piece
class piece:
def __init__(self, type, level, set, stats, lang=en()):
self.type = lang.types_dict[type] # Store as index
self.level = level
self.set = lang.sets_dict[set] # Store as index
self.stats = stats
self.score = (0,0)
self.main = (0,0)
self.sub = (0,0)
def get_type(self, lang=en()):
return lang.types[self.type]
def get_set(self, lang=en()):
return lang.sets[self.set]
def set_score(self, score, main, sub):
self.score = score
self.main = main
self.sub = sub
def get_array(self, lang=en()):
# Flatten everything into an array, the dynamic stats is in the end.
return [lang.types[self.type], self.level, lang.sets[self.set]] + \
list(self.score) + list(self.main) + list(self.sub) + \
[item for sublist in self.stats for item in sublist]
def print(self, lang=en()):
print(f"+{self.level} {lang.types[self.type]}")
[print(f" - {x[0]} {x[1]}") for x in self.stats]
print(lang.sets[self.set])
print(f"Total: {self.score[0]:.2f} ({self.score[1]:.2f}%) \n" +
f" Main: {self.main[0]:.2f} ({self.main[1]:.2f}%) \n" +
f" Sub: {self.sub[0]:.2f} ({self.sub[1]:.2f}%) \n")