Exemplo n.º 1
0
def new_game() -> Engine:
    """Return a brand new game session as an Engine instance."""
    map_width = 80
    map_height = 43

    room_max_size = 10
    room_min_size = 6
    max_rooms = 30

    max_monsters_per_room = 2
    max_items_per_room = 2

    player = copy.deepcopy(entity_factories.player)

    engine = Engine(player=player)

    engine.game_world = GameWorld(
        engine=engine,
        max_rooms=max_rooms,
        room_min_size=room_min_size,
        room_max_size=room_max_size,
        map_width=map_width,
        map_height=map_height,
        max_monsters_per_room=max_monsters_per_room,
        max_items_per_room=max_items_per_room,
    )

    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message(
        "Hello and welcome, adventurer, to yet another dungeon!",
        color.welcome_text)

    return engine
Exemplo n.º 2
0
def start() -> Engine:
    """Return a brand new game session as an Engine instance."""
    map_width = 80
    map_height = 45

    max_monsters_per_room = 2
    max_items_per_room = 2

    import entity_factories
    player = copy.deepcopy(entity_factories.player)

    engine = Engine(player=player)

    engine.game_world = GameWorld(
        engine=engine,
        map_width=map_width,
        map_height=map_height,
        max_monsters_per_room=max_monsters_per_room,
        max_items_per_room=max_items_per_room,
    )

    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message(
        "Welcome to the phonetics course!", color.welcome_text
    )
    return engine
Exemplo n.º 3
0
def new_game(lvl: int) -> Engine:
    """Return a brand new game session as an Engine instance."""
    map_width = 100
    map_height = 46

    room_max_size = 16
    room_min_size = 9
    max_rooms = 60

    player = copy.deepcopy(entity_factories.player)

    engine = Engine(player=player)

    engine.game_world = GameWorld(engine=engine,
                                  max_rooms=max_rooms,
                                  room_min_size=room_min_size,
                                  room_max_size=room_max_size,
                                  map_width=map_width,
                                  map_height=map_height,
                                  lvl=lvl)

    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message(
        "Hello and welcome, stranger, to the spaceship!", color.welcome_text)
    return engine
Exemplo n.º 4
0
def new_game() -> Engine:
    """Return a brand new game session as an Engine instance."""
    # map_width = 40
    # map_height = 25
    #
    # room_max_size = 10
    # room_min_size = 5
    # max_rooms = 30


    map_width = 30
    map_height = 30

    room_max_size = 3
    room_min_size = 2
    max_rooms = 20

    player = copy.deepcopy(entity_factories.player)

    engine = Engine(player=player)
    # player.fighter.base_power = 50

    curr_floor = 0

    engine.game_world = GameWorld(
        engine=engine,
        max_rooms=max_rooms,
        room_min_size=room_min_size,
        room_max_size=room_max_size,
        map_width=map_width,
        map_height=map_height,
        current_floor=curr_floor
    )

    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message(
        "Hello and welcome, adventurer, to yet another dungeon!", color.welcome_text
    )

    dagger = copy.deepcopy(entity_factories.dagger)
    leather_armor = copy.deepcopy(entity_factories.leather_armor)

    dagger.parent = player.inventory
    leather_armor.parent = player.inventory

    player.inventory.items.append(dagger)
    player.equipment.toggle_equip(dagger, add_message=False)

    player.inventory.items.append(leather_armor)
    player.equipment.toggle_equip(leather_armor, add_message=False)

    return engine
Exemplo n.º 5
0
def new_game() -> Engine:
    """Return a brand new game session as an Engine instance."""
    map_width = 80
    map_height = 43

    room_max_size = 10
    room_min_size = 6
    max_rooms = 30

    player = copy.deepcopy(entity_factories.player)

    engine = Engine(player=player)

    engine.game_world = GameWorld(
        engine=engine,
        max_rooms=max_rooms,
        room_min_size=room_min_size,
        room_max_size=room_max_size,
        map_width=map_width,
        map_height=map_height,
    )

    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message(
        "You have awoken after centuries to find your castle claimed by a rival.", color.welcome_text
    )

    engine.message_log.add_message(
        "Take back your throne!", color.welcome_text
    )

    dagger = copy.deepcopy(entity_factories.dagger)
    leather_armor = copy.deepcopy(entity_factories.leather_armor)

    health_spell = copy.deepcopy(entity_factories.health_spell)

    dagger.parent = player.inventory
    leather_armor.parent = player.inventory

    health_spell.parent = player.ability_menu

    player.ability_menu.abilities.append(health_spell)

    player.inventory.items.append(dagger)
    player.equipment.toggle_equip(dagger, add_message=False)

    player.inventory.items.append(leather_armor)
    player.equipment.toggle_equip(leather_armor, add_message=False)

    return engine
Exemplo n.º 6
0
def new_game() -> Engine:
    """Return a brand new game session as an Engine instance."""
    camera_width = 80
    camera_height = 43
    map_width = 100
    map_height = 60

    room_max_size = 20
    room_min_size = 8
    max_rooms = 50

    player = copy.deepcopy(entity_factories.player)

    engine = Engine(player=player,
                    camera_width=camera_width,
                    camera_height=camera_height,
                    map_width=map_width,
                    map_height=map_height)

    engine.game_world = GameWorld(
        engine=engine,
        max_rooms=max_rooms,
        room_min_size=room_min_size,
        room_max_size=room_max_size,
        map_width=map_width,
        map_height=map_height,
    )
    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message(
        "Hello and welcome, adventurer, to yet another dungeon!",
        color.welcome_text)
    dagger = copy.deepcopy(entity_factories.dagger)
    leather_armor = copy.deepcopy(entity_factories.leather_armor)

    dagger.parent = player.inventory
    leather_armor.parent = player.inventory

    player.inventory.items.append(dagger)
    player.equipment.toggle_equip(dagger, add_message=False)

    player.inventory.items.append(leather_armor)
    player.equipment.toggle_equip(leather_armor, add_message=False)

    return engine
