예제 #1
0
def test_run_validated_hud_text():
    # Setup
    rng = MagicMock()
    rng.randint.return_value = 0
    details = pickup_exporter.ExportedPickupDetails(
        index=PickupIndex(0),
        scan_text="scan",
        hud_text=["Energy Transfer Module acquired!"],
        conditional_resources=[
            ConditionalResources(None, None, ()),
        ],
        conversion=[],
        model=PickupModel(
            game=RandovaniaGame.METROID_PRIME_ECHOES,
            name="EnergyTransferModule",
        ),
        other_player=False,
        original_pickup=None,
    )

    # Run
    data = patch_data_factory.echoes_pickup_details_to_patcher(details, rng)

    # Assert
    assert data['hud_text'] == ['Run validated!']
예제 #2
0
def test_pickup_data_for_pb_expansion_unlocked(echoes_item_database, echoes_resource_database):
    # Setup
    pickup = pickup_creator.create_ammo_expansion(
        echoes_item_database.ammo["Power Bomb Expansion"],
        [2],
        False,
        echoes_resource_database,
    )
    creator = pickup_exporter.PickupExporterSolo(patch_data_factory._simplified_memo_data())

    # Run
    details = creator.export(PickupIndex(0), PickupTarget(pickup, 0), pickup, PickupModelStyle.ALL_VISIBLE)
    result = patch_data_factory.echoes_pickup_details_to_patcher(details, MagicMock())

    # Assert
    assert result == {
        "pickup_index": 0,
        "scan": "Power Bomb Expansion. Provides 2 Power Bombs and 1 Item Percentage",
        "model": {"game": "prime2", "name": "PowerBombExpansion"},
        "hud_text": ["Power Bomb Expansion acquired!"],
        'resources': [{'amount': 2, 'index': 43},
                      {'amount': 1, 'index': 47}],
        "conditional_resources": [],
        "convert": [],
    }
예제 #3
0
def test_pickup_data_for_pb_expansion_locked(simplified, echoes_item_database, echoes_resource_database):
    # Setup
    pickup = pickup_creator.create_ammo_expansion(
        echoes_item_database.ammo["Power Bomb Expansion"],
        [2],
        True,
        echoes_resource_database,
    )
    if simplified:
        memo = patch_data_factory._simplified_memo_data()
        hud_text = [
            "Power Bomb Expansion acquired, but the main Power Bomb is required to use it.",
            "Power Bomb Expansion acquired!",
        ]
    else:
        memo = default_database.default_prime2_memo_data()
        hud_text = [
            "Power Bomb Expansion acquired! \n"
            "Without the main Power Bomb item, you are still unable to release Power Bombs.",
            "Power Bomb Expansion acquired! \nMaximum Power Bomb carrying capacity increased by 2.",
        ]

    creator = pickup_exporter.PickupExporterSolo(memo)

    # Run
    details = creator.export(PickupIndex(0), PickupTarget(pickup, 0), pickup, PickupModelStyle.ALL_VISIBLE)
    result = patch_data_factory.echoes_pickup_details_to_patcher(details, MagicMock())

    # Assert
    assert result == {
        "pickup_index": 0,
        "scan": "Power Bomb Expansion. Provides 2 Power Bombs and 1 Item Percentage",
        "model": {"game": "prime2", "name": "PowerBombExpansion"},
        "hud_text": hud_text,
        'resources': [{'amount': 2, 'index': 72},
                      {'amount': 1, 'index': 47}],
        "conditional_resources": [
            {'item': 43,
             'resources': [{'amount': 2, 'index': 43},
                           {'amount': 1, 'index': 47}]}
        ],
        "convert": [],
    }
예제 #4
0
def test_pickup_data_for_seeker_launcher(echoes_item_database, echoes_resource_database):
    # Setup
    state = MajorItemState(
        include_copy_in_original_location=False,
        num_shuffled_pickups=0,
        num_included_in_starting_items=0,
        included_ammo=(5,),
    )
    pickup = pickup_creator.create_major_item(
        echoes_item_database.major_items["Seeker Launcher"],
        state,
        True,
        echoes_resource_database,
        echoes_item_database.ammo["Missile Expansion"],
        True
    )
    creator = pickup_exporter.PickupExporterSolo(patch_data_factory._simplified_memo_data())

    # Run
    details = creator.export(PickupIndex(0), PickupTarget(pickup, 0), pickup, PickupModelStyle.ALL_VISIBLE)
    result = patch_data_factory.echoes_pickup_details_to_patcher(details, MagicMock())

    # Assert
    assert result == {
        "pickup_index": 0,
        "scan": "Seeker Launcher",
        "model": {"game": "prime2", "name": "SeekerLauncher"},
        "hud_text": ["Seeker Launcher acquired, but the Missile Launcher is required to use it.",
                     "Seeker Launcher acquired!"],
        'resources': [{'amount': 5, 'index': 71},
                      {'amount': 1, 'index': 47},
                      {'amount': 1, 'index': 26}],
        "conditional_resources": [
            {'item': 73,
             'resources': [{'amount': 5, 'index': 44},
                           {'amount': 1, 'index': 47},
                           {'amount': 1, 'index': 26}]}
        ],
        "convert": [],
    }