-
Notifications
You must be signed in to change notification settings - Fork 0
/
favoredFoe.py
53 lines (53 loc) · 1.69 KB
/
favoredFoe.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
!alias foe tembed
<drac2>
cc_request = 0
num_die = 1
crit_text = ""
is_resistant = False
is_vulnerable = False
for input in &ARGS&:
input = input.lower()
length = len(input)
if input.isnumeric():
cc_request = int(input)
elif input == "critical"[0:length]:
num_die = 2
crit_text = " (CRIT!)"
elif input == "resistant"[0:length] or input == "resistance"[0:length]:
is_resistant = True
elif input == "vulnerable"[0:length] or input == "vulnerability"[0:length]:
is_vulnerable = True
ability_name = "Favored Foe"
cc_name = ability_name
cc_value = character().get_cc(cc_name)
return_string = ""
if cc_value >= cc_request:
cc_use = cc_request
character().mod_cc(cc_name, -cc_use)
if is_resistant and is_vulnerable:
return_string += f' -f "Calculation Uncertainty|Resisted and Vulnerable damage may have a lower total than displayed due to rounding down odds." '
die = 4+2*int((RangerLevel+2)/8)
roll_string = str(num_die) + "d" + die
if is_resistant:
roll_string = "(" + roll_string + ")/2"
if is_vulnerable:
roll_string = "(" + roll_string + ")*2"
damage = vroll(roll_string)
return_string = (
f'-title "{name} uses {ability_name}!" '
f'-desc "" '
f' -f "Damage{crit_text}|{str(damage)}|inline" '
)
else:
cc_use = 0
return_string = (
f' -title "{name} fails to use {ability_name}!" '
f' -desc "No uses remaining." '
)
cc_current = character().cc_str(cc_name)
return_string += (
f'-f "{cc_name} (-{cc_use})| {cc_current}|inline" '
f'-footer "{ctx.prefix}{ctx.alias}" [uses] [crit] [res] [vuln]'
)
return return_string
</drac2>