From a99bccbc116102361412c7670b9aa4a53d86932e Mon Sep 17 00:00:00 2001 From: LemonNexus Date: Sun, 8 Feb 2026 21:13:56 +0000 Subject: [PATCH] fix(nexus_api): correct DPP calculation formula and mock data values MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DPP was calculating damage per PED instead of per PEC (100x error) - Fixed Sollomate Opalo DPP: 3.70 → 3.33 - Added pytest.ini with asyncio configuration - Tests now pass correctly --- core/nexus_api.py | 10 +++++----- pytest.ini | 8 ++++++++ 2 files changed, 13 insertions(+), 5 deletions(-) create mode 100644 pytest.ini diff --git a/core/nexus_api.py b/core/nexus_api.py index 7e59a4b..45f4acc 100644 --- a/core/nexus_api.py +++ b/core/nexus_api.py @@ -190,7 +190,7 @@ MOCK_WEAPONS = { damage=Decimal("4.0"), decay_pec=Decimal("0.13"), ammo_pec=Decimal("1.07"), - dpp=Decimal("3.70"), + dpp=Decimal("3.33"), range=26, attacks_per_min=56, item_id="sollomate_opalo" @@ -812,12 +812,12 @@ def calculate_dpp(damage: Decimal, decay_pec: Decimal, ammo_pec: Decimal) -> Dec ammo_pec: Ammo cost per shot in PEC Returns: - DPP value + DPP value (damage per PEC spent) """ - total_cost_ped = (decay_pec + ammo_pec) / 100 - if total_cost_ped == 0: + total_cost_pec = decay_pec + ammo_pec + if total_cost_pec == 0: return Decimal("0") - return damage / total_cost_ped + return damage / total_cost_pec # ============================================================================= diff --git a/pytest.ini b/pytest.ini new file mode 100644 index 0000000..599aee5 --- /dev/null +++ b/pytest.ini @@ -0,0 +1,8 @@ +[tool:pytest] +testpaths = tests +python_files = test_*.py +python_classes = Test* +python_functions = test_* +asyncio_mode = auto +asyncio_default_fixture_loop_scope = function +addopts = -v --tb=short \ No newline at end of file