koishi-plugin-ggcevo-game 1.6.59 → 1.6.61

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.
Files changed (2) hide show
  1. package/lib/index.js +192 -77
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -1482,7 +1482,7 @@ var bossPool = [
1482
1482
  main: {
1483
1483
  name: "空间站感染虫",
1484
1484
  type: "主宰",
1485
- maxHP: 15e3,
1485
+ maxHP: 2e4,
1486
1486
  maxShield: 0,
1487
1487
  maxEnergy: 0,
1488
1488
  armor: 5,
@@ -1507,7 +1507,7 @@ var bossPool = [
1507
1507
  {
1508
1508
  name: "空间站哨枪塔",
1509
1509
  type: "子代",
1510
- maxHP: 2e4,
1510
+ maxHP: 3e4,
1511
1511
  maxShield: 0,
1512
1512
  maxEnergy: 0,
1513
1513
  armor: 6.5,
@@ -1709,7 +1709,7 @@ var bossPool = [
1709
1709
  main: {
1710
1710
  name: "虫群女王",
1711
1711
  type: "主宰",
1712
- maxHP: 1e4,
1712
+ maxHP: 2e4,
1713
1713
  maxShield: 0,
1714
1714
  maxEnergy: 0,
1715
1715
  armor: 5,
@@ -5515,6 +5515,21 @@ var ggcevoUpdates = [
5515
5515
  - 修改铝热炸弹的机制,现在无法直接击杀异形
5516
5516
  - 削弱了燃烧机制,现在每一层额外造成1点伤害(上限依旧是100点)
5517
5517
  `.trim()
5518
+ },
5519
+ {
5520
+ version: "1.6.60",
5521
+ time: "2025-08-4",
5522
+ content: `
5523
+ - 新增兑换资源,1张兑换券可以兑换20张资源兑换券
5524
+ `.trim()
5525
+ },
5526
+ {
5527
+ version: "1.6.61",
5528
+ time: "2025-08-5",
5529
+ content: `
5530
+ - 优化探索掠夺机制,现在相同名称的飞船互相掠夺成功率固定为50%
5531
+ - 修改TX-12S隐形巡洋舰的机制,现在只有当掠夺金币加成≤0时,探索才不会被掠夺
5532
+ `.trim()
5518
5533
  }
5519
5534
  ];
5520
5535
  function compareVersions(a, b) {
@@ -7322,7 +7337,7 @@ var spaceship = {
7322
7337
  description: "TX-12S是标准星际巡洋舰的改型",
7323
7338
  miningbonus: 10,
7324
7339
  explorebonus: 5,
7325
- effect: "探索的成功率提高10%;探索时不会被掠夺",
7340
+ effect: "探索的成功率提高10%;当掠夺金币加成≤0时,探索不会被掠夺",
7326
7341
  price: 1500
7327
7342
  },
7328
7343
  "TX-12A突击巡洋舰": {
@@ -12012,6 +12027,15 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
12012
12027
  return "🛠️ 系统维护中,请稍后再试";
12013
12028
  }
12014
12029
  });
12030
+ function getSpaceshipNameById(spaceshipId) {
12031
+ for (const [name2, data] of Object.entries(spaceship)) {
12032
+ if (data.id === spaceshipId) {
12033
+ return name2;
12034
+ }
12035
+ }
12036
+ return "未知飞船型号";
12037
+ }
12038
+ __name(getSpaceshipNameById, "getSpaceshipNameById");
12015
12039
  ctx.command("ggcevo/探索 [galaxyName]").action(async ({ session }, galaxyName) => {
12016
12040
  const Curfew = fixedCurfewCheck(session, config);
12017
12041
  if (!Curfew) return "⛔ 宵禁时段 (18:00-24:00) 禁止在群聊中使用咕咕之战指令。\n请添加C.O.R.E为好友使用私聊指令,好友验证信息为【咕咕之战】。";
@@ -12118,10 +12142,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
12118
12142
  bonusEffects.push(`▸ 🌌 ${record.galaxy}:金币+${galaxyBonusPercent.toFixed(0)}%`);
12119
12143
  }
12120
12144
  if (shipBonus || shipSuccessBonus) {
12121
- let shipType = "";
12122
- if (shipRecord.id === 2) shipType = "TX-12S隐形巡洋舰";
12123
- else if (shipRecord.id === 3) shipType = "TX-12A突击巡洋舰";
12124
- else if (shipRecord.id === 4) shipType = "庞兽号歼星舰";
12145
+ let shipType = shipRecord ? getSpaceshipNameById(shipRecord.id) : "未知飞船";
12125
12146
  if (shipBonus) bonusEffects.push(`▸ 🚀 ${shipType}:金币+${shipBonus}%`);
12126
12147
  if (shipSuccessBonus) bonusEffects.push(`▸ 🛸 ${shipType}:成功率+${Math.round(shipSuccessBonus * 100)}%`);
12127
12148
  }
@@ -12228,7 +12249,6 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
12228
12249
  });
12229
12250
  const isRewardModified = finalCoin !== baseCoinReward;
12230
12251
  const coinDisplay = isRewardModified ? `💰 金币 +${finalCoin}(基础值 ${baseCoinReward})` : `💰 金币 +${finalCoin}`;
12231
- const availableItemsDisplay = galaxyData2.available.join("、") || "无";
12232
12252
  const resultMessage = [
12233
12253
  isSuccess ? "🎉 探索成功!" : "⚠️ 探索失败!",
12234
12254
  `🌌 星系:${record.galaxy}`,
@@ -12277,8 +12297,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
12277
12297
  const explorers = await ctx.database.get("ggcevo_explore", {
12278
12298
  galaxy: galaxyName,
12279
12299
  status: "探索中",
12280
- handle: { $ne: handle },
12281
- plunderbonus: { $gte: 0 }
12300
+ handle: { $ne: handle }
12282
12301
  });
12283
12302
  if (explorers.length > 0) {
12284
12303
  const shipHandles = explorers.map((e) => e.handle);
@@ -12288,26 +12307,37 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
12288
12307
  const shipMap = new Map(ships.map((ship) => [ship.handle, ship.id]));
12289
12308
  const plunderTargets = explorers.filter((explorer) => {
12290
12309
  const shipId = shipMap.get(explorer.handle);
12291
- return shipId !== 2;
12310
+ return !(shipId === 2 && explorer.plunderbonus <= 0);
12292
12311
  });
12293
12312
  if (plunderTargets.length > 0) {
12294
12313
  const target = plunderTargets[Math.floor(Math.random() * plunderTargets.length)];
12314
+ const targetShipId = shipMap.get(target.handle) || 0;
12315
+ const targetShipType = getSpaceshipNameById(targetShipId);
12316
+ const playerShipType = shipRecord ? getSpaceshipNameById(shipRecord.id) : "未知型号";
12295
12317
  let isTargetBehemoth = false;
12296
12318
  let defenseNote = "";
12297
- const [targetShip] = await ctx.database.get("ggcevo_spaceship", { handle: target.handle });
12298
- if (targetShip && targetShip.id === 4) {
12299
- isTargetBehemoth = true;
12300
- }
12301
- let baseSuccessRate = 50;
12302
- if (isBehemoth) baseSuccessRate += 30;
12303
- if (shipRecord?.id === 3) baseSuccessRate += 10;
12304
- if (isTargetBehemoth && !isBehemoth) {
12319
+ if (targetShipId === 4) isTargetBehemoth = true;
12320
+ const sameShipType = shipRecord?.id === targetShipId;
12321
+ let baseSuccessRate = sameShipType ? 50 : (
12322
+ // 修改2:相同型号固定50%
12323
+ isBehemoth ? 80 : (
12324
+ // 庞兽号基础成功率
12325
+ shipRecord?.id === 3 ? 60 : (
12326
+ // 突击巡洋舰
12327
+ 50
12328
+ )
12329
+ )
12330
+ );
12331
+ if (isTargetBehemoth && !isBehemoth && !sameShipType) {
12305
12332
  baseSuccessRate -= 30;
12306
12333
  defenseNote = "⚠️ 目标飞船为庞兽号歼星舰,掠夺成功率降低30%!";
12307
12334
  }
12308
- baseSuccessRate = Math.max(0, Math.min(baseSuccessRate, 100));
12335
+ if (sameShipType) {
12336
+ defenseNote = `⚠️ 检测到相同型号飞船「${playerShipType}」,掠夺成功率固定为50%!`;
12337
+ }
12309
12338
  await session.send([
12310
- `❗ 您在探索过程中发现了【${target.name}】的飞船,是否掠夺?`,
12339
+ `❗ 您在探索过程中发现了【${target.name}】的飞船`,
12340
+ `🚀 对方飞船:${targetShipType}`,
12311
12341
  defenseNote,
12312
12342
  `🎯 掠夺成功率:${baseSuccessRate}%`,
12313
12343
  `⏱️ (30秒内输入"是"来进行掠夺)`
@@ -12315,7 +12345,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
12315
12345
  try {
12316
12346
  const response = await session.prompt(3e4);
12317
12347
  if (response === "是") {
12318
- let success = Math.random() < baseSuccessRate / 100;
12348
+ const success = Math.random() < baseSuccessRate / 100;
12319
12349
  let playerBonus, targetBonus;
12320
12350
  if (success) {
12321
12351
  playerBonus = 20;
@@ -12324,13 +12354,15 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
12324
12354
  playerBonus = -20;
12325
12355
  targetBonus = 20;
12326
12356
  }
12357
+ const [currentRecord] = await ctx.database.get("ggcevo_explore", { handle });
12327
12358
  await ctx.database.upsert("ggcevo_explore", [{
12328
12359
  handle,
12329
12360
  name: name2,
12330
12361
  startTime: /* @__PURE__ */ new Date(),
12331
12362
  galaxy: galaxyName,
12332
- returns: record?.returns || 0,
12333
- plunderbonus: playerBonus,
12363
+ returns: currentRecord?.returns || 0,
12364
+ plunderbonus: (currentRecord?.plunderbonus || 0) + playerBonus,
12365
+ // 累加加成值
12334
12366
  status: "探索中"
12335
12367
  }], ["handle"]);
12336
12368
  const [targetRecord] = await ctx.database.get("ggcevo_explore", { handle: target.handle });
@@ -12718,7 +12750,7 @@ ${validBossNames.join("、")}`;
12718
12750
  return "⚠️ 竞猜提交失败,请重试";
12719
12751
  }
12720
12752
  });
12721
- ctx.command("ggcevo/兑换资源 [name] [amount]").usage('输入"兑换资源"查看可兑换资源列表\n输入"兑换资源 物品名称 [数量]"进行兑换').action(async ({ session }, name2, amount) => {
12753
+ ctx.command("ggcevo/兑换资源 [name] [amount]").alias("兑换").usage('输入"兑换资源"查看可兑换物品列表\n输入"兑换资源 物品名称 [数量]"进行兑换').action(async ({ session }, name2, amount) => {
12722
12754
  const Curfew = fixedCurfewCheck(session, config);
12723
12755
  if (!Curfew) return "⛔ 宵禁时段 (18:00-24:00) 禁止在群聊中使用咕咕之战指令。\n请添加C.O.R.E为好友使用私聊指令,好友验证信息为【咕咕之战】。";
12724
12756
  const [profile] = await ctx.database.get("sc2arcade_player", { userId: session.userId });
@@ -12727,71 +12759,154 @@ ${validBossNames.join("、")}`;
12727
12759
  if ((await ctx.database.get("ggcevo_blacklist", { handle })).length) {
12728
12760
  return "⛔ 您已被列入黑名单。";
12729
12761
  }
12730
- const resourceItems = {
12731
- "金币": { valuePerCoupon: 100, currencyField: "totalRewards", table: "ggcevo_sign" },
12732
- "红晶": { valuePerCoupon: 1, currencyField: "redcrystal", table: "ggcevo_careers" }
12762
+ const exchangeItems = {
12763
+ // === 特殊资源兑换 ===
12764
+ "金币": {
12765
+ type: "resource",
12766
+ costItemId: 8,
12767
+ costAmount: 1,
12768
+ valuePerCoupon: 100,
12769
+ currencyField: "totalRewards",
12770
+ table: "ggcevo_sign",
12771
+ display: "1张资源兑换券 → 100金币"
12772
+ },
12773
+ "红晶": {
12774
+ type: "resource",
12775
+ costItemId: 8,
12776
+ costAmount: 1,
12777
+ valuePerCoupon: 1,
12778
+ currencyField: "redcrystal",
12779
+ table: "ggcevo_careers",
12780
+ display: "1张资源兑换券 → 1红晶",
12781
+ preCheck: /* @__PURE__ */ __name(async () => {
12782
+ const [career] = await ctx.database.get("ggcevo_careers", { handle });
12783
+ if (!career || career.group !== "辛迪加海盗") {
12784
+ return `⚠️ 兑换失败:仅限【辛迪加海盗】组织成员兑换,您当前属于【${career?.group || "无"}】`;
12785
+ }
12786
+ return null;
12787
+ }, "preCheck")
12788
+ },
12789
+ // === 物品兑换 ===
12790
+ "资源兑换券": {
12791
+ type: "item",
12792
+ costItemId: 2,
12793
+ // 消耗:ItemID=2 (兑换券)
12794
+ costAmount: 1,
12795
+ // 每张兑换券消耗数量
12796
+ gainItemId: 8,
12797
+ // 获得:ItemID=8 (资源兑换券)
12798
+ gainAmount: 20,
12799
+ // 获得数量
12800
+ display: "1张兑换券 → 20张资源兑换券"
12801
+ }
12802
+ // 可在此继续添加其他物品兑换...
12733
12803
  };
12734
12804
  if (!name2) {
12735
- const [coupon] = await ctx.database.get("ggcevo_backpack", {
12736
- handle,
12737
- itemId: 8
12738
- });
12805
+ const [resourceCoupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 8 });
12806
+ const [exchangeCoupon] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 2 });
12739
12807
  return [
12740
- "💰 资源兑换商店 💰",
12808
+ "🛒 资源兑换商店 🛒",
12741
12809
  '使用 "兑换资源 物品名称 数量" 进行兑换',
12742
- `您当前持有: ${coupon?.quantity || 0}张资源兑换券`,
12743
12810
  "====================",
12744
- ...Object.entries(resourceItems).map(([itemName, config2]) => `▸ ${itemName}:1张券兑换${config2.valuePerCoupon}${itemName === "金币" ? "金币" : "红晶"}`),
12811
+ `🪙 资源兑换券: ${resourceCoupon?.quantity || 0}张`,
12812
+ `🎟️ 兑换券: ${exchangeCoupon?.quantity || 0}张`,
12813
+ "====================",
12814
+ ...Object.entries(exchangeItems).map(([itemName, config2]) => {
12815
+ return `▸ ${itemName}: ${config2.display}`;
12816
+ }),
12745
12817
  "====================",
12746
- '输入示例:"兑换资源 金币 5"(兑换500金币)'
12818
+ "输入示例:",
12819
+ '"兑换资源 金币 5" → 兑换500金币(消耗5张资源券)',
12820
+ '"兑换资源 资源兑换券 2" → 兑换40张资源券(消耗2张兑换券)'
12747
12821
  ].join("\n");
12748
12822
  }
12749
- const itemconfig = resourceItems[name2];
12750
- if (!itemconfig) return `⚠️ 无效物品名称,可用选项:${Object.keys(resourceItems).join("、")}`;
12751
- if (name2 === "红晶") {
12752
- const [career] = await ctx.database.get("ggcevo_careers", { handle });
12753
- if (!career || career.group !== "辛迪加海盗") {
12754
- return `⚠️ 兑换红晶失败:仅限【辛迪加海盗】组织成员兑换,您当前属于【${career?.group || "无"}】`;
12755
- }
12756
- }
12757
- const exchangeAmount = parseInt(amount) || 1;
12758
- if (exchangeAmount <= 0 || exchangeAmount > 100) return "⚠️ 兑换数量需在1-100之间";
12759
- const [couponItem] = await ctx.database.get("ggcevo_backpack", {
12760
- handle,
12761
- itemId: 8
12762
- });
12763
- const couponCount = couponItem?.quantity || 0;
12764
- if (couponCount < exchangeAmount) {
12765
- return `⚠️ 兑换券不足,需要${exchangeAmount}张,当前持有:${couponCount}张`;
12766
- }
12767
- const gainAmount = itemconfig.valuePerCoupon * exchangeAmount;
12823
+ const itemConfig2 = exchangeItems[name2];
12824
+ if (!itemConfig2) return `⚠️ 无效物品名称,可用选项:${Object.keys(exchangeItems).join("、")}`;
12825
+ let exchangeCount = parseInt(amount) || 1;
12826
+ if (exchangeCount <= 0) return "⚠️ 兑换数量必须大于0";
12827
+ if (exchangeCount > 100) return "⚠️ 单次最多兑换100次";
12768
12828
  try {
12769
- await ctx.database.withTransaction(async () => {
12770
- await ctx.database.set(
12771
- "ggcevo_backpack",
12772
- { handle, itemId: 8 },
12773
- { quantity: couponCount - exchangeAmount }
12774
- );
12775
- const [record] = await ctx.database.get(itemconfig.table, { handle });
12776
- if (record) {
12829
+ if (itemConfig2.type === "resource") {
12830
+ if (itemConfig2.preCheck) {
12831
+ const checkResult = await itemConfig2.preCheck();
12832
+ if (checkResult) return checkResult;
12833
+ }
12834
+ const [costItem] = await ctx.database.get("ggcevo_backpack", {
12835
+ handle,
12836
+ itemId: itemConfig2.costItemId
12837
+ });
12838
+ const requiredCoupons = exchangeCount * itemConfig2.costAmount;
12839
+ const heldCoupons = costItem?.quantity || 0;
12840
+ if (heldCoupons < requiredCoupons) {
12841
+ return `⚠️ ${name2}不足,需要${requiredCoupons}张资源兑换券,当前持有:${heldCoupons}张`;
12842
+ }
12843
+ const gainAmount = itemConfig2.valuePerCoupon * exchangeCount;
12844
+ await ctx.database.withTransaction(async () => {
12777
12845
  await ctx.database.set(
12778
- itemconfig.table,
12779
- { handle },
12780
- { [itemconfig.currencyField]: record[itemconfig.currencyField] + gainAmount }
12846
+ "ggcevo_backpack",
12847
+ { handle, itemId: itemConfig2.costItemId },
12848
+ { quantity: heldCoupons - requiredCoupons }
12781
12849
  );
12782
- } else {
12783
- await ctx.database.create(itemconfig.table, {
12850
+ const [record] = await ctx.database.get(itemConfig2.table, { handle });
12851
+ if (record) {
12852
+ await ctx.database.set(
12853
+ itemConfig2.table,
12854
+ { handle },
12855
+ { [itemConfig2.currencyField]: record[itemConfig2.currencyField] + gainAmount }
12856
+ );
12857
+ } else {
12858
+ await ctx.database.create(itemConfig2.table, {
12859
+ handle,
12860
+ userId: session.userId,
12861
+ [itemConfig2.currencyField]: gainAmount,
12862
+ ...itemConfig2.table === "ggcevo_sign" ? { lastSign: /* @__PURE__ */ new Date() } : {}
12863
+ });
12864
+ }
12865
+ });
12866
+ return `🎉 兑换成功!使用${requiredCoupons}张资源券兑换了${gainAmount}${name2}`;
12867
+ } else if (itemConfig2.type === "item") {
12868
+ const [costItem] = await ctx.database.get("ggcevo_backpack", {
12869
+ handle,
12870
+ itemId: itemConfig2.costItemId
12871
+ });
12872
+ const requiredQuantity = exchangeCount * itemConfig2.costAmount;
12873
+ const heldQuantity = costItem?.quantity || 0;
12874
+ if (heldQuantity < requiredQuantity) {
12875
+ const requiredName = itemConfig2.costItemId === 2 ? "兑换券" : "物品";
12876
+ return `⚠️ ${name2}不足,需要${requiredQuantity}张${requiredName},当前持有:${heldQuantity}张`;
12877
+ }
12878
+ const gainQuantity = exchangeCount * itemConfig2.gainAmount;
12879
+ await ctx.database.withTransaction(async () => {
12880
+ await ctx.database.set(
12881
+ "ggcevo_backpack",
12882
+ { handle, itemId: itemConfig2.costItemId },
12883
+ { quantity: heldQuantity - requiredQuantity }
12884
+ );
12885
+ const [targetItem] = await ctx.database.get("ggcevo_backpack", {
12784
12886
  handle,
12785
- userId: session.userId,
12786
- [itemconfig.currencyField]: gainAmount,
12787
- ...itemconfig.table === "ggcevo_sign" ? { lastSign: /* @__PURE__ */ new Date() } : {}
12887
+ itemId: itemConfig2.gainItemId
12788
12888
  });
12789
- }
12790
- });
12791
- return `🎉 兑换成功!使用${exchangeAmount}张资源券兑换了${gainAmount}${name2 === "金币" ? "金币" : "红晶"}`;
12889
+ if (targetItem) {
12890
+ await ctx.database.set(
12891
+ "ggcevo_backpack",
12892
+ { handle, itemId: itemConfig2.gainItemId },
12893
+ { quantity: targetItem.quantity + gainQuantity }
12894
+ );
12895
+ } else {
12896
+ await ctx.database.create("ggcevo_backpack", {
12897
+ handle,
12898
+ itemId: itemConfig2.gainItemId,
12899
+ quantity: gainQuantity
12900
+ });
12901
+ }
12902
+ });
12903
+ const costName = itemConfig2.costItemId === 2 ? "兑换券" : "物品";
12904
+ return `🔄 兑换成功!使用${requiredQuantity}张${costName}兑换了${gainQuantity}张${name2}`;
12905
+ }
12906
+ return "⚠️ 未知的兑换类型";
12792
12907
  } catch (error) {
12793
- console.error("资源兑换失败:", error);
12794
- return "⚠️ 兑换失败,请稍后再试";
12908
+ console.error("兑换失败:", error);
12909
+ return "⚠️ 兑换过程中出错,请稍后再试";
12795
12910
  }
12796
12911
  });
12797
12912
  ctx.command("ggcevo/签到奖励").action(({}) => {
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.6.59",
4
+ "version": "1.6.61",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [