@allemandi/gacha-engine 0.3.6 → 1.0.0
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/README.md +7 -10
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -107,7 +107,7 @@ const pools = [
|
|
|
107
107
|
{
|
|
108
108
|
rarity: 'SSR',
|
|
109
109
|
items: [
|
|
110
|
-
{ name: '
|
|
110
|
+
{ name: 'Superior Rat', weight: 0.003, rateUp: true },
|
|
111
111
|
{ name: 'Dumpster King', weight: 0.002 }
|
|
112
112
|
]
|
|
113
113
|
},
|
|
@@ -129,30 +129,27 @@ const engine = new GachaEngine({ mode: 'flatRate', pools });
|
|
|
129
129
|
|
|
130
130
|
console.log('Roll x5:', engine.roll(5).join(', '));
|
|
131
131
|
|
|
132
|
-
const dropRate = engine.getItemDropRate('
|
|
133
|
-
console.log('Drop rate for
|
|
132
|
+
const dropRate = engine.getItemDropRate('Superior Rat');
|
|
133
|
+
console.log('Drop rate for Superior Rat:', (dropRate * 100) + '%');
|
|
134
134
|
// 0.3%
|
|
135
135
|
|
|
136
|
-
const cumulative = engine.getCumulativeProbabilityForItem('
|
|
136
|
+
const cumulative = engine.getCumulativeProbabilityForItem('Superior Rat', 500);
|
|
137
137
|
console.log('Chance after 500 rolls:', (cumulative * 100).toFixed(1) + '%');
|
|
138
138
|
// ~78.5%
|
|
139
139
|
|
|
140
|
-
const rollsFor50 = engine.getRollsForTargetProbability('
|
|
140
|
+
const rollsFor50 = engine.getRollsForTargetProbability('Superior Rat', 0.5);
|
|
141
141
|
console.log('Rolls for 50% chance:', rollsFor50);
|
|
142
142
|
// ~231
|
|
143
143
|
|
|
144
144
|
console.log('Rate-up items:', engine.getRateUpItems().join(', '));
|
|
145
|
-
//
|
|
146
|
-
|
|
147
|
-
console.log('All items:', engine.getAllItems().join(', '));
|
|
148
|
-
// God-Tier Rat, Dumpster King, Sleepy Chef, Unknown Student
|
|
145
|
+
// Superior Rat
|
|
149
146
|
```
|
|
150
147
|
|
|
151
148
|
**UMD (Browser, Weighted Mode)**
|
|
152
149
|
```html
|
|
153
150
|
<script src="https://unpkg.com/@allemandi/gacha-engine"></script>
|
|
154
151
|
<script>
|
|
155
|
-
const { GachaEngine } =
|
|
152
|
+
const { GachaEngine } = AllemandiGachaEngine;
|
|
156
153
|
|
|
157
154
|
const engine = new GachaEngine({
|
|
158
155
|
mode: 'weighted',
|
package/package.json
CHANGED