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.
112 lines
3.2 KiB
Python
112 lines
3.2 KiB
Python
2 years ago
|
# A Void
|
||
|
# by Gorgs Prc
|
||
|
#
|
||
|
# Adaptation to IF by log
|
||
|
# ------------------
|
||
|
|
||
|
# Variables
|
||
|
# ------------------
|
||
|
|
||
|
import random
|
||
|
import os
|
||
|
import sys
|
||
|
import json
|
||
|
from time import sleep
|
||
|
import voidfunc
|
||
|
|
||
|
with open('voiddata.json', 'r') as f:
|
||
|
voiddata = json.load(f)
|
||
|
|
||
|
rooms = ["room", "island", "bar"]
|
||
|
|
||
|
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'
|
||
|
|
||
|
# Start of book
|
||
|
# ------------------
|
||
|
|
||
|
os.system('clear') #this needs to be cls for windows
|
||
|
print(bcolors.CYAN + "-"*80 + "\n" + "-"*80 + "\n" + "-"*80 + "\n")
|
||
|
sleep(0.5)
|
||
|
print("""
|
||
|
|
||
|
_ _
|
||
|
__ _ __ _____ (_) __| |
|
||
|
/ _` | \ \ / / _ \| |/ _` |
|
||
|
| (_| | \ V / (_) | | (_| |
|
||
|
\__,_| \_/ \___/|_|\__,_|
|
||
|
|
||
|
by Gorgs Prc
|
||
|
|
||
|
|
||
|
|
||
|
|
||
|
Push ↵ to start
|
||
|
|
||
|
""")
|
||
|
sleep(0.5)
|
||
|
print("-"*80 + "\n" + "-"*80 + "\n" + "-"*80 + "\n" + bcolors.ENDC)
|
||
|
input()
|
||
|
os.system('clear') #this needs to be cls for windows
|
||
|
sleep(1)
|
||
|
print(bcolors.CYAN + "-"*80 +
|
||
|
"""
|
||
|
|
||
|
:::
|
||
|
:+:+:
|
||
|
+:+
|
||
|
+#+
|
||
|
+#+
|
||
|
#+#
|
||
|
#######
|
||
|
|
||
|
_ _ _ _ _ _ _ _ _
|
||
|
/ \ / \ / \ / \ / \ / \ / \ / \ / \
|
||
|
( A | n | t | o | n ) ( V | o | w | l )
|
||
|
\_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/ \_/
|
||
|
""")
|
||
|
print("-"*80)
|
||
|
sleep(1)
|
||
|
voidfunc.delayPrint("\n" + " "*40 + voiddata[voidfunc.current_room]["intro"])
|
||
|
print("-"*79 + bcolors.ENDC)
|
||
|
sleep(1)
|
||
|
voidfunc.delayPrint(voiddata[voidfunc.current_room]["message"])
|
||
|
|
||
|
while True:
|
||
|
# Wait for user input
|
||
|
reply = input()
|
||
|
|
||
|
# End the game if all rooms have been explored
|
||
|
if len(rooms) == 0:
|
||
|
voidfunc.gameover()
|
||
|
break
|
||
|
|
||
|
# End the room if all items have been interacted with
|
||
|
if any(s not in voidfunc.viewedthings for s in voiddata[voidfunc.current_room]["items"]):
|
||
|
pass
|
||
|
else:
|
||
|
voidfunc.nextroom(rooms)
|
||
|
|
||
|
# Do functions based on reply
|
||
|
if "exit" in reply:
|
||
|
voidfunc.gameover()
|
||
|
break
|
||
|
elif "e" in reply or len(voiddata[voidfunc.current_room]["items"]) == 0:
|
||
|
voidfunc.nextroom(rooms)
|
||
|
elif "port" in reply and "flip" in reply:
|
||
|
voidfunc.portflip(rooms)
|
||
|
elif any(word in reply.split() for word in voiddata[voidfunc.current_room]["items"]):
|
||
|
word = next((s for s in reply.split() if s in voiddata[voidfunc.current_room]["items"]), None)
|
||
|
voidfunc.interact(word)
|
||
|
elif any(s in reply for s in ["look", "scan", "watch", "study", "spot", "spy", "analysis", "probing", "grill", voidfunc.current_room]):
|
||
|
voidfunc.look()
|
||
|
else:
|
||
|
voidfunc.delayPrint(voidfunc.defaultReply())
|