Пример #1
0
def passage_table_11_12(engine, origin, x, y, direction, width, psquare, dice):
    catch1 = draw_passage_section(engine, x, y, direction, width, 4, psquare)
    if catch1[0] is False:
        return (True, (x, y, width, catch1[1]['blocks']))

    px, py = catch1[1]['next_square']
    catch = draw_passage_section(engine, px, py, direction, width, width,
                                 psquare)

    if catch[0] is False:
        return (True, (x, y, width, []))

    # funky math to figure out turn coordinates
    if not is_positive(direction):
        px, py = catch[1]['next_square']
        px, py = advance(px, py, back(direction), 1)
    px, py = turn_across(px, py, direction, left(direction), width)
    catch = draw_passage_section(engine, px, py, left(direction), width, 2,
                                 psquare)
    if catch[0] is False:
        return (True, (x, y, width, []))

    px, py = catch[1]['next_square']
    engine.add(['hall', 'passage', px, py, left(direction), width, psquare])
    return (True, (x, y, width, []))
Пример #2
0
def door_passage_table_1_2(engine, origin, x, y, direction, width, psquare,
                           dice):
    catch = draw_passage_section(engine, x, y, direction, width, 2, psquare)
    if catch[0] is False:
        return (True, (x, y, width, catch[1]['blocks']))
    x0, y0 = catch[1]['next_square']

    catch = draw_passage_section(engine, x0, y0, direction, width, width,
                                 psquare)
    if catch[0] is False:
        return (True, (x, y, width, catch[1]['blocks']))

    x1, y1 = catch[1]['next_square']
    px, py = x0, y0
    if not is_positive(direction):
        px, py = x1, y1
        px, py = advance(px, py, back(direction), 1)

    rx, ry = turn_across(px, py, direction, right(direction), width)
    lx, ly = turn_across(px, py, direction, left(direction), width)

    rcatch = draw_passage_section(engine, rx, ry, right(direction), width, 2,
                                  psquare)
    if rcatch[0] is not False:
        rx, ry = rcatch[1]['next_square']
        engine.add(
            ['hall', 'passage', rx, ry,
             right(direction), width, psquare])

    lcatch = draw_passage_section(engine, lx, ly, left(direction), width, 2,
                                  psquare)
    if lcatch[0] is not False:
        lx, ly = lcatch[1]['next_square']
        engine.add(
            ['hall', 'passage', lx, ly,
             left(direction), width, psquare])

    return (True, (x, y, width, []))
Пример #3
0
def passage_table_4(engine, origin, x, y, direction, width, psquare, dice):
    catch1 = draw_passage_section(engine, x, y, direction, width, 4, psquare)
    if catch1[0] is False:
        return (True, (x, y, width, catch1[1]['blocks']))

    x0, y0 = catch1[1]['next_square']
    dx, dy = x0, y0
    catch = draw_passage_section(engine, dx, dy, direction, width, 2, psquare)
    if catch[0] is False:
        return (True, (x, y, width, []))

    x0, y0 = catch[1]['next_square']
    dx, dy = turn_across(dx, dy, direction, left(direction), width)
    engine.add(['door', 'passage', dx, dy, left(direction), 1, ('door', -1)])
    engine.add(['hall', 'passage', x0, y0, direction, width, psquare])
    return (True, (x, y, width, []))
Пример #4
0
def passage_table_8_9(engine, origin, x, y, direction, width, psquare, dice):
    catch1 = draw_passage_section(engine, x, y, direction, width, 4, psquare)
    if catch1[0] is False:
        return (True, (x, y, width, catch1[1]['blocks']))

    x0, y0 = catch1[1]['next_square']
    px, py = turn_across(x0, y0, direction, left(direction), width)
    # TODO: add branching passag to immediate list, get width from dispatch
    nwidth = passage_width_table(dice[0])['width']
    catch = draw_passage_section(engine, x0, y0, direction, width, 2 + nwidth,
                                 psquare)
    if catch[0] is False:
        return (True, (x, y, width, []))

    x0, y0 = catch[1]['next_square']
    nsquare = (psquare[0], -1)
    engine.add(['hall', 'passage', px, py, left(direction), nwidth, nsquare])
    engine.add(['hall', 'passage', x0, y0, direction, width, psquare])
    return (True, (x, y, width, []))