-
Notifications
You must be signed in to change notification settings - Fork 1
Expand file tree
/
Copy pathClassAssignment
More file actions
135 lines (101 loc) · 4.37 KB
/
ClassAssignment
File metadata and controls
135 lines (101 loc) · 4.37 KB
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
import StatsAssignment
def classAssign(attributeList):
conversionTable = {("STR", "DEX"): Fighter,
("STR", "CON"): Barbarian,
("STR", "INT"): Artificer,
("STR", "WIS"): Cleric,
("STR", "CHA"): Bard,
("DEX", "STR"): Fighter,
("DEX", "CON"): Rogue,
("DEX", "INT"): Rogue,
("DEX", "WIS"): Monk,
("DEX", "CHA"): Bard,
("CON", "STR"): Barbarian,
("CON", "DEX"): Barbarian,
("CON", "INT"): Artificer,
("CON", "WIS"): Ranger,
("CON", "CHA"): Warlock,
("INT", "STR"): Artificer,
("INT", "DEX"): Wizard,
("INT", "CON"): Artificer,
("INT", "WIS"): Wizard,
("INT", "CHA"): Wizard,
("WIS", "STR"): Cleric,
("WIS", "DEX"): Monk,
("WIS", "CON"): Druid,
("WIS", "INT"): Druid,
("WIS", "CHA"): Cleric,
("CHA", "STR"): Paladin,
("CHA", "DEX"): Sorcerer,
("CHA", "CON"): Warlock,
("CHA", "INT"): Sorcerer,
("CHA", "WIS"): Warlock,
}
maxList = StatsAssignment.mainStats(attributeList)
return conversionTable[tuple([maxList[0], maxList[1]])]\
(attributeList, maxList)
class Base:
def getModifier(self, stat):
return int((stat - 10) / 2)
def getHitpoints(self):
if self.size == "small":
return 13 + 3 * self.attributes["CON"][1]
elif self.size == "medium":
return 17 + 3 * self.attributes["CON"][1]
elif self.size == "large":
return 21 + 3 * self.attributes["CON"][1]
elif self.size == "huge":
return 25 + 3 * self.attributes["CON"][1]
def __init__(self, attributeList, maxList, size):
attributes = ["STR", "DEX", "CON", "INT", "WIS", "CHA"]
self.maxList = maxList
attributeModifiers = list(map(self.getModifier, attributeList))
# This maps all of the attributeList through the get modifier function
self.attributes = dict(
zip(attributes, list(zip(attributeList, attributeModifiers))))
# Attributes in the format STR:[VALUE,MODIFIER]
self.size = size
self.hitpoints = self.getHitpoints()
class Artificer(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "medium")
class Bard(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "medium")
class Barbarian(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "huge")
class Cleric(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "medium")
class Druid(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "medium")
class Fighter(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "large")
class Monk(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "medium")
class Paladin(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "large")
class Ranger(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "large")
class Rogue(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "medium")
class Sorcerer(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "small")
class Warlock(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "medium")
class Wizard(Base):
def __init__(self, attributeList, maxList):
super().__init__(attributeList, maxList, "small")
if __name__ == "__main__":
character = classAssign(StatsAssignment.mainStats())
print(character)
print(character.getHitpoints())