-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathcombat2.py
More file actions
32 lines (27 loc) · 698 Bytes
/
combat2.py
File metadata and controls
32 lines (27 loc) · 698 Bytes
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
import random
def roll12():
roll = int(random.randrange(1, 12, 1))
return roll
playerhp = 250
trollhp = 225
print("a troll approaches!")
while True:
pdamageRoll = roll12()
print("you do ", pdamageRoll, "damage")
input("...")
trollhp -= pdamageRoll
tdamageRoll = roll12()
print("the troll does ", tdamageRoll, "damage")
input("...")
playerhp -= tdamageRoll
if playerhp <= 0:
print("YOU DIED")
input("...")
break
elif trollhp <= 0:
print("You defeated the troll!")
input("...")
break
print("Player HP: ", playerhp)
print("Troll HP: ", trollhp)
input("...")