You cannot select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
93 lines
2.4 KiB
Python
93 lines
2.4 KiB
Python
# A Void - Functions
|
|
# by Gorgs Prc
|
|
#
|
|
# Adaptation to IF by log
|
|
# ------------------
|
|
|
|
# Variables
|
|
# ------------------
|
|
|
|
import random
|
|
import os
|
|
from time import sleep
|
|
import sys
|
|
|
|
global current_room
|
|
global visited_rooms
|
|
global viewedthings
|
|
current_room = "room"
|
|
visited_rooms=[]
|
|
viewedthings=[]
|
|
|
|
class bcolors:
|
|
BLUE = '\033[94m'
|
|
CYAN = '\033[96m'
|
|
GREEN = '\033[92m'
|
|
YELLOW = '\033[93m'
|
|
RED = '\033[91m'
|
|
MAGENTA = '\x1b[35m'
|
|
ENDC = '\033[0m'
|
|
BOLD = '\033[1m'
|
|
UNDERLINE = '\033[4m'
|
|
|
|
|
|
# Funtions
|
|
# ------------------
|
|
|
|
def delayPrint(s):
|
|
for c in s:
|
|
sys.stdout.write(c)
|
|
sys.stdout.flush()
|
|
sleep(0.01)
|
|
print("\n")
|
|
sys.stdout.write(">")
|
|
|
|
def interact(thing, roomthings):
|
|
print("")
|
|
delayPrint(roomthings[current_room][thing])
|
|
viewedthings.append(thing)
|
|
|
|
def look(roomthings, current_room):
|
|
roomstring = ", a ".join(roomthings[current_room])
|
|
delayPrint(f"Looking around this spot, you sight a {roomstring}")
|
|
|
|
def portflip(rooms):
|
|
global current_room
|
|
rooms.remove(current_room)
|
|
current_room = "bar"
|
|
rooms.append(current_room)
|
|
delayPrint("""COMMANDANT (vigorously nodding): That's right, a port-flip! Any port-flip in a storm, what? Ha ha ha!
|
|
BARMAN (as though in pain): I . . . don't .. . think . . . any . .. in .. . stock . . .
|
|
COMMANDANT (jumping up off his stool): What, no port-flips! But only last month I had (laboriously counting out) 1, 2, no, 3 port-flips in this bar!
|
|
BARMAN (almost inaudibly): But now . . . now . . . you can't. . . """)
|
|
|
|
def defaultReply():
|
|
messages = ["You cannot do that", "What?", "That won't work"]
|
|
return random.choice(messages)
|
|
|
|
def nextroom(death,rooms,intro,message):
|
|
global current_room
|
|
sleep(1)
|
|
delayPrint(bcolors.RED + death[current_room] + bcolors.ENDC)
|
|
sleep(1)
|
|
rooms.remove(current_room)
|
|
if len(rooms) == 0:
|
|
gameover()
|
|
current_room = random.choice(rooms)
|
|
print(bcolors.CYAN + "-"*79)
|
|
sleep(1)
|
|
delayPrint("\n" + " "*40 + intro[current_room])
|
|
print("-"*79 + bcolors.ENDC)
|
|
sleep(1)
|
|
delayPrint(message[current_room])
|
|
|
|
def gameover():
|
|
print(bcolors.RED + "-"*79 + "\n" + "-"*80 + "\n" + "-"*80 + "\n")
|
|
sleep(1)
|
|
print("\n" + " "*28 + " / \ / \ / \ ")
|
|
print(" "*28 + "( f | i | n )")
|
|
print(" "*28 + " \_/ \_/ \_/ " + "\n")
|
|
sleep(1)
|
|
print("-"*79 + "\n" + "-"*80 + "\n" + "-"*80 + "\n" + bcolors.ENDC)
|
|
exit()
|