@devrongx/games 0.4.47 → 0.4.48

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@devrongx/games",
3
- "version": "0.4.47",
3
+ "version": "0.4.48",
4
4
  "description": "Game UI components for sports prediction markets",
5
5
  "license": "MIT",
6
6
  "main": "./src/index.ts",
@@ -423,7 +423,8 @@ export function calcBetSummary(
423
423
  }
424
424
 
425
425
  let totalEntry = 0;
426
- let baseReward = 0;
426
+ let individualReward = 0;
427
+ let parlayReward = 0;
427
428
  let weightedRiskSum = 0;
428
429
 
429
430
  for (const [mIdxStr, { optionIdx, amount, parlaySlot }] of Object.entries(bets)) {
@@ -434,7 +435,7 @@ export function calcBetSummary(
434
435
 
435
436
  const isInActiveParlay = parlaySlot !== null && activeSlots.has(parlaySlot);
436
437
  if (!isInActiveParlay) {
437
- baseReward += Math.round(amount * opt.odds);
438
+ individualReward += Math.round(amount * opt.odds);
438
439
  }
439
440
  }
440
441
 
@@ -448,10 +449,11 @@ export function calcBetSummary(
448
449
  combinedOdds *= opt.odds;
449
450
  parlayStake += bet.amount;
450
451
  }
451
- baseReward += Math.round(parlayStake * combinedOdds);
452
+ parlayReward += Math.round(parlayStake * combinedOdds * (config.compoundMultipliers[legs.length] ?? 1));
452
453
  }
453
454
 
454
- const compoundedReward = Math.round(baseReward * compoundMultiplier);
455
+ const baseReward = individualReward + parlayReward;
456
+ const compoundedReward = baseReward;
455
457
  const remainingBalance = startingBalance - totalEntry;
456
458
  const potentialBalance = remainingBalance + compoundedReward;
457
459
  const riskPercent = totalEntry > 0
@@ -599,8 +601,5 @@ export function calcDisplayReward(
599
601
  betAmount?: number,
600
602
  ): number {
601
603
  const base = betAmount != null ? Math.round(betAmount * opt.odds) : optionReward(opt);
602
- if (isSelected && selectedCount >= 2) {
603
- return Math.round(base * compoundMultiplier);
604
- }
605
604
  return base;
606
605
  }