From f2eafe824d9fc73272d83b675ca8092cf048f3b1 Mon Sep 17 00:00:00 2001 From: team3 Date: Thu, 23 Jul 2026 07:01:56 +0200 Subject: [PATCH] =?UTF-8?q?Streak=20und=20Siegbonus=20nur=20f=C3=BCr=20PvP?= =?UTF-8?q?-Runden;=20PvE=20friert=20die=20Streak=20ein?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit Co-Authored-By: Claude Fable 5 --- backend/tests/test_game.py | 8 ++++++++ backend/tft/sim/game.py | 9 +++++++-- 2 files changed, 15 insertions(+), 2 deletions(-) diff --git a/backend/tests/test_game.py b/backend/tests/test_game.py index a91cacb..d5a8b34 100644 --- a/backend/tests/test_game.py +++ b/backend/tests/test_game.py @@ -184,3 +184,11 @@ def test_ghost_source_takes_no_damage(art, cfg): game.step() drops = sum(1 for p in game.players if p.hp < hp_before[p.name]) assert drops <= 4 # max. 3 Paar-Verlierer + 1 Ghost-Verlierer + + +def test_pve_freezes_streak_and_pays_no_win_bonus(art, cfg): + game = Game(art, cfg, seed=4) + # Stage 1: drei PvE-Runden -> Streak bleibt 0 + while game.round["stage"] == 1 and not game.over: + game.step() + assert game.player.streak == 0 diff --git a/backend/tft/sim/game.py b/backend/tft/sim/game.py index 1da18cf..56256ab 100644 --- a/backend/tft/sim/game.py +++ b/backend/tft/sim/game.py @@ -141,10 +141,15 @@ class Game: if self.over: return + is_pvp = rnd["kind"] == "pvp" for p in self._alive(): won = results.get(p.name, False) - p.streak = max(p.streak, 0) + 1 if won else min(p.streak, 0) - 1 - p.gold += economy.round_income(p.gold, p.streak, won, rnd["label"], self.cfg) + # Nur PvP zählt für Streak und Siegbonus; PvE friert die Streak ein. + if is_pvp: + p.streak = max(p.streak, 0) + 1 if won else min(p.streak, 0) - 1 + p.gold += economy.round_income( + p.gold, p.streak, is_pvp and won, rnd["label"], self.cfg + ) p.level, p.xp = economy.apply_xp( p.level, p.xp, self.cfg["xp"]["passive_per_round"], self.cfg )