Ejemplo n.º 1
0
def test_shoot_wall():
    random.seed = 1
    game =  dungeons.create_game({
        'walls': [
            '%%%%',
            '%..%',
            '%%%%',
        ],
        'peeps': [
            create_peep('human', name='Super Dad', pos=(1,1)),
        ]
    })
    assert_game(game, ['a', 'l', '.', '.', Key.CTRL_Q])
Ejemplo n.º 2
0
def test_balrog_whip():
    random.seed = 1
    game = dungeons.create_game({
        'walls': [
            '%%%%%%',
            '%....%',
            '%%%%%%',
        ],
        'peeps': [
            create_peep('human', name='Super Dad', pos=(1,1)),
            create_peep('balrog', name='Gark', pos=(3,1))
        ]
    })
    assert_game(game, ['.', '.', '.', Key.CTRL_Q], paint=False)
Ejemplo n.º 3
0
def test_shoot_monster_blocked():
    random.seed = 1
    game =  dungeons.create_game({
        'walls': [
            '%%%%%%',
            '%..%.%',
            '%%%%%%',
        ],
        'peeps': [
            create_peep('human', name='Super Dad', pos=(1,1)),
            create_peep('goblin', name='Gark', pos=(4,1))
        ]
    })
    assert_game(game, ['a', '*', 't', '.', Key.CTRL_Q], paint=False)
Ejemplo n.º 4
0
def test_shoot_thru_monster():
    random.seed = 1
    game =  dungeons.create_game({
        'walls': [
            '%%%%%%',
            '%....%',
            '%%%%%%',
        ],
        'peeps': [
            create_peep('human', name='Super Dad', pos=(1,1)),
            create_peep('dodger', name='Dummy', pos=(4,1))
        ]
    })
    assert_game(game, ['a', 'l', '.', '.', '.', '.', Key.CTRL_Q], paint=False)
Ejemplo n.º 5
0
def test_shield_block():
    random.seed = 1
    game = dungeons.create_game({
        'walls': [
            '%%%%',
            '%..%',
            '%%%%',
        ],
        'peeps': [
            create_peep('human', name='Super Dad', pos=(1,1)),
            create_peep('big bird', name='birdy!', pos=(2,1)),
        ]
    })

    class shield:
        type: str = 'rect'
        height: int = 2
        width: int = 2

    p = game.maze_model.peeps[0]
    game.maze_model.peeps[0].inventory.hand1 = shield()
    print(p)
    assert_game(game, ['a', 'l', '.', '.',  '.', '.', '.', '.', '.', Key.CTRL_Q], paint=False)
Ejemplo n.º 6
0
def test_draw_target():
    data = (
        (0, -4),
        (1, -4),
        (2, -4),
        (3, -4),
        (4, -4),
        (4, -3),
        (4, -2),
        (4, -1),
        (4, 0),
        (4, 1),
        (4, 2),
        (4, 3),
        (4, 4),
        (3, 4),
        (2, 4),
        (1, 4),
        (0, 4),
        (-1, 4),
        (-2, 4),
        (-3, 4),
        (-4, 4),
        (-4, 3),
        (-4, 2),
        (-4, 1),
        (-4, 0),
        (-4, -1),
        (-4, -2),
        (-4, -3),
        (-4, -4),
        (-3, -4),
        (-2, -4),
        (-1, -4),
        (0, -4),
    )
    random.seed = 1
    game = dungeons.create_game({
        'walls': [
            '%%%%%%%%%',
            '%.......%',
            '%.......%',
            '%.......%',
            '%.......%',
            '%.......%',
            '%.......%',
            '%.......%',
            '%%%%%%%%%',
        ],
        'peeps': [
            create_peep('human', name='Super Dad', pos=(4, 4)),
        ]
    })
    root_layout = dummy_root(dim=Dim(11, 11), logger=Logger('dbg.py'))
    control = PrpgControl(root_layout, game)
    for comp in root_layout.info.comp_by_name.values():
        if not comp.children and comp.name != 'maze':
            comp.con = Con(0, 0, 1, 1)
    root_layout.do_layout()
    player = game.maze_model.peeps[0]
    for target in data:
        tp = (player.pos[0] + target[0], player.pos[1] + target[1])
        game.maze_model.target_path = tuple(line_points(player.pos, tp))
        control.root_layout.window.paint()
Ejemplo n.º 7
0
from lib.logger import Logger
from lib.prpg_main import main
from lib.startup import dummy_root
import lib.dungeons as dungeons

root_layout = dummy_root(logger=Logger('dbg.py'))
game = dungeons.create_game('level_2')

main(root_layout, game)