labag 1.0.0 → 1.0.2
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 +49 -15
- package/dist/types/JsonLaBaG.js +3 -3
- package/dist/types/LaBaG.js +18 -18
- package/dist/types/P.d.ts +12 -9
- package/dist/types/P.js +12 -10
- package/dist/types/PlayLaBaG.js +3 -3
- package/package.json +1 -1
- package/src/index.ts +49 -10
- package/src/types/JsonLaBaG.ts +3 -3
- package/src/types/LaBaG.ts +18 -18
- package/src/types/P.ts +22 -16
- package/src/types/PlayLaBaG.ts +3 -3
- package/dist/json/PDatas.json +0 -38
- package/src/json/PDatas.json +0 -38
- package/src/types/declaration.d.ts +0 -5
package/dist/index.d.ts
CHANGED
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import PDatas from "@/json/PDatas.json";
|
|
2
|
-
import { P, PData } from "@/types/P";
|
|
3
1
|
import { LaBaG } from "./types/LaBaG";
|
|
4
2
|
import { Mode, ModeNames } from "./types/Mode";
|
|
5
3
|
import { PlayLaBaG } from "./types/PlayLaBaG";
|
|
6
4
|
import { JsonLaBaG } from "./types/JsonLaBaG";
|
|
5
|
+
import { P, PData } from "./types/P";
|
|
6
|
+
declare const PDatas: Record<string, PData>;
|
|
7
7
|
declare const Modes: Record<Exclude<ModeNames, "Normal">, Mode>;
|
|
8
8
|
export { LaBaG, PlayLaBaG, JsonLaBaG, Modes, ModeNames, P, PData, PDatas };
|
package/dist/index.js
CHANGED
|
@@ -1,20 +1,54 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.PDatas = exports.P = exports.Modes = exports.JsonLaBaG = exports.PlayLaBaG = void 0;
|
|
7
|
-
const PDatas_json_1 = __importDefault(require("@/json/PDatas.json"));
|
|
8
|
-
exports.PDatas = PDatas_json_1.default;
|
|
9
|
-
const P_1 = require("@/types/P");
|
|
10
|
-
Object.defineProperty(exports, "P", { enumerable: true, get: function () { return P_1.P; } });
|
|
11
4
|
const RandInt_1 = require("./utils/RandInt");
|
|
12
5
|
const PlayLaBaG_1 = require("./types/PlayLaBaG");
|
|
13
6
|
Object.defineProperty(exports, "PlayLaBaG", { enumerable: true, get: function () { return PlayLaBaG_1.PlayLaBaG; } });
|
|
14
7
|
const JsonLaBaG_1 = require("./types/JsonLaBaG");
|
|
15
8
|
Object.defineProperty(exports, "JsonLaBaG", { enumerable: true, get: function () { return JsonLaBaG_1.JsonLaBaG; } });
|
|
16
|
-
|
|
17
|
-
|
|
9
|
+
const P_1 = require("./types/P");
|
|
10
|
+
Object.defineProperty(exports, "P", { enumerable: true, get: function () { return P_1.P; } });
|
|
11
|
+
const PDatas = {
|
|
12
|
+
Gss: {
|
|
13
|
+
name: "咖波",
|
|
14
|
+
code: "A",
|
|
15
|
+
rates: { Normal: 36, SuperHHH: 19, GreenWei: 36, PiKaChu: 36 },
|
|
16
|
+
scores: [800, 400, 180],
|
|
17
|
+
},
|
|
18
|
+
Hhh: {
|
|
19
|
+
name: "阿禾",
|
|
20
|
+
code: "B",
|
|
21
|
+
rates: { Normal: 24, SuperHHH: 5, GreenWei: 24, PiKaChu: 24 },
|
|
22
|
+
scores: [1500, 800, 300],
|
|
23
|
+
},
|
|
24
|
+
Hentai: {
|
|
25
|
+
name: "猥褻男",
|
|
26
|
+
code: "C",
|
|
27
|
+
rates: { Normal: 17, SuperHHH: 19, GreenWei: 17, PiKaChu: 17 },
|
|
28
|
+
scores: [2500, 1200, 500],
|
|
29
|
+
},
|
|
30
|
+
Handsun: {
|
|
31
|
+
name: "文傑",
|
|
32
|
+
code: "D",
|
|
33
|
+
rates: { Normal: 12, SuperHHH: 19, GreenWei: 12, PiKaChu: 12 },
|
|
34
|
+
scores: [2900, 1450, 690],
|
|
35
|
+
},
|
|
36
|
+
Kachu: {
|
|
37
|
+
name: "皮卡丘",
|
|
38
|
+
code: "E",
|
|
39
|
+
rates: { Normal: 8, SuperHHH: 19, GreenWei: 8, PiKaChu: 8 },
|
|
40
|
+
scores: [12000, 8000, 1250],
|
|
41
|
+
},
|
|
42
|
+
Rrr: {
|
|
43
|
+
name: "館長",
|
|
44
|
+
code: "F",
|
|
45
|
+
rates: { Normal: 3, SuperHHH: 19, GreenWei: 3, PiKaChu: 3 },
|
|
46
|
+
scores: [20000, 12000, 2500],
|
|
47
|
+
},
|
|
48
|
+
};
|
|
49
|
+
exports.PDatas = PDatas;
|
|
50
|
+
Object.values(PDatas).forEach((pd) => {
|
|
51
|
+
new P_1.P(pd.name, pd.code, pd.scores, pd.rates);
|
|
18
52
|
});
|
|
19
53
|
const Modes = {
|
|
20
54
|
// 超級阿禾
|
|
@@ -38,7 +72,7 @@ const Modes = {
|
|
|
38
72
|
this.Score = 0; // Reset score
|
|
39
73
|
if (this.InMode) {
|
|
40
74
|
this.Times -= 1;
|
|
41
|
-
if (Game.Ps.every((p) => p?.
|
|
75
|
+
if (Game.Ps.every((p) => p?.code === "B")) {
|
|
42
76
|
this.Times += 2;
|
|
43
77
|
}
|
|
44
78
|
if (this.Times <= 0) {
|
|
@@ -48,7 +82,7 @@ const Modes = {
|
|
|
48
82
|
}
|
|
49
83
|
}
|
|
50
84
|
else {
|
|
51
|
-
if (this.RandNum <= this.Rate && Game.Ps.some((p) => p?.
|
|
85
|
+
if (this.RandNum <= this.Rate && Game.Ps.some((p) => p?.code === "B")) {
|
|
52
86
|
this.InMode = true;
|
|
53
87
|
this.Times += 6;
|
|
54
88
|
Game.ModeToScreen = true;
|
|
@@ -56,7 +90,7 @@ const Modes = {
|
|
|
56
90
|
Modes.PiKaChu.InMode = false;
|
|
57
91
|
}
|
|
58
92
|
// 超級阿禾加倍
|
|
59
|
-
if (Game.Ps.every((p) => p?.
|
|
93
|
+
if (Game.Ps.every((p) => p?.code === "B")) {
|
|
60
94
|
this.Score = Math.round((Game.Score * Game.ScoreTime) / 2);
|
|
61
95
|
Game.MarginScore += this.Score;
|
|
62
96
|
}
|
|
@@ -83,7 +117,7 @@ const Modes = {
|
|
|
83
117
|
}
|
|
84
118
|
if (this.InMode) {
|
|
85
119
|
this.Times -= 1;
|
|
86
|
-
if (Game.Ps.every((p) => p?.
|
|
120
|
+
if (Game.Ps.every((p) => p?.code === "A")) {
|
|
87
121
|
this.Times += 1;
|
|
88
122
|
}
|
|
89
123
|
if (this.Times <= 0) {
|
|
@@ -94,7 +128,7 @@ const Modes = {
|
|
|
94
128
|
}
|
|
95
129
|
else {
|
|
96
130
|
if (this.RandNum <= this.Rate &&
|
|
97
|
-
Game.Ps.every((p) => p?.
|
|
131
|
+
Game.Ps.every((p) => p?.code === "A")) {
|
|
98
132
|
this.InMode = true;
|
|
99
133
|
this.Times += 2;
|
|
100
134
|
Game.ModeToScreen = true;
|
|
@@ -125,7 +159,7 @@ const Modes = {
|
|
|
125
159
|
// 關掉其他模式
|
|
126
160
|
Modes.SuperHHH.InMode = false;
|
|
127
161
|
Modes.GreenWei.InMode = false;
|
|
128
|
-
if (Game.Ps.some((p) => p?.
|
|
162
|
+
if (Game.Ps.some((p) => p?.code === "E")) {
|
|
129
163
|
this.InMode = true;
|
|
130
164
|
Game.Played -= 5;
|
|
131
165
|
this.Times += 1;
|
package/dist/types/JsonLaBaG.js
CHANGED
|
@@ -34,16 +34,16 @@ class JsonLaBaG extends LaBaG_1.BaseLaBaG {
|
|
|
34
34
|
__1.Modes.SuperHHH.RandNum = currData["SuperHHH"] ?? 0;
|
|
35
35
|
__1.Modes.GreenWei.RandNum = currData["GreenWei"] ?? 0;
|
|
36
36
|
const RateRange = this.RateRanges[this.NowMode()];
|
|
37
|
-
const PCodes = Object.keys(P_1.P.
|
|
37
|
+
const PCodes = Object.keys(P_1.P.Map);
|
|
38
38
|
RandNums.forEach((RandNum, i) => {
|
|
39
39
|
const code = PCodes.find((_, j) => RandNum <= RateRange[j]);
|
|
40
40
|
if (code) {
|
|
41
|
-
this.Ps[i] = P_1.P.
|
|
41
|
+
this.Ps[i] = P_1.P.Map.get(code) ?? null;
|
|
42
42
|
}
|
|
43
43
|
});
|
|
44
44
|
// 累積 GreenWei 分數
|
|
45
45
|
this.Ps.forEach((p) => {
|
|
46
|
-
if (p?.
|
|
46
|
+
if (p?.code === "A" &&
|
|
47
47
|
__1.Modes.GreenWei.Score !== undefined &&
|
|
48
48
|
__1.Modes.GreenWei.Score < 20) {
|
|
49
49
|
__1.Modes.GreenWei.Score += 1;
|
package/dist/types/LaBaG.js
CHANGED
|
@@ -21,7 +21,7 @@ class BaseLaBaG {
|
|
|
21
21
|
].reduce((Ranges, mode) => {
|
|
22
22
|
const res = [];
|
|
23
23
|
let accRate = 0;
|
|
24
|
-
for (const p of Object.values(P_1.P.
|
|
24
|
+
for (const p of Object.values(P_1.P.Map)) {
|
|
25
25
|
accRate += p.Rates[mode];
|
|
26
26
|
res.push(accRate);
|
|
27
27
|
}
|
|
@@ -77,17 +77,17 @@ class BaseLaBaG {
|
|
|
77
77
|
this.OneData["SuperHHH"] = __1.Modes.SuperHHH.RandNum;
|
|
78
78
|
this.OneData["GreenWei"] = __1.Modes.GreenWei.RandNum;
|
|
79
79
|
const RateRange = this.RateRanges[this.NowMode()];
|
|
80
|
-
const PCodes = Object.keys(P_1.P.
|
|
80
|
+
const PCodes = Object.keys(P_1.P.Map);
|
|
81
81
|
RandNums.forEach((RandNum, i) => {
|
|
82
82
|
const code = PCodes.find((_, j) => RandNum <= RateRange[j]);
|
|
83
83
|
if (code) {
|
|
84
|
-
this.Ps[i] = P_1.P.
|
|
84
|
+
this.Ps[i] = P_1.P.Map.get(code) ?? null;
|
|
85
85
|
}
|
|
86
86
|
});
|
|
87
87
|
// 累積咖波累積數
|
|
88
88
|
this.Ps.forEach((p) => {
|
|
89
89
|
if (__1.Modes.GreenWei.Score !== undefined) {
|
|
90
|
-
if (p?.
|
|
90
|
+
if (p?.code === "A" && __1.Modes.GreenWei.Score < 20) {
|
|
91
91
|
__1.Modes.GreenWei.Score += 1;
|
|
92
92
|
}
|
|
93
93
|
}
|
|
@@ -95,32 +95,32 @@ class BaseLaBaG {
|
|
|
95
95
|
}
|
|
96
96
|
CalculateScore() {
|
|
97
97
|
//計算分數
|
|
98
|
-
const UniqueCount = new Set(this.Ps.map((p) => p?.
|
|
98
|
+
const UniqueCount = new Set(this.Ps.map((p) => p?.code)).size;
|
|
99
99
|
switch (UniqueCount) {
|
|
100
100
|
case 1: // 三個一樣
|
|
101
|
-
this.MarginScore += this.Ps[0]?.
|
|
101
|
+
this.MarginScore += this.Ps[0]?.scores?.[0];
|
|
102
102
|
break;
|
|
103
103
|
case 2: // 兩個一樣
|
|
104
|
-
if (this.Ps[0]?.
|
|
105
|
-
this.MarginScore += this.Ps[0]?.
|
|
106
|
-
this.MarginScore += this.Ps[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
107
|
this.MarginScore = Math.round(this.MarginScore / 1.4);
|
|
108
108
|
}
|
|
109
|
-
else if (this.Ps[1]?.
|
|
110
|
-
this.MarginScore += this.Ps[1]?.
|
|
111
|
-
this.MarginScore += this.Ps[0]?.
|
|
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
112
|
this.MarginScore = Math.round(this.MarginScore / 1.4);
|
|
113
113
|
}
|
|
114
|
-
else if (this.Ps[2]?.
|
|
115
|
-
this.MarginScore += this.Ps[2]?.
|
|
116
|
-
this.MarginScore += this.Ps[1]?.
|
|
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
117
|
this.MarginScore = Math.round(this.MarginScore / 1.4);
|
|
118
118
|
}
|
|
119
119
|
break;
|
|
120
120
|
case 3: // 三個不一樣
|
|
121
|
-
this.MarginScore += this.Ps[0]?.
|
|
122
|
-
this.MarginScore += this.Ps[1]?.
|
|
123
|
-
this.MarginScore += this.Ps[2]?.
|
|
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
124
|
this.MarginScore = Math.round(this.MarginScore / 3);
|
|
125
125
|
break;
|
|
126
126
|
}
|
package/dist/types/P.d.ts
CHANGED
|
@@ -1,14 +1,17 @@
|
|
|
1
1
|
import { ModeNames } from "./Mode";
|
|
2
|
-
|
|
2
|
+
type ModeRates = Record<ModeNames, number>;
|
|
3
|
+
export interface PData {
|
|
3
4
|
name: string;
|
|
4
5
|
code: string;
|
|
5
|
-
rates:
|
|
6
|
+
rates: ModeRates;
|
|
6
7
|
scores: [number, number, number];
|
|
7
|
-
};
|
|
8
|
-
export declare class P {
|
|
9
|
-
static Obj: Record<string, P>;
|
|
10
|
-
Code: string | null;
|
|
11
|
-
Scores: [number, number, number];
|
|
12
|
-
Rates: Record<ModeNames, number>;
|
|
13
|
-
constructor(Code?: string | null, Scores?: [number, number, number], Rates?: Record<ModeNames, number>);
|
|
14
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
CHANGED
|
@@ -2,21 +2,23 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.P = void 0;
|
|
4
4
|
class P {
|
|
5
|
-
static
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
5
|
+
static Map = new Map();
|
|
6
|
+
name;
|
|
7
|
+
code;
|
|
8
|
+
scores;
|
|
9
|
+
rates;
|
|
10
|
+
constructor(name = "", code, scores = [0, 0, 0], rates = {
|
|
10
11
|
Normal: 0,
|
|
11
12
|
SuperHHH: 0,
|
|
12
13
|
GreenWei: 0,
|
|
13
14
|
PiKaChu: 0,
|
|
14
15
|
}) {
|
|
15
|
-
this.
|
|
16
|
-
this.
|
|
17
|
-
this.
|
|
18
|
-
|
|
19
|
-
|
|
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);
|
|
20
22
|
}
|
|
21
23
|
}
|
|
22
24
|
}
|
package/dist/types/PlayLaBaG.js
CHANGED
|
@@ -22,7 +22,7 @@ class PlayLaBaG extends LaBaG_1.BaseLaBaG {
|
|
|
22
22
|
Result() {
|
|
23
23
|
super.Result();
|
|
24
24
|
console.log("");
|
|
25
|
-
console.log(`| ${this.Ps[0]?.
|
|
25
|
+
console.log(`| ${this.Ps[0]?.code} | ${this.Ps[1]?.code} | ${this.Ps[2]?.code} |`);
|
|
26
26
|
console.log(`+ ${this.MarginScore}`);
|
|
27
27
|
console.log(`目前分數: ${this.Score}`);
|
|
28
28
|
console.log(`剩餘次數: ${this.Times - this.Played}`);
|
|
@@ -39,7 +39,7 @@ class PlayLaBaG extends LaBaG_1.BaseLaBaG {
|
|
|
39
39
|
}
|
|
40
40
|
}
|
|
41
41
|
else {
|
|
42
|
-
if (this.Ps.every((p) => p?.
|
|
42
|
+
if (this.Ps.every((p) => p?.code === "B")) {
|
|
43
43
|
console.log("全阿禾,次數不消耗且+1!");
|
|
44
44
|
}
|
|
45
45
|
}
|
|
@@ -50,7 +50,7 @@ class PlayLaBaG extends LaBaG_1.BaseLaBaG {
|
|
|
50
50
|
console.log("綠光阿瑋出現");
|
|
51
51
|
}
|
|
52
52
|
else {
|
|
53
|
-
if (this.Ps.every((p) => p?.
|
|
53
|
+
if (this.Ps.every((p) => p?.code === "A")) {
|
|
54
54
|
console.log("全咖波,次數不消耗!");
|
|
55
55
|
}
|
|
56
56
|
}
|
package/package.json
CHANGED
package/src/index.ts
CHANGED
|
@@ -1,14 +1,53 @@
|
|
|
1
|
-
import PDatas from "@/json/PDatas.json";
|
|
2
|
-
import { P, PData } from "@/types/P";
|
|
3
1
|
import { LaBaG } from "./types/LaBaG";
|
|
4
2
|
import { Mode, ModeNames } from "./types/Mode";
|
|
5
3
|
import { RandInt } from "./utils/RandInt";
|
|
6
4
|
import { PlayLaBaG } from "./types/PlayLaBaG";
|
|
7
5
|
import { JsonLaBaG } from "./types/JsonLaBaG";
|
|
6
|
+
import { P, PData } from "./types/P";
|
|
8
7
|
|
|
9
|
-
|
|
10
|
-
|
|
8
|
+
const PDatas: Record<string, PData> = {
|
|
9
|
+
Gss: {
|
|
10
|
+
name: "咖波",
|
|
11
|
+
code: "A",
|
|
12
|
+
rates: { Normal: 36, SuperHHH: 19, GreenWei: 36, PiKaChu: 36 },
|
|
13
|
+
scores: [800, 400, 180],
|
|
14
|
+
},
|
|
15
|
+
Hhh: {
|
|
16
|
+
name: "阿禾",
|
|
17
|
+
code: "B",
|
|
18
|
+
rates: { Normal: 24, SuperHHH: 5, GreenWei: 24, PiKaChu: 24 },
|
|
19
|
+
scores: [1500, 800, 300],
|
|
20
|
+
},
|
|
21
|
+
Hentai: {
|
|
22
|
+
name: "猥褻男",
|
|
23
|
+
code: "C",
|
|
24
|
+
rates: { Normal: 17, SuperHHH: 19, GreenWei: 17, PiKaChu: 17 },
|
|
25
|
+
scores: [2500, 1200, 500],
|
|
26
|
+
},
|
|
27
|
+
Handsun: {
|
|
28
|
+
name: "文傑",
|
|
29
|
+
code: "D",
|
|
30
|
+
rates: { Normal: 12, SuperHHH: 19, GreenWei: 12, PiKaChu: 12 },
|
|
31
|
+
scores: [2900, 1450, 690],
|
|
32
|
+
},
|
|
33
|
+
Kachu: {
|
|
34
|
+
name: "皮卡丘",
|
|
35
|
+
code: "E",
|
|
36
|
+
rates: { Normal: 8, SuperHHH: 19, GreenWei: 8, PiKaChu: 8 },
|
|
37
|
+
scores: [12000, 8000, 1250],
|
|
38
|
+
},
|
|
39
|
+
Rrr: {
|
|
40
|
+
name: "館長",
|
|
41
|
+
code: "F",
|
|
42
|
+
rates: { Normal: 3, SuperHHH: 19, GreenWei: 3, PiKaChu: 3 },
|
|
43
|
+
scores: [20000, 12000, 2500],
|
|
44
|
+
},
|
|
45
|
+
};
|
|
46
|
+
|
|
47
|
+
Object.values(PDatas).forEach((pd: PData) => {
|
|
48
|
+
new P(pd.name, pd.code, pd.scores, pd.rates);
|
|
11
49
|
});
|
|
50
|
+
|
|
12
51
|
const Modes: Record<Exclude<ModeNames, "Normal">, Mode> = {
|
|
13
52
|
// 超級阿禾
|
|
14
53
|
SuperHHH: {
|
|
@@ -35,7 +74,7 @@ const Modes: Record<Exclude<ModeNames, "Normal">, Mode> = {
|
|
|
35
74
|
if (this.InMode) {
|
|
36
75
|
this.Times -= 1;
|
|
37
76
|
|
|
38
|
-
if (Game.Ps.every((p) => p?.
|
|
77
|
+
if (Game.Ps.every((p) => p?.code === "B")) {
|
|
39
78
|
this.Times += 2;
|
|
40
79
|
}
|
|
41
80
|
if (this.Times <= 0) {
|
|
@@ -44,7 +83,7 @@ const Modes: Record<Exclude<ModeNames, "Normal">, Mode> = {
|
|
|
44
83
|
Game.ModeToScreen = true;
|
|
45
84
|
}
|
|
46
85
|
} else {
|
|
47
|
-
if (this.RandNum <= this.Rate && Game.Ps.some((p) => p?.
|
|
86
|
+
if (this.RandNum <= this.Rate && Game.Ps.some((p) => p?.code === "B")) {
|
|
48
87
|
this.InMode = true;
|
|
49
88
|
this.Times += 6;
|
|
50
89
|
Game.ModeToScreen = true;
|
|
@@ -52,7 +91,7 @@ const Modes: Record<Exclude<ModeNames, "Normal">, Mode> = {
|
|
|
52
91
|
Modes.PiKaChu.InMode = false;
|
|
53
92
|
}
|
|
54
93
|
// 超級阿禾加倍
|
|
55
|
-
if (Game.Ps.every((p) => p?.
|
|
94
|
+
if (Game.Ps.every((p) => p?.code === "B")) {
|
|
56
95
|
this.Score = Math.round((Game.Score * Game.ScoreTime) / 2);
|
|
57
96
|
Game.MarginScore += this.Score;
|
|
58
97
|
}
|
|
@@ -84,7 +123,7 @@ const Modes: Record<Exclude<ModeNames, "Normal">, Mode> = {
|
|
|
84
123
|
if (this.InMode) {
|
|
85
124
|
this.Times -= 1;
|
|
86
125
|
|
|
87
|
-
if (Game.Ps.every((p) => p?.
|
|
126
|
+
if (Game.Ps.every((p) => p?.code === "A")) {
|
|
88
127
|
this.Times += 1;
|
|
89
128
|
}
|
|
90
129
|
if (this.Times <= 0) {
|
|
@@ -95,7 +134,7 @@ const Modes: Record<Exclude<ModeNames, "Normal">, Mode> = {
|
|
|
95
134
|
} else {
|
|
96
135
|
if (
|
|
97
136
|
this.RandNum <= this.Rate &&
|
|
98
|
-
Game.Ps.every((p) => p?.
|
|
137
|
+
Game.Ps.every((p) => p?.code === "A")
|
|
99
138
|
) {
|
|
100
139
|
this.InMode = true;
|
|
101
140
|
this.Times += 2;
|
|
@@ -127,7 +166,7 @@ const Modes: Record<Exclude<ModeNames, "Normal">, Mode> = {
|
|
|
127
166
|
// 關掉其他模式
|
|
128
167
|
Modes.SuperHHH.InMode = false;
|
|
129
168
|
Modes.GreenWei.InMode = false;
|
|
130
|
-
if (Game.Ps.some((p) => p?.
|
|
169
|
+
if (Game.Ps.some((p) => p?.code === "E")) {
|
|
131
170
|
this.InMode = true;
|
|
132
171
|
Game.Played -= 5;
|
|
133
172
|
this.Times += 1;
|
package/src/types/JsonLaBaG.ts
CHANGED
|
@@ -38,19 +38,19 @@ export class JsonLaBaG extends BaseLaBaG {
|
|
|
38
38
|
Modes.GreenWei.RandNum = currData["GreenWei"] ?? 0;
|
|
39
39
|
|
|
40
40
|
const RateRange = this.RateRanges[this.NowMode()];
|
|
41
|
-
const PCodes = Object.keys(P.
|
|
41
|
+
const PCodes = Object.keys(P.Map);
|
|
42
42
|
|
|
43
43
|
RandNums.forEach((RandNum, i) => {
|
|
44
44
|
const code = PCodes.find((_, j) => RandNum <= RateRange[j]);
|
|
45
45
|
if (code) {
|
|
46
|
-
this.Ps[i] = P.
|
|
46
|
+
this.Ps[i] = P.Map.get(code) ?? null;
|
|
47
47
|
}
|
|
48
48
|
});
|
|
49
49
|
|
|
50
50
|
// 累積 GreenWei 分數
|
|
51
51
|
this.Ps.forEach((p) => {
|
|
52
52
|
if (
|
|
53
|
-
p?.
|
|
53
|
+
p?.code === "A" &&
|
|
54
54
|
Modes.GreenWei.Score !== undefined &&
|
|
55
55
|
Modes.GreenWei.Score < 20
|
|
56
56
|
) {
|
package/src/types/LaBaG.ts
CHANGED
|
@@ -53,7 +53,7 @@ export class BaseLaBaG implements LaBaG {
|
|
|
53
53
|
].reduce((Ranges: Record<ModeNames, number[]>, mode: string) => {
|
|
54
54
|
const res: number[] = [];
|
|
55
55
|
let accRate: number = 0;
|
|
56
|
-
for (const p of Object.values(P.
|
|
56
|
+
for (const p of Object.values(P.Map)) {
|
|
57
57
|
accRate += p.Rates[mode as ModeNames];
|
|
58
58
|
res.push(accRate);
|
|
59
59
|
}
|
|
@@ -122,18 +122,18 @@ export class BaseLaBaG implements LaBaG {
|
|
|
122
122
|
this.OneData["GreenWei"] = Modes.GreenWei.RandNum as number;
|
|
123
123
|
|
|
124
124
|
const RateRange: number[] = this.RateRanges[this.NowMode()];
|
|
125
|
-
const PCodes
|
|
125
|
+
const PCodes = Object.keys(P.Map);
|
|
126
126
|
RandNums.forEach((RandNum: number, i: number) => {
|
|
127
127
|
const code = PCodes.find((_, j: number) => RandNum <= RateRange[j]);
|
|
128
128
|
if (code) {
|
|
129
|
-
this.Ps[i] = P.
|
|
129
|
+
this.Ps[i] = P.Map.get(code) ?? null;
|
|
130
130
|
}
|
|
131
131
|
});
|
|
132
132
|
|
|
133
133
|
// 累積咖波累積數
|
|
134
134
|
this.Ps.forEach((p) => {
|
|
135
135
|
if (Modes.GreenWei.Score !== undefined) {
|
|
136
|
-
if (p?.
|
|
136
|
+
if (p?.code === "A" && Modes.GreenWei.Score < 20) {
|
|
137
137
|
Modes.GreenWei.Score += 1;
|
|
138
138
|
}
|
|
139
139
|
}
|
|
@@ -141,30 +141,30 @@ export class BaseLaBaG implements LaBaG {
|
|
|
141
141
|
}
|
|
142
142
|
CalculateScore(): void {
|
|
143
143
|
//計算分數
|
|
144
|
-
const UniqueCount: number = new Set(this.Ps.map((p) => p?.
|
|
144
|
+
const UniqueCount: number = new Set(this.Ps.map((p) => p?.code)).size;
|
|
145
145
|
switch (UniqueCount) {
|
|
146
146
|
case 1: // 三個一樣
|
|
147
|
-
this.MarginScore += this.Ps[0]?.
|
|
147
|
+
this.MarginScore += this.Ps[0]?.scores?.[0] as number;
|
|
148
148
|
break;
|
|
149
149
|
case 2: // 兩個一樣
|
|
150
|
-
if (this.Ps[0]?.
|
|
151
|
-
this.MarginScore += this.Ps[0]?.
|
|
152
|
-
this.MarginScore += this.Ps[2]?.
|
|
150
|
+
if (this.Ps[0]?.code === this.Ps[1]?.code) {
|
|
151
|
+
this.MarginScore += this.Ps[0]?.scores?.[1] as number;
|
|
152
|
+
this.MarginScore += this.Ps[2]?.scores?.[2] as number;
|
|
153
153
|
this.MarginScore = Math.round(this.MarginScore / 1.4);
|
|
154
|
-
} else if (this.Ps[1]?.
|
|
155
|
-
this.MarginScore += this.Ps[1]?.
|
|
156
|
-
this.MarginScore += this.Ps[0]?.
|
|
154
|
+
} else if (this.Ps[1]?.code === this.Ps[2]?.code) {
|
|
155
|
+
this.MarginScore += this.Ps[1]?.scores?.[1] as number;
|
|
156
|
+
this.MarginScore += this.Ps[0]?.scores?.[2] as number;
|
|
157
157
|
this.MarginScore = Math.round(this.MarginScore / 1.4);
|
|
158
|
-
} else if (this.Ps[2]?.
|
|
159
|
-
this.MarginScore += this.Ps[2]?.
|
|
160
|
-
this.MarginScore += this.Ps[1]?.
|
|
158
|
+
} else if (this.Ps[2]?.code === this.Ps[0]?.code) {
|
|
159
|
+
this.MarginScore += this.Ps[2]?.scores?.[1] as number;
|
|
160
|
+
this.MarginScore += this.Ps[1]?.scores?.[2] as number;
|
|
161
161
|
this.MarginScore = Math.round(this.MarginScore / 1.4);
|
|
162
162
|
}
|
|
163
163
|
break;
|
|
164
164
|
case 3: // 三個不一樣
|
|
165
|
-
this.MarginScore += this.Ps[0]?.
|
|
166
|
-
this.MarginScore += this.Ps[1]?.
|
|
167
|
-
this.MarginScore += this.Ps[2]?.
|
|
165
|
+
this.MarginScore += this.Ps[0]?.scores?.[2] as number;
|
|
166
|
+
this.MarginScore += this.Ps[1]?.scores?.[2] as number;
|
|
167
|
+
this.MarginScore += this.Ps[2]?.scores?.[2] as number;
|
|
168
168
|
this.MarginScore = Math.round(this.MarginScore / 3);
|
|
169
169
|
break;
|
|
170
170
|
}
|
package/src/types/P.ts
CHANGED
|
@@ -1,34 +1,40 @@
|
|
|
1
1
|
import { ModeNames } from "./Mode";
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
// 定義 ModeRates 類型,方便重用
|
|
4
|
+
type ModeRates = Record<ModeNames, number>;
|
|
5
|
+
|
|
6
|
+
export interface PData {
|
|
4
7
|
name: string;
|
|
5
8
|
code: string;
|
|
6
|
-
rates:
|
|
9
|
+
rates: ModeRates;
|
|
7
10
|
scores: [number, number, number];
|
|
8
|
-
}
|
|
11
|
+
}
|
|
9
12
|
|
|
10
|
-
export class P {
|
|
11
|
-
static
|
|
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;
|
|
12
19
|
|
|
13
|
-
Code: string | null;
|
|
14
|
-
Scores: [number, number, number];
|
|
15
|
-
Rates: Record<ModeNames, number>;
|
|
16
20
|
constructor(
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
21
|
+
name = "",
|
|
22
|
+
code: string,
|
|
23
|
+
scores: [number, number, number] = [0, 0, 0],
|
|
24
|
+
rates: ModeRates = {
|
|
20
25
|
Normal: 0,
|
|
21
26
|
SuperHHH: 0,
|
|
22
27
|
GreenWei: 0,
|
|
23
28
|
PiKaChu: 0,
|
|
24
29
|
}
|
|
25
30
|
) {
|
|
26
|
-
this.
|
|
27
|
-
this.
|
|
28
|
-
this.
|
|
31
|
+
this.name = name;
|
|
32
|
+
this.code = code;
|
|
33
|
+
this.scores = scores;
|
|
34
|
+
this.rates = rates;
|
|
29
35
|
|
|
30
|
-
if (this.
|
|
31
|
-
P.
|
|
36
|
+
if (this.code && !P.Map.has(this.code)) {
|
|
37
|
+
P.Map.set(this.code, this);
|
|
32
38
|
}
|
|
33
39
|
}
|
|
34
40
|
}
|
package/src/types/PlayLaBaG.ts
CHANGED
|
@@ -25,7 +25,7 @@ export class PlayLaBaG extends BaseLaBaG {
|
|
|
25
25
|
super.Result();
|
|
26
26
|
console.log("");
|
|
27
27
|
console.log(
|
|
28
|
-
`| ${this.Ps[0]?.
|
|
28
|
+
`| ${this.Ps[0]?.code} | ${this.Ps[1]?.code} | ${this.Ps[2]?.code} |`
|
|
29
29
|
);
|
|
30
30
|
console.log(`+ ${this.MarginScore}`);
|
|
31
31
|
console.log(`目前分數: ${this.Score}`);
|
|
@@ -43,7 +43,7 @@ export class PlayLaBaG extends BaseLaBaG {
|
|
|
43
43
|
console.log(`(超級阿禾加倍分: ${Modes.SuperHHH.Score})`);
|
|
44
44
|
}
|
|
45
45
|
} else {
|
|
46
|
-
if (this.Ps.every((p) => p?.
|
|
46
|
+
if (this.Ps.every((p) => p?.code === "B")) {
|
|
47
47
|
console.log("全阿禾,次數不消耗且+1!");
|
|
48
48
|
}
|
|
49
49
|
}
|
|
@@ -53,7 +53,7 @@ export class PlayLaBaG extends BaseLaBaG {
|
|
|
53
53
|
if (this.ModeToScreen) {
|
|
54
54
|
console.log("綠光阿瑋出現");
|
|
55
55
|
} else {
|
|
56
|
-
if (this.Ps.every((p) => p?.
|
|
56
|
+
if (this.Ps.every((p) => p?.code === "A")) {
|
|
57
57
|
console.log("全咖波,次數不消耗!");
|
|
58
58
|
}
|
|
59
59
|
}
|
package/dist/json/PDatas.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Gss": {
|
|
3
|
-
"name": "咖波",
|
|
4
|
-
"code": "A",
|
|
5
|
-
"rates": { "Normal": 36, "SuperHHH": 19, "GreenWei": 36, "PiKaChu": 36 },
|
|
6
|
-
"scores": [800, 400, 180]
|
|
7
|
-
},
|
|
8
|
-
"Hhh": {
|
|
9
|
-
"name": "阿禾",
|
|
10
|
-
"code": "B",
|
|
11
|
-
"rates": { "Normal": 24, "SuperHHH": 5, "GreenWei": 24, "PiKaChu": 24 },
|
|
12
|
-
"scores": [1500, 800, 300]
|
|
13
|
-
},
|
|
14
|
-
"Hentai": {
|
|
15
|
-
"name": "猥褻男",
|
|
16
|
-
"code": "C",
|
|
17
|
-
"rates": { "Normal": 17, "SuperHHH": 19, "GreenWei": 17, "PiKaChu": 17 },
|
|
18
|
-
"scores": [2500, 1200, 500]
|
|
19
|
-
},
|
|
20
|
-
"Handsun": {
|
|
21
|
-
"name": "文傑",
|
|
22
|
-
"code": "D",
|
|
23
|
-
"rates": { "Normal": 12, "SuperHHH": 19, "GreenWei": 12, "PiKaChu": 12 },
|
|
24
|
-
"scores": [2900, 1450, 690]
|
|
25
|
-
},
|
|
26
|
-
"Kachu": {
|
|
27
|
-
"name": "皮卡丘",
|
|
28
|
-
"code": "E",
|
|
29
|
-
"rates": { "Normal": 8, "SuperHHH": 19, "GreenWei": 8, "PiKaChu": 8 },
|
|
30
|
-
"scores": [12000, 8000, 1250]
|
|
31
|
-
},
|
|
32
|
-
"Rrr": {
|
|
33
|
-
"name": "館長",
|
|
34
|
-
"code": "F",
|
|
35
|
-
"rates": { "Normal": 3, "SuperHHH": 19, "GreenWei": 3, "PiKaChu": 3 },
|
|
36
|
-
"scores": [20000, 12000, 2500]
|
|
37
|
-
}
|
|
38
|
-
}
|
package/src/json/PDatas.json
DELETED
|
@@ -1,38 +0,0 @@
|
|
|
1
|
-
{
|
|
2
|
-
"Gss": {
|
|
3
|
-
"name": "咖波",
|
|
4
|
-
"code": "A",
|
|
5
|
-
"rates": { "Normal": 36, "SuperHHH": 19, "GreenWei": 36, "PiKaChu": 36 },
|
|
6
|
-
"scores": [800, 400, 180]
|
|
7
|
-
},
|
|
8
|
-
"Hhh": {
|
|
9
|
-
"name": "阿禾",
|
|
10
|
-
"code": "B",
|
|
11
|
-
"rates": { "Normal": 24, "SuperHHH": 5, "GreenWei": 24, "PiKaChu": 24 },
|
|
12
|
-
"scores": [1500, 800, 300]
|
|
13
|
-
},
|
|
14
|
-
"Hentai": {
|
|
15
|
-
"name": "猥褻男",
|
|
16
|
-
"code": "C",
|
|
17
|
-
"rates": { "Normal": 17, "SuperHHH": 19, "GreenWei": 17, "PiKaChu": 17 },
|
|
18
|
-
"scores": [2500, 1200, 500]
|
|
19
|
-
},
|
|
20
|
-
"Handsun": {
|
|
21
|
-
"name": "文傑",
|
|
22
|
-
"code": "D",
|
|
23
|
-
"rates": { "Normal": 12, "SuperHHH": 19, "GreenWei": 12, "PiKaChu": 12 },
|
|
24
|
-
"scores": [2900, 1450, 690]
|
|
25
|
-
},
|
|
26
|
-
"Kachu": {
|
|
27
|
-
"name": "皮卡丘",
|
|
28
|
-
"code": "E",
|
|
29
|
-
"rates": { "Normal": 8, "SuperHHH": 19, "GreenWei": 8, "PiKaChu": 8 },
|
|
30
|
-
"scores": [12000, 8000, 1250]
|
|
31
|
-
},
|
|
32
|
-
"Rrr": {
|
|
33
|
-
"name": "館長",
|
|
34
|
-
"code": "F",
|
|
35
|
-
"rates": { "Normal": 3, "SuperHHH": 19, "GreenWei": 3, "PiKaChu": 3 },
|
|
36
|
-
"scores": [20000, 12000, 2500]
|
|
37
|
-
}
|
|
38
|
-
}
|