volleyballsimtypes 0.0.386 → 0.0.387

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.
@@ -7,6 +7,11 @@ export declare const PITY_THRESHOLDS: {
7
7
  mythic: number;
8
8
  special: number;
9
9
  };
10
+ export declare const PITY_STEP: {
11
+ legendary: number;
12
+ mythic: number;
13
+ special: number;
14
+ };
10
15
  export interface PityState {
11
16
  legendaryPity: number;
12
17
  mythicPity: number;
@@ -1,6 +1,6 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlayerGenerator = exports.TOURNAMENT_PULL_CONFIG = exports.QUALIFIER_PULL_CONFIG = exports.NORMAL_PULL_CONFIG = exports.PITY_THRESHOLDS = void 0;
3
+ exports.PlayerGenerator = exports.TOURNAMENT_PULL_CONFIG = exports.QUALIFIER_PULL_CONFIG = exports.NORMAL_PULL_CONFIG = exports.PITY_STEP = exports.PITY_THRESHOLDS = void 0;
4
4
  exports.rollRarity = rollRarity;
5
5
  exports.pickPlayerCountry = pickPlayerCountry;
6
6
  const uuid_1 = require("uuid");
@@ -14,14 +14,21 @@ const utils_1 = require("../utils");
14
14
  const player_1 = require("./player");
15
15
  const trait_1 = require("./trait");
16
16
  const decline_1 = require("./decline");
17
- // Hard pity: each rarity's counter is the number of pulls since its last hit. Odds ramp linearly from
18
- // the base rate to 1 (a guaranteed drop) as the counter climbs from 0 to its threshold, so the
19
- // guarantee falls out for free once the counter reaches the threshold.
17
+ // Pity: each rarity's counter is the number of pulls since its last hit. Odds rise gently by a small
18
+ // per-pull step (soft pity), and the rarity becomes a guaranteed drop once the counter reaches its
19
+ // threshold (hard pity).
20
20
  exports.PITY_THRESHOLDS = {
21
21
  legendary: 25,
22
22
  mythic: 200,
23
23
  special: 575
24
24
  };
25
+ // Per-pull soft-pity step: how much a rarity's odds increase for each pull without it. Small enough
26
+ // that base rates stay honest until the hard-pity threshold guarantees the drop.
27
+ exports.PITY_STEP = {
28
+ legendary: 0.004,
29
+ mythic: 0.00001,
30
+ special: 0.000005
31
+ };
25
32
  // Used for world/bot player generation — full rarity range
26
33
  const WORLD_PULL_CONFIG = {
27
34
  special: 0.0003,
@@ -74,20 +81,21 @@ exports.TOURNAMENT_PULL_CONFIG = {
74
81
  accumulateMythicPity: true,
75
82
  accumulateSpecialPity: true
76
83
  };
77
- // Effective odds for a rarity: the base rate ramped linearly toward 1 (a guaranteed drop) as the
78
- // integer pity counter climbs from 0 to its threshold. At count 0 it equals the base rate; at
79
- // count === threshold it is 1, so the rarity is guaranteed. Returns the base rate unchanged when
80
- // pity is not applied for this pull type.
81
- function effectiveOdds(base, count, threshold, apply) {
84
+ // Effective odds for a rarity: the base rate plus a gentle per-pull soft-pity increase, until the
85
+ // counter reaches its threshold, at which point the rarity is a guaranteed drop (odds = 1). Returns
86
+ // the base rate unchanged when pity is not applied for this pull type.
87
+ function effectiveOdds(base, count, threshold, step, apply) {
82
88
  if (!apply)
83
89
  return base;
84
- return Math.min(1, base + (count / threshold) * (1 - base));
90
+ if (count >= threshold)
91
+ return 1;
92
+ return Math.min(1, base + step * count);
85
93
  }
86
94
  function rollRarity(pity, config = WORLD_PULL_CONFIG) {
87
95
  const roll = Math.random();
88
- const tSpecial = effectiveOdds(config.special, pity.specialPity, exports.PITY_THRESHOLDS.special, config.applySpecialPity);
89
- const tMythic = tSpecial + effectiveOdds(config.mythic, pity.mythicPity, exports.PITY_THRESHOLDS.mythic, config.applyMythicPity);
90
- const tLegendary = tMythic + effectiveOdds(config.legendary, pity.legendaryPity, exports.PITY_THRESHOLDS.legendary, config.applyLegendaryPity);
96
+ const tSpecial = effectiveOdds(config.special, pity.specialPity, exports.PITY_THRESHOLDS.special, exports.PITY_STEP.special, config.applySpecialPity);
97
+ const tMythic = tSpecial + effectiveOdds(config.mythic, pity.mythicPity, exports.PITY_THRESHOLDS.mythic, exports.PITY_STEP.mythic, config.applyMythicPity);
98
+ const tLegendary = tMythic + effectiveOdds(config.legendary, pity.legendaryPity, exports.PITY_THRESHOLDS.legendary, exports.PITY_STEP.legendary, config.applyLegendaryPity);
91
99
  const tRare = tLegendary + config.rare;
92
100
  let rarity;
93
101
  if (roll < tSpecial) {
@@ -7,6 +7,11 @@ export declare const PITY_THRESHOLDS: {
7
7
  mythic: number;
8
8
  special: number;
9
9
  };
10
+ export declare const PITY_STEP: {
11
+ legendary: number;
12
+ mythic: number;
13
+ special: number;
14
+ };
10
15
  export interface PityState {
11
16
  legendaryPity: number;
12
17
  mythicPity: number;
@@ -9,14 +9,21 @@ import { shuffle, generatePlayerName } from '../utils';
9
9
  import { Player } from './player';
10
10
  import { assignTraits } from './trait';
11
11
  import { declineProfiles } from './decline';
12
- // Hard pity: each rarity's counter is the number of pulls since its last hit. Odds ramp linearly from
13
- // the base rate to 1 (a guaranteed drop) as the counter climbs from 0 to its threshold, so the
14
- // guarantee falls out for free once the counter reaches the threshold.
12
+ // Pity: each rarity's counter is the number of pulls since its last hit. Odds rise gently by a small
13
+ // per-pull step (soft pity), and the rarity becomes a guaranteed drop once the counter reaches its
14
+ // threshold (hard pity).
15
15
  export const PITY_THRESHOLDS = {
16
16
  legendary: 25,
17
17
  mythic: 200,
18
18
  special: 575
19
19
  };
20
+ // Per-pull soft-pity step: how much a rarity's odds increase for each pull without it. Small enough
21
+ // that base rates stay honest until the hard-pity threshold guarantees the drop.
22
+ export const PITY_STEP = {
23
+ legendary: 0.004,
24
+ mythic: 0.00001,
25
+ special: 0.000005
26
+ };
20
27
  // Used for world/bot player generation — full rarity range
21
28
  const WORLD_PULL_CONFIG = {
22
29
  special: 0.0003,
@@ -69,20 +76,21 @@ export const TOURNAMENT_PULL_CONFIG = {
69
76
  accumulateMythicPity: true,
70
77
  accumulateSpecialPity: true
71
78
  };
72
- // Effective odds for a rarity: the base rate ramped linearly toward 1 (a guaranteed drop) as the
73
- // integer pity counter climbs from 0 to its threshold. At count 0 it equals the base rate; at
74
- // count === threshold it is 1, so the rarity is guaranteed. Returns the base rate unchanged when
75
- // pity is not applied for this pull type.
76
- function effectiveOdds(base, count, threshold, apply) {
79
+ // Effective odds for a rarity: the base rate plus a gentle per-pull soft-pity increase, until the
80
+ // counter reaches its threshold, at which point the rarity is a guaranteed drop (odds = 1). Returns
81
+ // the base rate unchanged when pity is not applied for this pull type.
82
+ function effectiveOdds(base, count, threshold, step, apply) {
77
83
  if (!apply)
78
84
  return base;
79
- return Math.min(1, base + (count / threshold) * (1 - base));
85
+ if (count >= threshold)
86
+ return 1;
87
+ return Math.min(1, base + step * count);
80
88
  }
81
89
  export function rollRarity(pity, config = WORLD_PULL_CONFIG) {
82
90
  const roll = Math.random();
83
- const tSpecial = effectiveOdds(config.special, pity.specialPity, PITY_THRESHOLDS.special, config.applySpecialPity);
84
- const tMythic = tSpecial + effectiveOdds(config.mythic, pity.mythicPity, PITY_THRESHOLDS.mythic, config.applyMythicPity);
85
- const tLegendary = tMythic + effectiveOdds(config.legendary, pity.legendaryPity, PITY_THRESHOLDS.legendary, config.applyLegendaryPity);
91
+ const tSpecial = effectiveOdds(config.special, pity.specialPity, PITY_THRESHOLDS.special, PITY_STEP.special, config.applySpecialPity);
92
+ const tMythic = tSpecial + effectiveOdds(config.mythic, pity.mythicPity, PITY_THRESHOLDS.mythic, PITY_STEP.mythic, config.applyMythicPity);
93
+ const tLegendary = tMythic + effectiveOdds(config.legendary, pity.legendaryPity, PITY_THRESHOLDS.legendary, PITY_STEP.legendary, config.applyLegendaryPity);
86
94
  const tRare = tLegendary + config.rare;
87
95
  let rarity;
88
96
  if (roll < tSpecial) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "volleyballsimtypes",
3
- "version": "0.0.386",
3
+ "version": "0.0.387",
4
4
  "description": "vbsim types",
5
5
  "main": "./dist/cjs/src/index.js",
6
6
  "module": "./dist/esm/src/index.js",