Last active

Embed URL

HTTPS clone URL

SSH clone URL

You can clone with HTTPS or SSH.

Download Gist

A text adventure through a horror.

View Adventure
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
#adventure.py
import os
from random import randint
import time
 
sanity = randint(4,10)
strength = randint(4,10)
intelligence = randint(4,10)
hp = 100
 
def weapon():
if strength >= 7:
weapon = knife
else:
weapon = gun
 
monster_sanity_damage = randint(0,4)
occurance_sanity_damage = randint(0,2)
 
def occurance_sanity():
if sanity <= 5:
print "You take a loss of %i to your sanity." % occurance_sanity_damage
if sanity > 5:
print "You squeeze your eyes shut, breathing deep, hoping this is all a dream."
 
def monster_sanity():
if sanity <=7:
print "You take a loss of %i to your sanity." % monster_sanity_damage
if sanity > 7:
print "You scream at the monster and it shimmers out of existance."
def occurance_damage():
occurance_hp_damage = randint(5,15)
if strength <= 5:
print "You take a loss of %i to your health." % occurance_hp_damage
if strength > 5:
print "You overcome and are safe... for now."
def monster_damage():
monster_hp_damage = randint(10,30)
if strength <= 5:
print "You take a loss of %i to your health." % monster_hp_damage
if strength > 5:
print "You draw your %s and destroy the monster." % weapon
 
print "Your sanity is %i, your strength is %i and your intelligence is %i." % (sanity, strength, intelligence)
print "Your weapon is a %s." % weapon
 
time.sleep(2)
print """You look down at the formal-looking letter in your shakey hands,
hardly able to recognize the letters and the words they compose.
You stumble up the cobblestone path, lights in the windows of a
large mansion just ahead. As you fall, weak, against the heavy door,
you squint at some of the letters and realize that it's your name.
With the pen in your pocket, you scrawl it hurridly. Almost as if to not forget."""
 
user_name = raw_input('')
user_name = str(user_name)
 
print """Tears begin to stream down your face as you mouth your name
over and over, struggling to make the sounds. Eventually, you whisper %s.""" % user_name
 
time.sleep(4)
os.system('Say -v whisper %s' % user_name)
 
print """The thick door blew inward as if shoved open as you say your
name. You peer inside through wet eyes as you push yourself up.
You step through the door into a large hall, 3 doors on the left, and 2
on the right, ending in a grand staircase lined with tapestries.
As you look all around you, the door slams shut behind you and three heavy
locks click closed."""
 
time.sleep(10)
occurance_sanity();
 
time.sleep(4)
choice = raw_input("""Do you go in door 1, 2 or 3 on the left?
Up the staircase or in door 1 or 2 on the right? """)
View Adventure
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
#adventure.py
import os
from random import randint
import time
 
strength = randint(4,10)
intelligence = randint(4,10)
hp = 100
sanity = 100
 
def weapon():
if strength >= 7:
return "knife."
else:
return "gun."
 
monster_sanity_damage = randint(10,30)
occurance_sanity_damage = randint(5,15)
occurance_hp_damage = randint(5,15)
monster_hp_damage = randint(10,30)
 
def left_room_one():
print """You creep towards the first room on the left. As you touch the handle
to the door, images of dark red liquid pouring from the ceiling, dripping down
tattered wallpaper fills your mind. You shake yourself from the horror and turn
the knob, throwing the door open. Ahead of you there is a hunched over, gray
figure gnawing viciously at a carcass. As you stand there in the doorway, it stops
gnawing and grotesquely twists its' spine so that its' upper body is now facing
you, gore and viscera dripping from its' maw. Its' eyes bare into you and the
creature screams and bounds towards you."""
time.sleep(8)
monster_damage()
 
def occurance_sanity():
if intelligence <= 5:
print "You take a loss of %i to your sanity." % occurance_sanity_damage
else:
print "You squeeze your eyes shut, breathing deep, hoping this is all a dream."
print sanity - loss
 
