koishi-plugin-ggcevo-game 1.2.7 → 1.2.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/lib/index.d.ts +1 -0
- package/lib/index.js +217 -86
- package/package.json +1 -1
package/lib/index.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -49,7 +49,8 @@ var Config = import_koishi.Schema.intersect([
|
|
|
49
49
|
import_koishi.Schema.object({
|
|
50
50
|
dailyPKLimit: import_koishi.Schema.number().description("每日最大发起PK次数").default(3),
|
|
51
51
|
sameOpponentLimit: import_koishi.Schema.boolean().description("同玩家每日单次限制").default(true),
|
|
52
|
-
maxDailyBeChallenged: import_koishi.Schema.number().description("最大被挑战次数(0=无限制)").default(5)
|
|
52
|
+
maxDailyBeChallenged: import_koishi.Schema.number().description("最大被挑战次数(0=无限制)").default(5),
|
|
53
|
+
unlimitedBossAttack: import_koishi.Schema.boolean().description("开启无限制攻击主宰").default(false)
|
|
53
54
|
}).description("对战限制"),
|
|
54
55
|
// 通知系统配置组
|
|
55
56
|
import_koishi.Schema.object({
|
|
@@ -270,18 +271,59 @@ function apply(ctx, config) {
|
|
|
270
271
|
// 对重甲目标造成150%伤害
|
|
271
272
|
"护盾": 0.5
|
|
272
273
|
}
|
|
274
|
+
},
|
|
275
|
+
"焚烧枪": {
|
|
276
|
+
id: 3,
|
|
277
|
+
type: "热能武器",
|
|
278
|
+
damage: 15,
|
|
279
|
+
description: "基于热能的强大武器",
|
|
280
|
+
price: 450,
|
|
281
|
+
tagEffects: {
|
|
282
|
+
"生物": 1.5,
|
|
283
|
+
"惧热": 2,
|
|
284
|
+
"护盾": 0.5
|
|
285
|
+
}
|
|
286
|
+
},
|
|
287
|
+
"碎骨步枪": {
|
|
288
|
+
id: 4,
|
|
289
|
+
type: "能量武器",
|
|
290
|
+
damage: 28,
|
|
291
|
+
description: "由激光步枪改良而来,高效的能量武器",
|
|
292
|
+
price: 850,
|
|
293
|
+
tagEffects: {
|
|
294
|
+
"重甲": 2,
|
|
295
|
+
"护盾": 0.8
|
|
296
|
+
}
|
|
273
297
|
}
|
|
274
298
|
};
|
|
275
299
|
const modConfig = {
|
|
276
300
|
"动能增幅": {
|
|
277
301
|
cost: 1250,
|
|
278
|
-
effect: "伤害+20%"
|
|
302
|
+
effect: "伤害+20%",
|
|
303
|
+
exclusiveTo: "",
|
|
304
|
+
isExclusive: false
|
|
279
305
|
},
|
|
280
306
|
"棱镜水晶": {
|
|
281
307
|
cost: 1750,
|
|
282
|
-
effect: "暴击率+20%"
|
|
308
|
+
effect: "暴击率+20%",
|
|
309
|
+
exclusiveTo: "",
|
|
310
|
+
isExclusive: false
|
|
311
|
+
},
|
|
312
|
+
// 新增专属模块
|
|
313
|
+
"裂甲核心": {
|
|
314
|
+
cost: 2050,
|
|
315
|
+
effect: "伤害+40%,对重甲目标变更为造成120%伤害",
|
|
316
|
+
exclusiveTo: "高斯步枪",
|
|
317
|
+
// 指定专属武器
|
|
318
|
+
isExclusive: true
|
|
319
|
+
// 标记为专属模块
|
|
283
320
|
}
|
|
284
321
|
};
|
|
322
|
+
const passiveConfig = {
|
|
323
|
+
"弱化形态": { effect: 0.1 },
|
|
324
|
+
"坚固外壳": { effect: -0.2 },
|
|
325
|
+
"孤立无援": { effect: 0.2 }
|
|
326
|
+
};
|
|
285
327
|
const bossPool = [
|
|
286
328
|
{
|
|
287
329
|
main: {
|
|
@@ -289,14 +331,18 @@ function apply(ctx, config) {
|
|
|
289
331
|
name: "异齿猛兽-首领",
|
|
290
332
|
type: "主宰",
|
|
291
333
|
maxHP: 1e4,
|
|
292
|
-
tags: ["重甲", "生物"]
|
|
334
|
+
tags: ["重甲", "生物"],
|
|
335
|
+
passive: ["坚固外壳", "孤立无援"]
|
|
336
|
+
// 明确类型
|
|
293
337
|
},
|
|
294
338
|
minions: [
|
|
295
339
|
{
|
|
296
340
|
name: "异齿猛兽",
|
|
297
341
|
type: "子代",
|
|
298
342
|
maxHP: 2e3,
|
|
299
|
-
tags: ["重甲", "生物"]
|
|
343
|
+
tags: ["重甲", "生物"],
|
|
344
|
+
passive: ["弱化形态", "坚固外壳"]
|
|
345
|
+
// 明确类型
|
|
300
346
|
}
|
|
301
347
|
]
|
|
302
348
|
}
|
|
@@ -1849,7 +1895,7 @@ ${achievementList.join("\n")}`;
|
|
|
1849
1895
|
`📊 胜率预测:${winRate.toFixed(1)}%`,
|
|
1850
1896
|
`🎰 金币变动:${stealPercentage}%`
|
|
1851
1897
|
];
|
|
1852
|
-
isWin ? result.push(
|
|
1898
|
+
isWin ? result.push(`💰 您获得 ${goldTransfer}`, `💸 对方损失 ${goldTransfer}`) : result.push(`💸 您损失 ${goldTransfer}`, `💰 对方获得 ${goldTransfer}`);
|
|
1853
1899
|
result.push(`📅 剩余挑战次数:${config.dailyPKLimit - (initiatorPK.todayCount + 1)}`);
|
|
1854
1900
|
return result.join("\n");
|
|
1855
1901
|
} catch (error) {
|
|
@@ -1907,7 +1953,7 @@ ${achievementList.join("\n")}`;
|
|
|
1907
1953
|
day: "2-digit"
|
|
1908
1954
|
})}`;
|
|
1909
1955
|
});
|
|
1910
|
-
ctx.command("ggcevo/商城").alias("商店").action(async ({ session }) => {
|
|
1956
|
+
ctx.command("ggcevo/商城").alias("商店", "商场").action(async ({ session }) => {
|
|
1911
1957
|
const items = Object.entries(weaponConfig).map(([name2, config2]) => {
|
|
1912
1958
|
const tagEffectsDesc = config2.tagEffects ? Object.entries(config2.tagEffects).map(([tag, multiplier]) => `▸ 对${tag}目标造成${(multiplier * 100).toFixed(0)}%伤害`).join("\n") : "▸ 无特殊加成效果";
|
|
1913
1959
|
return [
|
|
@@ -2017,11 +2063,11 @@ ${achievementList.join("\n")}`;
|
|
|
2017
2063
|
equipped: true
|
|
2018
2064
|
}], ["handle", "weaponId"]);
|
|
2019
2065
|
});
|
|
2020
|
-
return
|
|
2066
|
+
return `已成功装备 ${weapon}!`;
|
|
2021
2067
|
});
|
|
2022
2068
|
ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").action(async ({ session }, weapon) => {
|
|
2023
2069
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2024
|
-
if (!profile) return "
|
|
2070
|
+
if (!profile) return "您暂未绑定句柄";
|
|
2025
2071
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2026
2072
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2027
2073
|
const [equipment] = await ctx.database.get("ggcevo_equipment", {
|
|
@@ -2044,40 +2090,64 @@ ${achievementList.join("\n")}`;
|
|
|
2044
2090
|
totalRewards: signInfo.totalRewards - upgradeCost
|
|
2045
2091
|
});
|
|
2046
2092
|
const baseDamage = weaponConfig[weapon].damage * (1 + 0.1 * (equipment.level + 1));
|
|
2047
|
-
|
|
2093
|
+
const newLevel = equipment.level + 1;
|
|
2094
|
+
const slots = Math.floor(newLevel / 3) + 1;
|
|
2095
|
+
return `${weapon} 升级成功!当前等级:${newLevel},伤害:${baseDamage},可用改装槽:${slots}个`;
|
|
2048
2096
|
});
|
|
2049
|
-
ctx.command("ggcevo/改装 <weapon>
|
|
2097
|
+
ctx.command("ggcevo/改装 <weapon> [mod]", "安装武器改装件").action(async ({ session }, weapon, mod) => {
|
|
2098
|
+
const isValidWeapon = weapon && weaponConfig[weapon]?.id !== void 0;
|
|
2050
2099
|
const generateModList = /* @__PURE__ */ __name(() => {
|
|
2051
|
-
|
|
2052
|
-
|
|
2053
|
-
|
|
2054
|
-
|
|
2055
|
-
|
|
2056
|
-
].join("\n")).join("\n\n");
|
|
2100
|
+
if (!isValidWeapon) {
|
|
2101
|
+
return Object.entries(modConfig).filter(([_, m]) => !m.isExclusive).map(formatModEntry).join("\n\n");
|
|
2102
|
+
}
|
|
2103
|
+
const exclusiveMods = Object.entries(modConfig).filter(([_, m]) => m.isExclusive && m.exclusiveTo === weapon).map(formatModEntry);
|
|
2104
|
+
return exclusiveMods.length ? exclusiveMods.join("\n\n") : "该武器暂无专属改装件";
|
|
2057
2105
|
}, "generateModList");
|
|
2058
|
-
|
|
2106
|
+
const formatModEntry = /* @__PURE__ */ __name(([name2, config2]) => [
|
|
2107
|
+
`【${name2}】${config2.isExclusive ? ` (专属:${config2.exclusiveTo})` : ""}`,
|
|
2108
|
+
`价格:${config2.cost}金币`,
|
|
2109
|
+
`效果:${config2.effect.replace(/▸/g, "▸ ")}`,
|
|
2110
|
+
config2.isExclusive ? "※ 每个武器只能安装一个专属模块" : ""
|
|
2111
|
+
].filter(Boolean).join("\n"), "formatModEntry");
|
|
2112
|
+
if (!mod || !modConfig[mod]) {
|
|
2059
2113
|
return [
|
|
2060
|
-
"🛠️
|
|
2061
|
-
"
|
|
2114
|
+
isValidWeapon ? `🛠️ ${weapon} 专属改装件 🛠️` : "🛠️ 通用武器改装件 🛠️",
|
|
2115
|
+
isValidWeapon ? `使用「改装 ${weapon} 改装件」安装专属模块` : "使用「改装 武器名称 改装件」进行安装",
|
|
2062
2116
|
"====================",
|
|
2063
2117
|
generateModList()
|
|
2064
2118
|
].join("\n\n");
|
|
2065
2119
|
}
|
|
2120
|
+
if (!isValidWeapon) {
|
|
2121
|
+
return [
|
|
2122
|
+
"⚠️ 无效的武器名称 ⚠️",
|
|
2123
|
+
"====================",
|
|
2124
|
+
"可用通用改装件:",
|
|
2125
|
+
generateModList()
|
|
2126
|
+
].join("\n\n");
|
|
2127
|
+
}
|
|
2066
2128
|
const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
|
|
2067
2129
|
if (!profile) return "您暂未绑定句柄";
|
|
2068
2130
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2069
2131
|
const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2070
2132
|
const [equipment] = await ctx.database.get("ggcevo_equipment", {
|
|
2071
2133
|
handle,
|
|
2072
|
-
weaponId: weaponConfig[weapon]
|
|
2134
|
+
weaponId: weaponConfig[weapon].id
|
|
2073
2135
|
});
|
|
2074
2136
|
if (!equipment) return "尚未获得该武器";
|
|
2137
|
+
const modInfo = modConfig[mod];
|
|
2138
|
+
if (modInfo.isExclusive) {
|
|
2139
|
+
if (modInfo.exclusiveTo !== weapon) {
|
|
2140
|
+
return `【错误】该模块只能安装在${modInfo.exclusiveTo}上`;
|
|
2141
|
+
}
|
|
2142
|
+
const hasExclusive = equipment.installedMods.some((m) => modConfig[m]?.isExclusive);
|
|
2143
|
+
if (hasExclusive) return "【错误】每个武器只能安装一个专属模块";
|
|
2144
|
+
}
|
|
2075
2145
|
if (equipment.installedMods.length >= equipment.modificationSlots)
|
|
2076
2146
|
return "改装槽已满,请先升级武器";
|
|
2077
2147
|
if (equipment.installedMods.includes(mod))
|
|
2078
2148
|
return "已安装相同改装件";
|
|
2079
|
-
if ((signInfo?.totalRewards || 0) <
|
|
2080
|
-
return `需要${
|
|
2149
|
+
if ((signInfo?.totalRewards || 0) < modInfo.cost)
|
|
2150
|
+
return `需要${modInfo.cost}金币,当前持有:${signInfo?.totalRewards || 0}`;
|
|
2081
2151
|
await ctx.database.set("ggcevo_equipment", {
|
|
2082
2152
|
handle,
|
|
2083
2153
|
weaponId: weaponConfig[weapon].id
|
|
@@ -2085,22 +2155,21 @@ ${achievementList.join("\n")}`;
|
|
|
2085
2155
|
installedMods: [...equipment.installedMods, mod]
|
|
2086
2156
|
});
|
|
2087
2157
|
await ctx.database.set("ggcevo_sign", { handle }, {
|
|
2088
|
-
totalRewards: signInfo.totalRewards -
|
|
2158
|
+
totalRewards: signInfo.totalRewards - modInfo.cost
|
|
2089
2159
|
});
|
|
2090
2160
|
const installedModsList = [...equipment.installedMods, mod].map((m) => {
|
|
2091
2161
|
const config2 = modConfig[m];
|
|
2092
2162
|
return [
|
|
2093
2163
|
`【${m}】`,
|
|
2094
2164
|
`安装费用:${config2.cost}金币`,
|
|
2095
|
-
|
|
2096
|
-
config2.description
|
|
2165
|
+
`效果:${config2.effect}`
|
|
2097
2166
|
].join("\n");
|
|
2098
2167
|
}).join("\n\n");
|
|
2099
2168
|
return [
|
|
2100
2169
|
`✅ ${weapon} 成功安装 ${mod}!`,
|
|
2101
2170
|
"当前改装配置:",
|
|
2102
2171
|
installedModsList,
|
|
2103
|
-
`剩余金币:${signInfo.totalRewards -
|
|
2172
|
+
`剩余金币:${signInfo.totalRewards - modInfo.cost}`
|
|
2104
2173
|
].join("\n\n");
|
|
2105
2174
|
});
|
|
2106
2175
|
ctx.command("ggcevo/攻击 <targetType>").usage("使用 攻击 主宰/zz 或 攻击 子代/zd 来选择攻击目标").action(async (argv, targetType) => {
|
|
@@ -2122,12 +2191,16 @@ ${achievementList.join("\n")}`;
|
|
|
2122
2191
|
const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
|
|
2123
2192
|
const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
|
|
2124
2193
|
if (existingEntries.length > 0) return "❌拒绝访问,您已被列入活动黑名单。";
|
|
2125
|
-
const
|
|
2126
|
-
|
|
2127
|
-
|
|
2128
|
-
const
|
|
2129
|
-
if (
|
|
2130
|
-
|
|
2194
|
+
const config2 = ctx.config;
|
|
2195
|
+
const unlimitedBossAttack = config2.unlimitedBossAttack;
|
|
2196
|
+
if (!unlimitedBossAttack) {
|
|
2197
|
+
const lastAttack = await ctx.database.get("ggcevo_boss_damage", { handle });
|
|
2198
|
+
if (lastAttack.length > 0) {
|
|
2199
|
+
const lastDate = convertUTCtoChinaTime(new Date(lastAttack[0].lastattackDate));
|
|
2200
|
+
const today = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
|
|
2201
|
+
if (isSameHalfDay(lastDate, today)) {
|
|
2202
|
+
return "您在当前时段内已经攻击过了,请在12点或0点后再来挑战!";
|
|
2203
|
+
}
|
|
2131
2204
|
}
|
|
2132
2205
|
}
|
|
2133
2206
|
const [equippedWeapon] = await ctx.database.get("ggcevo_equipment", {
|
|
@@ -2136,7 +2209,7 @@ ${achievementList.join("\n")}`;
|
|
|
2136
2209
|
});
|
|
2137
2210
|
if (!equippedWeapon) return "请先装备武器再挑战主宰";
|
|
2138
2211
|
const activeBosses = await ctx.database.get("ggcevo_boss", { isActive: true });
|
|
2139
|
-
if (!activeBosses.length) return "
|
|
2212
|
+
if (!activeBosses.length) return "当前没有存活的主宰";
|
|
2140
2213
|
const targetBoss = normalizedTarget === "主宰" ? activeBosses.find((b) => b.type === "主宰") : activeBosses.find((b) => b.type === "子代");
|
|
2141
2214
|
if (!targetBoss) return `当前没有可攻击的${normalizedTarget === "主宰" ? "主宰" : "子代"}`;
|
|
2142
2215
|
const bossGroup = bossPool.find((group) => group.main.id === targetBoss.groupId);
|
|
@@ -2144,51 +2217,73 @@ ${achievementList.join("\n")}`;
|
|
|
2144
2217
|
const weaponConfigEntry = Object.entries(weaponConfig).find(([_, c]) => c.id === equippedWeapon.weaponId);
|
|
2145
2218
|
const [weaponName, weaponData] = weaponConfigEntry;
|
|
2146
2219
|
let damage = weaponData.damage * (1 + 0.1 * equippedWeapon.level);
|
|
2220
|
+
let totalModAdd = 0;
|
|
2221
|
+
let hasCrit = false;
|
|
2147
2222
|
equippedWeapon.installedMods.forEach((mod) => {
|
|
2148
|
-
if (mod === "动能增幅")
|
|
2149
|
-
|
|
2223
|
+
if (mod === "动能增幅") {
|
|
2224
|
+
totalModAdd += 0.2;
|
|
2225
|
+
}
|
|
2226
|
+
if (mod === "棱镜水晶") {
|
|
2227
|
+
if (Math.random() < 0.2) {
|
|
2228
|
+
hasCrit = true;
|
|
2229
|
+
totalModAdd += 1;
|
|
2230
|
+
}
|
|
2231
|
+
}
|
|
2232
|
+
if (mod === "裂甲核心") {
|
|
2233
|
+
totalModAdd += 0.4;
|
|
2234
|
+
}
|
|
2150
2235
|
});
|
|
2151
|
-
|
|
2236
|
+
damage = damage * (1 + totalModAdd);
|
|
2152
2237
|
const targetBossConfig = targetBoss.type === "主宰" ? bossGroup.main : bossGroup.minions[0];
|
|
2153
2238
|
if (targetBossConfig.tags && targetBossConfig.tags.length > 0) {
|
|
2154
2239
|
const armorTags = targetBossConfig.tags.filter((tag) => ["重甲", "轻甲", "护盾"].includes(tag));
|
|
2155
2240
|
const voidTags = targetBossConfig.tags.filter((tag) => ["惧热", "惧寒"].includes(tag));
|
|
2156
|
-
const typeTags = targetBossConfig.tags.filter((tag) => ["生物", "机械"].includes(tag));
|
|
2157
|
-
let
|
|
2158
|
-
let voidMultiplier = 1;
|
|
2159
|
-
let typeMultiplier = 1;
|
|
2241
|
+
const typeTags = targetBossConfig.tags.filter((tag) => ["生物", "机械", "灵能"].includes(tag));
|
|
2242
|
+
let totalTagAdd = 0;
|
|
2160
2243
|
armorTags.forEach((tag) => {
|
|
2161
|
-
|
|
2162
|
-
|
|
2244
|
+
let effectValue = weaponData.tagEffects?.[tag] ?? 1;
|
|
2245
|
+
if (tag === "重甲" && equippedWeapon.installedMods.includes("裂甲核心")) {
|
|
2246
|
+
effectValue = 1.2;
|
|
2247
|
+
}
|
|
2248
|
+
totalTagAdd += effectValue - 1;
|
|
2163
2249
|
});
|
|
2164
2250
|
voidTags.forEach((tag) => {
|
|
2165
|
-
const effectValue = weaponData.tagEffects
|
|
2166
|
-
|
|
2251
|
+
const effectValue = weaponData.tagEffects?.[tag] ?? 1;
|
|
2252
|
+
totalTagAdd += effectValue - 1;
|
|
2167
2253
|
});
|
|
2168
2254
|
typeTags.forEach((tag) => {
|
|
2169
|
-
const effectValue = weaponData.tagEffects
|
|
2170
|
-
|
|
2255
|
+
const effectValue = weaponData.tagEffects?.[tag] ?? 1;
|
|
2256
|
+
totalTagAdd += effectValue - 1;
|
|
2171
2257
|
});
|
|
2172
|
-
|
|
2173
|
-
|
|
2258
|
+
damage *= 1 + totalTagAdd;
|
|
2259
|
+
}
|
|
2260
|
+
if (targetBossConfig.passive?.length) {
|
|
2261
|
+
let passiveEffect = 0;
|
|
2262
|
+
const effectivePassives = [...targetBossConfig.passive];
|
|
2263
|
+
if (targetBoss.type === "主宰" && effectivePassives.includes("孤立无援")) {
|
|
2264
|
+
const activeMinions = await ctx.database.get("ggcevo_boss", {
|
|
2265
|
+
groupId: targetBoss.groupId,
|
|
2266
|
+
type: "子代",
|
|
2267
|
+
isActive: true
|
|
2268
|
+
});
|
|
2269
|
+
if (activeMinions.length !== 0) {
|
|
2270
|
+
effectivePassives.splice(effectivePassives.indexOf("孤立无援"), 1);
|
|
2271
|
+
}
|
|
2272
|
+
}
|
|
2273
|
+
effectivePassives.forEach((passive) => {
|
|
2274
|
+
const effect = passiveConfig[passive]?.effect || 0;
|
|
2275
|
+
passiveEffect += effect;
|
|
2276
|
+
});
|
|
2277
|
+
damage *= 1 + passiveEffect;
|
|
2174
2278
|
}
|
|
2175
2279
|
const [rankRecord] = await ctx.database.get("ggcevo_rank", { handle });
|
|
2176
2280
|
if (rankRecord?.rank > 0) {
|
|
2177
2281
|
const rankBonus = Math.floor(rankRecord.rank / 400) * 0.01;
|
|
2178
2282
|
damage *= 1 + rankBonus;
|
|
2179
2283
|
}
|
|
2180
|
-
if (targetBoss.type === "主宰") {
|
|
2181
|
-
const activeMinions = await ctx.database.get("ggcevo_boss", {
|
|
2182
|
-
groupId: targetBoss.groupId,
|
|
2183
|
-
type: "子代",
|
|
2184
|
-
isActive: true
|
|
2185
|
-
});
|
|
2186
|
-
if (activeMinions.length === 0) {
|
|
2187
|
-
damage *= 1.2;
|
|
2188
|
-
}
|
|
2189
|
-
}
|
|
2190
2284
|
damage = Math.round(damage);
|
|
2191
|
-
const
|
|
2285
|
+
const actualDamage = Math.min(damage, targetBoss.HP);
|
|
2286
|
+
const updatedHP = targetBoss.HP - actualDamage;
|
|
2192
2287
|
const isDefeated = updatedHP <= 0;
|
|
2193
2288
|
const [existingRecord] = await ctx.database.get("ggcevo_boss_damage", {
|
|
2194
2289
|
handle,
|
|
@@ -2199,7 +2294,8 @@ ${achievementList.join("\n")}`;
|
|
|
2199
2294
|
handle,
|
|
2200
2295
|
bossGroupId: targetBoss.groupId
|
|
2201
2296
|
}, {
|
|
2202
|
-
totalDamage: existingRecord.totalDamage +
|
|
2297
|
+
totalDamage: existingRecord.totalDamage + actualDamage,
|
|
2298
|
+
// 改为实际伤害
|
|
2203
2299
|
attackCount: existingRecord.attackCount + 1,
|
|
2204
2300
|
lastattackDate: /* @__PURE__ */ new Date()
|
|
2205
2301
|
});
|
|
@@ -2208,7 +2304,8 @@ ${achievementList.join("\n")}`;
|
|
|
2208
2304
|
handle,
|
|
2209
2305
|
playerName: session.username,
|
|
2210
2306
|
bossGroupId: targetBoss.groupId,
|
|
2211
|
-
totalDamage:
|
|
2307
|
+
totalDamage: actualDamage,
|
|
2308
|
+
// 改为实际伤害
|
|
2212
2309
|
attackCount: 1,
|
|
2213
2310
|
lastattackDate: /* @__PURE__ */ new Date()
|
|
2214
2311
|
});
|
|
@@ -2240,20 +2337,20 @@ ${achievementList.join("\n")}`;
|
|
|
2240
2337
|
const rank = index + 1;
|
|
2241
2338
|
let guguCoins, gold;
|
|
2242
2339
|
if (rank === 1) {
|
|
2243
|
-
guguCoins =
|
|
2244
|
-
gold =
|
|
2340
|
+
guguCoins = 30;
|
|
2341
|
+
gold = 2e3;
|
|
2245
2342
|
} else if (rank === 2) {
|
|
2246
|
-
guguCoins =
|
|
2247
|
-
gold =
|
|
2343
|
+
guguCoins = 25;
|
|
2344
|
+
gold = 1500;
|
|
2248
2345
|
} else if (rank === 3) {
|
|
2249
|
-
guguCoins =
|
|
2250
|
-
gold =
|
|
2346
|
+
guguCoins = 20;
|
|
2347
|
+
gold = 1e3;
|
|
2251
2348
|
} else if (rank <= 10) {
|
|
2252
|
-
guguCoins =
|
|
2253
|
-
gold =
|
|
2349
|
+
guguCoins = 15;
|
|
2350
|
+
gold = 750;
|
|
2254
2351
|
} else {
|
|
2255
|
-
guguCoins =
|
|
2256
|
-
gold =
|
|
2352
|
+
guguCoins = 10;
|
|
2353
|
+
gold = 500;
|
|
2257
2354
|
}
|
|
2258
2355
|
const key = record.handle;
|
|
2259
2356
|
rewardMap.set(key, {
|
|
@@ -2271,12 +2368,12 @@ ${achievementList.join("\n")}`;
|
|
|
2271
2368
|
others.forEach((record) => {
|
|
2272
2369
|
const key = record.handle;
|
|
2273
2370
|
rewardMap.set(key, {
|
|
2274
|
-
guguCoins: (rewardMap.get(key)?.guguCoins || 0) +
|
|
2275
|
-
gold: (rewardMap.get(key)?.gold || 0) +
|
|
2371
|
+
guguCoins: (rewardMap.get(key)?.guguCoins || 0) + 5,
|
|
2372
|
+
gold: (rewardMap.get(key)?.gold || 0) + 200,
|
|
2276
2373
|
playerName: record.playerName
|
|
2277
2374
|
});
|
|
2278
2375
|
});
|
|
2279
|
-
rewardMessages.push(`其他参与者各获得:
|
|
2376
|
+
rewardMessages.push(`其他参与者各获得: 5 咕咕币 + 200 金币`);
|
|
2280
2377
|
}
|
|
2281
2378
|
for (const [handle2, reward] of rewardMap) {
|
|
2282
2379
|
const signPromise = (async () => {
|
|
@@ -2297,7 +2394,6 @@ ${achievementList.join("\n")}`;
|
|
|
2297
2394
|
const [existingItem] = await ctx.database.get("ggcevo_backpack", {
|
|
2298
2395
|
handle: handle2,
|
|
2299
2396
|
itemId: 1
|
|
2300
|
-
// 假设1是咕咕币的ID
|
|
2301
2397
|
});
|
|
2302
2398
|
if (existingItem) {
|
|
2303
2399
|
await ctx.database.set("ggcevo_backpack", {
|
|
@@ -2321,7 +2417,7 @@ ${achievementList.join("\n")}`;
|
|
|
2321
2417
|
await ctx.database.remove("ggcevo_boss_damage", {
|
|
2322
2418
|
bossGroupId: targetBoss.groupId
|
|
2323
2419
|
});
|
|
2324
|
-
ctx.broadcast(
|
|
2420
|
+
ctx.broadcast(config2.groupId, [
|
|
2325
2421
|
`🎯 主宰 ${targetBoss.name} 已被击败!`,
|
|
2326
2422
|
`所有子代已消失,下一个主宰将在1小时后出现`,
|
|
2327
2423
|
"",
|
|
@@ -2338,7 +2434,7 @@ ${achievementList.join("\n")}`;
|
|
|
2338
2434
|
}
|
|
2339
2435
|
);
|
|
2340
2436
|
ctx.broadcast(
|
|
2341
|
-
|
|
2437
|
+
config2.groupId,
|
|
2342
2438
|
`🎯 子代 ${targetBoss.name} 已被击败!
|
|
2343
2439
|
主宰仍然存在,但是将额外遭受20%的易伤,继续战斗!`
|
|
2344
2440
|
);
|
|
@@ -2353,21 +2449,25 @@ ${achievementList.join("\n")}`;
|
|
|
2353
2449
|
const [existingSign] = await ctx.database.get("ggcevo_sign", { handle });
|
|
2354
2450
|
if (existingSign) {
|
|
2355
2451
|
await ctx.database.set("ggcevo_sign", { handle }, {
|
|
2356
|
-
totalRewards: existingSign.totalRewards +
|
|
2452
|
+
totalRewards: existingSign.totalRewards + actualDamage
|
|
2453
|
+
// 改为实际伤害
|
|
2357
2454
|
});
|
|
2358
2455
|
} else {
|
|
2359
2456
|
await ctx.database.create("ggcevo_sign", {
|
|
2360
2457
|
handle,
|
|
2361
|
-
totalRewards:
|
|
2458
|
+
totalRewards: actualDamage
|
|
2459
|
+
// 改为实际伤害
|
|
2362
2460
|
});
|
|
2363
2461
|
}
|
|
2364
2462
|
return [
|
|
2365
|
-
`🔥 对 ${targetBoss.name} 发起攻击!`,
|
|
2366
|
-
`造成伤害:${
|
|
2367
|
-
|
|
2463
|
+
`🔥 ${session.username} 使用武器 ${weaponName} 对 ${targetBoss.name} 发起攻击!`,
|
|
2464
|
+
`造成伤害:${actualDamage}${hasCrit ? "(✨ 暴击!)" : ""}`,
|
|
2465
|
+
// 改为实际伤害
|
|
2466
|
+
`获得金币:${actualDamage}`,
|
|
2467
|
+
// 改为实际伤害
|
|
2368
2468
|
`目标剩余HP:${isDefeated ? 0 : updatedHP}/${targetBoss.type === "主宰" ? bossGroup.main.maxHP : bossGroup.minions[0].maxHP}`,
|
|
2369
2469
|
isDefeated ? `🎉 成功击败 ${targetBoss.name}!` : ""
|
|
2370
|
-
].join("\n");
|
|
2470
|
+
].filter((line) => line !== "").join("\n");
|
|
2371
2471
|
});
|
|
2372
2472
|
ctx.command("ggcevo/初始化主宰", "初始化或重置主宰系统", { authority: 3 }).action(async () => {
|
|
2373
2473
|
try {
|
|
@@ -2422,10 +2522,30 @@ ${achievementList.join("\n")}`;
|
|
|
2422
2522
|
const bossGroup = bossPool.find((group) => group.main.name === mainBoss.name);
|
|
2423
2523
|
if (!bossGroup) return "BOSS配置数据异常,请联系管理员";
|
|
2424
2524
|
const mainBossHpBar = createHpBar(mainBoss.HP, bossGroup.main.maxHP);
|
|
2525
|
+
const formatEffect = /* @__PURE__ */ __name((value) => {
|
|
2526
|
+
const percentage = Math.abs(value * 100);
|
|
2527
|
+
return value > 0 ? `受到的伤害+${percentage}%` : `受到的伤害-${percentage}%`;
|
|
2528
|
+
}, "formatEffect");
|
|
2529
|
+
let passiveDisplay = [];
|
|
2530
|
+
if (bossGroup.main.passive) {
|
|
2531
|
+
const activeMinions = await ctx.database.get("ggcevo_boss", {
|
|
2532
|
+
groupId: mainBoss.groupId,
|
|
2533
|
+
type: "子代",
|
|
2534
|
+
isActive: true
|
|
2535
|
+
});
|
|
2536
|
+
passiveDisplay = bossGroup.main.passive.filter((p) => {
|
|
2537
|
+
if (p === "孤立无援") return activeMinions.length === 0;
|
|
2538
|
+
return true;
|
|
2539
|
+
}).map((p) => {
|
|
2540
|
+
const effect = passiveConfig[p].effect;
|
|
2541
|
+
return `${p}:${formatEffect(effect)}`;
|
|
2542
|
+
});
|
|
2543
|
+
}
|
|
2425
2544
|
const result = [
|
|
2426
2545
|
`🔴 主宰:${mainBoss.name}`,
|
|
2427
2546
|
`${mainBossHpBar} (${mainBoss.HP}/${bossGroup.main.maxHP})`,
|
|
2428
|
-
`标签:${bossGroup.main.tags.join("、")}
|
|
2547
|
+
`标签:${bossGroup.main.tags.join("、")}`,
|
|
2548
|
+
`被动:${passiveDisplay.join(",") || "无"}`
|
|
2429
2549
|
];
|
|
2430
2550
|
if (minions.length > 0) {
|
|
2431
2551
|
result.push("", "🟠 子代信息:");
|
|
@@ -2433,10 +2553,12 @@ ${achievementList.join("\n")}`;
|
|
|
2433
2553
|
const minionConfig = bossGroup.minions.find((m) => m.name === minion.name);
|
|
2434
2554
|
if (minionConfig) {
|
|
2435
2555
|
const minionHpBar = createHpBar(minion.HP, minionConfig.maxHP);
|
|
2556
|
+
const minionPassives = (minionConfig.passive || []).map((p) => `${p}:${formatEffect(passiveConfig[p].effect)}`).join(",");
|
|
2436
2557
|
result.push(
|
|
2437
2558
|
`${minion.name}`,
|
|
2438
2559
|
`${minionHpBar} (${minion.HP}/${minionConfig.maxHP})`,
|
|
2439
|
-
`标签:${minionConfig.tags.join("、")}
|
|
2560
|
+
`标签:${minionConfig.tags.join("、")}`,
|
|
2561
|
+
`被动:${minionPassives || "无"}`
|
|
2440
2562
|
);
|
|
2441
2563
|
}
|
|
2442
2564
|
});
|
|
@@ -2471,6 +2593,15 @@ function isSameDate(a, b) {
|
|
|
2471
2593
|
return a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
|
|
2472
2594
|
}
|
|
2473
2595
|
__name(isSameDate, "isSameDate");
|
|
2596
|
+
function isSameHalfDay(a, b) {
|
|
2597
|
+
if (!isSameDate(a, b)) {
|
|
2598
|
+
return false;
|
|
2599
|
+
}
|
|
2600
|
+
const hour1 = a.getUTCHours();
|
|
2601
|
+
const hour2 = b.getUTCHours();
|
|
2602
|
+
return hour1 < 12 && hour2 < 12 || hour1 >= 12 && hour2 >= 12;
|
|
2603
|
+
}
|
|
2604
|
+
__name(isSameHalfDay, "isSameHalfDay");
|
|
2474
2605
|
function getLatestGGCGameTime(response) {
|
|
2475
2606
|
const targetMap = "咕咕虫-evolved";
|
|
2476
2607
|
const records = response.data.results.filter(
|