labag 1.2.2 → 2.0.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.
Files changed (46) hide show
  1. package/dist/index.d.ts +3 -9
  2. package/dist/index.js +190 -160
  3. package/dist/labag.d.ts +78 -0
  4. package/dist/labag.js +222 -0
  5. package/dist/mode.d.ts +30 -0
  6. package/dist/mode.js +51 -0
  7. package/dist/pattern.d.ts +22 -0
  8. package/dist/pattern.js +32 -0
  9. package/dist/test.d.ts +1 -0
  10. package/dist/test.js +35 -0
  11. package/dist/types/index.d.ts +18 -0
  12. package/dist/utils/randInt.d.ts +7 -0
  13. package/dist/utils/randInt.js +11 -0
  14. package/package.json +1 -1
  15. package/src/index.ts +190 -178
  16. package/src/labag.ts +239 -0
  17. package/src/mode.ts +61 -0
  18. package/src/pattern.ts +31 -0
  19. package/src/test.ts +37 -0
  20. package/src/types/index.ts +28 -0
  21. package/src/utils/randInt.ts +8 -0
  22. package/tsconfig.json +13 -13
  23. package/dist/types/BaseLaBaG.d.ts +0 -26
  24. package/dist/types/BaseLaBaG.js +0 -174
  25. package/dist/types/JsonLaBaG.d.ts +0 -11
  26. package/dist/types/JsonLaBaG.js +0 -62
  27. package/dist/types/LaBaG.d.ts +0 -26
  28. package/dist/types/Mode.d.ts +0 -11
  29. package/dist/types/Mode.js +0 -2
  30. package/dist/types/P.d.ts +0 -17
  31. package/dist/types/P.js +0 -25
  32. package/dist/types/PlayLaBaG.d.ts +0 -9
  33. package/dist/types/PlayLaBaG.js +0 -77
  34. package/dist/utils/RandInt.d.ts +0 -1
  35. package/dist/utils/RandInt.js +0 -6
  36. package/dist/utils/data.d.ts +0 -3
  37. package/dist/utils/data.js +0 -13
  38. package/src/types/BaseLaBaG.ts +0 -193
  39. package/src/types/JsonLaBaG.ts +0 -70
  40. package/src/types/LaBaG.ts +0 -37
  41. package/src/types/Mode.ts +0 -13
  42. package/src/types/P.ts +0 -40
  43. package/src/types/PlayLaBaG.ts +0 -80
  44. package/src/utils/RandInt.ts +0 -3
  45. package/src/utils/data.ts +0 -12
  46. /package/dist/types/{LaBaG.js → index.js} +0 -0
@@ -1,11 +0,0 @@
1
- import { BaseLaBaG } from "./BaseLaBaG";
2
- import { AllDataType } from "./LaBaG";
3
- export declare class JsonLaBaG extends BaseLaBaG {
4
- jsonData: AllDataType;
5
- dataIndex: number;
6
- constructor();
7
- SetupData(data: AllDataType): void;
8
- Reset(): void;
9
- Random(): void;
10
- Result(): void;
11
- }
@@ -1,62 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.JsonLaBaG = void 0;
4
- const P_1 = require("./P");
5
- const __1 = require("..");
6
- const BaseLaBaG_1 = require("./BaseLaBaG");
7
- class JsonLaBaG extends BaseLaBaG_1.BaseLaBaG {
8
- jsonData;
9
- dataIndex;
10
- constructor() {
11
- super();
12
- this.jsonData = {};
13
- this.dataIndex = 1;
14
- }
15
- SetupData(data) {
16
- this.jsonData = data;
17
- }
18
- Reset() {
19
- super.Reset();
20
- this.dataIndex = 1;
21
- }
22
- Random() {
23
- const currData = this.jsonData[`${this.dataIndex}`];
24
- if (!currData) {
25
- throw new Error("No data found for the current index");
26
- }
27
- try {
28
- const RandNums = [
29
- currData["RandNums[0]"] ?? 0,
30
- currData["RandNums[1]"] ?? 0,
31
- currData["RandNums[2]"] ?? 0,
32
- ];
33
- __1.Modes.SuperHHH.RandNum = currData["SuperHHH"] ?? 0;
34
- __1.Modes.GreenWei.RandNum = currData["GreenWei"] ?? 0;
35
- const RateRange = this.RateRanges[this.NowMode()];
36
- const PCodes = Array.from(P_1.P.Map.keys());
37
- RandNums.forEach((RandNum, i) => {
38
- const code = PCodes.find((_, j) => RandNum <= RateRange[j]);
39
- if (code) {
40
- this.Ps[i] = P_1.P.Map.get(code) ?? null;
41
- }
42
- });
43
- // 累積 GreenWei 分數
44
- this.Ps.forEach((p) => {
45
- if (p?.code === "A" &&
46
- __1.Modes.GreenWei.Score !== undefined &&
47
- __1.Modes.GreenWei.Score < 20) {
48
- __1.Modes.GreenWei.Score += 1;
49
- }
50
- });
51
- }
52
- catch (error) {
53
- console.error("Error in Random():", error);
54
- super.Random();
55
- }
56
- }
57
- Result() {
58
- super.Result();
59
- this.dataIndex++;
60
- }
61
- }
62
- exports.JsonLaBaG = JsonLaBaG;
@@ -1,26 +0,0 @@
1
- import { P } from "../types/P";
2
- import { ModeNames } from "../types/Mode";
3
- export type OneDataType = Partial<Record<"SuperHHH" | "GreenWei" | `RandNums[${0 | 1 | 2}]`, number>>;
4
- export type AllDataType = Record<`${number}`, OneDataType>;
5
- export interface LaBaG {
6
- AllData: AllDataType;
7
- OneData: OneDataType;
8
- DataIndex: number;
9
- Times: number;
10
- Played: number;
11
- Score: number;
12
- MarginScore: number;
13
- Ps: [P | null, P | null, P | null];
14
- RateRanges: Record<ModeNames, number[]>;
15
- ScoreTimes: Record<ModeNames, number>;
16
- ScoreTime: number;
17
- ModeToScreen: boolean;
18
- GameRunning(): boolean;
19
- NowMode(): ModeNames;
20
- Reset(): void;
21
- Random(): void;
22
- CalculateScore(): void;
23
- Result(): void;
24
- JudgeMode(): void;
25
- Logic(): void;
26
- }
@@ -1,11 +0,0 @@
1
- import { LaBaG } from "./LaBaG";
2
- export type Mode = {
3
- InMode?: boolean;
4
- Rate?: number;
5
- Times?: number;
6
- Score?: number;
7
- RandNum?: number;
8
- Random?: () => void;
9
- Judge?: (Game: LaBaG) => void;
10
- };
11
- export type ModeNames = "Normal" | "GreenWei" | "SuperHHH" | "PiKaChu";
@@ -1,2 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
package/dist/types/P.d.ts DELETED
@@ -1,17 +0,0 @@
1
- import { ModeNames } from "./Mode";
2
- type ModeRates = Record<ModeNames, number>;
3
- export interface PData {
4
- name: string;
5
- code: string;
6
- rates: ModeRates;
7
- scores: [number, number, number];
8
- }
9
- export declare class P implements PData {
10
- static Map: Map<string, P>;
11
- name: string;
12
- code: string;
13
- scores: [number, number, number];
14
- rates: ModeRates;
15
- constructor(name: string | undefined, code: string, scores?: [number, number, number], rates?: ModeRates);
16
- }
17
- export {};
package/dist/types/P.js DELETED
@@ -1,25 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.P = void 0;
4
- class P {
5
- static Map = new Map();
6
- name;
7
- code;
8
- scores;
9
- rates;
10
- constructor(name = "", code, scores = [0, 0, 0], rates = {
11
- Normal: 0,
12
- SuperHHH: 0,
13
- GreenWei: 0,
14
- PiKaChu: 0,
15
- }) {
16
- this.name = name;
17
- this.code = code;
18
- this.scores = scores;
19
- this.rates = rates;
20
- if (this.code && !P.Map.has(this.code)) {
21
- P.Map.set(this.code, this);
22
- }
23
- }
24
- }
25
- exports.P = P;
@@ -1,9 +0,0 @@
1
- import { BaseLaBaG } from "./BaseLaBaG";
2
- export declare class PlayLaBaG extends BaseLaBaG {
3
- Reset(): void;
4
- Random(): void;
5
- CalculateScore(): void;
6
- Result(): void;
7
- JudgeMode(): void;
8
- Logic(): void;
9
- }
@@ -1,77 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.PlayLaBaG = void 0;
4
- const __1 = require("..");
5
- const BaseLaBaG_1 = require("./BaseLaBaG");
6
- class PlayLaBaG extends BaseLaBaG_1.BaseLaBaG {
7
- Reset() {
8
- super.Reset();
9
- console.log("遊戲已重置");
10
- }
11
- Random() {
12
- super.Random();
13
- console.log(`機率區間: ${this.RateRanges[this.NowMode()]}`);
14
- console.log(`超級阿禾隨機數為: ${__1.Modes.SuperHHH.RandNum}`);
15
- console.log(`綠光阿瑋隨機數為: ${__1.Modes.GreenWei.RandNum}`);
16
- console.log(`咖波累積數:${__1.Modes.GreenWei.Score}`);
17
- }
18
- CalculateScore() {
19
- super.CalculateScore();
20
- console.log(`加分倍數: ${this.ScoreTime}`);
21
- }
22
- Result() {
23
- super.Result();
24
- console.log("");
25
- console.log(`| ${this.Ps[0]?.code} | ${this.Ps[1]?.code} | ${this.Ps[2]?.code} |`);
26
- console.log(`+ ${this.MarginScore}`);
27
- console.log(`目前分數: ${this.Score}`);
28
- console.log(`剩餘次數: ${this.Times - this.Played}`);
29
- }
30
- JudgeMode() {
31
- super.JudgeMode();
32
- const mode = this.NowMode();
33
- switch (mode) {
34
- case "SuperHHH":
35
- if (this.ModeToScreen) {
36
- console.log("超級阿禾出現");
37
- if (__1.Modes.SuperHHH.Score !== 0) {
38
- console.log(`(超級阿禾加倍分: ${__1.Modes.SuperHHH.Score})`);
39
- }
40
- }
41
- else {
42
- if (this.Ps.every((p) => p?.code === "B")) {
43
- console.log("全阿禾,次數不消耗且+1!");
44
- }
45
- }
46
- console.log(`超級阿禾剩餘次數:${__1.Modes.SuperHHH.Times}次`);
47
- break;
48
- case "GreenWei":
49
- if (this.ModeToScreen) {
50
- console.log("綠光阿瑋出現");
51
- }
52
- else {
53
- if (this.Ps.every((p) => p?.code === "A")) {
54
- console.log("全咖波,次數不消耗!");
55
- }
56
- }
57
- console.log(`綠光阿瑋剩餘次數:${__1.Modes.GreenWei.Times}次`);
58
- break;
59
- case "PiKaChu":
60
- if (this.ModeToScreen) {
61
- console.log("皮卡丘為你充電");
62
- console.log(`已觸發 ${__1.Modes.PiKaChu.Times} 次皮卡丘充電`);
63
- }
64
- break;
65
- }
66
- }
67
- Logic() {
68
- this.ModeToScreen = false;
69
- this.OneData = {};
70
- this.MarginScore = 0;
71
- this.Random();
72
- this.CalculateScore();
73
- this.Result();
74
- this.JudgeMode();
75
- }
76
- }
77
- exports.PlayLaBaG = PlayLaBaG;
@@ -1 +0,0 @@
1
- export declare function RandInt(min: number, max: number): number;
@@ -1,6 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.RandInt = RandInt;
4
- function RandInt(min, max) {
5
- return Math.floor(Math.random() * (max - min + 1)) + min;
6
- }
@@ -1,3 +0,0 @@
1
- import { AllDataType } from "../types/LaBaG";
2
- export declare const parseScore: (allData: AllDataType) => number;
3
- export declare const verifyScore: (score: number, allData: AllDataType) => boolean;
@@ -1,13 +0,0 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.verifyScore = exports.parseScore = void 0;
4
- const JsonLaBaG_1 = require("../types/JsonLaBaG");
5
- const parseScore = (allData) => {
6
- const game = new JsonLaBaG_1.JsonLaBaG();
7
- game.SetupData(allData);
8
- game.Logic();
9
- return game.Score;
10
- };
11
- exports.parseScore = parseScore;
12
- const verifyScore = (score, allData) => (0, exports.parseScore)(allData) === score;
13
- exports.verifyScore = verifyScore;
@@ -1,193 +0,0 @@
1
- import { Modes } from "..";
2
- import { AllDataType, LaBaG, OneDataType } from "./LaBaG";
3
- import { Mode, ModeNames } from "./Mode";
4
- import { P } from "./P";
5
- import { RandInt } from "../utils/RandInt";
6
-
7
- export class BaseLaBaG implements LaBaG {
8
- AllData: AllDataType = {};
9
- OneData: OneDataType = {};
10
- DataIndex: number = 0;
11
-
12
- Times: number = 30;
13
- Played: number = 0;
14
-
15
- Score: number = 0;
16
- MarginScore: number = 0;
17
-
18
- Ps: [P | null, P | null, P | null] = [null, null, null];
19
-
20
- RateRanges: Record<ModeNames, number[]> = [
21
- "Normal",
22
- "SuperHHH",
23
- "GreenWei",
24
- "PiKaChu",
25
- ].reduce((Ranges: Record<ModeNames, number[]>, mode: string) => {
26
- const res: number[] = [];
27
- let accRate: number = 0;
28
- for (const p of P.Map.values()) {
29
- accRate += p.rates[mode as ModeNames];
30
- res.push(accRate);
31
- }
32
- Ranges[mode as ModeNames] = res;
33
- return Ranges;
34
- }, {} as Record<ModeNames, number[]>);
35
-
36
- ScoreTimes: Record<ModeNames, number> = {
37
- Normal: 1,
38
- SuperHHH: 1,
39
- GreenWei: 3,
40
- PiKaChu: 1,
41
- };
42
- ScoreTime: number = 1;
43
-
44
- ModeToScreen: boolean = false;
45
-
46
- constructor() {}
47
-
48
- GameRunning(): boolean {
49
- //遊戲進行
50
- return this.Times > this.Played;
51
- }
52
-
53
- NowMode(): ModeNames {
54
- // 查找當前模式
55
- const mode = Object.entries(Modes).find(
56
- ([_, mode]: [string, Mode]) => mode.InMode ?? false
57
- );
58
- return mode ? (mode[0] as ModeNames) : "Normal";
59
- }
60
-
61
- Reset() {
62
- // 重置
63
- this.AllData = {};
64
- this.DataIndex = 0;
65
-
66
- this.Played = 0;
67
- this.Score = 0;
68
- this.MarginScore = 0;
69
- this.ScoreTime = 1;
70
-
71
- this.Ps = [null, null, null];
72
-
73
- Object.values(Modes).forEach((mode: Mode) => {
74
- if (mode.InMode !== undefined) mode.InMode = false;
75
- if (mode.Score !== undefined) mode.Score = 0;
76
- if (mode.RandNum !== undefined) mode.RandNum = 0;
77
- if (mode.Times !== undefined) mode.Times = 0;
78
- });
79
- }
80
-
81
- Random(): void {
82
- const RandNums: [number, number, number] = Array.from({ length: 3 }, () =>
83
- RandInt(1, 100)
84
- ) as [number, number, number];
85
-
86
- RandNums.forEach((RandNum: number, index: number) => {
87
- this.OneData[`RandNums[${index}]` as `RandNums[${0 | 1 | 2}]`] = RandNum;
88
- });
89
-
90
- Object.values(Modes).forEach((mode: Mode) => {
91
- mode.Random?.();
92
- });
93
- this.OneData["SuperHHH"] = Modes.SuperHHH.RandNum as number;
94
- this.OneData["GreenWei"] = Modes.GreenWei.RandNum as number;
95
-
96
- const RateRange: number[] = this.RateRanges[this.NowMode()];
97
- const PCodes = Array.from(P.Map.keys());
98
- RandNums.forEach((RandNum: number, i: number) => {
99
- const code = PCodes.find((_, j: number) => RandNum <= RateRange[j]);
100
- if (code) {
101
- this.Ps[i] = P.Map.get(code) ?? null;
102
- }
103
- });
104
-
105
- // 累積咖波累積數
106
- this.Ps.forEach((p) => {
107
- if (Modes.GreenWei.Score !== undefined) {
108
- if (p?.code === "A" && Modes.GreenWei.Score < 20) {
109
- Modes.GreenWei.Score += 1;
110
- }
111
- }
112
- });
113
- }
114
- CalculateScore(): void {
115
- //計算分數
116
- const UniqueCount: number = new Set(this.Ps.map((p) => p?.code)).size;
117
- switch (UniqueCount) {
118
- case 1: // 三個一樣
119
- this.MarginScore += this.Ps[0]?.scores?.[0] as number;
120
- break;
121
- case 2: // 兩個一樣
122
- if (this.Ps[0]?.code === this.Ps[1]?.code) {
123
- this.MarginScore += this.Ps[0]?.scores?.[1] as number;
124
- this.MarginScore += this.Ps[2]?.scores?.[2] as number;
125
- this.MarginScore = Math.round(this.MarginScore / 1.4);
126
- } else if (this.Ps[1]?.code === this.Ps[2]?.code) {
127
- this.MarginScore += this.Ps[1]?.scores?.[1] as number;
128
- this.MarginScore += this.Ps[0]?.scores?.[2] as number;
129
- this.MarginScore = Math.round(this.MarginScore / 1.4);
130
- } else if (this.Ps[2]?.code === this.Ps[0]?.code) {
131
- this.MarginScore += this.Ps[2]?.scores?.[1] as number;
132
- this.MarginScore += this.Ps[1]?.scores?.[2] as number;
133
- this.MarginScore = Math.round(this.MarginScore / 1.4);
134
- }
135
- break;
136
- case 3: // 三個不一樣
137
- this.MarginScore += this.Ps[0]?.scores?.[2] as number;
138
- this.MarginScore += this.Ps[1]?.scores?.[2] as number;
139
- this.MarginScore += this.Ps[2]?.scores?.[2] as number;
140
- this.MarginScore = Math.round(this.MarginScore / 3);
141
- break;
142
- }
143
-
144
- // 根據當前模式更新加分倍數
145
- this.ScoreTime = this.ScoreTimes[this.NowMode()];
146
- this.MarginScore *= this.ScoreTime;
147
- }
148
- Result(): void {
149
- // 結果
150
- this.Played += 1;
151
- this.DataIndex += 1;
152
- this.Score += this.MarginScore;
153
- this.AllData[`${this.DataIndex}`] = this.OneData;
154
- }
155
- JudgeMode(): void {
156
- if (!this.GameRunning()) {
157
- Modes.PiKaChu.Judge?.(this);
158
- return;
159
- }
160
-
161
- const mode: ModeNames = this.NowMode();
162
- switch (mode) {
163
- case "Normal":
164
- case "PiKaChu":
165
- Modes.SuperHHH.Judge?.(this);
166
- if (!Modes.SuperHHH.InMode) {
167
- Modes.GreenWei.Judge?.(this);
168
- }
169
- break;
170
- case "SuperHHH":
171
- Modes.SuperHHH.Judge?.(this);
172
- break;
173
- case "GreenWei":
174
- Modes.GreenWei.Judge?.(this);
175
- break;
176
- }
177
- }
178
- Logic(): void {
179
- // 邏輯流程
180
- this.Reset();
181
- while (this.GameRunning()) {
182
- this.ModeToScreen = false;
183
- this.OneData = {};
184
-
185
- this.MarginScore = 0;
186
-
187
- this.Random();
188
- this.CalculateScore();
189
- this.Result();
190
- this.JudgeMode();
191
- }
192
- }
193
- }
@@ -1,70 +0,0 @@
1
- import { P } from "./P";
2
- import { Modes } from "..";
3
- import { BaseLaBaG } from "./BaseLaBaG";
4
- import { AllDataType } from "./LaBaG";
5
-
6
- export class JsonLaBaG extends BaseLaBaG {
7
- jsonData: AllDataType;
8
- dataIndex: number;
9
- constructor() {
10
- super();
11
- this.jsonData = {};
12
- this.dataIndex = 1;
13
- }
14
-
15
- SetupData(data: AllDataType): void {
16
- this.jsonData = data;
17
- }
18
-
19
- Reset(): void {
20
- super.Reset();
21
- this.dataIndex = 1;
22
- }
23
-
24
- Random(): void {
25
- const currData = this.jsonData[`${this.dataIndex}`];
26
- if (!currData) {
27
- throw new Error("No data found for the current index");
28
- }
29
-
30
- try {
31
- const RandNums: [number, number, number] = [
32
- currData["RandNums[0]"] ?? 0,
33
- currData["RandNums[1]"] ?? 0,
34
- currData["RandNums[2]"] ?? 0,
35
- ];
36
-
37
- Modes.SuperHHH.RandNum = currData["SuperHHH"] ?? 0;
38
- Modes.GreenWei.RandNum = currData["GreenWei"] ?? 0;
39
-
40
- const RateRange = this.RateRanges[this.NowMode()];
41
- const PCodes = Array.from(P.Map.keys());
42
-
43
- RandNums.forEach((RandNum, i) => {
44
- const code = PCodes.find((_, j) => RandNum <= RateRange[j]);
45
- if (code) {
46
- this.Ps[i] = P.Map.get(code) ?? null;
47
- }
48
- });
49
-
50
- // 累積 GreenWei 分數
51
- this.Ps.forEach((p) => {
52
- if (
53
- p?.code === "A" &&
54
- Modes.GreenWei.Score !== undefined &&
55
- Modes.GreenWei.Score < 20
56
- ) {
57
- Modes.GreenWei.Score += 1;
58
- }
59
- });
60
- } catch (error) {
61
- console.error("Error in Random():", error);
62
- super.Random();
63
- }
64
- }
65
-
66
- Result(): void {
67
- super.Result();
68
- this.dataIndex++;
69
- }
70
- }
@@ -1,37 +0,0 @@
1
- import { P } from "../types/P";
2
- import { ModeNames } from "../types/Mode";
3
-
4
- export type OneDataType = Partial<
5
- Record<"SuperHHH" | "GreenWei" | `RandNums[${0 | 1 | 2}]`, number>
6
- >;
7
-
8
- export type AllDataType = Record<`${number}`, OneDataType>;
9
-
10
- export interface LaBaG {
11
- AllData: AllDataType;
12
- OneData: OneDataType;
13
- DataIndex: number;
14
-
15
- Times: number;
16
- Played: number;
17
-
18
- Score: number;
19
- MarginScore: number;
20
-
21
- Ps: [P | null, P | null, P | null];
22
-
23
- RateRanges: Record<ModeNames, number[]>;
24
- ScoreTimes: Record<ModeNames, number>;
25
- ScoreTime: number;
26
-
27
- ModeToScreen: boolean;
28
-
29
- GameRunning(): boolean;
30
- NowMode(): ModeNames;
31
- Reset(): void;
32
- Random(): void;
33
- CalculateScore(): void;
34
- Result(): void;
35
- JudgeMode(): void;
36
- Logic(): void;
37
- }
package/src/types/Mode.ts DELETED
@@ -1,13 +0,0 @@
1
- import { LaBaG } from "./LaBaG";
2
-
3
- export type Mode = {
4
- InMode?: boolean;
5
- Rate?: number;
6
- Times?: number;
7
- Score?: number;
8
- RandNum?: number;
9
- Random?: () => void;
10
- Judge?: (Game: LaBaG) => void;
11
- };
12
-
13
- export type ModeNames = "Normal" | "GreenWei" | "SuperHHH" | "PiKaChu";
package/src/types/P.ts DELETED
@@ -1,40 +0,0 @@
1
- import { ModeNames } from "./Mode";
2
-
3
- // 定義 ModeRates 類型,方便重用
4
- type ModeRates = Record<ModeNames, number>;
5
-
6
- export interface PData {
7
- name: string;
8
- code: string;
9
- rates: ModeRates;
10
- scores: [number, number, number];
11
- }
12
-
13
- export class P implements PData {
14
- static Map: Map<string, P> = new Map();
15
- name: string;
16
- code: string;
17
- scores: [number, number, number];
18
- rates: ModeRates;
19
-
20
- constructor(
21
- name = "",
22
- code: string,
23
- scores: [number, number, number] = [0, 0, 0],
24
- rates: ModeRates = {
25
- Normal: 0,
26
- SuperHHH: 0,
27
- GreenWei: 0,
28
- PiKaChu: 0,
29
- }
30
- ) {
31
- this.name = name;
32
- this.code = code;
33
- this.scores = scores;
34
- this.rates = rates;
35
-
36
- if (this.code && !P.Map.has(this.code)) {
37
- P.Map.set(this.code, this);
38
- }
39
- }
40
- }