def monster_sanity():
if intelligence <=7:
print "You take a loss of %i to your sanity." % monster_sanity_damage
else:
print "You scream at the monster and it shimmers out of existance."
def occurance_damage():
if strength <= 5:
print "You take a loss of %i to your health." % occurance_hp_damage
else:
print "You overcome and are safe... for now."
def monster_damage():
if strength <= 7:
print "You take a loss of %i to your health." % monster_hp_damage
else:
print "You draw your",weapon(), "The monster is destroyed."
 
print "Your strength is %i and your intelligence is %i." % (strength, intelligence)
print "Your weapon is a",weapon()
 
time.sleep(4)
print """You look down at the formal-looking letter in your shakey hands,
hardly able to recognize the letters and the words they compose.
You stumble up the cobblestone path, lights in the windows of a
large mansion just ahead. As you fall, weak, against the heavy door,
you squint at some of the letters and realize that it's your name.
With the pen in your pocket, you scrawl it hurridly. Almost as if to not forget."""
 
user_name = raw_input('')
user_name = str(user_name)
 
print """Tears begin to stream down your face as you mouth your name
over and over, struggling to make the sounds. Eventually, you whisper %s.""" % user_name
 
time.sleep(4)
os.system('Say -v whisper %s' % user_name)
 
print """The thick door blew inward as if shoved open as you say your
name. You peer inside through wet eyes as you push yourself up.
You step through the door into a large hall, 3 doors on the left, and 2
on the right, ending in a grand staircase lined with tapestries.
As you look all around you, the door slams shut behind you and three heavy
locks click closed."""
 
time.sleep(10)
occurance_sanity();
 
time.sleep(4)
choice = raw_input("""Do you go in door 1, 2 or 3 on the left?
Up the staircase or in door 1 or 2 on the right? """)
choice = int(choice)
 
if choice == 1:
left_room_one()
View Adventure
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 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 220
#adventure.py
import os
from random import randint
import time
 
"""
Defines an interconnected graph of game areas
using Python's dictionary data structure.
 
map = {
"start" :
{ "description" : "You are in a room with three doors."
, "exits" : { "N" : "room_north", "W" : "room_west", "E" : "room_east" }
},
"room_north" :
{ "description" : "The northernmost room. Looks abandoned."
, "exits" : { "S" : "start", "SW" : "room_west" }
},
"room_west" :
{ "description" : "The floor is squishy here."
, "exits" : { "E" : "start", "NE" : "room_north" }
},
"room_east" :
{ "description" : "A dead end. Sad."
, "exits" : { "W" : "start" }
}
}
if __name__ == "__main__":
room = map["start"]
while True:
print room["description"], "\n"
print "Available exits: ", ", ".join(room["exits"]), "\n"
while True:
exit = raw_input("Choose exit: ")
exit = exit.upper()
if exit in room["exits"]:
break
else:
print "You run into a wall and rub your face looking embarrassed."
room = map[ room["exits"][exit] ]
print "\n"
"""
 
 
point_pool = 10
monster_dmg = [10, 30]
occurrence_dmg = [5, 15]
#player_strength, player_intelligence = [point_assignation(0, stat_name) for stat_name in ["strength", "intelligence"]]
player_hp = 100
player_sanity = 100
 
#later in mid game you might use it like player_strength = point_assignation(player_strength, "strength")
 
def point_assignation(stat_value, stat_name):
global point_pool
while True:
try:
point_adjustment = int(raw_input('Please enter a number 0 - %i to set your %s: ' % (point_pool, stat_name)))
if point_adjustment >= 0 and point_adjustment <= point_pool:
point_pool -= point_adjustment
stat_value += point_adjustment
print "Your %s is now %i." % (stat_name, stat_value)
print "You now have %i points to distribute." % point_pool
return stat_value
else:
print "Not valid. Try again."
except ValueError:
print "Not valid. Try again."
 
 
"""def point_assignation():
global point_pool, player_strength, player_intelligence
while True:
try:
point_strength = int(raw_input('Please enter a number 1 - 10 to set your strength: '))
if point_strength >= 1 and point_strength <=10:
point_pool -= point_strength
player_strength += point_strength
print "Your strength is now %i." % player_strength
print "You now have %i points. They will be assigned to in
break
else:
print "Not valid. Try again."
except ValueError:
print "Not valid. Try again."""
 
