def main(): game_config = _load_config() if game_config.get("extra_commands"): from . import extra_commands _start_game(None, game_config) adventurelib.say("") # Necessary for space before first prompt. adventurelib.start()
def main(): game_config = _load_config() if game_config.get("extra_commands"): from . import extra_commands while True: try: _start_game(game_config) adventurelib.say("") # Necessary for space before first prompt. adventurelib.start() except KeyboardInterrupt: adventurelib.say("☠ Farewell☠") return except tartarus.RaptureException: pass
if room: current_room = room al.say('You go {}.'.format(direction)) look() else: al.say('You can\'t go {}.'.format(direction)) @al.when('look') def look(): al.say(current_room) msg = 'Exists are ' for exit in current_room.exits(): msg += exit + ' ' msg += '.' al.say(msg) g = nx.path_graph(4) nodes = list(g.nodes()) g.add_edge(nodes[-1], nodes[0]) loader = RoomLoader(g) current_room = loader.root_room look() al.start()
current_room.items.add(obj) @a.when('look') def look(): a.say(current_room) if current_room.items: for i in current_room.items: a.say('A %s is here.' % i) @a.when('inventory') def show_inventory(): a.say('You have:') for thing in inventory: a.say(thing) @a.when('cast', magic=None, context='magic_aura') @a.when("cast MAGIC", context='magic_aura') def cast(magic): if magic == None: a.say("Which magic you would like to spell?") elif magic == "fireball": a.say("you cast a flaming Fireball! Woooosh....") look() a.say("hallo Anastasija") a.start()
def start(skipIntro=False): from .bagsOfHolding import items colorama.init() bootstrap(skipIntro) adventurelib.start(help=False)
"INT - Inteligence allows you to craft better items or trick your enemies in combat." ) print( "MIND - Each point in Mind increases your total mana by {} and your concentration(chance to succesfully cast a spell) by 1" .format(cfg.MP_per_lvl)) print("FORCE - Makes most of your spells more powerfull.") return print( "Use \"show SOMETHING\" command to learn information about the game elements." ) print("As SOMETHING you can type:") print("spells - to get complete information about the spells you control.") print("stats - shows your stats and what they mean.") set_context("combat") @when('cast SPELL', context="combat") def casting(spell): if spell in player.spells: if spell in spells_logic.spells: spells_logic.spells[spell].cast_spell(player, player) else: print("Invalid casting instructions.") #set_context("combat") start(help=False)
INVENTORY.add(word_search) first_room = dungeon.get_room(0,0) entrance.east = first_room first_room.enter_scene = CutScene("Opening the Ancient Door") first_room.enter_scene.add_dialogue(""" You spy a small crack in the ancient stone door and just manage to insert your fingers enough to get a good grip. You pull on the door with all your might and just as you're about to give up, the door slides sideways and completely disentigrates in a cloud of dust. """) first_room.enter_scene.add_dialogue(""" As you are stepping through the portal your word search puzzle starts to give off a faint light. """) first_room.enter_scene.add_dialogue("""Your entire body starts to tingle.""") first_room.enter_scene.add_dialogue("""Then with a final crack, pop and fizzle...""") def crumble_door(): door = entrance.objects.find('stone door') door.state = "big pile of rubble" first_room.enter_scene.add_action(crumble_door, pause=False) adventurelib.prompt = prompt adventurelib.no_command_matches = invalid_command # Context.add(contexts.CHEATING) intro.play() adventurelib.start(help=True)
def main(): set_context('attacking.Greg') print_start_of_game_text() start()
@when('cast MAGIC', context='magic_aura', magic=None) def cast(magic): if magic is None: say("Which magic you would like to spell?") else: say("You cast " + magic) # save and load not currently working # @when('save') # def save(): # data = {"current_room": current_room, "inventory": inventory} # #pickle.dump(data, open("save.p", "wb")) # say("Game saved. ") # @when('load') # def load(): # # data = pickle.load(open("save.p", "rb")) # global current_room # current_room = data["current_room"] # global inventory # inventory = data["inventory"] # say("Game loaded. ") # look() # show_inventory() if __name__ == "__main__": # look() # mechanics.testing() start()