Exemplo n.º 1
0
def test_rope_deployed(new_entity_types, theme, expected_no):
    run_state = RunState()
    run_state.new_entities = [
        poly_pointer_no_mem(Entity(type=EntityDBEntry(id=t)))
        for t in new_entity_types
    ]

    run_state.update_rope_deployed(theme)

    is_no = Label.NO in run_state.run_label._set
    assert is_no == expected_no
Exemplo n.º 2
0
def test_no_tp(
    player_x,
    player_y,
    player_vx,
    player_vy,
    idle_counter,
    shadow_x,
    shadow_y,
    expected_no_tp,
):
    fx_shadow_type = EntityDBEntry(id=EntityType.FX_TELEPORTSHADOW)
    new_entities = []
    src_shadow = LightEmitter(type=fx_shadow_type,
                              idle_counter=idle_counter,
                              emitted_light=Illumination())
    new_entities.append(poly_pointer_no_mem(src_shadow))

    dest_illumination = Illumination(light_pos_x=shadow_x,
                                     light_pos_y=shadow_y)
    dest_shadow = LightEmitter(type=fx_shadow_type,
                               idle_counter=idle_counter,
                               emitted_light=dest_illumination)
    new_entities.append(poly_pointer_no_mem(dest_shadow))

    player = Player(
        position_x=player_x,
        position_y=player_y,
        velocity_x=player_vx,
        velocity_y=player_vy,
    )
    item_set = {EntityType.ITEM_TELEPORTER_BACKPACK}
    prev_item_set = set()

    run_state = RunState()
    run_state.new_entities = new_entities
    run_state.update_no_tp(player, item_set, prev_item_set)

    is_no_tp = Label.NO_TELEPORTER in run_state.run_label._set
    assert is_no_tp == expected_no_tp