Beispiel #1
0
def doStep(step):
    ad = Adventure('data.json')

    click.clear()
    if ad.type(step) is not None:
        quiz.run(ad.getStep(step))

    click.echo(click.style(ad.title(step), bold=True))
    click.echo(click.style(ad.text(step)))

    if ad.choices(step) is None:
        click.echo(click.style('End of your journey goodbye.', fg='red'))
        quit()

    for idx, option in enumerate(ad.choices(step)):
        click.echo(click.style('['+str(idx+1)+'] ' + option['text']))

    choice = click.prompt('What do you want to do ?', type = int)
    doStep(ad.choices(step)[choice-1]['link'])
Beispiel #2
0
if __name__ == "__main__":
    print(World())
    print("Predominant architectural feature: {}".format(Architecture()))
    print("---")
    for i in range(random.choice([2, 3])):
        print("Animal:\n{}\n".format(Animal()))
    print("---")
    for i in range(random.choice([2, 3])):
        print("Political Party:\n{}\n".format(PoliticalParty()))
    print("---")
    for i in range(random.choice([2, 3])):
        print("Corporation:\n{}\n".format(Corporation()))
    print("---")
    for i in range(random.choice([1, 2])):
        print(
            random.choice([
                "Religion:\n{}\n".format(Religion()),
                "Heresy:\n{}\n".format(Heresy())
            ]))
    print("---")
    print("Local Faction: {}".format(Faction()))
    print("---")
    print("Prominent NPCs:")
    for i in range(random.choice([3, 4, 5])):
        print("-\n{}".format(NPC()))
    print("---")
    print("Adventure Seeds:")
    for i in range(3):
        print(Adventure())
    print(Trade())
Beispiel #3
0
async def on_message(ctx, adventureName, minPlayers: int, maxPlayers: int):
    newAdv = Adventure(adventureName, minPlayers, maxPlayers)
    listOfAdventures.append(newAdv)
    await ctx.send(f'Added {adventureName}')
Beispiel #4
0
from termcolor import colored
from sys import argv
from os.path import dirname, basename

if len(argv) == 1:
    path = "testing"
    fileName = "testAdventure.yaml"
elif len(argv) == 2:
    path = dirname(argv[1])
    fileName = basename(argv[1])
else:
    print("Takes 0 or 1 args:")
    print("1. path to adventure file")
    exit()

ad = Adventure(path, fileName)
print("*******************************************************")
print("* " + ad.name)
print("*******************************************************")
print(ad.getQuest())
print("*******************************************************")

while ad.running:
    print(ad.getLocalDescription())
    action = input(colored(ad.player.name + " >> ", 'red')).split()

    if len(action) == 0:
        verb = ' '
    else:
        verb = action[0]
#!/usr/bin/env python3

from adventure import Adventure
import os

if __name__ == "__main__":
    adventure = Adventure(os.path.dirname(os.path.realpath(__file__)))
    adventure.play()