-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathDnD.py
52 lines (39 loc) · 1.44 KB
/
DnD.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
from initializer import *
from listHandling import *
def printFighters(roster): #need to add formatting, want to make it a table
print('%-5s%-13s%-12s%-15s' % ('Init|','Fighter Name|','current HP|',\
'Status Effects|'))
for fighter in roster:
print('%-5d%-13s%-12d%-15s' % (fighter.initiative, \
fighter.name, fighter.hp, fighter.status))
print('\nAll Done!\n')
def mainGameLoop(roster):
notExiting = True
timer = 0
printFighters(roster)
while notExiting:
if keyboard.is_pressed('n') and timer > 10000: #Ends Turn
roster = goDownList(roster)
printFighters(roster)
timer = 0
if keyboard.is_pressed('e'): #Exits program
notExiting = False
if keyboard.is_pressed('a') and timer>10000: #Makes attack
attacker = roster[0]
attacker.makeAttack(roster)
timer = 0
if keyboard.is_pressed('s') and timer>10000: #Adds status effect
attacker = roster[0]
attacker.applyStatus(roster)
timer = 0
timer += 1 #prevents multiple inputs
def main():
combats = []
standardBool = areYouTesting()
combats = createNPCfighters(combats,standardBool)
combats = addPCs(combats,standardBool)
combats = sortByIntiative(combats)
print('\n\n')
mainGameLoop(combats)
if __name__ == '__main__':
main()