forked from bredeson/PnP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathcombat.py
74 lines (67 loc) · 1.89 KB
/
combat.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
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
import re
import sys
import time
import random
goblin = 20
magic = 3
gobatk = 2
prisoner = 40
attack = 5
maxdmg = 10
while goblin > 0:
if prisoner < 1:
print('you have died; you little bitch')
break
elif goblin > 0:
combat_query=input('[attack], [risky] attack, or [magic]?\n')
if combat_query == 'attack':
usratk = random.randint(1,6)
print('You strike at the goblin dealing',usratk,'damage')
time.sleep(3)
goblin = goblin-usratk
if goblin > 0:
print('The goblin is almost dead. It has', goblin, 'health remaining')
time.sleep(3)
print('The goblin hit you for', gobatk, 'damage; your health is now',prisoner)
time.sleep(3)
prisoner = prisoner-gobatk
else:
print('the goblin is dead')
break
if combat_query =='risky':
chance = random.randint(1,20)
min = 0.5*maxdmg
max = 2*maxdmg
usratk = random.randint(min,max)
if chance > 10:
print('You hit for', usratk, 'damage')
goblin = goblin-usratk
if goblin > 0:
print('The goblin is almost dead. It has', goblin, 'health remaining')
print('The goblin hit you for', gobatk, 'damage; your health is now',prisoner)
prisoner = prisoner-gobatk
else:
print('the gob is dead')
break
else:
print('You missed!')
print('The goblin hit you for', gobatk, 'damage; your health is now',prisoner)
prisoner = prisoner-gobatk
if combat_query =='magic':
if magic > 0:
usratk = 6
print('You do magic stuff for', usratk,'damage')
goblin = goblin-usratk
magic -=1
print ('You have', magic, 'magicjuice left')
if goblin > 0:
print('The goblin is almost dead. It has', goblin, 'health remaining')
print('The goblin hit you for', gobatk, 'damage; your health is now',prisoner)
prisoner = prisoner-gobatk
else:
print('the gob is dead')
break
else:
print('You have no magic juice left')
else:
break