Exemplo n.º 7
0
def new_game() -> Engine:
    """Return a brand new game session as an Engine instance."""
    map_width = 80
    map_height = 43

    room_max_size = 14
    room_min_size = 8
    max_rooms = 32

    player = copy.deepcopy(entities_factory.player)

    engine = Engine(player=player)

    engine.game_world = GameWorld(
        engine=engine,
        max_rooms=max_rooms,
        room_min_size=room_min_size,
        room_max_size=room_max_size,
        map_width=map_width,
        map_height=map_height,
    )
    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message(
        "The World is not the same anymore... Have a good death friend.", color.welcome_text
    )

    rknife = copy.deepcopy(entities_factory.rknife)
    LJacket = copy.deepcopy(entities_factory.LJacket)

    rknife.parent = player.inventory
    LJacket.parent = player.inventory

    player.inventory.items.append(rknife)
    player.equipment.toggle_equip(rknife, add_message=False)

    player.inventory.items.append(LJacket)
    player.equipment.toggle_equip(LJacket, add_message=False)

    return engine
Exemplo n.º 8
0
def new_game() -> Engine:
    """Return a brand new game session as an Engine instance."""
    map_width = 80
    map_height = 43

    room_max_size = 10
    room_min_size = 6
    max_rooms = 30

    player = copy.deepcopy(entity_factories.player)

    engine = Engine(player=player)

    engine.game_world = GameWorld(
        engine=engine,
        max_rooms=max_rooms,
        room_min_size=room_min_size,
        room_max_size=room_max_size,
        map_width=map_width,
        map_height=map_height,
    )
    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message("May the Gods watch over you, brave one.",
                                   color.welcome_text)

    dagger = copy.deepcopy(entity_factories.dagger)
    leather_armor = copy.deepcopy(entity_factories.leather_armor)

    dagger.parent = player.inventory
    leather_armor.parent = player.inventory

    player.inventory.items.append(dagger)
    player.equipment.toggle_equip(dagger, add_message=False)

    player.inventory.items.append(leather_armor)
    player.equipment.toggle_equip(leather_armor, add_message=False)

    return engine
Exemplo n.º 9
0
def new_game() -> Engine:
    """Return a brand new game session as an Engine instance."""
    map_width = 80
    map_height = 43

    room_max_size = 10
    room_min_size = 6
    max_rooms = 30

    player = copy.deepcopy(entity_factories.player)
    gunman = copy.deepcopy(entity_factories.gunman)

    engine = Engine(player=player)

    engine.game_world = GameWorld(
        engine=engine,
        max_rooms=max_rooms,
        room_min_size=room_min_size,
        room_max_size=room_max_size,
        map_width=map_width,
        map_height=map_height,
    )

    engine.game_world.generate_floor()
    engine.update_fov()

    engine.message_log.add_message(
        "Help Strong Terry prove his strength and unite the Rickys and Terrys of the streets! "
        "Also see if you can find info about a strange new drug...", color.welcome_text
    )

    gun = copy.deepcopy(entity_factories.gun)

    gun.parent = gunman.inventory

    gunman.inventory.append(gun)

    return engine
Exemplo n.º 10
0
def main():
    print("wattup")

    screen_width = 35
    screen_height = 35

    map_width = 35
    map_height = 30
    room_max_size = 7
    room_min_size = 3
    max_rooms = 30
    monster_max = 3  #max amt of monsters in a room
    items_max = 1  #max food in a room

    tileset = tcod.tileset.load_tilesheet('dejavu16x16.png', 32, 8,
                                          tcod.tileset.CHARMAP_TCOD)

    player = copy.deepcopy(entity_maker.player)

    engine = Engine(player=player)

    engine.game_world = GameWorld(
        engine=engine,
        m_width=map_width,
        m_height=map_height,
        max_rooms=max_rooms,
        room_min_size=room_min_size,
        room_max_size=room_max_size,
        monster_max=monster_max,
        items_max=items_max,
    )
    engine.game_world.generate_floor()
    engine.update_fov()
    engine.message_log.add_message(
        "Anyone who thinks sitting in a church makes you saint must think sitting in a garage makes you a car.",
        colors.lite_green)

    with tcod.context.new_terminal(
            screen_width,
            screen_height,
            tileset=tileset,
            title="Seek",
            vsync=True,
    ) as context:
        root_console = tcod.Console(screen_width, screen_height, order="F")
        tcod.lib.SDL_SetWindowFullscreen(
            context.sdl_window_p, tcod.lib.SDL_WINDOW_FULLSCREEN_DESKTOP)
        # fullscreen = tcod.lib.SDL_GetWindowFlags(context.sdl_window_p) & (
        # tcod.lib.SDL_WINDOW_FULLSCREEN | tcod.lib.SDL_WINDOW_FULLSCREEN_DESKTOP
        #  )
        # tcod.lib.SDL_SetWindowFullscreen(
        #     context.sdl_window_p,
        #     0 if fullscreen else tcod.lib.SDL_WINDOW_FULLSCREEN_DESKTOP,
        # )

        while True:
            # tcod.console.recommended_size()
            root_console.clear()
            engine.event_handler.on_render(console=root_console)
            context.present(root_console)
            try:
                for event in tcod.event.wait():
                    context.convert_event(event)
                    engine.event_handler.handle_events(event)
            except Exception:  # Handle exceptions in game.
                traceback.print_exc()  # Print error to stderr.
                # Then print the error to the message log.
                engine.message_log.add_message(traceback.format_exc(),
                                               colors.error)