labag 2.0.1 → 2.0.3

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/index.js CHANGED
@@ -1,208 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  const labag_1 = require("./labag");
4
- const mode_1 = require("./mode");
5
- const randInt_1 = require("./utils/randInt");
4
+ const modes_1 = require("./modes");
6
5
  const labag = new labag_1.LaBaG();
7
- const modes = [
8
- [
9
- false,
10
- "superhhh",
11
- {
12
- gss: 19,
13
- hhh: 5,
14
- hentai: 19,
15
- handson: 19,
16
- kachu: 19,
17
- rrr: 19,
18
- },
19
- {
20
- gameStart: (_, mode) => {
21
- mode.active = false;
22
- mode.variable.times = 0;
23
- },
24
- roundStart: (_, mode) => {
25
- if (!mode.active)
26
- return;
27
- mode.variable.score = 0;
28
- mode.variable.times -= 1;
29
- },
30
- rollSlots: (_, mode) => {
31
- mode.variable.randNum = (0, randInt_1.randInt)(1, 100);
32
- },
33
- roundEnd: (game, mode) => {
34
- const { patterns } = game;
35
- const { variable } = mode;
36
- let hhhCount = 0;
37
- let allHHH = true;
38
- for (const p of patterns) {
39
- if (p?.name === "hhh")
40
- hhhCount++;
41
- else
42
- allHHH = false;
43
- }
44
- if (mode.active) {
45
- if (allHHH) {
46
- variable.times += 2;
47
- }
48
- if (variable.times <= 0) {
49
- mode.active = false;
50
- }
51
- }
52
- else {
53
- if (variable.randNum <= variable.rate && hhhCount > 0) {
54
- mode.active = true;
55
- variable.times += 6;
56
- for (let i = 0; i < patterns.length; i++) {
57
- if (patterns[i]?.name === "hhh") {
58
- patterns[i] = variable.pattern;
59
- }
60
- }
61
- }
62
- }
63
- },
64
- },
65
- {
66
- times: 0,
67
- rate: 15,
68
- score: 0,
69
- randNum: 0,
70
- pattern: {
71
- name: "superhhh",
72
- scores: [1500, 800, 300],
73
- },
74
- },
75
- ],
76
- [
77
- false,
78
- "greenwei",
79
- {
80
- gss: 36,
81
- hhh: 24,
82
- hentai: 17,
83
- handson: 12,
84
- kachu: 8,
85
- rrr: 3,
86
- },
87
- {
88
- gameStart: (_, mode) => {
89
- mode.active = false;
90
- mode.variable.times = 0;
91
- },
92
- roundStart: (_, mode) => {
93
- if (!mode.active)
94
- return;
95
- mode.variable.times -= 1;
96
- },
97
- rollSlots: (_, mode) => {
98
- mode.variable.randNum = (0, randInt_1.randInt)(1, 100);
99
- },
100
- calculateScore: (game, mode) => {
101
- if (mode.active) {
102
- game.marginScore = Math.round(game.marginScore * 3);
103
- }
104
- },
105
- roundEnd: (game, mode) => {
106
- const { patterns } = game;
107
- const { variable } = mode;
108
- let gssCount = 0;
109
- let allGSS = true;
110
- for (const p of patterns) {
111
- if (p?.name === "gss")
112
- gssCount++;
113
- else
114
- allGSS = false;
115
- }
116
- variable.count += gssCount;
117
- if (mode.active) {
118
- if (allGSS) {
119
- variable.times += 1;
120
- }
121
- if (variable.times <= 0) {
122
- mode.active = false;
123
- }
124
- }
125
- else {
126
- let activated = false;
127
- if (variable.randNum <= variable.rate && allGSS) {
128
- activated = true;
129
- variable.times += 2;
130
- }
131
- else if (variable.count >= 20) {
132
- activated = true;
133
- variable.times += 2;
134
- variable.count -= 20;
135
- }
136
- if (activated) {
137
- mode.active = true;
138
- for (let i = 0; i < patterns.length; i++) {
139
- if (patterns[i]?.name === "gss") {
140
- patterns[i] = variable.pattern;
141
- }
142
- }
143
- }
144
- }
145
- },
146
- },
147
- {
148
- times: 0,
149
- rate: 35,
150
- randNum: 0,
151
- count: 0,
152
- pattern: {
153
- name: "greenwei",
154
- scores: [800, 400, 180],
155
- },
156
- },
157
- ],
158
- [
159
- false,
160
- "pikachu",
161
- {
162
- gss: 36,
163
- hhh: 24,
164
- hentai: 17,
165
- handson: 12,
166
- kachu: 8,
167
- rrr: 3,
168
- },
169
- {
170
- gameStart: (_, mode) => {
171
- mode.active = false;
172
- mode.variable.times = 0;
173
- },
174
- roundEnd: (game, mode) => {
175
- if (!game.isRunning() &&
176
- game.patterns.some((p) => p && p.name === "kachu")) {
177
- mode.active = true;
178
- game.played -= 5;
179
- mode.variable.times += 1;
180
- }
181
- },
182
- },
183
- {
184
- times: 0,
185
- pattern: {
186
- name: "pikachu",
187
- scores: [12000, 8000, 1250],
188
- },
189
- },
190
- ],
191
- [
192
- true,
193
- "normal",
194
- {
195
- gss: 36,
196
- hhh: 24,
197
- hentai: 17,
198
- handson: 12,
199
- kachu: 8,
200
- rrr: 3,
201
- },
202
- ],
203
- ];
204
- for (const modeArgs of modes) {
205
- const mode = new mode_1.Mode(...modeArgs);
206
- labag.addMode(mode);
207
- }
6
+ modes_1.modeList.forEach((mode) => {
7
+ console.log(mode);
8
+ if (mode.active) {
9
+ labag.modes.push(mode);
10
+ }
11
+ else {
12
+ labag.addMode(mode);
13
+ }
14
+ });
208
15
  exports.default = labag;
