labag 2.2.3 → 2.2.5

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.d.ts CHANGED
@@ -81,4 +81,5 @@ export declare class LaBaG {
81
81
  private roundEnd;
82
82
  private gameOver;
83
83
  play(): void;
84
+ getMode(modeName: string): Mode | undefined;
84
85
  }
package/dist/labag.js CHANGED
@@ -226,5 +226,8 @@ class LaBaG {
226
226
  this.gameOver();
227
227
  }
228
228
  }
229
+ getMode(modeName) {
230
+ return this.modes.find((mode) => mode.name === modeName);
231
+ }
229
232
  }
230
233
  exports.LaBaG = LaBaG;
@@ -35,7 +35,6 @@ exports.default = new mode_1.Mode(false, "greenwei", {
35
35
  for (const p of patterns) {
36
36
  if (p?.name === "gss") {
37
37
  gssCount++;
38
- mode.variable.times += 1;
39
38
  }
40
39
  else {
41
40
  allGSS = false;
@@ -43,7 +42,7 @@ exports.default = new mode_1.Mode(false, "greenwei", {
43
42
  }
44
43
  variable.count += gssCount;
45
44
  if (mode.active) {
46
- if (allGSS) {
45
+ if (patterns.some((p) => p?.name === "gss")) {
47
46
  variable.times += 1;
48
47
  }
49
48
  if (variable.times <= 0) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labag",
3
- "version": "2.2.3",
3
+ "version": "2.2.5",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/labag.ts CHANGED
@@ -245,4 +245,8 @@ export class LaBaG {
245
245
  this.gameOver();
246
246
  }
247
247
  }
248
+
249
+ getMode(modeName: string): Mode | undefined {
250
+ return this.modes.find((mode) => mode.name === modeName);
251
+ }
248
252
  }
@@ -38,7 +38,6 @@ export default new Mode(
38
38
  for (const p of patterns) {
39
39
  if (p?.name === "gss") {
40
40
  gssCount++;
41
- mode.variable.times += 1;
42
41
  } else {
43
42
  allGSS = false;
44
43
  }
@@ -47,7 +46,7 @@ export default new Mode(
47
46
  variable.count += gssCount;
48
47
 
49
48
  if (mode.active) {
50
- if (allGSS) {
49
+ if (patterns.some((p) => p?.name === "gss")) {
51
50
  variable.times += 1;
52
51
  }
53
52
  if (variable.times <= 0) {