fix: Correct PnL calculation by using betAmount in net profit computation
Some checks failed
Deploy to Production / test (push) Failing after 34s
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:
@@ -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,
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user