package/dist/labag.d.ts CHANGED
@@ -50,7 +50,7 @@ export declare class LaBaG {
50
50
  * 取得目前遊戲的相關設定
51
51
  */
52
52
  getCurrentConfig(): {
53
- modes: Mode[];
53
+ modes: Mode<string>[];
54
54
  ranges: {
55
55
  threshold: number;
56
56
  pattern: Pattern;
package/dist/mode.d.ts CHANGED
@@ -3,11 +3,11 @@ import { LaBaGEvent, Pattern, PatternName } from "./types";
3
3
  /**
4
4
  * 代表遊戲的一種模式,包含機率設定和事件監聽器。
5
5
  */
6
- export declare class Mode {
6
+ export declare class Mode<N extends string = string> {
7
7
  /** 模式是否啟用 */
8
8
  active: boolean;
9
9
  /** 模式名稱 */
10
- name: string;
10
+ name: N;
11
11
  /** 各圖案出現的機率 */
12
12
  rates: Record<PatternName, number>;
13
13
  ranges: {
@@ -26,5 +26,5 @@ export declare class Mode {
26
26
  * @param rates - 各圖案的機率設定。
27
27
  * @param eventListener - 事件監聽器。
28
28
  */
29
- constructor(active: boolean, name: string, rates: Record<PatternName, number>, eventListener?: Partial<Record<LaBaGEvent, (game: LaBaG, mode: Mode) => void>>, variable?: Record<string, any>);
29
+ constructor(active: boolean, name: N, rates: Record<PatternName, number>, eventListener?: Partial<Record<LaBaGEvent, (game: LaBaG, mode: Mode) => void>>, variable?: Record<string, any>);
30
30
  }
@@ -0,0 +1,3 @@
1
+ import { Mode } from "../mode";
2
+ declare const _default: Mode<"greenwei">;
3
+ export default _default;
@@ -0,0 +1,80 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mode_1 = require("../mode");
4
+ const randInt_1 = require("../utils/randInt");
5
+ exports.default = new mode_1.Mode(false, "greenwei", {
6
+ gss: 36,
7
+ hhh: 24,
8
+ hentai: 17,
9
+ handson: 12,
10
+ kachu: 8,
11
+ rrr: 3,
12
+ }, {
13
+ gameStart: (_, mode) => {
14
+ mode.active = false;
15
+ mode.variable.times = 0;
16
+ },
17
+ roundStart: (_, mode) => {
18
+ if (!mode.active)
19
+ return;
20
+ mode.variable.times -= 1;
21
+ },
22
+ rollSlots: (_, mode) => {
23
+ mode.variable.randNum = (0, randInt_1.randInt)(1, 100);
24
+ },
25
+ calculateScore: (game, mode) => {
26
+ if (mode.active) {
27
+ game.marginScore = Math.round(game.marginScore * 3);
28
+ }
29
+ },
30
+ roundEnd: (game, mode) => {
31
+ const { patterns } = game;
32
+ const { variable } = mode;
33
+ let gssCount = 0;
34
+ let allGSS = true;
35
+ for (const p of patterns) {
36
+ if (p?.name === "gss")
37
+ gssCount++;
38
+ else
39
+ allGSS = false;
40
+ }
41
+ variable.count += gssCount;
42
+ if (mode.active) {
43
+ if (allGSS) {
44
+ variable.times += 1;
45
+ }
46
+ if (variable.times <= 0) {
47
+ mode.active = false;
48
+ }
49
+ }
50
+ else {
51
+ let activated = false;
52
+ if (variable.randNum <= variable.rate && allGSS) {
53
+ activated = true;
54
+ variable.times += 2;
55
+ }
56
+ else if (variable.count >= 20) {
57
+ activated = true;
58
+ variable.times += 2;
59
+ variable.count -= 20;
60
+ }
61
+ if (activated) {
62
+ mode.active = true;
63
+ for (let i = 0; i < patterns.length; i++) {
64
+ if (patterns[i]?.name === "gss") {
65
+ patterns[i] = variable.pattern;
66
+ }
67
+ }
68
+ }
69
+ }
70
+ },
71
+ }, {
72
+ times: 0,
73
+ rate: 35,
74
+ randNum: 0,
75
+ count: 0,
76
+ pattern: {
77
+ name: "greenwei",
78
+ scores: [800, 400, 180],
79
+ },
80
+ });
@@ -0,0 +1,8 @@
1
+ export declare const modes: {
2
+ readonly greenwei: import("../mode").Mode<"greenwei">;
3
+ readonly normal: import("../mode").Mode<"normal">;
4
+ readonly pikachu: import("../mode").Mode<"pikachu">;
5
+ readonly superhhh: import("../mode").Mode<"superhhh">;
6
+ };
7
+ export type ModeName = typeof modes[keyof typeof modes]["name"];
8
+ export declare const modeList: (import("../mode").Mode<"greenwei"> | import("../mode").Mode<"normal"> | import("../mode").Mode<"pikachu"> | import("../mode").Mode<"superhhh">)[];
@@ -0,0 +1,17 @@
1
+ "use strict";
2
+ var __importDefault = (this && this.__importDefault) || function (mod) {
3
+ return (mod && mod.__esModule) ? mod : { "default": mod };
4
+ };
5
+ Object.defineProperty(exports, "__esModule", { value: true });
6
+ exports.modeList = exports.modes = void 0;
7
+ const greenwei_1 = __importDefault(require("./greenwei"));
8
+ const normal_1 = __importDefault(require("./normal"));
9
+ const pikachu_1 = __importDefault(require("./pikachu"));
10
+ const superhhh_1 = __importDefault(require("./superhhh"));
11
+ exports.modes = {
12
+ greenwei: greenwei_1.default,
13
+ normal: normal_1.default,
14
+ pikachu: pikachu_1.default,
15
+ superhhh: superhhh_1.default,
16
+ };
17
+ exports.modeList = Object.values(exports.modes);
@@ -0,0 +1,3 @@
1
+ import { Mode } from "../mode";
2
+ declare const _default: Mode<"normal">;
3
+ export default _default;
@@ -0,0 +1,11 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mode_1 = require("../mode");
4
+ exports.default = new mode_1.Mode(true, "normal", {
5
+ gss: 36,
6
+ hhh: 24,
7
+ hentai: 17,
8
+ handson: 12,
9
+ kachu: 8,
10
+ rrr: 3,
11
+ });
@@ -0,0 +1,3 @@
1
+ import { Mode } from "../mode";
2
+ declare const _default: Mode<"pikachu">;
3
+ export default _default;
@@ -0,0 +1,30 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mode_1 = require("../mode");
4
+ exports.default = new mode_1.Mode(false, "pikachu", {
5
+ gss: 36,
6
+ hhh: 24,
7
+ hentai: 17,
8
+ handson: 12,
9
+ kachu: 8,
10
+ rrr: 3,
11
+ }, {
12
+ gameStart: (_, mode) => {
13
+ mode.active = false;
14
+ mode.variable.times = 0;
15
+ },
16
+ roundEnd: (game, mode) => {
17
+ if (!game.isRunning() &&
18
+ game.patterns.some((p) => p && p.name === "kachu")) {
19
+ mode.active = true;
20
+ game.played -= 5;
21
+ mode.variable.times += 1;
22
+ }
23
+ },
24
+ }, {
25
+ times: 0,
26
+ pattern: {
27
+ name: "pikachu",
28
+ scores: [12000, 8000, 1250],
29
+ },
30
+ });
@@ -0,0 +1,3 @@
1
+ import { Mode } from "../mode";
2
+ declare const _default: Mode<"superhhh">;
3
+ export default _default;
@@ -0,0 +1,66 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ const mode_1 = require("../mode");
4
+ const randInt_1 = require("../utils/randInt");
5
+ exports.default = new mode_1.Mode(false, "superhhh", {
6
+ gss: 19,
7
+ hhh: 5,
8
+ hentai: 19,
9
+ handson: 19,
10
+ kachu: 19,
11
+ rrr: 19,
12
+ }, {
13
+ gameStart: (_, mode) => {
14
+ mode.active = false;
15
+ mode.variable.times = 0;
16
+ },
17
+ roundStart: (_, mode) => {
18
+ if (!mode.active)
19
+ return;
20
+ mode.variable.score = 0;
21
+ mode.variable.times -= 1;
22
+ },
23
+ rollSlots: (_, mode) => {
24
+ mode.variable.randNum = (0, randInt_1.randInt)(1, 100);
25
+ },
26
+ roundEnd: (game, mode) => {
27
+ const { patterns } = game;
28
+ const { variable } = mode;
29
+ let hhhCount = 0;
30
+ let allHHH = true;
31
+ for (const p of patterns) {
32
+ if (p?.name === "hhh")
33
+ hhhCount++;
34
+ else
35
+ allHHH = false;
36
+ }
37
+ if (mode.active) {
38
+ if (allHHH) {
39
+ variable.times += 2;
40
+ }
41
+ if (variable.times <= 0) {
42
+ mode.active = false;
43
+ }
44
+ }
45
+ else {
46
+ if (variable.randNum <= variable.rate && hhhCount > 0) {
47
+ mode.active = true;
48
+ variable.times += 6;
49
+ for (let i = 0; i < patterns.length; i++) {
50
+ if (patterns[i]?.name === "hhh") {
51
+ patterns[i] = variable.pattern;
52
+ }
53
+ }
54
+ }
55
+ }
56
+ },
57
+ }, {
58
+ times: 0,
59
+ rate: 15,
60
+ score: 0,
61
+ randNum: 0,
62
+ pattern: {
63
+ name: "superhhh",
64
+ scores: [1500, 800, 300],
65
+ },
66
+ });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "labag",
3
- "version": "2.0.1",
3
+ "version": "2.0.3",
4
4
  "description": "",
5
5
  "main": "dist/index.js",
6
6
  "types": "dist/index.d.ts",
package/src/index.ts CHANGED
@@ -1,211 +1,13 @@
1
1
  import { LaBaG } from "./labag";
2
- import { Mode } from "./mode";
3
- import { randInt } from "./utils/randInt";
2
+ import { modeList } from "./modes";
4
3
 
5
4
  const labag = new LaBaG();
6
-
7
- const modes: ConstructorParameters<typeof Mode>[] = [
8
- [
9
- false,
10
- "superhhh",
11
- {
12
- gss: 19,
13
- hhh: 5,
14
- hentai: 19,
15
- handson: 19,
16
- kachu: 19,
17
- rrr: 19,
18
- },
19
- {
20
- gameStart: (_, mode) => {
21
- mode.active = false;
22
- mode.variable.times = 0;
23
- },
24
- roundStart: (_, mode) => {
25
- if (!mode.active) return;
26
- mode.variable.score = 0;
27
- mode.variable.times -= 1;
28
- },
29
- rollSlots: (_, mode) => {
30
- mode.variable.randNum = randInt(1, 100);
31
- },
32
- roundEnd: (game, mode) => {
33
- const { patterns } = game;
34
- const { variable } = mode;
35
-
36
- let hhhCount = 0;
37
- let allHHH = true;
38
- for (const p of patterns) {
39
- if (p?.name === "hhh") hhhCount++;
40
- else allHHH = false;
41
- }
42
-
43
- if (mode.active) {
44
- if (allHHH) {
45
- variable.times += 2;
46
- }
47
- if (variable.times <= 0) {
48
- mode.active = false;
49
- }
50
- } else {
51
- if (variable.randNum <= variable.rate && hhhCount > 0) {
52
- mode.active = true;
53
- variable.times += 6;
54
-
55
- for (let i = 0; i < patterns.length; i++) {
56
- if (patterns[i]?.name === "hhh") {
57
- patterns[i] = variable.pattern;
58
- }
59
- }
60
- }
61
- }
62
- },
63
- },
64
- {
65
- times: 0,
66
- rate: 15,
67
- score: 0,
68
- randNum: 0,
69
- pattern: {
70
- name: "superhhh",
71
- scores: [1500, 800, 300],
72
- },
73
- },
74
- ],
75
- [
76
- false,
77
- "greenwei",
78
- {
79
- gss: 36,
80
- hhh: 24,
81
- hentai: 17,
82
- handson: 12,
83
- kachu: 8,
84
- rrr: 3,
85
- },
86
- {
87
- gameStart: (_, mode) => {
88
- mode.active = false;
89
- mode.variable.times = 0;
90
- },
91
- roundStart: (_, mode) => {
92
- if (!mode.active) return;
93
- mode.variable.times -= 1;
94
- },
95
- rollSlots: (_, mode) => {
96
- mode.variable.randNum = randInt(1, 100);
97
- },
98
- calculateScore: (game, mode) => {
99
- if (mode.active) {
100
- game.marginScore = Math.round(game.marginScore * 3);
101
- }
102
- },
103
- roundEnd: (game, mode) => {
104
- const { patterns } = game;
105
- const { variable } = mode;
106
-
107
- let gssCount = 0;
108
- let allGSS = true;
109
- for (const p of patterns) {
110
- if (p?.name === "gss") gssCount++;
111
- else allGSS = false;
112
- }
113
-
114
- variable.count += gssCount;
115
-
116
- if (mode.active) {
117
- if (allGSS) {
118
- variable.times += 1;
119
- }
120
- if (variable.times <= 0) {
121
- mode.active = false;
122
- }
123
- } else {
124
- let activated = false;
125
- if (variable.randNum <= variable.rate && allGSS) {
126
- activated = true;
127
- variable.times += 2;
128
- } else if (variable.count >= 20) {
129
- activated = true;
130
- variable.times += 2;
131
- variable.count -= 20;
132
- }
133
-
134
- if (activated) {
135
- mode.active = true;
136
- for (let i = 0; i < patterns.length; i++) {
137
- if (patterns[i]?.name === "gss") {
138
- patterns[i] = variable.pattern;
139
- }
140
- }
141
- }
142
- }
143
- },
144
- },
145
- {
146
- times: 0,
147
- rate: 35,
148
- randNum: 0,
149
- count: 0,
150
- pattern: {
151
- name: "greenwei",
152
- scores: [800, 400, 180],
153
- },
154
- },
155
- ],
156
- [
157
- false,
158
- "pikachu",
159
- {
160
- gss: 36,
161
- hhh: 24,
162
- hentai: 17,
163
- handson: 12,
164
- kachu: 8,
165
- rrr: 3,
166
- },
167
- {
168
- gameStart: (_, mode) => {
169
- mode.active = false;
170
- mode.variable.times = 0;
171
- },
172
- roundEnd: (game, mode) => {
173
- if (
174
- !game.isRunning() &&
175
- game.patterns.some((p) => p && p.name === "kachu")
176
- ) {
177
- mode.active = true;
178
- game.played -= 5;
179
- mode.variable.times += 1;
180
- }
181
- },
182
- },
183
- {
184
- times: 0,
185
- pattern: {
186
- name: "pikachu",
187
- scores: [12000, 8000, 1250],
188
- },
189
- },
190
- ],
191
- [
192
- true,
193
- "normal",
194
- {
195
- gss: 36,
196
- hhh: 24,
197
- hentai: 17,
198
- handson: 12,
199
- kachu: 8,
200
- rrr: 3,
201
- },
202
- ],
203
- ];
204
-
205
- for (const modeArgs of modes) {
206
- const mode = new Mode(...modeArgs);
207
- labag.addMode(mode);
208
- }
209
-
5
+ modeList.forEach((mode) => {
6
+ console.log(mode);
7
+ if (mode.active) {
8
+ labag.modes.push(mode);
9
+ } else {
10
+ labag.addMode(mode);
11
+ }
12
+ });
210
13
  export default labag;
211
-
package/src/mode.ts CHANGED
@@ -5,11 +5,11 @@ import { LaBaGEvent, Pattern, PatternName } from "./types";
5
5
  /**
6
6
  * 代表遊戲的一種模式,包含機率設定和事件監聽器。
7
7
  */
8
- export class Mode {
8
+ export class Mode<N extends string = string> {
9
9
  /** 模式是否啟用 */
10
10
  active: boolean;
11
11
  /** 模式名稱 */
12
- name: string;
12
+ name: N;
13
13
  /** 各圖案出現的機率 */
14
14
  rates: Record<PatternName, number>;
15
15
  // 預先計算的區間,用於高效查找
@@ -30,7 +30,7 @@ export class Mode {
30
30
  */
31
31
  constructor(
32
32
  active: boolean,
33
- name: string,
33
+ name: N,
34
34
  rates: Record<PatternName, number>,
35
35
  eventListener?: Partial<
36
36
  Record<LaBaGEvent, (game: LaBaG, mode: Mode) => void>
@@ -0,0 +1,84 @@
1
+ import { Mode } from "../mode";
2
+ import { randInt } from "../utils/randInt";
3
+
4
+ export default new Mode(
5
+ false,
6
+ "greenwei",
7
+ {
8
+ gss: 36,
9
+ hhh: 24,
10
+ hentai: 17,
11
+ handson: 12,
12
+ kachu: 8,
13
+ rrr: 3,
14
+ },
15
+ {
16
+ gameStart: (_, mode) => {
17
+ mode.active = false;
18
+ mode.variable.times = 0;
19
+ },
20
+ roundStart: (_, mode) => {
21
+ if (!mode.active) return;
22
+ mode.variable.times -= 1;
23
+ },
24
+ rollSlots: (_, mode) => {
25
+ mode.variable.randNum = randInt(1, 100);
26
+ },
27
+ calculateScore: (game, mode) => {
28
+ if (mode.active) {
29
+ game.marginScore = Math.round(game.marginScore * 3);
30
+ }
31
+ },
32
+ roundEnd: (game, mode) => {
33
+ const { patterns } = game;
34
+ const { variable } = mode;
35
+
36
+ let gssCount = 0;
37
+ let allGSS = true;
38
+ for (const p of patterns) {
39
+ if (p?.name === "gss") gssCount++;
40
+ else allGSS = false;
41
+ }
42
+
43
+ variable.count += gssCount;
44
+
45
+ if (mode.active) {
46
+ if (allGSS) {
47
+ variable.times += 1;
48
+ }
49
+ if (variable.times <= 0) {
50
+ mode.active = false;
51
+ }
52
+ } else {
53
+ let activated = false;
54
+ if (variable.randNum <= variable.rate && allGSS) {
55
+ activated = true;
56
+ variable.times += 2;
57
+ } else if (variable.count >= 20) {
58
+ activated = true;
59
+ variable.times += 2;
60
+ variable.count -= 20;
61
+ }
62
+
63
+ if (activated) {
64
+ mode.active = true;
65
+ for (let i = 0; i < patterns.length; i++) {
66
+ if (patterns[i]?.name === "gss") {
67
+ patterns[i] = variable.pattern;
68
+ }
69
+ }
70
+ }
71
+ }
72
+ },
73
+ },
74
+ {
75
+ times: 0,
76
+ rate: 35,
77
+ randNum: 0,
78
+ count: 0,
79
+ pattern: {
80
+ name: "greenwei",
81
+ scores: [800, 400, 180],
82
+ },
83
+ }
84
+ );
@@ -0,0 +1,15 @@
1
+ import greenwei from "./greenwei";
2
+ import normal from "./normal";
3
+ import pikachu from "./pikachu";
4
+ import superhhh from "./superhhh";
5
+
6
+ export const modes = {
7
+ greenwei,
8
+ normal,
9
+ pikachu,
10
+ superhhh,
11
+ } as const;
12
+
13
+ export type ModeName = typeof modes[keyof typeof modes]["name"];
14
+
15
+ export const modeList = Object.values(modes);
@@ -0,0 +1,10 @@
1
+ import { Mode } from "../mode";
2
+
3
+ export default new Mode(true, "normal", {
4
+ gss: 36,
5
+ hhh: 24,
6
+ hentai: 17,
7
+ handson: 12,
8
+ kachu: 8,
9
+ rrr: 3,
10
+ });
@@ -0,0 +1,37 @@
1
+ import { Mode } from "../mode";
2
+
3
+ export default new Mode(
4
+ false,
5
+ "pikachu",
6
+ {
7
+ gss: 36,
8
+ hhh: 24,
9
+ hentai: 17,
10
+ handson: 12,
11
+ kachu: 8,
12
+ rrr: 3,
13
+ },
14
+ {
15
+ gameStart: (_, mode) => {
16
+ mode.active = false;
17
+ mode.variable.times = 0;
18
+ },
19
+ roundEnd: (game, mode) => {
20
+ if (
21
+ !game.isRunning() &&
22
+ game.patterns.some((p) => p && p.name === "kachu")
23
+ ) {
24
+ mode.active = true;
25
+ game.played -= 5;
26
+ mode.variable.times += 1;
27
+ }
28
+ },
29
+ },
30
+ {
31
+ times: 0,
32
+ pattern: {
33
+ name: "pikachu",
34
+ scores: [12000, 8000, 1250],
35
+ },
36
+ }
37
+ );
@@ -0,0 +1,70 @@
1
+ import { Mode } from "../mode";
2
+ import { randInt } from "../utils/randInt";
3
+
4
+ export default new Mode(
5
+ false,
6
+ "superhhh",
7
+ {
8
+ gss: 19,
9
+ hhh: 5,
10
+ hentai: 19,
11
+ handson: 19,
12
+ kachu: 19,
13
+ rrr: 19,
14
+ },
15
+ {
16
+ gameStart: (_, mode) => {
17
+ mode.active = false;
18
+ mode.variable.times = 0;
19
+ },
20
+ roundStart: (_, mode) => {
21
+ if (!mode.active) return;
22
+ mode.variable.score = 0;
23
+ mode.variable.times -= 1;
24
+ },
25
+ rollSlots: (_, mode) => {
26
+ mode.variable.randNum = randInt(1, 100);
27
+ },
28
+ roundEnd: (game, mode) => {
29
+ const { patterns } = game;
30
+ const { variable } = mode;
31
+
32
+ let hhhCount = 0;
33
+ let allHHH = true;
34
+ for (const p of patterns) {
35
+ if (p?.name === "hhh") hhhCount++;
36
+ else allHHH = false;
37
+ }
38
+
39
+ if (mode.active) {
40
+ if (allHHH) {
41
+ variable.times += 2;
42
+ }
43
+ if (variable.times <= 0) {
44
+ mode.active = false;
45
+ }
46
+ } else {
47
+ if (variable.randNum <= variable.rate && hhhCount > 0) {
48
+ mode.active = true;
49
+ variable.times += 6;
50
+
51
+ for (let i = 0; i < patterns.length; i++) {
52
+ if (patterns[i]?.name === "hhh") {
53
+ patterns[i] = variable.pattern;
54
+ }
55
+ }
56
+ }
57
+ }
58
+ },
59
+ },
60
+ {
61
+ times: 0,
62
+ rate: 15,
63
+ score: 0,
64
+ randNum: 0,
65
+ pattern: {
66
+ name: "superhhh",
67
+ scores: [1500, 800, 300],
68
+ },
69
+ }
70
+ );