koishi-plugin-ggcevo-game 1.5.29 → 1.5.30

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/database.d.ts CHANGED
@@ -211,7 +211,6 @@ export interface PKProtection {
211
211
  export interface spaceship {
212
212
  handle: string;
213
213
  id: number;
214
- status: string;
215
214
  createTime: Date;
216
215
  }
217
216
  export interface explore {
package/lib/index.js CHANGED
@@ -7251,7 +7251,6 @@ function apply(ctx, config) {
7251
7251
  ctx.model.extend("ggcevo_spaceship", {
7252
7252
  handle: "string",
7253
7253
  id: "unsigned",
7254
- status: "string",
7255
7254
  createTime: "timestamp"
7256
7255
  }, {
7257
7256
  primary: "handle"
@@ -11141,7 +11140,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
11141
11140
  const baseTotal = taskConfig.price * completableTimes;
11142
11141
  let baseBonus = 0;
11143
11142
  if (techLevel > 0) {
11144
- baseBonus = careerData?.group === "人类联盟" && ["舰长", "情报副官"].includes(careerData?.career) ? [0, 20, 40, 60, 50, 100][techLevel] : [0, 10, 20, 30, 40, 50][techLevel];
11143
+ baseBonus = careerData?.group === "人类联盟" && ["舰长", "情报副官"].includes(careerData?.career) ? [0, 20, 40, 60, 80, 100][techLevel] : [0, 10, 20, 30, 40, 50][techLevel];
11145
11144
  }
11146
11145
  const captainBonus = careerData?.group === "人类联盟" && careerData.career === "舰长" ? 50 : 0;
11147
11146
  const totalBonus = baseBonus + captainBonus;
@@ -11579,53 +11578,53 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
11579
11578
  const actualPlunderRate = basePlunderRate + plunderRateBonus / 100;
11580
11579
  const canPlunder = Math.random() < actualPlunderRate;
11581
11580
  if (canPlunder) {
11582
- let otherPlayers = await ctx.database.get("ggcevo_explore", {
11581
+ const explorers = await ctx.database.get("ggcevo_explore", {
11583
11582
  galaxy: galaxyName,
11584
11583
  status: "探索中",
11585
- handle: { $ne: handle },
11586
- plunderbonus: { $gte: 0 }
11584
+ handle: { $ne: handle }
11587
11585
  });
11588
- if (otherPlayers.length > 0) {
11589
- const nonStealthPlayers = [];
11590
- for (const player of otherPlayers) {
11591
- const [playerShip] = await ctx.database.get("ggcevo_spaceship", { handle: player.handle });
11592
- if (!playerShip || playerShip.id !== 2) {
11593
- nonStealthPlayers.push(player);
11594
- }
11595
- }
11596
- otherPlayers = nonStealthPlayers;
11597
- }
11598
- if (otherPlayers.length > 0) {
11599
- const target = otherPlayers[Math.floor(Math.random() * otherPlayers.length)];
11600
- await session.send(`❗ 您在探索过程中发现了【${target.name}】的飞船,是否掠夺?(30秒内输入"是"来进行掠夺)`);
11601
- const response = await session.prompt(3e4);
11602
- if (response === "是") {
11603
- let baseSuccessRate = 0.5;
11604
- if (isBehemoth) baseSuccessRate += 0.3;
11605
- if (shipRecord?.id === 3) baseSuccessRate += 0.1;
11606
- const success = Math.random() < baseSuccessRate;
11607
- let playerBonus, targetBonus;
11608
- if (success) {
11609
- playerBonus = 20;
11610
- targetBonus = -20;
11611
- } else {
11612
- playerBonus = -20;
11613
- targetBonus = 20;
11586
+ if (explorers.length > 0) {
11587
+ const shipHandles = explorers.map((e) => e.handle);
11588
+ const ships = await ctx.database.get("ggcevo_spaceship", {
11589
+ handle: { $in: shipHandles }
11590
+ });
11591
+ const shipMap = new Map(ships.map((ship) => [ship.handle, ship.id]));
11592
+ const plunderTargets = explorers.filter((explorer) => {
11593
+ const shipId = shipMap.get(explorer.handle);
11594
+ return shipId !== 2;
11595
+ });
11596
+ if (plunderTargets.length > 0) {
11597
+ const target = plunderTargets[Math.floor(Math.random() * plunderTargets.length)];
11598
+ await session.send(`❗ 您在探索过程中发现了【${target.name}】的飞船,是否掠夺?(30秒内输入"是"来进行掠夺)`);
11599
+ const response = await session.prompt(3e4);
11600
+ if (response === "是") {
11601
+ let baseSuccessRate = 0.5;
11602
+ if (isBehemoth) baseSuccessRate += 0.3;
11603
+ if (shipRecord?.id === 3) baseSuccessRate += 0.1;
11604
+ const success = Math.random() < baseSuccessRate;
11605
+ let playerBonus, targetBonus;
11606
+ if (success) {
11607
+ playerBonus = 20;
11608
+ targetBonus = -20;
11609
+ } else {
11610
+ playerBonus = -20;
11611
+ targetBonus = 20;
11612
+ }
11613
+ await ctx.database.upsert("ggcevo_explore", [{
11614
+ handle,
11615
+ name: name2,
11616
+ startTime: /* @__PURE__ */ new Date(),
11617
+ galaxy: galaxyName,
11618
+ returns: record?.returns || 0,
11619
+ plunderbonus: playerBonus,
11620
+ status: "探索中"
11621
+ }], ["handle"]);
11622
+ const [targetRecord] = await ctx.database.get("ggcevo_explore", { handle: target.handle });
11623
+ await ctx.database.set("ggcevo_explore", { handle: target.handle }, {
11624
+ plunderbonus: (targetRecord.plunderbonus || 0) + targetBonus
11625
+ });
11626
+ return success ? `✅ 掠夺成功!您获得${playerBonus}%金币加成,${target.name}的金币收益被降低了20%。` : `❌ 掠夺失败!您的金币收益被降低20%,${target.name}获得了20%的金币收益加成。`;
11614
11627
  }
11615
- await ctx.database.upsert("ggcevo_explore", [{
11616
- handle,
11617
- name: name2,
11618
- startTime: /* @__PURE__ */ new Date(),
11619
- galaxy: galaxyName,
11620
- returns: record?.returns || 0,
11621
- plunderbonus: playerBonus,
11622
- status: "探索中"
11623
- }], ["handle"]);
11624
- const [targetRecord] = await ctx.database.get("ggcevo_explore", { handle: target.handle });
11625
- await ctx.database.set("ggcevo_explore", { handle: target.handle }, {
11626
- plunderbonus: (targetRecord.plunderbonus || 0) + targetBonus
11627
- });
11628
- return success ? `✅ 掠夺成功!您获得${playerBonus}%金币加成,${target.name}的金币收益被降低了20%。` : `❌ 掠夺失败!您的金币收益被降低20%,${target.name}获得了20%的金币收益加成。`;
11629
11628
  }
11630
11629
  }
11631
11630
  }
@@ -11700,10 +11699,7 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
11700
11699
  `🔭 探索加成:+${ship.explorebonus}%金币`,
11701
11700
  `⛏️ 挖矿加成:+${ship.miningbonus}%金币`,
11702
11701
  `💡 特殊效果:${ship.effect || "无"}`,
11703
- `🛒 购买价格:${ship.price}金币`,
11704
- `📅 获得时间:${shipRecord.createTime.toLocaleString("zh-CN", { hour12: false })}`,
11705
- `🔋 状态:${shipRecord.status}`,
11706
- `💰 当前金币余额:${coins}`
11702
+ `📅 获得时间:${shipRecord.createTime.toLocaleString("zh-CN", { hour12: false })}`
11707
11703
  ].join("\n");
11708
11704
  });
11709
11705
  ctx.command("ggcevo/购买飞船 [shipName]").action(async ({ session }, shipName) => {
@@ -11756,8 +11752,6 @@ ${Spacestationtechnology.map((t) => t.techname).join("、")}`;
11756
11752
  await ctx.database.create("ggcevo_spaceship", {
11757
11753
  handle,
11758
11754
  id: ship.id,
11759
- status: "空闲",
11760
- // 设置初始状态
11761
11755
  createTime: now
11762
11756
  });
11763
11757
  }
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.5.29",
4
+ "version": "1.5.30",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [