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