-
Notifications
You must be signed in to change notification settings - Fork 0
/
abilities.py
42 lines (31 loc) · 1.37 KB
/
abilities.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
import nethysdb
import math
class AbilityScore(nethysdb.NethysDB):
def __init__(self, link, SourceBook, Page, score):
super().__init__(link, SourceBook, Page)
self.score = score
def __repr__(self) -> int:
# TODO: idk why requests as a string, it should be an integer
"""Returns the score of the function as a string
Returns:
int: score of the ability (12, 14, 18)
"""
return str(self.score)
def getModifier(self):
# TODO: Test every modifier
modifier = math.floor((self.score - 10) / 2)
return modifier
def boost(self):
if self.score < 18:
self.score = self.score + 2
else:
self.score = self.score + 1
def flaw(self):
self.score = self.score - 2
# Starting ability scores
Strength = AbilityScore("https://2e.aonprd.com/Rules.aspx?ID=68", "Core RuleBook", 19, 10)
Dexterity = AbilityScore("https://2e.aonprd.com/Rules.aspx?ID=69", "Core RuleBook", 19, 10)
Constitution = AbilityScore("https://2e.aonprd.com/Rules.aspx?ID=70", "Core RuleBook", 19, 10)
Intelligence = AbilityScore("https://2e.aonprd.com/Rules.aspx?ID=71", "Core RuleBook", 19, 10)
Wisdom = AbilityScore("https://2e.aonprd.com/Rules.aspx?ID=72", "Core RuleBook", 19, 10)
Charisma = AbilityScore("https://2e.aonprd.com/Rules.aspx?ID=73", "Core RuleBook", 19, 10)