Example #1
0
def test_attacked_with_excalibur(
    layer,
    theme,
    presence_flags,
    chain_status,
    expected_failed_low_if_not_chain,
    expected_low,
):
    prev_state = CharState.PUSHING
    cur_state = CharState.ATTACKING
    item_set = {EntityType.ITEM_EXCALIBUR}
    # These should vary with theme, but there's already a lot of params
    world = 4
    level = 2
    run_state = RunState()
    run_state.sunken_chain_status = chain_status
    run_state.update_attacked_with(
        prev_state,
        cur_state,
        layer,
        world,
        level,
        theme,
        presence_flags,
        item_set,
        item_set,
    )

    # We only expect these to be set together
    assert run_state.failed_low_if_not_chain == expected_failed_low_if_not_chain

    is_low = Label.LOW in run_state.run_label._set
    assert is_low == expected_low
Example #2
0
def test_attacked_with_mattock(layer, theme, presence_flags, expected_low):
    prev_state = CharState.PUSHING
    cur_state = CharState.ATTACKING
    item_set = {EntityType.ITEM_MATTOCK}
    # These should vary with theme, but there's already a lot of params
    world = 2
    level = 2
    run_state = RunState()
    run_state.update_attacked_with(
        prev_state,
        cur_state,
        layer,
        world,
        level,
        theme,
        presence_flags,
        item_set,
        item_set,
    )

    # We only expect this to be set when we're still low%
    assert run_state.mc_has_swung_mattock == expected_low

    is_low = Label.LOW in run_state.run_label._set
    assert is_low == expected_low
Example #3
0
def test_attacked_with_hou_yi(layer, world, level, presence_flags,
                              expected_low):
    prev_state = CharState.JUMPING
    cur_state = CharState.ATTACKING
    item_set = {EntityType.ITEM_HOUYIBOW}
    # This should vary with world+level, but there's already a lot of params
    theme = Theme.DWELLING
    run_state = RunState()
    run_state.update_attacked_with(
        prev_state,
        cur_state,
        layer,
        world,
        level,
        theme,
        presence_flags,
        item_set,
        item_set,
    )

    is_low = Label.LOW in run_state.run_label._set
    assert is_low == expected_low
Example #4
0
def test_attacked_with_simple(prev_state, cur_state, item_set, prev_item_set,
                              expected_low):
    # These shouldn't be location sensitive
    layer = Layer.FRONT
    world = 2
    level = 2
    theme = Theme.JUNGLE
    presence_flags = 0
    run_state = RunState()
    run_state.sunken_chain_status = ChainStatus.IN_PROGRESS
    run_state.update_attacked_with(
        prev_state,
        cur_state,
        layer,
        world,
        level,
        theme,
        presence_flags,
        item_set,
        prev_item_set,
    )

    is_low = Label.LOW in run_state.run_label._set
    assert is_low == expected_low