labag 2.1.0 → 2.1.1

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/dist/labag.js CHANGED
@@ -85,8 +85,7 @@ class LaBaG {
85
85
  getCurrentConfig() {
86
86
  const activeModes = this.modes.filter((m) => m.active);
87
87
  if (activeModes.length === 0) {
88
- console.warn("目前沒有啟用中的模式,無法轉動拉霸機。");
89
- return { modes: activeModes, ranges: [] };
88
+ throw new Error("目前沒有啟用中的模式,無法轉動拉霸機。");
90
89
  }
91
90
  // 合併所有啟用中模式的機率設定
92
91
  const combinedRates = {
@@ -164,8 +163,7 @@ class LaBaG {
164
163
  calculateScore() {
165
164
  const [p1, p2, p3] = this.patterns;
166
165
  if (!p1 || !p2 || !p3) {
167
- console.warn("圖案未正確生成,無法計算分數。");
168
- return;
166
+ throw new Error("圖案未正確生成,無法計算分數。");
169
167
  }
170
168
  if (p1.name === p2.name && p2.name === p3.name) {
171
169
  // 三個圖案相同
@@ -207,8 +205,7 @@ class LaBaG {
207
205
  }
208
206
  play() {
209
207
  if (!this.isRunning()) {
210
- console.warn("遊戲次數已達上限,無法繼續遊玩。");
211
- return;
208
+ throw new Error("遊戲次數已達上限,無法繼續遊玩。");
212
209
  }
213
210
  this.roundStart();
214
211
  this.rollSlots();
package/dist/mode.js CHANGED
@@ -43,9 +43,6 @@ class Mode {
43
43
  this.ranges.push({ threshold: acc, pattern });
44
44
  }
45
45
  }
46
- if (acc > 100) {
47
- console.warn(`模式 "${name}" 的機率總和超過 100%,請檢查設定。`);
48
- }
49
46
  }
50
47
  }
51
48
  exports.Mode = Mode;
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labag",
3
- "version": "2.1.0",
3
+ "version": "2.1.1",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -17,5 +17,4 @@ export {
17
17
  type Pattern,
18
18
  type PatternName,
19
19
  type ModeName,
20
-
21
20
  };
package/src/labag.ts CHANGED
@@ -93,8 +93,7 @@ export class LaBaG {
93
93
  getCurrentConfig() {
94
94
  const activeModes = this.modes.filter((m) => m.active);
95
95
  if (activeModes.length === 0) {
96
- console.warn("目前沒有啟用中的模式,無法轉動拉霸機。");
97
- return { modes: activeModes, ranges: [] };
96
+ throw new Error("目前沒有啟用中的模式,無法轉動拉霸機。");
98
97
  }
99
98
  // 合併所有啟用中模式的機率設定
100
99
  const combinedRates: Record<PatternName, number> = {
@@ -180,8 +179,7 @@ export class LaBaG {
180
179
  private calculateScore() {
181
180
  const [p1, p2, p3] = this.patterns;
182
181
  if (!p1 || !p2 || !p3) {
183
- console.warn("圖案未正確生成,無法計算分數。");
184
- return;
182
+ throw new Error("圖案未正確生成,無法計算分數。");
185
183
  }
186
184
  if (p1.name === p2.name && p2.name === p3.name) {
187
185
  // 三個圖案相同
@@ -225,8 +223,7 @@ export class LaBaG {
225
223
 
226
224
  play() {
227
225
  if (!this.isRunning()) {
228
- console.warn("遊戲次數已達上限,無法繼續遊玩。");
229
- return;
226
+ throw new Error("遊戲次數已達上限,無法繼續遊玩。");
230
227
  }
231
228
  this.roundStart();
232
229
  this.rollSlots();
package/src/mode.ts CHANGED
@@ -54,8 +54,5 @@ export class Mode<N extends string = string> {
54
54
  this.ranges.push({ threshold: acc, pattern });
55
55
  }
56
56
  }
57
- if (acc > 100) {
58
- console.warn(`模式 "${name}" 的機率總和超過 100%,請檢查設定。`);
59
- }
60
57
  }
61
58
  }