fix: Correct PnL calculation by using betAmount in net profit computation
Some checks failed
Deploy to Production / test (push) Failing after 34s

- Add betAmount field to BlackjackState to track the base bet
- Fix finishPlayerTurns: multiply hand.bet by state.betAmount for actual money bets
- Fix GameServer: roundPayouts are already gross payouts (not multipliers)
- Update cumulative PnL calculation to correctly subtract actual bet amount
- Add betAmount support to riggedState test helper
This commit is contained in:
syntaxbullet
2026-04-06 14:50:40 +02:00
parent f09cbe6939
commit 06c3891045
4 changed files with 13 additions and 8 deletions

View File

@@ -34,6 +34,7 @@ function riggedState(overrides: {
activePlayerIndex?: number;
phase?: "betting" | "player_turns" | "resolved";
roundNumber?: number;
betAmount?: number;
}): BlackjackState {
return {
deck: overrides.deck ?? [makeCard("5"), makeCard("6"), makeCard("7"), makeCard("8"), makeCard("9"), makeCard("10")],
@@ -43,6 +44,7 @@ function riggedState(overrides: {
activePlayerIndex: overrides.activePlayerIndex ?? 0,
phase: overrides.phase ?? "player_turns",
roundNumber: overrides.roundNumber ?? 1,
betAmount: overrides.betAmount ?? 0,
};
}