-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathswordfight
More file actions
executable file
·170 lines (150 loc) · 5.99 KB
/
swordfight
File metadata and controls
executable file
·170 lines (150 loc) · 5.99 KB
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
93
94
95
96
97
98
99
100
101
102
103
104
105
106
107
108
109
110
111
112
113
114
115
116
117
118
119
120
121
122
123
124
125
126
127
128
129
130
131
132
133
134
135
136
137
138
139
140
141
142
143
144
145
146
147
148
149
150
151
152
153
154
155
156
157
158
159
160
161
162
163
164
165
166
167
168
169
170
#!/usr/bin/env python3
import random
import colors as c
print(c.clear)
print(c.green + '''This is a fight quiz the text in blue tells you what
the other knight is doing if he swing left block left. Blocks, stabs and
Cleaves have different answers. Cut = Block, Stab = Deflect,
and Cleave = Cross block. Don't wait to long or
he get desperate and make rash moves.
That is all you should need to know have fun.''')
print(c.blue + '''
You are a knight from a far off land. You are traveling through a village and you
stop to look at a platform with 5 knights standing on it challenging near by people.
One of the knights looks your way and says You fight me in the arena.
You have been challenged to a dual by the other knight.
type what you want to do bellow.
''')
try:
score = 0
def q1():
print(c.orange + '(accept or decline)')
answer = input(c.base2 + '> ').strip().lower()
if "accept" in answer:
print(c.clear)
print(c.green + 'You have accepted the dual.')
return 1
else:
print(c.red + 'The other knight replies "Fine run you coward."')
return 0
exit()
def q2():
print(c.blue + 'he swing to the left.')
print(c.orange + '(block left, block right, or attack)')
answer = input(c.base2 + '> ').strip().lower()
if "block left" in answer:
print(c.clear)
print(c.green + 'You blocked his cut.')
return 1
else:
print(c.red + 'The other knight cuts your side.')
return 0
exit()
def q3():
print(c.blue + 'he thrusts right.')
print(c.orange + '(deflect left, deflect right, or attack)')
answer = input(c.base2 + '> ').strip().lower()
if "deflect right" in answer:
print(c.clear)
print(c.green + 'You blocked his thrust')
return 0
else:
print(c.red + 'The other knight ran you through.')
return 0
exit()
def q4():
print(c.blue + 'instead of attacking he takes a defensive poster')
print(c.orange + '(attack, or take a defensive poster)')
answer = input(c.base2 + '> ').strip().lower()
if "attack" in answer:
print(c.clear)
print(c.green + '''You stab the other knight in the chest
he is now wounded and will attack less.''')
return 1
else:
print(c.blue + 'he thrusts left.')
print(c.orange + '(deflect left, deflect right, or attack)')
answer = input(c.base2 + '> ').strip().lower()
if "deflect left" in answer:
print(c.clear)
print(c.green + 'You deflected his thrust')
return 1
else:
print(c.red + 'the other knight ran you through.')
return 0
exit()
def q5():
print(c.blue + 'he swings right and then thrusts left')
print(c.orange + '(block right deflect left, block left block right right, or attack)')
answer = input(c.base2 + '> ').strip().lower()
if "block right deflect left" in answer:
print(c.clear)
print(c.green + '''the other knight is exhausted and will attack less.''')
return 1
else:
print(c.red + 'The other knight ran you through.')
return 0
exit()
def q6():
print(c.blue + 'he swings to the left.')
print(c.orange + '(block left, block right, or attack)')
answer = input(c.base2 + '> ').strip().lower()
if "block left" in answer:
print(c.clear)
print(c.green + 'You blocked his cut.')
return 1
else:
print(c.red + 'The other knight cuts your side.')
return 0
exit()
def q7():
print(c.blue + 'instead of attacking the other knight lowers his sword and waits')
print(c.orange + '(attack, or take a defensive poster)')
answer = input(c.base2 + '> ').strip().lower()
if "attack" in answer:
print(c.clear)
print(c.green + '''You stab the other knight in the chest
and he dies you win the dual.''')
return 1
exit()
else:
print(c.blue + 'he cleaves down.')
print(c.orange + '(cross block up, block right, block left, or attack)')
answer = input(c.base2 + '> ').strip().lower()
if "cross block up" in answer:
print(c.green + 'You blocked his cut')
return 1
else:
print(c.red + 'the other knight cleaves you from above and you die.')
return 0
exit()
def q8():
print(c.blue + 'instead of attacking the other knight waits')
print(c.orange + '(attack, or take a defensive poster)')
answer = input(c.base2 + '> ').strip().lower()
if "attack" in answer:
print(c.clear)
print(c.green + '''You stab the other knight in the chest.''')
return 1
exit()
else:
print(c.red + '''the other knight made a desperate move
and cleaves you from above.''')
return 0
exit()
q1()
questions = [q2,q3,q4,q5,q6,q7,q8]
while questions:
question = random.choice(questions)
points = question()
score += points
if points:
questions.remove(question)
print(c.reset + c.green + '''You have completed the dual.
If your score was 6,5 you are wounded and die later of infection.
If your score was 8,7, you win with only minor or no injurys.
if your score was 4,0 you die a painfull death as the knight laughs at your corpse.
score: ''', score)
except KeyboardInterrupt:
print(c.clear)
exit()