コード例 #1
0
def get_level():
    dimensions = default_level_dimensions
    charstr = (
        '^^^^^^^^¨=¨¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^^¨¨=¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^¨¨t=¨¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^¨¨....¨¨¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^¨.""""T"¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^¨¨.TT"T""¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^¨*.TT""""¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^¨¨.""T"""¨¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^¨"""""""¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^¨¨¨¨¨¨¨¨¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^^^'
        '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
    )

    # Overworld movement multiplier
    MULT = min(default_level_dimensions)
    custom_tiles = {
        '"': Tile("grassland",      ('"', Pair.Green), ('"', Pair.Green), True,  True,  move_mult=MULT),
        '¨': Tile("mountains",      ('^', Pair.White), ('^', Pair.White), False, True,  move_mult=MULT),
        '=': Tile("river",          ('=', Pair.Blue),  ('=', Pair.Blue),  False, False, move_mult=MULT),
        'T': Tile("forest",         ('T', Pair.Green), ('T', Pair.Green), True,  True,  move_mult=MULT),
        't': Tile("town",           ('*', Pair.Green), ('*', Pair.Green), True,  True,  move_mult=MULT),
        '*': Tile("dungeon",        ('*', Pair.Brown), ('*', Pair.Brown), True,  True,  move_mult=MULT),
        '^': Tile("high mountains", ('^', Pair.Brown), ('^', Pair.Brown), False, False, move_mult=MULT),
    }
    custom_locations = {
        '*': OverWorldLocation.Dungeon,
        't': OverWorldLocation.Village,
    }
    custom_creatures = {
    }
    level_data = custom_tiles, custom_locations, custom_creatures
    tiles, locations, creatures = construct_data(dimensions, charstr, *level_data)

    return Level(
        danger_level=1,
        generation_type=LevelGen.NoGeneration,
        tiles=tiles,
        locations=locations,
        custom_creatures=creatures,
        creature_spawning=False,
    )
コード例 #2
0
def get_level(player):

    dimensions = default_level_dimensions
    charstr = (
        '################################################################################################'
        '#######################..##################.#.#.#######.....#################################.##'
        '######...##############.#.################.#.#.#.#####.####.###......#######################.@.#'
        '######.##..############.##..#############.######.#..###.###.###.####.########################.##'
        '#######.###...##.######.####.######.....##.#####.#.#.##.###.....###..###.#######################'
        '########.######...#####.#####.#####.###.###.####...##.##.##########.###.#.######################'
        '###.#####.####..#######.######.####...#.###.##########.#.##########.##.##.######################'
        '###.######.###.########.######.######.#.###.########...#.##########....##.######################'
        '###.#######.##.########.######.######.#.###.########.###.################.######################'
        '###..........##.#######.######.#####.##.....########.###.################.######################'
        '###.#######..###.######.##...#.####.################.....########.........######################'
        '###.######...####.#####.##.#...###.##############################.##############################'
        '###.#.###...######.####.##.######.###############################.###...########################'
        '####.#.##..########.###.###.####.################################.##.##........#################'
        '###.#.##.###########.##.####.##.#################################...##########.#################'
        '####.####.###########.#.#####..###############################################.#################'
        '##########.#########.##.######################################################...###############'
        '###########.#######.###.########################################################.###############'
        '############.#####.####........................................................##.##############'
        '#############.###.####.########################################################..>##############'
        '##############.#.##...##########################################################################'
        '###############.###.#.##########################################################################'
        '###############.###...##############################.....................#######################'
        '###############P...###...................................................#######################'
        '#######################################..................................#######################'
        '################################################################################################'
    )
    custom_tiles = {
        'P': PyrlTile.Stairs_Up,
        '@': PyrlTile.Floor,
    }
    custom_locations = {
        'P': LevelLocation.Passage_Up,
    }
    custom_creatures = {
        '@': Creature("The Crone", ('@', Pair.Purple)),
        'P': player,
    }
    level_data = custom_tiles, custom_locations, custom_creatures
    tiles, locations, creatures = construct_data(dimensions, charstr,
                                                 *level_data)

    return Level(
        danger_level=1,
        generation_type=LevelGen.NoGeneration,
        tiles=tiles,
        locations=locations,
        custom_creatures=creatures,
        creature_spawning=False,
    )
