koishi-plugin-ggcevo-game 1.2.38 → 1.2.40

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 CHANGED
@@ -146,6 +146,7 @@ export interface Boss {
146
146
  name: string;
147
147
  type: string;
148
148
  HP: number;
149
+ skills: string[];
149
150
  groupId: number;
150
151
  isActive: boolean;
151
152
  respawnTime: Date;
package/lib/index.js CHANGED
@@ -230,6 +230,8 @@ function apply(ctx, config) {
230
230
  name: "string",
231
231
  type: "string",
232
232
  HP: "unsigned",
233
+ skills: { type: "list", initial: [] },
234
+ // 明确数组元素类型
233
235
  groupId: "unsigned",
234
236
  isActive: "boolean",
235
237
  respawnTime: "timestamp"
@@ -335,9 +337,22 @@ function apply(ctx, config) {
335
337
  description: "用于隐秘射击的最佳武器,但是无法穿透护甲",
336
338
  price: 550,
337
339
  tagEffects: {
340
+ "护盾": 0.8,
338
341
  "轻甲": 0.5,
339
342
  "重甲": 0.2
340
343
  }
344
+ },
345
+ "零度之下": {
346
+ id: 8,
347
+ type: "热能武器",
348
+ damage: 30,
349
+ description: "喷射稳定的液氮恒流,对长时间接触者造成致命的损伤",
350
+ price: 775,
351
+ tagEffects: {
352
+ "惧寒": 2,
353
+ "灵能": 1.5,
354
+ "护盾": 0.8
355
+ }
341
356
  }
342
357
  };
343
358
  const modConfig = {
@@ -382,7 +397,7 @@ function apply(ctx, config) {
382
397
  },
383
398
  {
384
399
  name: "王权增幅",
385
- effect: "攻击伤害+10%"
400
+ effect: "攻击伤害+5%"
386
401
  },
387
402
  {
388
403
  name: "金柚赐福",
@@ -417,6 +432,162 @@ function apply(ctx, config) {
417
432
  }
418
433
  ]
419
434
  };
435
+ const spaceStationCrewConfig = [
436
+ {
437
+ professionName: "深空矿工",
438
+ effectname: "",
439
+ effect: "每日签到获得的金币收益增加100%",
440
+ requirements: "当月累计签到14天",
441
+ description: "",
442
+ Jobtransfer: true
443
+ },
444
+ {
445
+ professionName: "安保警卫",
446
+ effectname: "",
447
+ effect: "攻击获得的金币增加100%",
448
+ requirements: "当期伤害榜攻击次数达到5次",
449
+ description: "",
450
+ Jobtransfer: true
451
+ },
452
+ {
453
+ professionName: "首席武器官",
454
+ effectname: "",
455
+ effect: "攻击伤害+10%",
456
+ requirements: "当期伤害榜造成200点伤害",
457
+ description: "",
458
+ Jobtransfer: true
459
+ },
460
+ {
461
+ professionName: "医生",
462
+ effectname: "",
463
+ effect: "",
464
+ requirements: "",
465
+ description: "",
466
+ Jobtransfer: false
467
+ },
468
+ {
469
+ professionName: "首席情报官",
470
+ effectname: "",
471
+ effect: "升级联盟空间站科技享有80%的折扣",
472
+ requirements: "拥有500枚金币",
473
+ description: "",
474
+ Jobtransfer: false
475
+ },
476
+ {
477
+ professionName: "首席工程师",
478
+ effectname: "",
479
+ effect: "拥有独特的C.O.R.E科技升级权限",
480
+ requirements: "",
481
+ description: "",
482
+ Jobtransfer: false
483
+ },
484
+ {
485
+ professionName: "舰长",
486
+ effectname: "",
487
+ effect: "pk胜利将获得对面的红晶,可以使用红晶升级联盟空间站科技",
488
+ requirements: "pk总次数达10次",
489
+ description: "",
490
+ Jobtransfer: false
491
+ },
492
+ {
493
+ professionName: "首席机械师",
494
+ effectname: "",
495
+ effect: "机甲形态攻击伤害+50%",
496
+ requirements: "",
497
+ description: "",
498
+ Jobtransfer: false
499
+ },
500
+ {
501
+ professionName: "联盟新兵",
502
+ effectname: "无",
503
+ effect: "无",
504
+ requirements: "无",
505
+ description: "",
506
+ Jobtransfer: false
507
+ }
508
+ ];
509
+ const syndicatePirateConfig = [
510
+ {
511
+ professionName: "能量武器",
512
+ effectname: "",
513
+ effect: "能量武器攻击伤害+20%",
514
+ requirements: "",
515
+ description: "",
516
+ Jobtransfer: true
517
+ },
518
+ {
519
+ professionName: "清洁工",
520
+ effectname: "",
521
+ effect: "击败主宰能够根据排名获得红晶",
522
+ requirements: "",
523
+ description: "",
524
+ Jobtransfer: true
525
+ },
526
+ {
527
+ professionName: "枪手",
528
+ effectname: "",
529
+ effect: "升级武器享有80%的折扣",
530
+ requirements: "",
531
+ description: "",
532
+ Jobtransfer: true
533
+ },
534
+ {
535
+ professionName: "纵火狂",
536
+ effectname: "",
537
+ effect: "热能武器攻击伤害+15%",
538
+ requirements: "",
539
+ description: "",
540
+ Jobtransfer: true
541
+ },
542
+ {
543
+ professionName: "财务",
544
+ effectname: "",
545
+ effect: "每日签到能额外获得红晶",
546
+ requirements: "",
547
+ description: "",
548
+ Jobtransfer: true
549
+ },
550
+ {
551
+ professionName: "计算机专家",
552
+ effectname: "",
553
+ effect: "每日pk次数翻倍,pk的胜率提高10%",
554
+ requirements: "",
555
+ description: "",
556
+ Jobtransfer: false
557
+ },
558
+ {
559
+ professionName: "指挥官",
560
+ effectname: "",
561
+ effect: "可以使用红晶升级独特的辛迪加空间站科技",
562
+ requirements: "",
563
+ description: "",
564
+ Jobtransfer: false
565
+ },
566
+ {
567
+ professionName: "装甲兵",
568
+ effectname: "",
569
+ effect: "改装武器享有80%的折扣",
570
+ requirements: "",
571
+ description: "",
572
+ Jobtransfer: true
573
+ },
574
+ {
575
+ professionName: "破坏狂",
576
+ effectname: "",
577
+ effect: "pk胜利获得额外红晶",
578
+ requirements: "",
579
+ description: "",
580
+ Jobtransfer: false
581
+ },
582
+ {
583
+ professionName: "辛迪加炮灰新兵",
584
+ effectname: "无",
585
+ effect: "无",
586
+ requirements: "无",
587
+ description: "",
588
+ Jobtransfer: false
589
+ }
590
+ ];
420
591
  const passiveConfig = {
421
592
  "弱化形态": {
422
593
  effect: 0.1,
@@ -429,6 +600,22 @@ function apply(ctx, config) {
429
600
  "孤立无援": {
430
601
  effect: 0.2,
431
602
  description: "没有存活的子代,受到的伤害+20%"
603
+ },
604
+ "冰霜回复": {
605
+ effect: 0,
606
+ description: "血量降低到30%以下时触发,回复自身和主宰20%的生命值(触发后移除被动)"
607
+ },
608
+ "冰霜进化": {
609
+ effect: 0,
610
+ description: "免疫冰霜伤害,受到冰霜伤害会回复生命值"
611
+ },
612
+ "冰霜环绕": {
613
+ effect: 0,
614
+ description: "血量降低到30%以下时触发,回复自身45%的生命值(触发后移除被动)"
615
+ },
616
+ "寒霜地狱": {
617
+ effect: -0.3,
618
+ description: "灾难的暴风雪降临,受到的伤害-30%"
432
619
  }
433
620
  };
434
621
  const bossPool = [
@@ -439,7 +626,7 @@ function apply(ctx, config) {
439
626
  type: "主宰",
440
627
  maxHP: 1e4,
441
628
  tags: ["重甲", "生物"],
442
- passive: ["坚固外壳", "孤立无援"]
629
+ passive: ["坚固外壳"]
443
630
  // 明确类型
444
631
  },
445
632
  minions: [
@@ -452,6 +639,27 @@ function apply(ctx, config) {
452
639
  // 明确类型
453
640
  }
454
641
  ]
642
+ },
643
+ {
644
+ main: {
645
+ id: 2,
646
+ name: "寒冰王蛇",
647
+ type: "主宰",
648
+ maxHP: 7500,
649
+ tags: ["重甲", "惧热", "生物"],
650
+ passive: ["冰霜环绕", "冰霜进化"]
651
+ // 明确类型
652
+ },
653
+ minions: [
654
+ {
655
+ name: "冰蛇",
656
+ type: "子代",
657
+ maxHP: 1500,
658
+ tags: ["惧热", "生物"],
659
+ passive: ["弱化形态", "冰霜回复", "冰霜进化"]
660
+ // 明确类型
661
+ }
662
+ ]
455
663
  }
456
664
  ];
457
665
  function calculateModifiers(equippedWeapon, weaponName, hasCritRhythm) {
@@ -505,14 +713,9 @@ function apply(ctx, config) {
505
713
  return totalTagAdd;
506
714
  }
507
715
  __name(calculateTagEffects, "calculateTagEffects");
508
- function calculatePassiveEffects(targetBossConfig, activeMinionsCount) {
716
+ function calculatePassiveEffects(targetBoss) {
509
717
  let passiveEffect = 0;
510
- const effectivePassives = [...targetBossConfig.passive || []];
511
- if (targetBossConfig.type === "主宰" && effectivePassives.includes("孤立无援")) {
512
- if (activeMinionsCount !== 0) {
513
- effectivePassives.splice(effectivePassives.indexOf("孤立无援"), 1);
514
- }
515
- }
718
+ const effectivePassives = [...targetBoss.skills || []];
516
719
  effectivePassives.forEach((passive) => {
517
720
  const effect = passiveConfig[passive]?.effect || 0;
518
721
  passiveEffect += effect;
@@ -551,12 +754,7 @@ function apply(ctx, config) {
551
754
  const targetBossConfig = targetBoss.type === "主宰" ? bossPool.find((g) => g.main.name === targetBoss.name).main : bossPool.find((g) => g.minions.some((m) => m.name === targetBoss.name)).minions[0];
552
755
  const tagMultiplier = calculateTagEffects(weaponData, targetBossConfig, equippedWeapon);
553
756
  damage *= 1 + tagMultiplier;
554
- const activeMinions = await ctx2.database.get("ggcevo_boss", {
555
- groupId: targetBoss.groupId,
556
- type: "子代",
557
- isActive: true
558
- });
559
- const passiveMultiplier = calculatePassiveEffects(targetBossConfig, activeMinions.length);
757
+ const passiveMultiplier = calculatePassiveEffects(targetBoss);
560
758
  damage *= 1 + passiveMultiplier;
561
759
  const [sovereignEffect] = await ctx2.database.get("ggcevo_Wish_Record", {
562
760
  handle,
@@ -571,13 +769,13 @@ function apply(ctx, config) {
571
769
  endTime: { $gte: /* @__PURE__ */ new Date() }
572
770
  });
573
771
  if (sovereignEffect) {
574
- damage *= 1.1;
575
- effectMessage.push(`👑 王权增幅祈愿生效(攻击伤害+10%)`);
772
+ damage *= 1.05;
773
+ effectMessage.push(`👑 王权增幅祈愿生效(攻击伤害+5%)`);
576
774
  }
577
775
  if (lamentEffect) {
578
776
  const levelBonus = 0.1 * (equippedWeapon.level + 1);
579
777
  damage *= 1 + levelBonus;
580
- effectMessage.push(`🗡️ 悲鸣之锋祈愿触发(+${(levelBonus * 100).toFixed(0)}%等级加成)`);
778
+ effectMessage.push(`🗡️ 悲鸣之锋祈愿生效(+${(levelBonus * 100).toFixed(0)}%等级加成)`);
581
779
  }
582
780
  const [rankRecord] = await ctx2.database.get("ggcevo_rank", { handle: session.handle, rankseason: config.rankseason });
583
781
  const rankBonus = calculateRankBonus(rankRecord);
@@ -706,13 +904,6 @@ function apply(ctx, config) {
706
904
  }
707
905
  }
708
906
  __name(checkSensitiveWord, "checkSensitiveWord");
709
- async function initializeBoss() {
710
- const activeBoss = await ctx.database.get("ggcevo_boss", { isActive: true });
711
- if (!activeBoss.length) {
712
- await activateNextBossGroup();
713
- }
714
- }
715
- __name(initializeBoss, "initializeBoss");
716
907
  async function activateNextBossGroup(currentBossId = null) {
717
908
  let nextIndex = 0;
718
909
  if (currentBossId !== null) {
@@ -726,6 +917,8 @@ function apply(ctx, config) {
726
917
  name: nextBossGroup.main.name,
727
918
  type: nextBossGroup.main.type,
728
919
  HP: nextBossGroup.main.maxHP,
920
+ skills: [...nextBossGroup.main.passive],
921
+ // 直接展开被动数组
729
922
  groupId: nextBossGroup.main.id,
730
923
  isActive: true,
731
924
  respawnTime: /* @__PURE__ */ new Date()
@@ -735,6 +928,8 @@ function apply(ctx, config) {
735
928
  name: minion.name,
736
929
  type: minion.type,
737
930
  HP: minion.maxHP,
931
+ skills: [...minion.passive],
932
+ // 直接展开被动数组
738
933
  groupId: mainBoss.groupId,
739
934
  isActive: true,
740
935
  respawnTime: /* @__PURE__ */ new Date()
@@ -747,7 +942,7 @@ function apply(ctx, config) {
747
942
  const totalBosses = await ctx.database.select("ggcevo_boss").execute((row) => import_koishi.$.count(row.name));
748
943
  if (totalBosses === 0) {
749
944
  await activateNextBossGroup();
750
- ctx.broadcast(config.groupId, `🔄 BOSS系统已初始化,首个主宰已登场!`);
945
+ await ctx.broadcast(config.groupId, [`🔄 咕咕PVE系统已初始化,首个主宰已登场!`]);
751
946
  return;
752
947
  }
753
948
  const now = /* @__PURE__ */ new Date();
@@ -761,9 +956,9 @@ function apply(ctx, config) {
761
956
  groupId: group.groupId
762
957
  });
763
958
  await activateNextBossGroup(group.groupId);
764
- ctx.broadcast(
959
+ await ctx.broadcast(
765
960
  config.groupId,
766
- `🔄 新的主宰已刷新,快去挑战吧!`
961
+ [`🔄 新的主宰已刷新,快去挑战吧!`]
767
962
  );
768
963
  }
769
964
  }, 60 * 1e3);
@@ -1009,7 +1204,7 @@ ${itemDetails.join("\n")}`;
1009
1204
  quantity: (backpack?.quantity || 0) + tickets
1010
1205
  }]);
1011
1206
  return `签到成功!本月累计签到${monthlyDays}天,获得:
1012
- 💰 枚金币 x ${points}
1207
+ 💰 金币 x ${points}
1013
1208
  🪙 咕咕币 x ${tickets}` + effectMessage;
1014
1209
  } catch (error) {
1015
1210
  console.error("签到命令时发生错误:", error);
@@ -1111,7 +1306,7 @@ ${itemDetails.join("\n")}`;
1111
1306
  if (!backpack) return "您还没有签到。";
1112
1307
  const memberInfo = await session.event?.member?.roles;
1113
1308
  if (memberInfo?.includes("member")) {
1114
- return "❌拒绝访问,仅限管理员和群主领取每月津贴。";
1309
+ return "❌ 拒绝访问,仅限管理员和群主领取每月津贴。";
1115
1310
  }
1116
1311
  const now = /* @__PURE__ */ new Date();
1117
1312
  const chinatime = convertUTCtoChinaTime(now);
@@ -1329,7 +1524,7 @@ ${itemDetails.join("\n")}`;
1329
1524
  }
1330
1525
  }
1331
1526
  }, 60 * 60 * 1e3);
1332
- ctx.command("ggcevo/数据同步", { authority: 3 }).action(async () => {
1527
+ ctx.command("ggcevo/胜点榜数据同步", { authority: 3 }).action(async () => {
1333
1528
  try {
1334
1529
  const ggcmap = await ctx.database.get("sc2arcade_map", { guildId: config.ggcqun });
1335
1530
  const lastdate = ggcmap[0].lastdate;
@@ -1385,7 +1580,7 @@ ${itemDetails.join("\n")}`;
1385
1580
  lastdate: new Date(currentMaxDate.toISOString())
1386
1581
  });
1387
1582
  }
1388
- return "✅ 胜点榜数据手动同步成功!";
1583
+ return "✅ 胜点榜数据同步成功!";
1389
1584
  } catch (err) {
1390
1585
  console.error("错误:", err);
1391
1586
  return "服务器繁忙,请稍后尝试。";
@@ -1843,6 +2038,9 @@ ${output}`;
1843
2038
  if (existingEntries.length > 0) {
1844
2039
  return `❌ 拒绝访问,您已被列入黑名单。`;
1845
2040
  }
2041
+ await session.send(`您确定要使用3张兑换券换取一枚扭蛋币吗?(请在30秒内回复“是”确认)`);
2042
+ const confirm = await session.prompt(3e4);
2043
+ if (confirm !== "是") return "已取消操作。";
1846
2044
  const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 3 });
1847
2045
  const [coupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 2 });
1848
2046
  if (!coupon || coupon.quantity < 3) {
@@ -1909,7 +2107,7 @@ ${output}`;
1909
2107
  try {
1910
2108
  const handleRegex = /^([1235])-S2-([12])-(\d+)$/;
1911
2109
  if (!handleRegex.test(handle)) {
1912
- return "句柄格式错误,请重新输入";
2110
+ return "句柄格式错误,请重新输入。";
1913
2111
  }
1914
2112
  const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
1915
2113
  if (existingEntries.length > 0) {
@@ -2123,6 +2321,7 @@ ${achievementList.join("\n")}`;
2123
2321
  const parsedUser = import_koishi.h.parse(user)[0];
2124
2322
  if (!parsedUser || parsedUser.type !== "at" || !parsedUser.attrs.id) return "参数格式错误,请输入“pk @指定pk玩家”。";
2125
2323
  const targetUserId = parsedUser.attrs.id;
2324
+ const targetUsername = await session.bot.getGuildMember(config.ggcqun, targetUserId);
2126
2325
  const [targetprofile] = await ctx.database.get("sc2arcade_player", { userId: targetUserId });
2127
2326
  if (!targetprofile) return "对方尚未绑定句柄。";
2128
2327
  const initiatorHandle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
@@ -2200,7 +2399,7 @@ ${achievementList.join("\n")}`;
2200
2399
  const initiatorRank = initiatorData[0]?.rank || 0;
2201
2400
  const targetRank = targetData[0]?.rank || 0;
2202
2401
  const initiatorRankname = initiatorData[0]?.name || session.username;
2203
- const targetRankname = targetData[0]?.name || parsedUser.attrs.id;
2402
+ const targetRankname = targetData[0]?.name || (targetUsername.name || targetUsername.user.name);
2204
2403
  const [initiatorSign, targetSign] = await Promise.all([
2205
2404
  ctx.database.get("ggcevo_sign", initiatorHandle),
2206
2405
  ctx.database.get("ggcevo_sign", targetHandle)
@@ -2308,7 +2507,7 @@ ${achievementList.join("\n")}`;
2308
2507
  pageNum < totalPages ? `输入 pk榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
2309
2508
  ].join("\n");
2310
2509
  });
2311
- ctx.command("ggcevo/切换pk状态", "切换玩家对战状态").action(async ({ session }) => {
2510
+ ctx.command("ggcevo/切换pk状态", "切换玩家对战状态").alias("切换pk").action(async ({ session }) => {
2312
2511
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
2313
2512
  if (!profile) return "您暂未绑定句柄。";
2314
2513
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
@@ -2396,6 +2595,10 @@ ${validTypes.join("、")}`;
2396
2595
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
2397
2596
  if (!profile) return "您暂未绑定句柄";
2398
2597
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
2598
+ const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
2599
+ if (existingEntries.length > 0) {
2600
+ return `❌ 拒绝访问,您已被列入黑名单。`;
2601
+ }
2399
2602
  const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
2400
2603
  if (!weapon) return "如果您想购买武器,请输入“购买 武器名称”。";
2401
2604
  if (!weaponConfig[weapon]) return "无效的武器名称,请重新输入。";
@@ -2481,15 +2684,19 @@ ${validTypes.join("、")}`;
2481
2684
  });
2482
2685
  ctx.command("ggcevo/装备 <weapon>").action(async ({ session }, weapon) => {
2483
2686
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
2484
- if (!profile) return "未绑定句柄";
2687
+ if (!profile) return "您暂未绑定句柄。";
2485
2688
  if (!weaponConfig[weapon]) return "请输入“装备 武器名称”来装备一把你拥有的武器。";
2486
2689
  const config2 = weaponConfig[weapon];
2487
2690
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
2691
+ const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
2692
+ if (existingEntries.length > 0) {
2693
+ return `❌ 拒绝访问,您已被列入黑名单。`;
2694
+ }
2488
2695
  const [owned] = await ctx.database.get("ggcevo_equipment", {
2489
2696
  handle,
2490
2697
  weaponId: config2.id
2491
2698
  });
2492
- if (!owned) return "尚未获得该武器";
2699
+ if (!owned) return "尚未获得该武器。";
2493
2700
  await ctx.database.withTransaction(async () => {
2494
2701
  await ctx.database.set(
2495
2702
  "ggcevo_equipment",
@@ -2506,12 +2713,16 @@ ${validTypes.join("、")}`;
2506
2713
  equipped: true
2507
2714
  }], ["handle", "weaponId"]);
2508
2715
  });
2509
- return `已成功装备 ${weapon}!`;
2716
+ return `您已成功装备 ${weapon}!`;
2510
2717
  });
2511
2718
  ctx.command("ggcevo/升级 <weapon>", "升级武器伤害").alias("升级武器", "武器升级", "武器强化", "强化武器").action(async ({ session }, weapon) => {
2512
2719
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
2513
2720
  if (!profile) return "您暂未绑定句柄。";
2514
2721
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
2722
+ const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
2723
+ if (existingEntries.length > 0) {
2724
+ return `❌ 拒绝访问,您已被列入黑名单。`;
2725
+ }
2515
2726
  const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
2516
2727
  const [equipment] = await ctx.database.get("ggcevo_equipment", {
2517
2728
  handle,
@@ -2590,6 +2801,10 @@ ${validTypes.join("、")}`;
2590
2801
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
2591
2802
  if (!profile) return "您暂未绑定句柄";
2592
2803
  const handle = `${profile.regionId}-S2-${profile.realmId}-${profile.profileId}`;
2804
+ const existingEntries = await ctx.database.get("ggcevo_blacklist", { handle });
2805
+ if (existingEntries.length > 0) {
2806
+ return `❌ 拒绝访问,您已被列入黑名单。`;
2807
+ }
2593
2808
  const [signInfo] = await ctx.database.get("ggcevo_sign", { handle });
2594
2809
  const [equipment] = await ctx.database.get("ggcevo_equipment", {
2595
2810
  handle,
@@ -2670,19 +2885,90 @@ ${validTypes.join("、")}`;
2670
2885
  handle,
2671
2886
  equipped: true
2672
2887
  });
2673
- if (!equippedWeapon) return "请先装备武器再挑战主宰。";
2888
+ if (!equippedWeapon) return "请先装备武器再攻击。";
2674
2889
  const activeBosses = await ctx.database.get("ggcevo_boss", { isActive: true });
2675
2890
  if (!activeBosses.length) return "当前没有存活的主宰。";
2676
2891
  const targetBoss = normalizedTarget === "主宰" ? activeBosses.find((b) => b.type === "主宰") : activeBosses.find((b) => b.type === "子代");
2677
2892
  if (!targetBoss) return `当前没有可攻击的${normalizedTarget === "主宰" ? "主宰" : "子代"}。`;
2678
- const bossGroup = bossPool.find((group) => group.main.id === targetBoss.groupId);
2679
- if (!bossGroup) return "无法获取BOSS组信息,请联系管理员。";
2680
2893
  const weaponConfigEntry = Object.entries(weaponConfig).find(([_, c]) => c.id === equippedWeapon.weaponId);
2681
2894
  const [weaponName, weaponData] = weaponConfigEntry;
2682
2895
  const { damage: baseDamage, hasCrit, effectMessage } = await calculateTotalDamage(ctx, session, equippedWeapon, targetBoss);
2683
- const actualDamage = Math.min(baseDamage, targetBoss.HP);
2684
- const updatedHP = targetBoss.HP - actualDamage;
2685
- const isDefeated = updatedHP <= 0;
2896
+ const bossGroup = bossPool.find((g) => g.main.id === targetBoss.groupId);
2897
+ if (!bossGroup) return "无法获取BOSS组配置。";
2898
+ const maxHP = targetBoss.type === "主宰" ? bossGroup.main.maxHP : bossGroup.minions.find((m) => m.name === targetBoss.name)?.maxHP || 0;
2899
+ let initialDamage = Math.min(baseDamage, targetBoss.HP);
2900
+ let currentHP = targetBoss.HP - initialDamage;
2901
+ let healMessages = [];
2902
+ let triggeredSkills = [];
2903
+ let globalSkillUpdates = /* @__PURE__ */ new Map();
2904
+ if (targetBoss.skills.includes("冰霜进化") && weaponName === "零度之下") {
2905
+ const healAmount = baseDamage;
2906
+ currentHP = Math.min(targetBoss.HP + healAmount, maxHP);
2907
+ initialDamage = 0;
2908
+ }
2909
+ const willDieInstantly = currentHP <= 0;
2910
+ if (!willDieInstantly) {
2911
+ const hpPercentage = currentHP / maxHP;
2912
+ if (targetBoss.type === "主宰" && targetBoss.skills.includes("冰霜环绕") && hpPercentage <= 0.3) {
2913
+ const healAmount = Math.floor(maxHP * 0.45);
2914
+ currentHP = Math.min(currentHP + healAmount, maxHP);
2915
+ triggeredSkills.push("冰霜环绕");
2916
+ const activeMinions = await ctx.database.get("ggcevo_boss", {
2917
+ groupId: targetBoss.groupId,
2918
+ type: "子代",
2919
+ isActive: true
2920
+ });
2921
+ const updates = [
2922
+ // 更新主宰
2923
+ {
2924
+ name: targetBoss.name,
2925
+ skills: [
2926
+ ...targetBoss.skills.filter((s) => s !== "冰霜环绕"),
2927
+ "寒霜地狱"
2928
+ ]
2929
+ // 明确类型
2930
+ },
2931
+ // 更新所有存活子代
2932
+ ...activeMinions.map((minion) => ({
2933
+ name: minion.name,
2934
+ skills: [
2935
+ ...minion.skills,
2936
+ "寒霜地狱"
2937
+ // 明确字面量类型
2938
+ ]
2939
+ }))
2940
+ ];
2941
+ updates.forEach((update) => {
2942
+ globalSkillUpdates.set(update.name, update.skills);
2943
+ });
2944
+ await ctx.database.upsert("ggcevo_boss", updates, ["name"]);
2945
+ healMessages.push(
2946
+ `❄️ ${targetBoss.name} 触发【冰霜环绕】,自身回复45%最大生命值(+${healAmount}HP)`,
2947
+ `🌪️ 【寒霜地狱】降临!所有存活的主宰和子代将获得30%减伤效果`
2948
+ );
2949
+ }
2950
+ if (targetBoss.type === "子代" && targetBoss.skills.includes("冰霜回复") && hpPercentage <= 0.3) {
2951
+ let mainHeal;
2952
+ const selfHeal = Math.floor(maxHP * 0.2);
2953
+ currentHP = Math.min(currentHP + selfHeal, maxHP);
2954
+ const mainBoss = activeBosses.find(
2955
+ (b) => b.groupId === targetBoss.groupId && b.type === "主宰"
2956
+ );
2957
+ if (mainBoss) {
2958
+ const mainMaxHP = bossGroup.main.maxHP;
2959
+ mainHeal = Math.floor(mainMaxHP * 0.2);
2960
+ const mainNewHP = Math.min(mainBoss.HP + mainHeal, mainMaxHP);
2961
+ await ctx.database.set(
2962
+ "ggcevo_boss",
2963
+ { name: mainBoss.name },
2964
+ { HP: mainNewHP }
2965
+ );
2966
+ }
2967
+ triggeredSkills.push("冰霜回复");
2968
+ healMessages.push(`❄️ ${targetBoss.name} 触发【冰霜回复】,自身回复20%最大生命值(+${selfHeal}HP),主宰回复20%最大生命值(+${mainHeal}HP)`);
2969
+ }
2970
+ }
2971
+ const isDefeated = currentHP <= 0;
2686
2972
  const [existingRecord] = await ctx.database.get("ggcevo_boss_damage", {
2687
2973
  handle,
2688
2974
  bossGroupId: targetBoss.groupId
@@ -2693,7 +2979,7 @@ ${validTypes.join("、")}`;
2693
2979
  bossGroupId: targetBoss.groupId
2694
2980
  }, {
2695
2981
  playerName: session.username,
2696
- totalDamage: existingRecord.totalDamage + actualDamage,
2982
+ totalDamage: existingRecord.totalDamage + initialDamage,
2697
2983
  // 改为实际伤害
2698
2984
  attackCount: existingRecord.attackCount + 1,
2699
2985
  lastattackDate: /* @__PURE__ */ new Date()
@@ -2703,7 +2989,7 @@ ${validTypes.join("、")}`;
2703
2989
  handle,
2704
2990
  playerName: session.username,
2705
2991
  bossGroupId: targetBoss.groupId,
2706
- totalDamage: actualDamage,
2992
+ totalDamage: initialDamage,
2707
2993
  // 改为实际伤害
2708
2994
  attackCount: 1,
2709
2995
  lastattackDate: /* @__PURE__ */ new Date()
@@ -2878,47 +3164,77 @@ ${validTypes.join("、")}`;
2878
3164
  HP: 0
2879
3165
  }
2880
3166
  );
2881
- broadcastMessage = [
2882
- `⚡ ${session.username} 击破了子代 ${targetBoss.name}!`,
2883
- `【连锁效果】主宰获得 20% 易伤状态!`
2884
- ];
3167
+ const groupId = targetBoss.groupId;
3168
+ const remainingMinions = await ctx.database.get("ggcevo_boss", {
3169
+ groupId,
3170
+ type: "子代",
3171
+ isActive: true
3172
+ });
3173
+ const broadcastMessages = [`⚡ ${session.username} 击破了子代 ${targetBoss.name}!`];
3174
+ if (remainingMinions.length === 0) {
3175
+ const [mainBoss] = await ctx.database.get("ggcevo_boss", {
3176
+ groupId,
3177
+ type: "主宰",
3178
+ isActive: true
3179
+ });
3180
+ if (mainBoss && !mainBoss.skills.includes("孤立无援")) {
3181
+ const updatedSkills = [...mainBoss.skills, "孤立无援"];
3182
+ await ctx.database.set(
3183
+ "ggcevo_boss",
3184
+ { name: mainBoss.name },
3185
+ { skills: updatedSkills }
3186
+ );
3187
+ broadcastMessages.push("💥 所有子代已阵亡,主宰进入【孤立无援】状态,受到的伤害+20%!");
3188
+ }
3189
+ }
3190
+ broadcastMessage = broadcastMessages;
2885
3191
  }
2886
3192
  } else {
3193
+ const finalSkills = globalSkillUpdates.get(targetBoss.name) || targetBoss.skills.filter((s) => !triggeredSkills.includes(s));
2887
3194
  await ctx.database.set(
2888
3195
  "ggcevo_boss",
2889
3196
  { name: targetBoss.name },
2890
- { HP: updatedHP }
3197
+ {
3198
+ HP: Math.max(currentHP, 0),
3199
+ skills: finalSkills
3200
+ }
2891
3201
  );
2892
3202
  }
2893
3203
  const [existingSign] = await ctx.database.get("ggcevo_sign", { handle });
2894
3204
  if (existingSign) {
2895
3205
  await ctx.database.set("ggcevo_sign", { handle }, {
2896
- totalRewards: existingSign.totalRewards + actualDamage
3206
+ totalRewards: existingSign.totalRewards + initialDamage
2897
3207
  // 改为实际伤害
2898
3208
  });
2899
3209
  } else {
2900
3210
  await ctx.database.create("ggcevo_sign", {
2901
3211
  handle,
2902
- totalRewards: actualDamage
3212
+ totalRewards: initialDamage
2903
3213
  // 改为实际伤害
2904
3214
  });
2905
3215
  }
2906
3216
  const resultMessage = [
2907
3217
  `🔥 ${session.username} 使用武器 ${weaponName} 对 ${targetBoss.name} 发起攻击!`,
2908
3218
  ...effectMessage.length > 0 ? [
2909
- // 新增效果反馈
2910
3219
  `💫 祈愿效果:${effectMessage.join(" | ")}`
2911
3220
  ] : [],
2912
- `造成伤害:${actualDamage}${hasCrit ? "(✨ 暴击!)" : ""}`,
2913
- `获得金币:${actualDamage}`,
2914
- `目标剩余HP:${isDefeated ? 0 : updatedHP}/${targetBoss.type === "主宰" ? bossGroup.main.maxHP : bossGroup.minions[0].maxHP}`,
3221
+ // 冰霜进化特殊处理(新增条件判断)
3222
+ ...targetBoss.skills.includes("冰霜进化") && weaponName === "零度之下" ? [
3223
+ `❄️ ${targetBoss.name} 触发【冰霜进化】免疫冰霜伤害!并且回复 ${baseDamage} 生命值`
3224
+ ] : [
3225
+ `造成伤害:${initialDamage}${hasCrit ? "(✨ 暴击)" : ""}`,
3226
+ ...healMessages
3227
+ ],
3228
+ // 金币奖励显示逻辑优化
3229
+ `获得金币:${targetBoss.skills.includes("冰霜进化") && weaponName === "零度之下" ? 0 : initialDamage}`,
3230
+ `目标剩余HP:${Math.max(currentHP, 0)}/${maxHP}`,
2915
3231
  isDefeated ? `🎉 成功击败 ${targetBoss.name}!` : ""
2916
3232
  ].filter((line) => line).join("\n");
2917
3233
  await session.send(resultMessage);
2918
3234
  if (broadcastMessage) {
2919
3235
  const finalBroadcast = Array.isArray(broadcastMessage) ? broadcastMessage.join("\n") : broadcastMessage;
2920
3236
  await new Promise((resolve) => setTimeout(resolve, 500));
2921
- ctx.broadcast(config2.groupId, finalBroadcast);
3237
+ await ctx.broadcast(config2.groupId, finalBroadcast);
2922
3238
  }
2923
3239
  return;
2924
3240
  });
@@ -2951,7 +3267,7 @@ ${validTypes.join("、")}`;
2951
3267
  pageNum < totalPages ? `输入 伤害榜 ${pageNum + 1} 查看下一页` : "已是最后一页"
2952
3268
  ].join("\n");
2953
3269
  });
2954
- ctx.command("ggcevo/主宰信息", "查看当前主宰信息").alias("zz信息").action(async () => {
3270
+ ctx.command("ggcevo/主宰信息", "查看当前主宰信息").alias("zz信息", "主宰状态", "zz状态").action(async () => {
2955
3271
  const activeBosses = await ctx.database.get("ggcevo_boss", { isActive: true });
2956
3272
  if (!activeBosses.length) return "当前没有存活的主宰。";
2957
3273
  const mainBoss = activeBosses.find((b) => b.type === "主宰");
@@ -2960,44 +3276,61 @@ ${validTypes.join("、")}`;
2960
3276
  const bossGroup = bossPool.find((group) => group.main.name === mainBoss.name);
2961
3277
  if (!bossGroup) return "BOSS配置数据异常,请联系管理员";
2962
3278
  const mainBossHpBar = createHpBar(mainBoss.HP, bossGroup.main.maxHP);
2963
- let passiveDisplay = [];
2964
- if (bossGroup.main.passive) {
2965
- const activeMinions = await ctx.database.get("ggcevo_boss", {
2966
- groupId: mainBoss.groupId,
2967
- type: "子代",
2968
- isActive: true
2969
- });
2970
- passiveDisplay = bossGroup.main.passive.filter((p) => {
2971
- if (p === "孤立无援") return activeMinions.length === 0;
2972
- return true;
2973
- }).map((p) => {
2974
- return `${p}:${passiveConfig[p].description}`;
2975
- });
2976
- }
3279
+ const mainPassives = mainBoss.skills.map((p) => `${p}:${passiveConfig[p].description}`);
2977
3280
  const result = [
2978
3281
  `🔴 主宰:${mainBoss.name}`,
2979
3282
  `${mainBossHpBar} (${mainBoss.HP}/${bossGroup.main.maxHP})`,
2980
3283
  `标签:${bossGroup.main.tags.join("、")}`,
2981
- `被动:${passiveDisplay.join("") || "无"}`
3284
+ "被动:",
3285
+ ...mainPassives.length ? mainPassives : ["无"]
2982
3286
  ];
2983
3287
  if (minions.length > 0) {
2984
- result.push("", "🟠 子代:");
2985
- minions.forEach((minion) => {
3288
+ result.push("\n🟠 子代:");
3289
+ for (const minion of minions) {
2986
3290
  const minionConfig = bossGroup.minions.find((m) => m.name === minion.name);
2987
- if (minionConfig) {
2988
- const minionHpBar = createHpBar(minion.HP, minionConfig.maxHP);
2989
- const minionPassives = (minionConfig.passive || []).map((p) => `${p}:${passiveConfig[p].description}`).join(",");
2990
- result.push(
2991
- `${minion.name}`,
2992
- `${minionHpBar} (${minion.HP}/${minionConfig.maxHP})`,
2993
- `标签:${minionConfig.tags.join("、")}`,
2994
- `被动:${minionPassives || ""}`
2995
- );
2996
- }
2997
- });
3291
+ if (!minionConfig) continue;
3292
+ const minionHpBar = createHpBar(minion.HP, minionConfig.maxHP);
3293
+ const minionPassives = minion.skills.map((p) => `${p}:${passiveConfig[p].description}`);
3294
+ result.push(
3295
+ `${minion.name}`,
3296
+ `${minionHpBar} (${minion.HP}/${minionConfig.maxHP})`,
3297
+ `标签:${minionConfig.tags.join("、")}`,
3298
+ "被动:",
3299
+ ...minionPassives.length ? minionPassives : ["无"]
3300
+ );
3301
+ }
2998
3302
  }
2999
3303
  return result.join("\n");
3000
3304
  });
3305
+ ctx.command("ggcevo/初始化主宰 <groupid:number>", "初始化指定主宰组", { authority: 3 }).alias("初始化zz").action(async ({ session }, groupid) => {
3306
+ if (!groupid) groupid = 1;
3307
+ const bossConfig = bossPool.find((g) => g.main.id === groupid);
3308
+ if (!bossConfig) {
3309
+ return `未找到groupid为${groupid}的主宰配置`;
3310
+ }
3311
+ await ctx.database.remove("ggcevo_boss", {});
3312
+ const mainBoss = await ctx.database.create("ggcevo_boss", {
3313
+ name: bossConfig.main.name,
3314
+ type: "主宰",
3315
+ HP: bossConfig.main.maxHP,
3316
+ skills: [...bossConfig.main.passive],
3317
+ groupId: groupid,
3318
+ isActive: true,
3319
+ respawnTime: /* @__PURE__ */ new Date()
3320
+ });
3321
+ for (const minion of bossConfig.minions) {
3322
+ await ctx.database.create("ggcevo_boss", {
3323
+ name: minion.name,
3324
+ type: "子代",
3325
+ HP: minion.maxHP,
3326
+ skills: [...minion.passive],
3327
+ groupId: groupid,
3328
+ isActive: true,
3329
+ respawnTime: /* @__PURE__ */ new Date()
3330
+ });
3331
+ }
3332
+ return `✅ 主宰初始化成功!当前主宰:${bossConfig.main.name}(HP:${bossConfig.main.maxHP})`;
3333
+ });
3001
3334
  ctx.command("ggcevo/祈愿").alias("祈福", "祈祷").action(async (argv) => {
3002
3335
  const session = argv.session;
3003
3336
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-ggcevo-game",
3
3
  "description": "《星际争霸2》咕咕虫-evolved地图的专属游戏助手插件,集成天梯排行、抽奖系统、签到福利、兑换商城等丰富功能。",
4
- "version": "1.2.38",
4
+ "version": "1.2.40",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [