koishi-plugin-ggcevo-game 1.4.1 → 1.4.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/lib/index.js CHANGED
@@ -35,6 +35,7 @@ var weaponConfig = {
35
35
  "高斯步枪": {
36
36
  id: 1,
37
37
  type: "实弹武器",
38
+ category: "实弹武器",
38
39
  damage: 10,
39
40
  description: "标准配置武器,中距离作战利器",
40
41
  specialeffect: "",
@@ -49,6 +50,7 @@ var weaponConfig = {
49
50
  "激光步枪": {
50
51
  id: 2,
51
52
  type: "能量武器",
53
+ category: "能量武器",
52
54
  damage: 23,
53
55
  description: "先进激光武器,远距离精准打击",
54
56
  specialeffect: "",
@@ -64,6 +66,7 @@ var weaponConfig = {
64
66
  "焚烧枪": {
65
67
  id: 3,
66
68
  type: "热能武器",
69
+ category: "热能武器",
67
70
  damage: 20,
68
71
  description: "基于热能的强大武器,烧烬一切",
69
72
  specialeffect: "",
@@ -79,6 +82,7 @@ var weaponConfig = {
79
82
  "碎骨步枪": {
80
83
  id: 4,
81
84
  type: "能量武器",
85
+ category: "能量武器",
82
86
  damage: 28,
83
87
  description: "由激光步枪改良而来,高效的对重甲武器",
84
88
  specialeffect: "",
@@ -94,6 +98,7 @@ var weaponConfig = {
94
98
  "等离子切割机": {
95
99
  id: 5,
96
100
  type: "实弹武器",
101
+ category: "实弹武器",
97
102
  damage: 12,
98
103
  description: "一种改造后的采矿切割机,有效对抗重甲目标",
99
104
  specialeffect: "",
@@ -109,6 +114,7 @@ var weaponConfig = {
109
114
  "突击霰弹枪": {
110
115
  id: 6,
111
116
  type: "实弹武器",
117
+ category: "实弹武器",
112
118
  damage: 28,
113
119
  description: "近距离攻击武器,专为遭遇战设计使用",
114
120
  specialeffect: "",
@@ -123,6 +129,7 @@ var weaponConfig = {
123
129
  "侦察步枪": {
124
130
  id: 7,
125
131
  type: "实弹武器",
132
+ category: "实弹武器",
126
133
  damage: 50,
127
134
  description: "用于隐秘射击的最佳武器,但是无法穿透护甲",
128
135
  specialeffect: "",
@@ -137,6 +144,7 @@ var weaponConfig = {
137
144
  "零度之下": {
138
145
  id: 8,
139
146
  type: "热能武器",
147
+ category: "热能武器",
140
148
  damage: 20,
141
149
  description: "喷射稳定的液氮恒流,对长时间接触者造成致命的损伤",
142
150
  specialeffect: "攻击使目标叠加“寒冷”层数,每层使其受到的伤害+5%(至多叠加10层)",
@@ -151,6 +159,7 @@ var weaponConfig = {
151
159
  "弧焊枪": {
152
160
  id: 9,
153
161
  type: "能量武器",
162
+ category: "能量武器",
154
163
  damage: 25,
155
164
  description: "一种经过改造的电动工具,可对近距离的目标放出高压电",
156
165
  specialeffect: "攻击拥有能量的目标将会消耗其200点能量",
@@ -165,6 +174,7 @@ var weaponConfig = {
165
174
  "伽马枪": {
166
175
  id: 10,
167
176
  type: "热能武器",
177
+ category: "热能武器",
168
178
  damage: 25,
169
179
  description: "一种高度危险性的武器,设计用辐射照射并伤害敌人",
170
180
  specialeffect: "攻击使生物目标(无机械标签)叠加“辐射”层数,每层使其受到的伤害+5%(至多叠加10层)",
@@ -179,9 +189,10 @@ var weaponConfig = {
179
189
  "中子步枪": {
180
190
  id: 11,
181
191
  type: "能量武器",
192
+ category: "能量武器",
182
193
  damage: 30,
183
194
  description: "激光步枪的变种,采用折射技术升级",
184
- specialeffect: "拥有“散射”效果,对其他目标造成80%的武器基础伤害",
195
+ specialeffect: "拥有“散射”效果,对其他目标造成80%的伤害",
185
196
  price: 1450,
186
197
  redCrystalCost: 15,
187
198
  isantiair: true,
@@ -192,6 +203,7 @@ var weaponConfig = {
192
203
  "粒子相位枪": {
193
204
  id: 12,
194
205
  type: "能量武器",
206
+ category: "能量武器",
195
207
  damage: 30,
196
208
  description: "面对护盾目标而开发的武器",
197
209
  specialeffect: "攻击护盾目标,无视其50%的减伤效果",
@@ -203,6 +215,148 @@ var weaponConfig = {
203
215
  "轻甲": 0.5,
204
216
  "重甲": 0.2
205
217
  }
218
+ },
219
+ "动力钻头": {
220
+ id: 13,
221
+ type: "实弹武器",
222
+ category: "实弹武器",
223
+ damage: 25,
224
+ description: "这种强大的钻头是由那些想把矿工SCV上的大螺丝用作武器的人创造的",
225
+ specialeffect: "",
226
+ price: 1e3,
227
+ redCrystalCost: 15,
228
+ isantiair: true,
229
+ tagEffects: {
230
+ "建筑": 2,
231
+ "重甲": 1.5,
232
+ "机械": 1.5
233
+ }
234
+ },
235
+ "脉冲扰乱枪": {
236
+ id: 14,
237
+ type: "能量武器",
238
+ category: "能量武器",
239
+ damage: 30,
240
+ description: "一种原型能量武器,能够发射强大的脉冲",
241
+ specialeffect: "",
242
+ price: 1500,
243
+ redCrystalCost: 15,
244
+ isantiair: true,
245
+ tagEffects: {}
246
+ },
247
+ "外星电浆": {
248
+ id: 101,
249
+ type: "能量武器",
250
+ category: "传奇武器",
251
+ damage: 88,
252
+ description: "一件传奇武器",
253
+ specialeffect: "",
254
+ price: 6400,
255
+ redCrystalCost: 150,
256
+ isantiair: true,
257
+ tagEffects: {
258
+ "护盾": 0.5,
259
+ "重甲": 0.5
260
+ }
261
+ },
262
+ "MK-4激光步枪": {
263
+ id: 102,
264
+ type: "能量武器",
265
+ category: "传奇武器",
266
+ damage: 36,
267
+ description: "一件传奇武器",
268
+ specialeffect: "",
269
+ price: 6400,
270
+ redCrystalCost: 150,
271
+ isantiair: true,
272
+ tagEffects: {
273
+ "重甲": 2
274
+ }
275
+ },
276
+ "龙息霰弹枪": {
277
+ id: 103,
278
+ type: "实弹武器",
279
+ category: "传奇武器",
280
+ damage: 80,
281
+ description: "这是传说中的武器",
282
+ specialeffect: "",
283
+ price: 6400,
284
+ redCrystalCost: 150,
285
+ isantiair: false,
286
+ tagEffects: {
287
+ "轻甲": 1.5,
288
+ "惧热": 1.5
289
+ }
290
+ },
291
+ "DSR-55反器材步枪": {
292
+ id: 104,
293
+ type: "实弹武器",
294
+ category: "传奇武器",
295
+ damage: 145,
296
+ description: "一件传奇武器",
297
+ specialeffect: "",
298
+ price: 6400,
299
+ redCrystalCost: 150,
300
+ isantiair: true,
301
+ tagEffects: {
302
+ "重甲": 1.2
303
+ }
304
+ },
305
+ "光剑": {
306
+ id: 105,
307
+ type: "能量武器",
308
+ category: "传奇武器",
309
+ damage: 100,
310
+ description: "优雅而独特的武器",
311
+ specialeffect: "",
312
+ price: 6400,
313
+ redCrystalCost: 150,
314
+ isantiair: false,
315
+ tagEffects: {}
316
+ },
317
+ "DG-3电弧步枪": {
318
+ id: 106,
319
+ type: "能量武器",
320
+ category: "传奇武器",
321
+ damage: 100,
322
+ description: "一件传奇武器",
323
+ specialeffect: "",
324
+ price: 6400,
325
+ redCrystalCost: 150,
326
+ isantiair: true,
327
+ tagEffects: {
328
+ "机械": 1.5
329
+ }
330
+ },
331
+ "M4AE脉冲步枪": {
332
+ id: 107,
333
+ type: "能量武器",
334
+ category: "传奇武器",
335
+ damage: 30,
336
+ description: "一件传奇武器",
337
+ specialeffect: "",
338
+ price: 6400,
339
+ redCrystalCost: 150,
340
+ isantiair: true,
341
+ tagEffects: {
342
+ "重甲": 2
343
+ }
344
+ },
345
+ "核聚变重炮": {
346
+ id: 108,
347
+ type: "能量武器",
348
+ category: "传奇武器",
349
+ damage: 110,
350
+ description: "一件传奇武器",
351
+ specialeffect: "",
352
+ price: 6400,
353
+ redCrystalCost: 150,
354
+ isantiair: true,
355
+ tagEffects: {
356
+ "建筑": 2,
357
+ "重型": 1.5,
358
+ "重甲": 1.2
359
+ }
206
360
  }
207
361
  };
208
362
  var modConfig = {
@@ -218,6 +372,12 @@ var modConfig = {
218
372
  exclusiveTo: "",
219
373
  isExclusive: false
220
374
  },
375
+ "穿蚀模块": {
376
+ cost: 2750,
377
+ effect: "攻击时无视目标10%的减伤效果",
378
+ exclusiveTo: "",
379
+ isExclusive: false
380
+ },
221
381
  // 新增专属模块
222
382
  "裂甲核心": {
223
383
  cost: 750,
@@ -241,7 +401,7 @@ var modConfig = {
241
401
  },
242
402
  "光束曲射晶片": {
243
403
  cost: 2750,
244
- effect: "拥有“散射”效果,对其他目标造成80%的武器基础伤害",
404
+ effect: "拥有“散射”效果,对其他目标造成80%的伤害",
245
405
  exclusiveTo: "碎骨步枪",
246
406
  isExclusive: true
247
407
  },
@@ -453,7 +613,7 @@ var syndicatePirateConfig = [
453
613
  },
454
614
  {
455
615
  professionName: "纵火狂",
456
- effect: "热能武器攻击伤害+20%; 解锁龙息散弹枪(传奇)购买权限",
616
+ effect: "热能武器攻击伤害+20%; 解锁龙息霰弹枪(传奇)购买权限",
457
617
  requirements: "至少拥有一把3级及以上等级的热能武器",
458
618
  Jobtransfer: true,
459
619
  costcoins: 0,
@@ -940,14 +1100,6 @@ var bossPool = [
940
1100
  energy: 0,
941
1101
  tags: asBossTags(["护盾", "灵能", "异形"]),
942
1102
  passive: asPassives(["弱化形态", "超导体", "能量虹吸", "能量黑洞"])
943
- },
944
- {
945
- name: "电能者",
946
- type: "子代",
947
- maxHP: 3e3,
948
- energy: 0,
949
- tags: asBossTags(["护盾", "灵能", "异形"]),
950
- passive: asPassives(["弱化形态", "电能导体", "能量虹吸", "能量黑洞"])
951
1103
  }
952
1104
  ]
953
1105
  }),
@@ -971,6 +1123,35 @@ var bossPool = [
971
1123
  passive: asPassives(["弱化形态", "火焰异形", "灼烧粘液", "腐蚀胆汁", "燃烧潜地"])
972
1124
  }
973
1125
  ]
1126
+ }),
1127
+ defineBoss({
1128
+ main: {
1129
+ id: 8,
1130
+ name: "狂猎猛禽首领",
1131
+ type: "主宰",
1132
+ maxHP: 2e4,
1133
+ energy: 0,
1134
+ tags: asBossTags(["生物", "异形"]),
1135
+ passive: asPassives(["猎手异形", "致命一击", "狂暴", "伪装"])
1136
+ },
1137
+ minions: [
1138
+ {
1139
+ name: "狂猎猛禽1",
1140
+ type: "子代",
1141
+ maxHP: 5e3,
1142
+ energy: 0,
1143
+ tags: asBossTags(["生物", "异形"]),
1144
+ passive: asPassives(["弱化形态", "猎手异形", "狂暴", "伪装"])
1145
+ },
1146
+ {
1147
+ name: "狂猎猛禽2",
1148
+ type: "子代",
1149
+ maxHP: 5e3,
1150
+ energy: 0,
1151
+ tags: asBossTags(["生物", "异形"]),
1152
+ passive: asPassives(["弱化形态", "猎手异形", "狂暴", "伪装"])
1153
+ }
1154
+ ]
974
1155
  })
975
1156
  ];
976
1157
 
@@ -1102,7 +1283,7 @@ var passiveConfig = {
1102
1283
  },
1103
1284
  "灼烧粘液": {
1104
1285
  effect: 0,
1105
- description: "受到伤害后,会获得一层“胆汁”; 若存在“胆汁”层数时受到火焰攻击,将立刻清空层数并回复X点生命值(X为“胆汁”层数 x 10)"
1286
+ description: "受到伤害时,会获得一层“胆汁”; 若存在“胆汁”层数时受到火焰攻击,将立刻清空层数并回复X点生命值(X为“胆汁”层数 x 10)"
1106
1287
  },
1107
1288
  "腐蚀胆汁": {
1108
1289
  effect: 0,
@@ -1123,6 +1304,22 @@ var passiveConfig = {
1123
1304
  "炼狱爆弹": {
1124
1305
  effect: 0,
1125
1306
  description: "每拥有一层“胆汁”,受到的伤害-5%; 若有存活的子代,则每层“胆汁”使受到的伤害额外-5%"
1307
+ },
1308
+ "猎手异形": {
1309
+ effect: 0,
1310
+ description: "若有存活的其他异形,则受到的伤害-20%; 若没有存活的其他异形,则受到的伤害+20%; 免疫火焰伤害; 免疫寒冷伤害"
1311
+ },
1312
+ "狂暴": {
1313
+ effect: 0,
1314
+ description: "血量低于50%时,进入狂暴状态,受到的伤害-50%"
1315
+ },
1316
+ "伪装": {
1317
+ effect: 0,
1318
+ description: "受到伤害时,记录伤害来源的武器名称(最多一种,新记录会替换旧记录),下次受到相同武器伤害时伤害减少80%"
1319
+ },
1320
+ "致命一击": {
1321
+ effect: 0,
1322
+ description: "受到伤害时,有5%的概率免疫此次伤害"
1126
1323
  }
1127
1324
  };
1128
1325
 
@@ -1900,6 +2097,28 @@ async function generateUpgradePriceList(ctx, handle) {
1900
2097
  ].join("\n");
1901
2098
  }
1902
2099
  __name(generateUpgradePriceList, "generateUpgradePriceList");
2100
+ async function getRankInfo(ctx, config, handle) {
2101
+ const [user] = await ctx.database.get("ggcevo_rank", {
2102
+ handle,
2103
+ rankseason: config.rankseason
2104
+ });
2105
+ if (!user) return "暂未找到排名信息。";
2106
+ if (user.Blacklist) return "❌ 该用户已被禁止参加本赛季胜点榜。";
2107
+ const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false, rankseason: config.rankseason }).orderBy("rank", "desc").execute();
2108
+ const userRank = allRanks.findIndex((u) => u.handle === handle) + 1;
2109
+ const isSafe = await checkSensitiveWord(ctx, user.name);
2110
+ const displayName = isSafe ? user.name : (user.name[0] || "") + "***";
2111
+ return `🎮 咕咕排名信息 🎮
2112
+ ------------------------------
2113
+ 昵称:${displayName}
2114
+ 句柄:${user.handle}
2115
+ 当前积分:${user.rank}
2116
+ 参赛次数:${user.matches} 次
2117
+ 胜率:${user.matches === 0 ? "0.00%" : (user.wins / user.matches * 100).toFixed(2) + "%"}
2118
+ 全服排名:第 ${userRank} 名
2119
+ ------------------------------`;
2120
+ }
2121
+ __name(getRankInfo, "getRankInfo");
1903
2122
 
1904
2123
  // src/boss/passivehandler.ts
1905
2124
  var PassiveHandler = {
@@ -2472,27 +2691,6 @@ var PassiveHandler = {
2472
2691
  }
2473
2692
  return { messages };
2474
2693
  }, "handleArcWelderEffect"),
2475
- // 处理粒子相位枪的无视减伤效果
2476
- handleParticlePhaseEffect: /* @__PURE__ */ __name((targetBoss, weaponName, totalMultiplier) => {
2477
- if (weaponName !== "粒子相位枪" || totalMultiplier >= 0) return null;
2478
- const messages = [];
2479
- const hasShieldTag = targetBoss.tags.includes("护盾");
2480
- if (hasShieldTag) {
2481
- const originalReduction = Math.abs(totalMultiplier);
2482
- const effectiveReduction = originalReduction * 0.5;
2483
- const reducedMultiplier = -effectiveReduction;
2484
- messages.push(
2485
- `⚡ 【粒子相位枪】触发特效:护盾目标减伤效果减半`,
2486
- `原减伤:${Math.round(originalReduction * 100)}% → 实际减伤:${Math.round(effectiveReduction * 100)}%`
2487
- );
2488
- return {
2489
- damageMultiplier: reducedMultiplier,
2490
- messages
2491
- };
2492
- } else {
2493
- return null;
2494
- }
2495
- }, "handleParticlePhaseEffect"),
2496
2694
  // 庞兽狂暴处理(血量低于50%时减伤)
2497
2695
  handleGiantRage: /* @__PURE__ */ __name(function(targetBoss, currentHP, maxHP) {
2498
2696
  if (!targetBoss.skills.includes("庞兽狂暴")) return null;
@@ -2749,8 +2947,139 @@ var PassiveHandler = {
2749
2947
  messages: messageParts
2750
2948
  };
2751
2949
  }, "handleHellfireBomb"),
2950
+ // 猎手异形处理(Hunter Alien)
2951
+ handleHunterAlien: /* @__PURE__ */ __name(async function(ctx, targetBoss, weaponName, activeBosses) {
2952
+ if (!targetBoss.skills.includes("猎手异形")) return null;
2953
+ if (weaponName === "焚烧枪" || weaponName === "零度之下") {
2954
+ return {
2955
+ immune: true,
2956
+ messages: [`🛡️ 【猎手异形】生效:免疫${weaponName === "焚烧枪" ? "火焰" : "寒冷"}伤害`]
2957
+ };
2958
+ }
2959
+ const otherAlive = activeBosses.some(
2960
+ (boss) => boss.groupId === targetBoss.groupId && boss.name !== targetBoss.name && boss.HP > 0
2961
+ );
2962
+ const multiplier = otherAlive ? -0.2 : 0.2;
2963
+ return {
2964
+ damageMultiplier: multiplier,
2965
+ messages: [
2966
+ `🕵️ 【猎手异形】生效:${otherAlive ? "有其他存活异形,受到的伤害-20%" : "无其他存活异形,受到的伤害+20%"}`
2967
+ ]
2968
+ };
2969
+ }, "handleHunterAlien"),
2970
+ // 狂暴处理(Rage)
2971
+ handleRage: /* @__PURE__ */ __name(function(targetBoss, currentHP, maxHP) {
2972
+ if (!targetBoss.skills.includes("狂暴")) return null;
2973
+ if (currentHP / maxHP < 0.5) {
2974
+ return {
2975
+ damageMultiplier: -0.5,
2976
+ messages: [`😠 【狂暴】生效:血量低于50%,受到的伤害-50%`]
2977
+ };
2978
+ }
2979
+ return null;
2980
+ }, "handleRage"),
2981
+ // 伪装处理(Disguise)
2982
+ handleDisguise: /* @__PURE__ */ __name(async function(ctx, targetBoss, weaponName, initialDamage) {
2983
+ if (!targetBoss.skills.includes("伪装")) return null;
2984
+ const messages = [];
2985
+ let damageMultiplier = 0;
2986
+ let recordWeapon = initialDamage > 0;
2987
+ if (targetBoss.lastWeaponName === weaponName) {
2988
+ damageMultiplier = -0.8;
2989
+ messages.push(`🎭 【伪装】生效:已适应武器【${weaponName}】,本次受到的伤害-80%`);
2990
+ }
2991
+ if (recordWeapon) {
2992
+ await ctx.database.set(
2993
+ "ggcevo_boss",
2994
+ { name: targetBoss.name },
2995
+ { lastWeaponName: weaponName }
2996
+ );
2997
+ messages.push(`🎭 【伪装】生效:记录新武器【${weaponName}】`);
2998
+ }
2999
+ return {
3000
+ damageMultiplier,
3001
+ messages
3002
+ };
3003
+ }, "handleDisguise"),
3004
+ // 致命一击处理(Critical Hit)
3005
+ handleCriticalHit: /* @__PURE__ */ __name(function(targetBoss, initialDamage) {
3006
+ if (!targetBoss.skills.includes("致命一击") || initialDamage === 0) return null;
3007
+ if (Math.random() * 100 < 5) {
3008
+ return {
3009
+ immune: true,
3010
+ messages: ["💥 【致命一击】生效:免疫本次伤害"]
3011
+ };
3012
+ }
3013
+ return null;
3014
+ }, "handleCriticalHit"),
3015
+ // 穿蚀模块效果处理
3016
+ handleCorrosionModule: /* @__PURE__ */ __name((installedMods) => {
3017
+ if (!installedMods) return 0;
3018
+ return installedMods.includes("穿蚀模块") ? 0.1 : 0;
3019
+ }, "handleCorrosionModule"),
3020
+ // 粒子相位枪效果处理
3021
+ handleParticlePhaseEffect: /* @__PURE__ */ __name((targetBoss, weaponName) => {
3022
+ if (!targetBoss || weaponName !== "粒子相位枪") return 0;
3023
+ return targetBoss.tags.includes("护盾") ? 0.5 : 0;
3024
+ }, "handleParticlePhaseEffect"),
3025
+ // 修复handleIgnoreReductionEffects函数,确保始终返回有效对象
3026
+ handleIgnoreReductionEffects: /* @__PURE__ */ __name(async (ctx, userId, weaponName, targetBoss, totalMultiplier) => {
3027
+ const fallbackResult = {
3028
+ damageMultiplier: totalMultiplier,
3029
+ messages: []
3030
+ };
3031
+ try {
3032
+ if (totalMultiplier >= 0) {
3033
+ return fallbackResult;
3034
+ }
3035
+ const weaponConfigData = weaponConfig[weaponName];
3036
+ if (!weaponConfigData) {
3037
+ return fallbackResult;
3038
+ }
3039
+ const [equippedWeapon] = await ctx.database.get("ggcevo_equipment", {
3040
+ weaponId: weaponConfigData.id,
3041
+ handle: userId,
3042
+ equipped: true
3043
+ });
3044
+ if (!equippedWeapon || !equippedWeapon.installedMods) {
3045
+ return fallbackResult;
3046
+ }
3047
+ const ignoreEffects = [];
3048
+ const particleEffect = PassiveHandler.handleParticlePhaseEffect(targetBoss, weaponName);
3049
+ if (particleEffect > 0) {
3050
+ ignoreEffects.push(particleEffect);
3051
+ }
3052
+ const corrosionEffect = PassiveHandler.handleCorrosionModule(equippedWeapon.installedMods);
3053
+ if (corrosionEffect > 0) {
3054
+ ignoreEffects.push(corrosionEffect);
3055
+ }
3056
+ if (ignoreEffects.length === 0) {
3057
+ return fallbackResult;
3058
+ }
3059
+ const totalIgnoreRate = ignoreEffects.reduce((sum, rate) => sum + rate, 0);
3060
+ const originalMultiplier = totalMultiplier;
3061
+ const effectiveMultiplier = totalMultiplier * (1 - totalIgnoreRate);
3062
+ const messages = [];
3063
+ if (particleEffect > 0) {
3064
+ messages.push(`⚡ 【粒子相位枪】特效:无视护盾目标${particleEffect * 100}%减伤效果`);
3065
+ }
3066
+ if (corrosionEffect > 0) {
3067
+ messages.push(`⚡ 【穿蚀模块】生效:无视目标${corrosionEffect * 100}%减伤效果`);
3068
+ }
3069
+ messages.push(
3070
+ `⚡ 减伤系数由${(originalMultiplier * 100).toFixed(0)}% → ${(effectiveMultiplier * 100).toFixed(0)}%`
3071
+ );
3072
+ return {
3073
+ damageMultiplier: effectiveMultiplier,
3074
+ messages
3075
+ };
3076
+ } catch (error) {
3077
+ ctx.logger("PassiveHandler").warn("处理无视减伤效果失败", error);
3078
+ return fallbackResult;
3079
+ }
3080
+ }, "handleIgnoreReductionEffects"),
2752
3081
  // 统一处理被动技能
2753
- handlePassives: /* @__PURE__ */ __name(async function(ctx, targetBoss, initialDamage, currentHP, maxHP, weaponName, weaponData, activeBosses, bossGroup) {
3082
+ handlePassives: /* @__PURE__ */ __name(async function(ctx, handle, targetBoss, initialDamage, currentHP, maxHP, weaponName, weaponData, activeBosses, bossGroup) {
2754
3083
  let messages = [];
2755
3084
  let skillUpdates = [];
2756
3085
  let totalMultiplier = 0;
@@ -2812,6 +3141,24 @@ var PassiveHandler = {
2812
3141
  bileStacks: fireEvoResult.bileStacks
2813
3142
  };
2814
3143
  }
3144
+ const criticalResult = this.handleCriticalHit(targetBoss, initialDamage);
3145
+ if (criticalResult?.immune) {
3146
+ return {
3147
+ currentHP: targetBoss.HP,
3148
+ messages: criticalResult.messages,
3149
+ skillUpdates: [],
3150
+ initialDamage: 0
3151
+ };
3152
+ }
3153
+ const hunterImmune = await this.handleHunterAlien(ctx, targetBoss, weaponName, activeBosses);
3154
+ if (hunterImmune?.immune) {
3155
+ return {
3156
+ currentHP: targetBoss.HP,
3157
+ messages: hunterImmune.messages,
3158
+ skillUpdates: [],
3159
+ initialDamage: 0
3160
+ };
3161
+ }
2815
3162
  targetBoss.skills.forEach((skill) => {
2816
3163
  const config = passiveConfig[skill];
2817
3164
  if (config && config.effect !== void 0 && config.effect !== 0) {
@@ -2855,6 +3202,20 @@ var PassiveHandler = {
2855
3202
  totalMultiplier += hellfireBombResult.damageMultiplier;
2856
3203
  messages.push(...hellfireBombResult.messages);
2857
3204
  }
3205
+ const disguiseResult = await this.handleDisguise(ctx, targetBoss, weaponName, initialDamage);
3206
+ if (disguiseResult) {
3207
+ totalMultiplier += disguiseResult.damageMultiplier;
3208
+ messages.push(...disguiseResult.messages);
3209
+ }
3210
+ if (hunterImmune && !hunterImmune.immune) {
3211
+ totalMultiplier += hunterImmune.damageMultiplier;
3212
+ messages.push(...hunterImmune.messages);
3213
+ }
3214
+ const rageResult = this.handleRage(targetBoss, currentHP, maxHP);
3215
+ if (rageResult) {
3216
+ totalMultiplier += rageResult.damageMultiplier;
3217
+ messages.push(...rageResult.messages);
3218
+ }
2858
3219
  const radiationCalc = this.calculateRadiationDamage(targetBoss);
2859
3220
  if (radiationCalc) {
2860
3221
  totalMultiplier += radiationCalc.damageMultiplier;
@@ -2865,14 +3226,16 @@ var PassiveHandler = {
2865
3226
  totalMultiplier += coldDamageResult.damageMultiplier;
2866
3227
  messages.push(...coldDamageResult.messages);
2867
3228
  }
2868
- const particleResult = this.handleParticlePhaseEffect(
2869
- targetBoss,
3229
+ const ignoreReductionResult = await this.handleIgnoreReductionEffects(
3230
+ ctx,
3231
+ handle,
2870
3232
  weaponName,
3233
+ targetBoss,
2871
3234
  totalMultiplier
2872
3235
  );
2873
- if (particleResult) {
2874
- totalMultiplier = particleResult.damageMultiplier;
2875
- messages.push(...particleResult.messages);
3236
+ if (ignoreReductionResult && ignoreReductionResult.messages && ignoreReductionResult.messages.length > 0) {
3237
+ totalMultiplier = ignoreReductionResult.damageMultiplier;
3238
+ messages.push(...ignoreReductionResult.messages);
2876
3239
  }
2877
3240
  if (solarFlareResult.messages.length > 0) {
2878
3241
  messages.push(...solarFlareResult.messages);
@@ -3212,10 +3575,11 @@ async function handleBossDefeatRewards(ctx, targetBoss) {
3212
3575
  return { rewardMessages };
3213
3576
  }
3214
3577
  __name(handleBossDefeatRewards, "handleBossDefeatRewards");
3215
- async function handlePrimaryAttack(ctx, session, config, equippedWeapon, targetBoss, activeBosses, bossGroup, weaponName, weaponData, maxHP) {
3578
+ async function handlePrimaryAttack(ctx, session, config, handle, equippedWeapon, targetBoss, activeBosses, bossGroup, weaponName, weaponData, maxHP) {
3216
3579
  const damageResult = await calculateTotalDamage(ctx, session, config, equippedWeapon, targetBoss);
3217
3580
  const passiveResult = await PassiveHandler.handlePassives(
3218
3581
  ctx,
3582
+ handle,
3219
3583
  targetBoss,
3220
3584
  damageResult.damage,
3221
3585
  targetBoss.HP,
@@ -3245,7 +3609,7 @@ async function handlePrimaryAttack(ctx, session, config, equippedWeapon, targetB
3245
3609
  };
3246
3610
  }
3247
3611
  __name(handlePrimaryAttack, "handlePrimaryAttack");
3248
- async function handleScatterAttack(ctx, session, config, equippedWeapon, targetBoss, weaponName, weaponData, activeBosses, bossGroup) {
3612
+ async function handleScatterAttack(ctx, session, config, handle, equippedWeapon, targetBoss, weaponName, weaponData, activeBosses, bossGroup) {
3249
3613
  const secondaryTargets = activeBosses.filter((boss) => boss.name !== targetBoss.name);
3250
3614
  const scatterEffectMessages = [];
3251
3615
  const extraDamages = [];
@@ -3271,6 +3635,7 @@ async function handleScatterAttack(ctx, session, config, equippedWeapon, targetB
3271
3635
  );
3272
3636
  const passiveResult = await PassiveHandler.handlePassives(
3273
3637
  ctx,
3638
+ handle,
3274
3639
  secondaryTarget,
3275
3640
  damageResult.damage,
3276
3641
  secondaryTarget.HP,
@@ -3733,6 +4098,8 @@ function apply(ctx, config) {
3733
4098
  Vulnerability: "unsigned",
3734
4099
  freezing: "unsigned",
3735
4100
  energy: "unsigned",
4101
+ lastWeaponName: "string",
4102
+ // 新增字段,记录伪装技能的信息
3736
4103
  groupId: "unsigned",
3737
4104
  isActive: "boolean",
3738
4105
  respawnTime: "timestamp"
@@ -3798,6 +4165,14 @@ function apply(ctx, config) {
3798
4165
  }, {
3799
4166
  primary: ["handle", "taskId"]
3800
4167
  });
4168
+ ctx.model.extend("ggcevo_purchasepermissions", {
4169
+ handle: "string",
4170
+ legendarypermissions: "unsigned",
4171
+ explosiondoorauthority: "unsigned",
4172
+ syndicatelegendspermissions: "unsigned"
4173
+ }, {
4174
+ primary: "handle"
4175
+ });
3801
4176
  ctx.setInterval(async () => {
3802
4177
  const totalBosses = await ctx.database.select("ggcevo_boss").execute((row) => import_koishi.$.count(row.name));
3803
4178
  const groupId = [...config.groupId];
@@ -4667,69 +5042,23 @@ ${itemDetails.join("\n")}`;
4667
5042
  });
4668
5043
  ctx.command("ggcevo/排名 [player]", "查询个人排名").alias("rank").usage("输入“排名”查看自己的排名信息").action(async (argv, player) => {
4669
5044
  const session = argv.session;
5045
+ const ctx2 = session.bot.ctx;
5046
+ let handle;
4670
5047
  if (!player) {
4671
- const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
4672
- if (!profile) {
4673
- return "🔒 需要先绑定游戏句柄。";
4674
- }
4675
- const { regionId, realmId, profileId } = profile;
4676
- const handle = `${regionId}-S2-${realmId}-${profileId}`;
4677
- const [user] = await ctx.database.get("ggcevo_rank", {
4678
- handle,
4679
- rankseason: config.rankseason
4680
- });
4681
- if (!user) return "暂未找到您的排名信息。";
4682
- if (user.Blacklist) return "❌ 您已经被禁止参加本赛季胜点榜。";
4683
- const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false, rankseason: config.rankseason }).orderBy("rank", "desc").execute();
4684
- const userRank = allRanks.findIndex(
4685
- (u) => u.handle === handle
4686
- ) + 1;
4687
- const isSafe = await checkSensitiveWord(ctx, user.name);
4688
- const displayName = isSafe ? user.name : (user.name[0] || "") + "***";
4689
- return `🎮 咕咕排名信息 🎮
4690
- ------------------------------
4691
- 昵称:${displayName}
4692
- 句柄:${user.handle}
4693
- 当前积分:${user.rank}
4694
- 参赛次数:${user.matches} 次
4695
- 胜率: ${user.matches === 0 ? "0.00%" : (user.wins / user.matches * 100).toFixed(2) + "%"}
4696
- 全服排名:第 ${userRank} 名
4697
- ------------------------------`;
5048
+ const [profile] = await ctx2.database.get("sc2arcade_player", { userId: session.userId });
5049
+ if (!profile) return "🔒 需要先绑定游戏句柄。";
5050
+ handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
4698
5051
  } else {
4699
5052
  const parsedUser = import_koishi.h.parse(player)[0];
4700
5053
  if (!parsedUser || parsedUser.type !== "at" || !parsedUser.attrs.id) {
4701
5054
  return "参数错误,请输入“排名 @玩家”";
4702
5055
  }
4703
5056
  const targetUserId = parsedUser.attrs.id;
4704
- let targetUsername = parsedUser.attrs.name || targetUserId;
4705
- const [profile] = await ctx.database.get("sc2arcade_player", { userId: targetUsername });
4706
- if (!profile) {
4707
- return "对方暂未绑定句柄。";
4708
- }
4709
- const { regionId, realmId, profileId } = profile;
4710
- const handle = `${regionId}-S2-${realmId}-${profileId}`;
4711
- const [user] = await ctx.database.get("ggcevo_rank", {
4712
- handle,
4713
- rankseason: config.rankseason
4714
- });
4715
- if (!user) return "暂未找到对方的排名信息。";
4716
- if (user.Blacklist) return "❌ 对方已经被禁止参加本赛季胜点榜。";
4717
- const allRanks = await ctx.database.select("ggcevo_rank").where({ Blacklist: false, rankseason: config.rankseason }).orderBy("rank", "desc").execute();
4718
- const userRank = allRanks.findIndex(
4719
- (u) => u.handle === handle
4720
- ) + 1;
4721
- const isSafe = await checkSensitiveWord(ctx, user.name);
4722
- const displayName = isSafe ? user.name : (user.name[0] || "") + "***";
4723
- return `🎮 咕咕排名信息 🎮
4724
- ------------------------------
4725
- 昵称:${displayName}
4726
- 句柄:${user.handle}
4727
- 当前积分:${user.rank}
4728
- 参赛次数:${user.matches} 次
4729
- 胜率: ${user.matches === 0 ? "0.00%" : (user.wins / user.matches * 100).toFixed(2) + "%"}
4730
- 全服排名:第 ${userRank} 名
4731
- ------------------------------`;
5057
+ const [profile] = await ctx2.database.get("sc2arcade_player", { userId: targetUserId });
5058
+ if (!profile) return "对方暂未绑定句柄。";
5059
+ handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
4732
5060
  }
5061
+ return getRankInfo(ctx2, config, handle);
4733
5062
  });
4734
5063
  ctx.command("ggcevo/给予 <handle> <itemName:string> <amount:number>", "增加用户物品/金币", { authority: 3 }).action(async (_, handle, itemName, amount) => {
4735
5064
  try {
@@ -5015,11 +5344,8 @@ ${items.join("、")}
5015
5344
  }]);
5016
5345
  return `🎉 恭喜!您获得了${itemName}`;
5017
5346
  });
5018
- ctx.command("ggcevo/拉黑 [handle]", "添加用户到黑名单").action(async (argv, handle) => {
5347
+ ctx.command("ggcevo/拉黑 [handle]", "添加用户到黑名单", { authority: 3 }).action(async (argv, handle) => {
5019
5348
  const session = argv.session;
5020
- if (!ctx.config.admins.includes(session.userId)) {
5021
- return "⚠️ 没有操作权限。";
5022
- }
5023
5349
  if (!handle) {
5024
5350
  await session.send("请在30秒内输入需要拉黑的句柄:\n(句柄格式为: [区域ID]-S2-[服务器ID]-[档案ID])");
5025
5351
  handle = await session.prompt(3e4);
@@ -5044,11 +5370,8 @@ ${items.join("、")}
5044
5370
  return "操作失败,请稍后重试。错误详情已记录";
5045
5371
  }
5046
5372
  });
5047
- ctx.command("ggcevo/标记 [handle]", "标记用户到胜点榜黑名单").action(async (argv, handle) => {
5373
+ ctx.command("ggcevo/标记 [handle]", "标记用户到胜点榜黑名单", { authority: 3 }).action(async (argv, handle) => {
5048
5374
  const session = argv.session;
5049
- if (!ctx.config.admins.includes(session.userId)) {
5050
- return "⚠️ 没有操作权限。";
5051
- }
5052
5375
  if (!handle) {
5053
5376
  await session.send("请在30秒内输入需要标记的句柄:\n(句柄格式为: [区域ID]-S2-[服务器ID]-[档案ID])");
5054
5377
  handle = await session.prompt(3e4);
@@ -5451,7 +5774,7 @@ ${items.join("、")}
5451
5774
  pageNum < totalPages ? `输入 pk榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
5452
5775
  ].join("\n");
5453
5776
  });
5454
- ctx.command("ggcevo/武器库 [type]").usage("输入“武器库”查看类型,或“武器库 类型”查看详细武器信息").action(async ({ session }, type) => {
5777
+ ctx.command("ggcevo/武器库 [category]").usage("输入“武器库”查看类型,或“武器库 类型”查看详细武器信息").action(async ({ session }, category) => {
5455
5778
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
5456
5779
  if (!profile) return "⚠️ 需要先绑定游戏句柄";
5457
5780
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
@@ -5492,43 +5815,47 @@ ${items.join("、")}
5492
5815
  }
5493
5816
  let totalDiscount = techDiscount + weaponSpecialistDiscount + grasshopperDiscount;
5494
5817
  totalDiscount = Math.min(totalDiscount, 100);
5495
- const typeStats = Object.values(weaponConfig).filter((weapon) => weapon.price !== 0).reduce((stats, weapon) => {
5496
- stats[weapon.type] = (stats[weapon.type] || 0) + 1;
5818
+ const categoryStats = Object.values(weaponConfig).filter((weapon) => weapon.price !== 0).reduce((stats, weapon) => {
5819
+ stats[weapon.category] = (stats[weapon.category] || 0) + 1;
5497
5820
  return stats;
5498
5821
  }, {});
5499
- if (!type) {
5822
+ if (!category) {
5500
5823
  return [
5501
5824
  "🏪 咕咕武器库分类 🏪",
5502
- '使用 "武器库 类型名称" 查看详细列表',
5825
+ '使用 "武器库 分类名称" 查看详细列表',
5503
5826
  totalDiscount > 0 && `💰 当前折扣:
5504
5827
  ${discountDetails.length ? `${discountDetails.join("\n")}` : ""}`,
5505
5828
  "====================",
5506
- ...Object.entries(typeStats).map(([typeName, count]) => `▸ ${typeName} (${count}种)`),
5829
+ ...Object.entries(categoryStats).map(([catName, count]) => `▸ ${catName} (${count}种)`),
5507
5830
  "===================="
5508
5831
  ].filter(Boolean).join("\n");
5509
5832
  }
5510
- if (!Object.keys(typeStats).includes(type)) {
5511
- return `无效武器类型,可用类型:
5512
- ${Object.keys(typeStats).join("、")}`;
5833
+ if (!Object.keys(categoryStats).includes(category)) {
5834
+ return `无效武器分类,可用分类:
5835
+ ${Object.keys(categoryStats).join("、")}`;
5513
5836
  }
5514
- const items = Object.entries(weaponConfig).filter(([_, config2]) => config2.type === type && config2.price !== 0).map(([name2, config2]) => {
5837
+ const items = Object.entries(weaponConfig).filter(([_, config2]) => config2.category === category && config2.price !== 0).map(([name2, config2]) => {
5515
5838
  const actualPrice = Math.floor(config2.price * (100 - totalDiscount) / 100);
5516
- const tagEffectsDesc = config2.tagEffects ? Object.entries(config2.tagEffects).map(([tag, multiplier]) => `▸ 对${tag}目标造成${(multiplier * 100).toFixed(0)}%伤害`).join("\n") : "▸ 无特殊加成效果";
5839
+ let tagEffectsDesc = "▸ 无特殊加成效果";
5840
+ if (config2.tagEffects && Object.keys(config2.tagEffects).length > 0) {
5841
+ tagEffectsDesc = Object.entries(config2.tagEffects).map(([tag, multiplier]) => `▸ 对${tag}目标造成${(multiplier * 100).toFixed(0)}%伤害`).join("\n");
5842
+ }
5517
5843
  const specialEffect = config2.specialeffect ? `特殊效果:${config2.specialeffect}` : "";
5518
5844
  return [
5519
5845
  `【${name2}】`,
5520
- `类型:${config2.type}`,
5846
+ `攻击类型:${config2.type}`,
5521
5847
  `基础伤害:${config2.damage}`,
5522
5848
  `价格:${actualPrice}金币${totalDiscount > 0 ? ` (原价${config2.price})` : ""}`,
5523
5849
  specialEffect,
5524
5850
  "特性:",
5525
5851
  tagEffectsDesc,
5852
+ // 确保tagEffects为空时也显示"无特殊加成效果"
5526
5853
  `描述:${config2.description}`,
5527
5854
  "------------------"
5528
5855
  ].filter(Boolean).join("\n");
5529
5856
  });
5530
5857
  return [
5531
- `🏪 咕咕武器库 - ${type} 🏪`,
5858
+ `🏪 咕咕武器库 - ${category} 🏪`,
5532
5859
  '使用"购买 武器名称"指令进行购买',
5533
5860
  totalDiscount > 0 && `💰 当前折扣:
5534
5861
  ${discountDetails.length ? `${discountDetails.join("\n")}` : ""}`,
@@ -5585,11 +5912,12 @@ ${validTypes.join("、")}`;
5585
5912
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
5586
5913
  if (existingEntries.length > 0) return "⛔ 您已被列入黑名单。";
5587
5914
  const allItems = { ...weaponConfig, ...SyndicatedItems };
5588
- if (!item) return "请输入“购买 物品名称”来购买所需物品。";
5915
+ if (!item) return '请输入"购买 物品名称"来购买所需物品。';
5589
5916
  const config2 = allItems[item];
5590
5917
  if (!config2) return "无效的物品名称,请重新输入。";
5591
5918
  if (config2.price <= 0) return "❌ 该物品不可直接购买";
5592
- const isWeapon = ["能量武器", "热能武器", "实弹武器"].includes(config2.type);
5919
+ const isWeapon = ["能量武器", "热能武器", "实弹武器", "传奇武器"].includes(config2.category);
5920
+ const isLegendaryWeapon = config2.category === "传奇武器";
5593
5921
  if (isWeapon) {
5594
5922
  const existingWeapon = await ctx.database.get("ggcevo_equipment", {
5595
5923
  handle,
@@ -5597,6 +5925,12 @@ ${validTypes.join("、")}`;
5597
5925
  });
5598
5926
  if (existingWeapon.length > 0) return `❌ 您已经拥有${item},无法重复购买`;
5599
5927
  }
5928
+ if (isLegendaryWeapon) {
5929
+ const [permissions] = await ctx.database.get("ggcevo_purchasepermissions", { handle });
5930
+ if (!permissions || permissions.legendarypermissions <= 0) {
5931
+ return '❌ 购买传奇武器需要"传奇武器购买权限",您当前没有购买权限。';
5932
+ }
5933
+ }
5600
5934
  const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
5601
5935
  const [careerData] = await ctx.database.get("ggcevo_careers", { handle });
5602
5936
  const [weaponTech] = await ctx.database.get("ggcevo_tech", { handle, techId: 2 });
@@ -5656,6 +5990,16 @@ ${validTypes.join("、")}`;
5656
5990
  isused: true
5657
5991
  });
5658
5992
  }
5993
+ if (isLegendaryWeapon) {
5994
+ const [permissionRecord] = await ctx.database.get("ggcevo_purchasepermissions", { handle });
5995
+ if (!permissionRecord || permissionRecord.legendarypermissions <= 0) {
5996
+ throw new Error("传奇武器购买权限不足");
5997
+ }
5998
+ const remaining = permissionRecord.legendarypermissions - 1;
5999
+ await ctx.database.set("ggcevo_purchasepermissions", { handle }, {
6000
+ legendarypermissions: remaining
6001
+ });
6002
+ }
5659
6003
  if (isWeapon) {
5660
6004
  await ctx.database.upsert("ggcevo_equipment", [{
5661
6005
  handle,
@@ -5688,6 +6032,11 @@ ${validTypes.join("、")}`;
5688
6032
  let message = `✅ 成功购买${isWeapon ? "武器" : "物品"}「${item}」
5689
6033
  `;
5690
6034
  message += `花费 ${actualPrice} 金币`;
6035
+ if (isLegendaryWeapon) {
6036
+ const [permissions] = await ctx.database.get("ggcevo_purchasepermissions", { handle });
6037
+ message += `
6038
+ 扣除 1 次传奇武器购买权限,剩余次数:${permissions?.legendarypermissions || 0}`;
6039
+ }
5691
6040
  if (discountDetails.length > 0) {
5692
6041
  message += `(原价${config2.price} 金币)
5693
6042
  折扣明细:
@@ -6009,6 +6358,7 @@ ${validTypes.join("、")}`;
6009
6358
  ctx,
6010
6359
  session,
6011
6360
  config2,
6361
+ handle,
6012
6362
  equippedWeapon,
6013
6363
  targetBoss,
6014
6364
  activeBosses,
@@ -6029,6 +6379,7 @@ ${validTypes.join("、")}`;
6029
6379
  ctx,
6030
6380
  session,
6031
6381
  config2,
6382
+ handle,
6032
6383
  equippedWeapon,
6033
6384
  targetBoss,
6034
6385
  weaponName,
@@ -6213,6 +6564,9 @@ ${validTypes.join("、")}`;
6213
6564
  if (countingSkill) {
6214
6565
  result.push(`📈 ${countingSkill}:${mainBoss.Skillcountpoints}层`);
6215
6566
  }
6567
+ if (mainBoss.lastWeaponName) {
6568
+ result.push(`🎭 记录武器:${mainBoss.lastWeaponName}`);
6569
+ }
6216
6570
  if (minions.length > 0) {
6217
6571
  result.push("\n🟠 子代:");
6218
6572
  for (let i = 0; i < minions.length; i++) {
@@ -6243,6 +6597,9 @@ ${validTypes.join("、")}`;
6243
6597
  if (minionCountingSkill) {
6244
6598
  minionInfo.push(`📈 ${minionCountingSkill}:${minion.Skillcountpoints}层`);
6245
6599
  }
6600
+ if (minion.lastWeaponName) {
6601
+ minionInfo.push(`🎭 记录武器:${minion.lastWeaponName}`);
6602
+ }
6246
6603
  result.push(...minionInfo);
6247
6604
  if (i < minions.length - 1) result.push("");
6248
6605
  }
@@ -6633,7 +6990,7 @@ ${validTypes.join("、")}`;
6633
6990
  return "获取职业信息失败,请稍后重试";
6634
6991
  }
6635
6992
  });
6636
- ctx.command("ggcevo/黑市 [type]", "辛迪加海盗专属黑市").usage("输入“黑市”查看类型,或“黑市 类型”查看详细").action(async ({ session }, type) => {
6993
+ ctx.command("ggcevo/黑市 [category]", "辛迪加海盗专属黑市").usage('输入"黑市"查看分类,或"黑市 分类名称"查看详细').action(async ({ session }, category) => {
6637
6994
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
6638
6995
  if (!profile) return "🔒 需要先绑定游戏句柄。";
6639
6996
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
@@ -6642,45 +6999,47 @@ ${validTypes.join("、")}`;
6642
6999
  return "🚫 该功能需要【辛迪加海盗】阵营权限";
6643
7000
  }
6644
7001
  const isComputerExpert = careerData.career === "计算机专家";
6645
- const typeStats = {};
7002
+ const categoryStats = {};
6646
7003
  Object.values(weaponConfig).filter((config2) => config2.redCrystalCost > 0).forEach((weapon) => {
6647
- typeStats[weapon.type] = (typeStats[weapon.type] || 0) + 1;
7004
+ categoryStats[weapon.category] = (categoryStats[weapon.category] || 0) + 1;
6648
7005
  });
6649
7006
  Object.values(SyndicatedItems).filter((item) => item.redCrystalCost > 0).forEach((item) => {
6650
- typeStats[item.type] = (typeStats[item.type] || 0) + 1;
7007
+ categoryStats[item.type] = (categoryStats[item.type] || 0) + 1;
6651
7008
  });
6652
- if (!type) {
7009
+ if (!category) {
6653
7010
  return [
6654
7011
  "🏴 辛迪加黑市 🏴",
6655
- '使用 "黑市 类型名称" 查看详细信息',
6656
- // 添加计算机专家提示 - 优化为带emoji的分行显示
7012
+ '使用 "黑市 分类名称" 查看详细信息',
6657
7013
  isComputerExpert ? [
6658
7014
  "💰 当前折扣:",
6659
7015
  "💻 计算机专家:设备工具类物品50%折扣"
6660
7016
  ].join("\n") : "",
6661
7017
  "====================",
6662
- ...Object.entries(typeStats).map(([typeName, count]) => `▸ ${typeName} (${count}种)`),
7018
+ ...Object.entries(categoryStats).map(([catName, count]) => `▸ ${catName} (${count}种)`),
6663
7019
  "===================="
6664
7020
  ].join("\n");
6665
7021
  }
6666
- const normalizedType = Object.keys(typeStats).find((t) => t === type);
6667
- if (!normalizedType) return `无效类型,可用:${Object.keys(typeStats).join("、")}`;
7022
+ const normalizedCategory = Object.keys(categoryStats).find((c) => c === category);
7023
+ if (!normalizedCategory) return `无效分类,可用:${Object.keys(categoryStats).join("、")}`;
6668
7024
  const items = [
6669
7025
  ...Object.entries(weaponConfig).filter(
6670
- ([_, config2]) => config2.type === normalizedType && config2.redCrystalCost > 0
7026
+ ([_, config2]) => config2.category === normalizedCategory && // 使用 category 代替 type
7027
+ config2.redCrystalCost > 0
6671
7028
  ).map(([name2, config2]) => {
6672
7029
  const infoBlocks = [
6673
7030
  `【${name2}】`,
6674
- `类型:${config2.type}`,
7031
+ `攻击类型:${config2.type}`,
7032
+ // 保留攻击类型显示
6675
7033
  `订购价:${config2.redCrystalCost}红晶`
6676
7034
  ];
6677
7035
  if (config2.specialeffect) {
6678
7036
  infoBlocks.push(`特殊效果:${config2.specialeffect}`);
6679
7037
  }
6680
- if (Object.keys(config2.tagEffects).length > 0) {
6681
- const tagEffectsDesc = Object.entries(config2.tagEffects).map(([tag, mul]) => `▸ 对${tag}目标造成${(mul * 100).toFixed(0)}%伤害`).join("\n");
6682
- infoBlocks.push("特性:", tagEffectsDesc);
7038
+ let tagEffectsDesc = "▸ 无特殊加成效果";
7039
+ if (config2.tagEffects && Object.keys(config2.tagEffects).length > 0) {
7040
+ tagEffectsDesc = Object.entries(config2.tagEffects).map(([tag, mul]) => `▸ 对${tag}目标造成${(mul * 100).toFixed(0)}%伤害`).join("\n");
6683
7041
  }
7042
+ infoBlocks.push("特性:", tagEffectsDesc);
6684
7043
  infoBlocks.push(
6685
7044
  `描述:${config2.description}`,
6686
7045
  "------------------"
@@ -6688,14 +7047,15 @@ ${validTypes.join("、")}`;
6688
7047
  return infoBlocks.join("\n");
6689
7048
  }),
6690
7049
  ...Object.entries(SyndicatedItems).filter(
6691
- ([_, item]) => item.type === normalizedType && item.redCrystalCost > 0
7050
+ ([_, item]) => item.type === normalizedCategory && // 爆破物仍然使用 type
7051
+ item.redCrystalCost > 0
6692
7052
  ).map(([name2, item]) => {
6693
- const finalPrice = isComputerExpert && normalizedType === "设备工具" ? Math.floor(item.redCrystalCost * 0.5) : item.redCrystalCost;
7053
+ const finalPrice = isComputerExpert && normalizedCategory === "设备工具" ? Math.floor(item.redCrystalCost * 0.5) : item.redCrystalCost;
6694
7054
  const infoBlocks = [
6695
7055
  `【${name2}】`,
6696
- `类型:${item.type}`
7056
+ `物品类型:${item.type}`
6697
7057
  ];
6698
- if (isComputerExpert && normalizedType === "设备工具") {
7058
+ if (isComputerExpert && normalizedCategory === "设备工具") {
6699
7059
  infoBlocks.push(
6700
7060
  `订购价:${finalPrice}红晶 (原价${item.redCrystalCost})`
6701
7061
  );
@@ -6713,16 +7073,15 @@ ${validTypes.join("、")}`;
6713
7073
  })
6714
7074
  ];
6715
7075
  let discountInfo = [];
6716
- if (isComputerExpert && normalizedType === "设备工具") {
7076
+ if (isComputerExpert && normalizedCategory === "设备工具") {
6717
7077
  discountInfo = [
6718
7078
  "💰 当前折扣:",
6719
7079
  "💻 计算机专家:设备工具类物品50%折扣"
6720
7080
  ];
6721
7081
  }
6722
7082
  return [
6723
- `🏴☠️ 辛迪加黑市 - ${normalizedType} 🏴☠️`,
7083
+ `🏴☠️ 辛迪加黑市 - ${normalizedCategory} 🏴☠️`,
6724
7084
  '使用"订购 物品名称"进行购买(仅消耗红晶)',
6725
- // 显示折扣信息(如果有)
6726
7085
  ...discountInfo,
6727
7086
  "====================",
6728
7087
  ...items
@@ -6739,12 +7098,19 @@ ${validTypes.join("、")}`;
6739
7098
  if (!careerData || careerData.group !== "辛迪加海盗") {
6740
7099
  return "🚫 该功能需要【辛迪加海盗】阵营权限";
6741
7100
  }
6742
- if (!item) return "请输入“订购 物品名称”向辛迪加总部订购物品。";
7101
+ if (!item) return '请输入"订购 物品名称"向辛迪加总部订购物品。';
6743
7102
  const isWeapon = Object.prototype.hasOwnProperty.call(weaponConfig, item);
6744
7103
  const isSyndicatedItem = Object.prototype.hasOwnProperty.call(SyndicatedItems, item);
6745
7104
  if (!isWeapon && !isSyndicatedItem) return "❌ 无效物品名称";
6746
7105
  const itemConfig2 = isWeapon ? weaponConfig[item] : SyndicatedItems[item];
6747
7106
  if (!itemConfig2.redCrystalCost) return "⛔ 该物品不可订购";
7107
+ const isLegendaryWeapon = isWeapon && itemConfig2.category === "传奇武器";
7108
+ if (isLegendaryWeapon) {
7109
+ const [permissions] = await ctx.database.get("ggcevo_purchasepermissions", { handle });
7110
+ if (!permissions || permissions.syndicatelegendspermissions <= 0) {
7111
+ return '❌ 购买传奇武器需要"辛迪加传奇武器购买权限",您当前没有购买权限。';
7112
+ }
7113
+ }
6748
7114
  let isComputerExpertDiscount = false;
6749
7115
  let originalPrice = itemConfig2.redCrystalCost;
6750
7116
  let finalCost = originalPrice;
@@ -6765,10 +7131,21 @@ ${validTypes.join("、")}`;
6765
7131
  });
6766
7132
  if (existing.length) return "您已经拥有该武器。";
6767
7133
  }
7134
+ let isAutoEquipped = false;
6768
7135
  await ctx.database.withTransaction(async () => {
6769
7136
  await ctx.database.set("ggcevo_careers", { handle }, {
6770
7137
  redcrystal: careerData.redcrystal - finalCost
6771
7138
  });
7139
+ if (isLegendaryWeapon) {
7140
+ const [permissionRecord] = await ctx.database.get("ggcevo_purchasepermissions", { handle });
7141
+ if (!permissionRecord || permissionRecord.syndicatelegendspermissions <= 0) {
7142
+ throw new Error("辛迪加传奇武器购买权限不足");
7143
+ }
7144
+ const remaining = permissionRecord.syndicatelegendspermissions - 1;
7145
+ await ctx.database.set("ggcevo_purchasepermissions", { handle }, {
7146
+ syndicatelegendspermissions: remaining
7147
+ });
7148
+ }
6772
7149
  if (isWeapon) {
6773
7150
  await ctx.database.create("ggcevo_equipment", {
6774
7151
  handle,
@@ -6785,6 +7162,7 @@ ${validTypes.join("、")}`;
6785
7162
  { handle, weaponId: itemConfig2.id },
6786
7163
  { equipped: true }
6787
7164
  );
7165
+ isAutoEquipped = true;
6788
7166
  }
6789
7167
  } else {
6790
7168
  const [existing] = await ctx.database.get("ggcevo_warehouse", {
@@ -6799,6 +7177,11 @@ ${validTypes.join("、")}`;
6799
7177
  }
6800
7178
  });
6801
7179
  const buildResponse = /* @__PURE__ */ __name(async () => {
7180
+ let permissionMessage = [];
7181
+ if (isLegendaryWeapon) {
7182
+ const [permissions] = await ctx.database.get("ggcevo_purchasepermissions", { handle });
7183
+ permissionMessage.push(`扣除 1 次辛迪加传奇武器购买权限,剩余次数:${permissions?.syndicatelegendspermissions || 0}`);
7184
+ }
6802
7185
  const discountLines = [];
6803
7186
  if (discountApplied) {
6804
7187
  discountLines.push("💻 计算机专家:设备工具类物品50%折扣");
@@ -6806,19 +7189,14 @@ ${validTypes.join("、")}`;
6806
7189
  const priceInfo = [
6807
7190
  `消耗红晶:${finalCost}${discountApplied ? ` (原价${originalPrice})` : ""}`
6808
7191
  ];
6809
- if (discountApplied) {
6810
- priceInfo.push("折扣明细:");
6811
- priceInfo.push(...discountLines);
6812
- }
6813
7192
  if (isWeapon) {
6814
- const equippedStatus = await ctx.database.get("ggcevo_equipment", {
6815
- handle,
6816
- weaponId: itemConfig2.id
6817
- }).then((r) => r[0]?.equipped ? "已自动装备武器" : "需手动装备武器");
7193
+ const equippedStatus = isAutoEquipped ? "已自动装备武器" : "需手动装备武器";
6818
7194
  return [
6819
7195
  `✅ 成功订购【${item}】!`,
7196
+ ...permissionMessage,
6820
7197
  ...priceInfo,
6821
- // 价格和折扣信息显示在一起
7198
+ discountApplied ? `折扣明细:
7199
+ ▸ ${discountLines.join("\n▸ ")}` : "",
6822
7200
  `装备状态:${equippedStatus}`,
6823
7201
  '输入 "武器仓库" 管理武器'
6824
7202
  ].filter(Boolean).join("\n");
@@ -6829,8 +7207,10 @@ ${validTypes.join("、")}`;
6829
7207
  }).then((r) => r[0]?.quantity || 1);
6830
7208
  return [
6831
7209
  `✅ 成功订购【${item}】x1!`,
7210
+ ...permissionMessage,
6832
7211
  ...priceInfo,
6833
- // 价格和折扣信息显示在一起
7212
+ discountApplied ? `折扣明细:
7213
+ ▸ ${discountLines.join("\n▸ ")}` : "",
6834
7214
  `当前库存:${currentStock}件`,
6835
7215
  '输入 "仓库" 查看所有物品'
6836
7216
  ].filter(Boolean).join("\n");