-
Notifications
You must be signed in to change notification settings - Fork 2
/
Copy pathmod.py
61 lines (51 loc) · 2.08 KB
/
mod.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
class ModDrop:
"""
Superclass for mod drops
"""
def __init__(self, dropped_by, name, total_chance):
self.dropped_by = dropped_by
self.name = name
self.total_chance = total_chance
def __repr__(self):
return f"ModDrop(\"{self.dropped_by}\",\"{self.name}\",{self.total_chance})"
def __str__(self):
return f"{self.dropped_by:.<45}: {self.total_chance:0<4.3f}%"
def reversedName(self):
return f"{self.name:.<45}: {self.total_chance:0<4.3f}%|"
class EnemyModDrop(ModDrop):
"""
Class for mods and blueprints that drop from enemies
"""
def __init__(self, e, n, em, m, c):
"""
:param e: Name of enemy that drops the mod
:param en: Name of mod
:param em: Percentage chance of the enemy dropping a mod
:param m: Percentage chance that if the enemy drops a mod, it will be this one
:param c: "Chance name" - Common, Uncommon, Rare, Legendary, etc
"""
self.enemy_mod = em
self.mod_chance = m
self.mod_chance_name = c
super().__init__(e, n, (self.mod_chance/100 * self.enemy_mod/100) * 100)
def __repr__(self):
return f"EnemyModDrop(\"{self.dropped_by}\",\"{self.name}\",{self.enemy_mod},{self.mod_chance},\"{self.mod_chance_name}\")"
class MissionDrop(ModDrop):
"""
Class for mods and items that drop from missions
"""
def __init__(self, m, n, r, c):
"""
:param m: Mission object
:param n: Item/Mod name
:param r: Rotation (or '' if not applicable)
:param c: Drop chance of the mod
"""
super().__init__(m, n, c)
self.rotation = r
def __repr__(self):
return f"MissionDrop({repr(self.dropped_by)},\"{self.name}\",\"{self.rotation}\",{self.total_chance})"
def __str__(self):
return f"{str(self.dropped_by) + (' Rot ' + self.rotation if self.rotation else ''):.<45}: {self.total_chance:0<4.3f}%"
def reversedName(self):
return f"{((self.rotation if self.rotation else '') + ': ' + self.name):.<40}: {self.total_chance:0<4.3f}%"