labag 2.2.9 → 2.2.11

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.
@@ -34,7 +34,7 @@ exports.default = new mode_1.Mode(false, "greenwei", {
34
34
  let gssCount = 0;
35
35
  let allGSS = true;
36
36
  for (const p of patterns) {
37
- if (p?.name === "gss") {
37
+ if (p?.name === mode.variable.bindPattern) {
38
38
  gssCount++;
39
39
  }
40
40
  else {
@@ -44,7 +44,7 @@ exports.default = new mode_1.Mode(false, "greenwei", {
44
44
  variable.count += gssCount;
45
45
  if (mode.active) {
46
46
  if (allGSS) {
47
- variable.times += 2;
47
+ variable.times += mode.variable.extendTimes;
48
48
  }
49
49
  if (variable.times <= 0) {
50
50
  mode.active = false;
@@ -54,17 +54,17 @@ exports.default = new mode_1.Mode(false, "greenwei", {
54
54
  let activated = false;
55
55
  if (variable.randNum <= variable.rate && allGSS) {
56
56
  activated = true;
57
- variable.times += 2;
57
+ variable.times += mode.variable.extendTimes;
58
58
  }
59
- else if (variable.count >= 20) {
59
+ else if (variable.count >= mode.variable.requiredGssCount) {
60
60
  activated = true;
61
- variable.times += 2;
62
- variable.count -= 20;
61
+ variable.times += mode.variable.bonusTimes;
62
+ variable.count -= mode.variable.requiredGssCount;
63
63
  }
64
64
  if (activated) {
65
65
  mode.active = true;
66
66
  for (let i = 0; i < patterns.length; i++) {
67
- if (patterns[i]?.name === "gss") {
67
+ if (patterns[i]?.name === mode.variable.bindPattern) {
68
68
  patterns[i] = variable.pattern;
69
69
  }
70
70
  }
@@ -80,4 +80,8 @@ exports.default = new mode_1.Mode(false, "greenwei", {
80
80
  name: "greenwei",
81
81
  scores: [800, 400, 180],
82
82
  },
83
+ extendTimes: 2,
84
+ bindPattern: "gss",
85
+ bonusTimes: 2,
86
+ requiredGssCount: 20,
83
87
  });
@@ -1,7 +1,7 @@
1
1
  export declare const modes: {
2
2
  pikachu: import("..").Mode<"pikachu">;
3
- greenwei: import("..").Mode<"greenwei">;
4
3
  superhhh: import("..").Mode<"superhhh">;
4
+ greenwei: import("..").Mode<"greenwei">;
5
5
  normal: import("..").Mode<"normal">;
6
6
  };
7
7
  export type ModeName = (typeof modes)[keyof typeof modes]["name"];
@@ -10,8 +10,8 @@ const pikachu_1 = __importDefault(require("./pikachu"));
10
10
  const superhhh_1 = __importDefault(require("./superhhh"));
11
11
  exports.modes = {
12
12
  pikachu: pikachu_1.default,
13
- greenwei: greenwei_1.default,
14
13
  superhhh: superhhh_1.default,
14
+ greenwei: greenwei_1.default,
15
15
  normal: normal_1.default,
16
16
  };
17
17
  exports.modeList = Object.values(exports.modes);
@@ -15,12 +15,13 @@ exports.default = new mode_1.Mode(false, "pikachu", {
15
15
  },
16
16
  roundEnd: (game, mode) => {
17
17
  const { patterns } = game;
18
- if (!game.isRunning() && patterns.some((p) => p && p.name === "kachu")) {
18
+ if (!game.isRunning() &&
19
+ patterns.some((p) => p && p.name === mode.variable.bindPattern)) {
19
20
  mode.active = true;
20
- game.played -= 5;
21
+ game.played -= mode.variable.bonusRounds;
21
22
  mode.variable.times += 1;
22
23
  for (let i = 0; i < patterns.length; i++) {
23
- if (patterns[i]?.name === 'kachu') {
24
+ if (patterns[i]?.name === mode.variable.bindPattern) {
24
25
  patterns[i] = mode.variable.pattern;
25
26
  }
26
27
  }
@@ -32,4 +33,6 @@ exports.default = new mode_1.Mode(false, "pikachu", {
32
33
  name: "pikachu",
33
34
  scores: [12000, 8000, 1250],
34
35
  },
36
+ bindPattern: "kachu",
37
+ bonusRounds: 5,
35
38
  });
@@ -27,7 +27,7 @@ exports.default = new mode_1.Mode(false, "superhhh", {
27
27
  calculateScore: (game, mode) => {
28
28
  if (mode.active)
29
29
  return;
30
- if (game.patterns.every((p) => p?.name === "hhh") &&
30
+ if (game.patterns.every((p) => p?.name === mode.variable.bindPattern) &&
31
31
  mode.variable.randNum <= mode.variable.rate) {
32
32
  mode.variable.score += Math.round(game.score / 2);
33
33
  game.marginScore += mode.variable.score;
@@ -39,14 +39,14 @@ exports.default = new mode_1.Mode(false, "superhhh", {
39
39
  let hhhCount = 0;
40
40
  let allHHH = true;
41
41
  for (const p of patterns) {
42
- if (p?.name === "hhh")
42
+ if (p?.name === mode.variable.bindPattern)
43
43
  hhhCount++;
44
44
  else
45
45
  allHHH = false;
46
46
  }
47
47
  if (mode.active) {
48
48
  if (allHHH) {
49
- variable.times += 2;
49
+ variable.times += mode.variable.extendTimes;
50
50
  }
51
51
  if (variable.times <= 0) {
52
52
  mode.active = false;
@@ -55,9 +55,9 @@ exports.default = new mode_1.Mode(false, "superhhh", {
55
55
  else {
56
56
  if (variable.randNum <= variable.rate && hhhCount > 0) {
57
57
  mode.active = true;
58
- variable.times += 6;
58
+ variable.times += variable.bonusTimes;
59
59
  for (let i = 0; i < patterns.length; i++) {
60
- if (patterns[i]?.name === "hhh") {
60
+ if (patterns[i]?.name === mode.variable.bindPattern) {
61
61
  patterns[i] = variable.pattern;
62
62
  }
63
63
  }
@@ -69,8 +69,11 @@ exports.default = new mode_1.Mode(false, "superhhh", {
69
69
  rate: 15,
70
70
  score: 0,
71
71
  randNum: 0,
72
+ bindPattern: "hhh",
73
+ bonusTimes: 6,
72
74
  pattern: {
73
75
  name: "superhhh",
74
76
  scores: [1500, 800, 300],
75
77
  },
78
+ extendTimes: 2,
76
79
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labag",
3
- "version": "2.2.9",
3
+ "version": "2.2.11",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
@@ -37,18 +37,18 @@ export default new Mode(
37
37
  let gssCount = 0;
38
38
  let allGSS = true;
39
39
  for (const p of patterns) {
40
- if (p?.name === "gss") {
40
+ if (p?.name === mode.variable.bindPattern) {
41
41
  gssCount++;
42
42
  } else {
43
43
  allGSS = false;
44
44
  }
45
45
  }
46
46
 
47
- variable.count += gssCount;
47
+ variable.count += gssCount;
48
48
 
49
49
  if (mode.active) {
50
50
  if (allGSS) {
51
- variable.times += 2;
51
+ variable.times += mode.variable.extendTimes;
52
52
  }
53
53
  if (variable.times <= 0) {
54
54
  mode.active = false;
@@ -57,17 +57,17 @@ export default new Mode(
57
57
  let activated = false;
58
58
  if (variable.randNum <= variable.rate && allGSS) {
59
59
  activated = true;
60
- variable.times += 2;
61
- } else if (variable.count >= 20) {
60
+ variable.times += mode.variable.extendTimes;
61
+ } else if (variable.count >= mode.variable.requiredGssCount) {
62
62
  activated = true;
63
- variable.times += 2;
64
- variable.count -= 20;
63
+ variable.times += mode.variable.bonusTimes;
64
+ variable.count -= mode.variable.requiredGssCount;
65
65
  }
66
66
 
67
67
  if (activated) {
68
68
  mode.active = true;
69
69
  for (let i = 0; i < patterns.length; i++) {
70
- if (patterns[i]?.name === "gss") {
70
+ if (patterns[i]?.name === mode.variable.bindPattern) {
71
71
  patterns[i] = variable.pattern;
72
72
  }
73
73
  }
@@ -84,5 +84,9 @@ export default new Mode(
84
84
  name: "greenwei",
85
85
  scores: [800, 400, 180],
86
86
  },
87
+ extendTimes: 2,
88
+ bindPattern: "gss",
89
+ bonusTimes: 2,
90
+ requiredGssCount: 20,
87
91
  }
88
- );
92
+ );
@@ -5,8 +5,8 @@ import superhhh from "./superhhh";
5
5
 
6
6
  export const modes = {
7
7
  pikachu,
8
- greenwei,
9
8
  superhhh,
9
+ greenwei,
10
10
  normal,
11
11
  }
12
12
 
@@ -18,12 +18,15 @@ export default new Mode(
18
18
  },
19
19
  roundEnd: (game, mode) => {
20
20
  const { patterns } = game;
21
- if (!game.isRunning() && patterns.some((p) => p && p.name === "kachu")) {
21
+ if (
22
+ !game.isRunning() &&
23
+ patterns.some((p) => p && p.name === mode.variable.bindPattern)
24
+ ) {
22
25
  mode.active = true;
23
- game.played -= 5;
26
+ game.played -= mode.variable.bonusRounds;
24
27
  mode.variable.times += 1;
25
28
  for (let i = 0; i < patterns.length; i++) {
26
- if (patterns[i]?.name === 'kachu') {
29
+ if (patterns[i]?.name === mode.variable.bindPattern) {
27
30
  patterns[i] = mode.variable.pattern;
28
31
  }
29
32
  }
@@ -36,5 +39,7 @@ export default new Mode(
36
39
  name: "pikachu",
37
40
  scores: [12000, 8000, 1250],
38
41
  },
42
+ bindPattern: "kachu",
43
+ bonusRounds: 5,
39
44
  }
40
45
  );
@@ -29,7 +29,7 @@ export default new Mode(
29
29
  calculateScore: (game, mode) => {
30
30
  if (mode.active) return;
31
31
  if (
32
- game.patterns.every((p) => p?.name === "hhh") &&
32
+ game.patterns.every((p) => p?.name === mode.variable.bindPattern) &&
33
33
  mode.variable.randNum <= mode.variable.rate
34
34
  ) {
35
35
  mode.variable.score += Math.round(game.score / 2);
@@ -43,13 +43,13 @@ export default new Mode(
43
43
  let hhhCount = 0;
44
44
  let allHHH = true;
45
45
  for (const p of patterns) {
46
- if (p?.name === "hhh") hhhCount++;
46
+ if (p?.name === mode.variable.bindPattern) hhhCount++;
47
47
  else allHHH = false;
48
48
  }
49
49
 
50
50
  if (mode.active) {
51
51
  if (allHHH) {
52
- variable.times += 2;
52
+ variable.times += mode.variable.extendTimes;
53
53
  }
54
54
  if (variable.times <= 0) {
55
55
  mode.active = false;
@@ -57,10 +57,10 @@ export default new Mode(
57
57
  } else {
58
58
  if (variable.randNum <= variable.rate && hhhCount > 0) {
59
59
  mode.active = true;
60
- variable.times += 6;
60
+ variable.times += variable.bonusTimes;
61
61
 
62
62
  for (let i = 0; i < patterns.length; i++) {
63
- if (patterns[i]?.name === "hhh") {
63
+ if (patterns[i]?.name === mode.variable.bindPattern) {
64
64
  patterns[i] = variable.pattern;
65
65
  }
66
66
  }
@@ -73,9 +73,12 @@ export default new Mode(
73
73
  rate: 15,
74
74
  score: 0,
75
75
  randNum: 0,
76
+ bindPattern: "hhh",
77
+ bonusTimes: 6,
76
78
  pattern: {
77
79
  name: "superhhh",
78
80
  scores: [1500, 800, 300],
79
81
  },
82
+ extendTimes: 2,
80
83
  }
81
84
  );