"""def point_assignation():
global point_pool
point_strength = raw_input('Please enter a number 1 - 10 to set your strength: ')
point_strength = int(point_strength)
if point_strength >= 1 and point_strength <= 10:
print "Your strength is now %i" % point_strength
while point_strength not >= 1 and point_strength not >=10
else:
response = raw_input('Not valid. Try again: ')
point_assignation(response);
point_pool -= strength
strength = randint(4,10)
intelligence = randint(4,10)
player_hp = 100
player_sanity = 100 """
 
def weapon():
if player_strength >= 7:
return "knife."
else:
return "gun."
 
"""monster_dmg = [10, 30]
occurrence_dmg = [5, 15]"""
 
 
"""def compute_dmg(x,y):
return randint(x,y)"""
 
def left_room_one():
print """You creep towards the first room on the left. As you touch the handle
to the door, images of dark red liquid pouring from the ceiling, dripping down
tattered wallpaper fills your mind. You shake yourself from the horror and turn
the knob, throwing the door open. Ahead of you there is a hunched over, gray
figure gnawing viciously at a carcass. As you stand there in the doorway, it stops
gnawing and grotesquely twists its' spine so that its' upper body is now facing
you, gore and viscera dripping from its' maw. Its' eyes bare into you and the
creature screams and bounds towards you."""
time.sleep(8)
monster_damage()
 
def occurance_sanity():
global player_sanity
dmg = randint(*occurrence_dmg)
if player_intelligence <= 5:
print "You take a loss of %i to your sanity." % dmg
player_sanity -= dmg
print player_sanity, "sanity points remaining."
else:
print "You squeeze your eyes shut, breathing deep, hoping this is all a dream."
 
def monster_sanity():
global player_sanity
dmg = randint(*monster_dmg)
if player_intelligence <=7:
print "You take a loss of %i to your sanity." % dmg
player_sanity -= dmg
print player_sanity, "sanity points remaining."
else:
print "You scream at the monster and it shimmers out of existence."
def occurance_damage():
global player_hp
dmg = randint(*occurrence_dmg)
if player_strength <= 5:
print "You take a loss of %i to your health." % dmg
player_hp -= dmg
print player_hp, "health points remaining."
else:
print "You overcome and are safe... for now."
def monster_damage():
global player_hp
dmg = randint(*monster_dmg)
if player_strength <= 7:
print "You take a loss of %i to your health." % dmg
player_hp -= dmg
print player_hp, "health points remaining."
else:
print "You draw your",weapon(), "The monster is destroyed."
 
player_strength, player_intelligence = [point_assignation(0, stat_name) for stat_name in ["strength", "intelligence"]]
#print "Your strength is %i and your intelligence is %i." % (strength, intelligence)
print "Your weapon is a",weapon()
#point_assignation();
#print point_pool
 
time.sleep(4)
print """You look down at the formal-looking letter in your shakey hands,
hardly able to recognize the letters and the words they compose.
You stumble up the cobblestone path, lights in the windows of a
large mansion just ahead. As you fall, weak, against the heavy door,
you squint at some of the letters and realize that it's your name.
With the pen in your pocket, you scrawl it hurridly. Almost as if to not forget."""
 
user_name = raw_input('')
user_name = str(user_name)
 
print """Tears begin to stream down your face as you mouth your name
over and over, struggling to make the sounds. You hear something whisper %s.""" % user_name
 
time.sleep(4)
os.system('Say -v whisper %s' % user_name)
 
print """The thick door blew inward as if shoved open as your name is said.
You peer inside through wet eyes as you push yourself up.
You step through the door into a large hall, 3 doors on the left, and 2
on the right, ending in a grand staircase lined with tapestries.
As you look all around you, the door slams shut behind you and three heavy
locks click closed."""
 
time.sleep(10)
occurance_sanity();
 
time.sleep(4)
choice = raw_input("""Do you go in door 1, 2 or 3 on the left?
Up the staircase or in door 1 or 2 on the right? """)
choice = int(choice)
 
if choice == 1:
left_room_one()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Something went wrong with that request. Please try again.