-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattackmodified.py
92 lines (58 loc) · 1.58 KB
/
attackmodified.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
74
75
76
77
78
79
80
81
82
83
84
85
86
87
88
89
90
91
92
#In the original project enemy attacks first so enemy has got an advantage. But it is only fair if both attacks happen simulataneouly
import random
playerHP= 100
enemyHP=120
enemyattackh=30
enemyattackl=20
playerattack=30
damage=0
damage2=0
x=1
c=0
bol=True
def autogameplay():
playerHP = 100
enemyHP = 120
enemyattackh = 30
enemyattackl = 20
playerattack = 30
damage = 0
damage2 = 0
while playerHP>0:
aimenemy =random.randrange(0,2)
aim =random.randrange(0, 2)
if aimenemy==1:
damage=random.randrange(enemyattackl,enemyattackh)
playerHP=playerHP-damage
print("Enemy strikes damage for",damage,"points!")
else:
print("Enemy missed!")
if aim==1:
enemyHP =enemyHP-playerattack
print("You strike damage for 30 points! \n")
else:
print("You missed! \n")
if playerHP<=0 and enemyHP<=0:
print("Nobody won the game..")
break
if playerHP<=0:
print("Enemy laughs. You fall to the ground \nGame over.")
break
if enemyHP<=0:
print("Enemy falls to the ground.\nYou won the game.\n")
break
while bol== True:
if x==1:
autogameplay()
choice=input("Play again?")
while c==0:
if (choice!="Yes" and choice!="yes") and (choice!="No" and choice!="no"):
choice= input("Type Yes/yes or No/no..? 🙄 ")
continue
else:
c=1
if choice=="No" or choice=="no":
print("Haha! Coward")
break
if choice=="Yes" or choice=="yes":
c=0