forked from bredeson/PnP
-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathattempt_climb.py
executable file
·32 lines (26 loc) · 1.2 KB
/
attempt_climb.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
#!/usr/bin/env python3
import random
from sass import sample_sass
from textFormat import input_s, print_s
def attempt_climb(user, climb_query):
success=0
while user.hp>0 and success==0 and climb_query=="climb":
while climb_query not in ["climb", "rope", "walk"]:
climb_query=input_s(sample_sass(),user, "purple")
success_rate=random.randrange(0,10)
if success_rate<6:
user.hp-=2
climb_query=input_s("You were unsuccessful scaling the wall and your health points are reduced to "+ str(user.hp) + ". Do you want to attempt the [climb] again or [walk] in the door?\n", user)
while climb_query not in ["climb", "rope", "walk"]:
climb_query=input_s(sample_sass(),user, "purple")
else:
success=1
print_s("You've successfully climbed through the window!")
if user.hp<=0:
print_s("You really should have tried the door.")
elif climb_query=="rope":
print_s("You deftly swing the rope over a gargoyle flanking the window and scamper up the wall like a white-faced capuchin.")
success=1
elif climb_query=="walk":
success=2
return(success)