labag 1.0.7 → 1.0.9
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/types/BaseLaBaG.js +16 -16
- package/dist/utils/data.d.ts +3 -0
- package/dist/utils/data.js +13 -0
- package/package.json +1 -1
- package/src/types/BaseLaBaG.ts +2 -2
- package/src/utils/data.ts +12 -0
package/dist/types/BaseLaBaG.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.BaseLaBaG = void 0;
|
|
4
|
-
const
|
|
4
|
+
const __1 = require("..");
|
|
5
5
|
const P_1 = require("./P");
|
|
6
|
-
const RandInt_1 = require("
|
|
6
|
+
const RandInt_1 = require("../utils/RandInt");
|
|
7
7
|
class BaseLaBaG {
|
|
8
8
|
AllData = {};
|
|
9
9
|
OneData = {};
|
|
@@ -43,7 +43,7 @@ class BaseLaBaG {
|
|
|
43
43
|
}
|
|
44
44
|
NowMode() {
|
|
45
45
|
// 查找當前模式
|
|
46
|
-
const mode = Object.entries(
|
|
46
|
+
const mode = Object.entries(__1.Modes).find(([_, mode]) => mode.InMode ?? false);
|
|
47
47
|
return mode ? mode[0] : "Normal";
|
|
48
48
|
}
|
|
49
49
|
Reset() {
|
|
@@ -55,7 +55,7 @@ class BaseLaBaG {
|
|
|
55
55
|
this.MarginScore = 0;
|
|
56
56
|
this.ScoreTime = 1;
|
|
57
57
|
this.Ps = [null, null, null];
|
|
58
|
-
Object.values(
|
|
58
|
+
Object.values(__1.Modes).forEach((mode) => {
|
|
59
59
|
if (mode.InMode !== undefined)
|
|
60
60
|
mode.InMode = false;
|
|
61
61
|
if (mode.Score !== undefined)
|
|
@@ -71,11 +71,11 @@ class BaseLaBaG {
|
|
|
71
71
|
RandNums.forEach((RandNum, index) => {
|
|
72
72
|
this.OneData[`RandNums[${index}]`] = RandNum;
|
|
73
73
|
});
|
|
74
|
-
Object.values(
|
|
74
|
+
Object.values(__1.Modes).forEach((mode) => {
|
|
75
75
|
mode.Random?.();
|
|
76
76
|
});
|
|
77
|
-
this.OneData["SuperHHH"] =
|
|
78
|
-
this.OneData["GreenWei"] =
|
|
77
|
+
this.OneData["SuperHHH"] = __1.Modes.SuperHHH.RandNum;
|
|
78
|
+
this.OneData["GreenWei"] = __1.Modes.GreenWei.RandNum;
|
|
79
79
|
const RateRange = this.RateRanges[this.NowMode()];
|
|
80
80
|
const PCodes = Array.from(P_1.P.Map.keys());
|
|
81
81
|
RandNums.forEach((RandNum, i) => {
|
|
@@ -86,9 +86,9 @@ class BaseLaBaG {
|
|
|
86
86
|
});
|
|
87
87
|
// 累積咖波累積數
|
|
88
88
|
this.Ps.forEach((p) => {
|
|
89
|
-
if (
|
|
90
|
-
if (p?.code === "A" &&
|
|
91
|
-
|
|
89
|
+
if (__1.Modes.GreenWei.Score !== undefined) {
|
|
90
|
+
if (p?.code === "A" && __1.Modes.GreenWei.Score < 20) {
|
|
91
|
+
__1.Modes.GreenWei.Score += 1;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
94
94
|
});
|
|
@@ -137,23 +137,23 @@ class BaseLaBaG {
|
|
|
137
137
|
}
|
|
138
138
|
JudgeMode() {
|
|
139
139
|
if (!this.GameRunning()) {
|
|
140
|
-
|
|
140
|
+
__1.Modes.PiKaChu.Judge?.(this);
|
|
141
141
|
return;
|
|
142
142
|
}
|
|
143
143
|
const mode = this.NowMode();
|
|
144
144
|
switch (mode) {
|
|
145
145
|
case "Normal":
|
|
146
146
|
case "PiKaChu":
|
|
147
|
-
|
|
148
|
-
if (!
|
|
149
|
-
|
|
147
|
+
__1.Modes.SuperHHH.Judge?.(this);
|
|
148
|
+
if (!__1.Modes.SuperHHH.InMode) {
|
|
149
|
+
__1.Modes.GreenWei.Judge?.(this);
|
|
150
150
|
}
|
|
151
151
|
break;
|
|
152
152
|
case "SuperHHH":
|
|
153
|
-
|
|
153
|
+
__1.Modes.SuperHHH.Judge?.(this);
|
|
154
154
|
break;
|
|
155
155
|
case "GreenWei":
|
|
156
|
-
|
|
156
|
+
__1.Modes.GreenWei.Judge?.(this);
|
|
157
157
|
break;
|
|
158
158
|
}
|
|
159
159
|
}
|
|
@@ -0,0 +1,13 @@
|
|
|
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;
|
package/package.json
CHANGED
package/src/types/BaseLaBaG.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import { Modes } from "
|
|
1
|
+
import { Modes } from "..";
|
|
2
2
|
import { AllDataType, LaBaG, OneDataType } from "./LaBaG";
|
|
3
3
|
import { Mode, ModeNames } from "./Mode";
|
|
4
4
|
import { P } from "./P";
|
|
5
|
-
import { RandInt } from "
|
|
5
|
+
import { RandInt } from "../utils/RandInt";
|
|
6
6
|
|
|
7
7
|
export class BaseLaBaG implements LaBaG {
|
|
8
8
|
AllData: AllDataType = {};
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { JsonLaBaG } from "../types/JsonLaBaG";
|
|
2
|
+
import { AllDataType } from "../types/LaBaG";
|
|
3
|
+
|
|
4
|
+
export const parseScore = (allData: AllDataType): number => {
|
|
5
|
+
const game = new JsonLaBaG();
|
|
6
|
+
game.SetupData(allData);
|
|
7
|
+
game.Logic();
|
|
8
|
+
return game.Score;
|
|
9
|
+
};
|
|
10
|
+
|
|
11
|
+
export const verifyScore = (score: number, allData: AllDataType): boolean =>
|
|
12
|
+
parseScore(allData) === score;
|