コード例 #3
0
def test_dungeon_generation(rectangles, generator):
    rect = rectangles[0]

    generator.attempt_room(rect, (0, 1))
    room, _, _ = construct_data(
        TEST_DIMENSIONS,
        "w.wwwrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "wwwwwrrrrr",
        {}, {}, {},
    )
    assert generator.level.tiles == room

    generator.attempt_corridor((4, 4), (0, 1), 6)
    room, _, _ = construct_data(
        TEST_DIMENSIONS,
        "w.wwwrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "w...wwwwww"
        "w........w"
        "w...wwwwww"
        "w...wrrrrr"
        "w...wrrrrr"
        "w...wrrrrr"
        "wwwwwrrrrr",
        {}, {}, {},
    )
    assert generator.level.tiles == room
コード例 #4
0
def get_level(player):

    dimensions = default_level_dimensions
    charstr = (
        "################################################################################################"
        "#######################..##################.#.#.#######.....#################################.##"
        "######...##############.#.################.#.#.#.#####.####.###......#######################.@.#"
        "######.##..############.##..#############.######.#..###.###.###.####.########################.##"
        "#######.###...##.######.####.######.....##.#####.#.#.##.###.....###..###.#######################"
        "########.######...#####.#####.#####.###.###.####...##.##.##########.###.#.######################"
        "###.#####.####..#######.######.####...#.###.##########.#.##########.##.##.######################"
        "###.######.###.########.######.######.#.###.########...#.##########....##.######################"
        "###.#######.##.########.######.######.#.###.########.###.################.######################"
        "###..........##.#######.######.#####.##.....########.###.################.######################"
        "###.#######..###.######.##...#.####.################.....########.........######################"
        "###.######...####.#####.##.#...###.##############################.##############################"
        "###.#.###...######.####.##.######.###############################.###...########################"
        "####.#.##..########.###.###.####.################################.##.##........#################"
        "###.#.##.###########.##.####.##.#################################...##########.#################"
        "####.####.###########.#.#####..###############################################.#################"
        "##########.#########.##.######################################################...###############"
        "###########.#######.###.########################################################.###############"
        "############.#####.####........................................................##.##############"
        "#############.###.####.########################################################..>##############"
        "##############.#.##...##########################################################################"
        "###############.###.#.##########################################################################"
        "###############.###...##############################.....................#######################"
        "###############P...###...................................................#######################"
        "#######################################..................................#######################"
        "################################################################################################"
    )
    custom_tiles = {"P": PyrlTile.Stairs_Up, "@": PyrlTile.Floor}
    custom_locations = {"P": LevelLocation.Passage_Up}
    custom_creatures = {"@": Creature("The Crone", ("@", Pair.Purple)), "P": player}
    level_data = custom_tiles, custom_locations, custom_creatures
    tiles, locations, creatures = construct_data(dimensions, charstr, *level_data)

    return Level(
        danger_level=1,
        generation_type=LevelGen.NoGeneration,
        tiles=tiles,
        locations=locations,
        custom_creatures=creatures,
        creature_spawning=False,
    )
コード例 #5
0
def get_level():
    dimensions = default_level_dimensions
    charstr = (
        '^^^^^^^^¨=¨¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^^¨¨=¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^^¨¨t=¨¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^¨¨....¨¨¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^^¨.""""T"¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^'
        '^^^^^¨¨.TT"T""¨^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^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^^^^^^^^^^^'
    )

    # Overworld movement multiplier
    MULT = min(default_level_dimensions)
    custom_tiles = {
        '"':
        Tile("grassland", ('"', Pair.Green), ('"', Pair.Green),
             True,
             True,
             move_mult=MULT),
        '¨':
        Tile("mountains", ('^', Pair.White), ('^', Pair.White),
             False,
             True,
             move_mult=MULT),
        '=':
        Tile("river", ('=', Pair.Blue), ('=', Pair.Blue),
             False,
             False,
             move_mult=MULT),
        'T':
        Tile("forest", ('T', Pair.Green), ('T', Pair.Green),
             True,
             True,
             move_mult=MULT),
        't':
        Tile("town", ('*', Pair.Green), ('*', Pair.Green),
             True,
             True,
             move_mult=MULT),
        '*':
        Tile("dungeon", ('*', Pair.Brown), ('*', Pair.Brown),
             True,
             True,
             move_mult=MULT),
        '^':
        Tile("high mountains", ('^', Pair.Brown), ('^', Pair.Brown),
             False,
             False,
             move_mult=MULT),
    }
    custom_locations = {
        '*': OverWorldLocation.Dungeon,
        't': OverWorldLocation.Village,
    }
    custom_creatures = {}
    level_data = custom_tiles, custom_locations, custom_creatures
    tiles, locations, creatures = construct_data(dimensions, charstr,
                                                 *level_data)

    return Level(
        danger_level=1,
        generation_type=LevelGen.NoGeneration,
        tiles=tiles,
        locations=locations,
        custom_creatures=creatures,
        creature_spawning=False,
    )