koishi-plugin-ggcevo-game 1.6.62 → 1.6.63

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
@@ -15,6 +15,8 @@ declare module 'koishi' {
15
15
  ggcevo_weapons: WeaponInventory;
16
16
  ggcevo_boss: BossInfo;
17
17
  ggcevo_boss_damage: BossDamage;
18
+ ggcevo_damage_logs: damageLogs;
19
+ ggcevo_boss_weights: bossweights;
18
20
  ggcevo_wish: WishRecord;
19
21
  ggcevo_careers: CareerInfo;
20
22
  ggcevo_warehouse: Warehouse;
@@ -240,3 +242,13 @@ export interface guess {
240
242
  wins: number;
241
243
  createdAt: Date;
242
244
  }
245
+ export interface damageLogs {
246
+ id: number;
247
+ handle: string;
248
+ date: Date;
249
+ }
250
+ export interface bossweights {
251
+ bossId: number;
252
+ weight: number;
253
+ lastSpawn: Date;
254
+ }
package/lib/index.js CHANGED
@@ -4615,11 +4615,15 @@ function applyPassiveEffects(targetBoss, activeBosses, weaponName, damage, hasCr
4615
4615
  if (hasCrit) {
4616
4616
  finalDamage *= 2;
4617
4617
  }
4618
+ let burnDamage;
4618
4619
  if (weaponName === "焚烧枪" || weaponName === "龙息霰弹枪") {
4619
4620
  const currentBurnLayers = Math.min(targetBoss?.burnLayers || 0, 100);
4620
- const burnDamage = currentBurnLayers * 1;
4621
+ burnDamage = currentBurnLayers * 1;
4622
+ const burnDebuffMultiplier = totalNerfMultiplier * 0.5;
4623
+ burnDamage *= 1 - burnDebuffMultiplier;
4621
4624
  if (burnDamage > 0) {
4622
- messages.push(`🔥 【燃烧】效果造成额外${burnDamage}点伤害`);
4625
+ const debuffText = burnDebuffMultiplier > 0 ? `(受到${Math.round(burnDebuffMultiplier * 100)}%的减伤效果)` : "";
4626
+ messages.push(`🔥 【燃烧】效果造成额外${burnDamage}点伤害${debuffText}`);
4623
4627
  }
4624
4628
  finalDamage += burnDamage;
4625
4629
  }
@@ -5182,11 +5186,11 @@ var wishConfig = {
5182
5186
  },
5183
5187
  {
5184
5188
  name: "金柚赐福",
5185
- effect: "立即获得250枚金币"
5189
+ effect: "立即获得3张资源兑换券"
5186
5190
  },
5187
5191
  {
5188
5192
  name: "夜市赠礼",
5189
- effect: "立即获得5张资源兑换券"
5193
+ effect: "立即获得3枚咕咕币"
5190
5194
  }
5191
5195
  ],
5192
5196
  // 稀有祈愿(总概率 5 * 1=5%)
@@ -5523,6 +5527,14 @@ var ggcevoUpdates = [
5523
5527
  - 新增兑换资源,1张兑换券可以兑换20张资源兑换券
5524
5528
  `.trim()
5525
5529
  },
5530
+ {
5531
+ version: "1.6.61",
5532
+ time: "2025-08-5",
5533
+ content: `
5534
+ - 优化探索掠夺机制,现在相同名称的飞船互相掠夺成功率固定为50%
5535
+ - 修改TX-12S隐形巡洋舰的机制,现在只有当掠夺金币加成≤0时,探索才不会被掠夺
5536
+ `.trim()
5537
+ },
5526
5538
  {
5527
5539
  version: "1.6.62",
5528
5540
  time: "2025-08-9",
@@ -5531,11 +5543,14 @@ var ggcevoUpdates = [
5531
5543
  `.trim()
5532
5544
  },
5533
5545
  {
5534
- version: "1.6.61",
5535
- time: "2025-08-5",
5546
+ version: "1.6.63",
5547
+ time: "2025-08-10",
5536
5548
  content: `
5537
- - 优化探索掠夺机制,现在相同名称的飞船互相掠夺成功率固定为50%
5538
- - 修改TX-12S隐形巡洋舰的机制,现在只有当掠夺金币加成≤0时,探索才不会被掠夺
5549
+ - 修改了斩杀机制,现在进入斩杀阶段后变为攻击时段内可以攻击2次,而不是原来的分为4个攻击时段
5550
+ - 修改了主宰复活机制,现在采用权重计算
5551
+ - 削弱了燃烧机制,现在燃烧伤害会受到目标减伤效果的50%影响
5552
+ - 斩杀阶段删除了验证码机制
5553
+ - 同一用户攻击指令增加了5秒的使用冷却时间
5539
5554
  `.trim()
5540
5555
  }
5541
5556
  ];
@@ -5618,15 +5633,6 @@ function isSameDate(a, b) {
5618
5633
  return a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
5619
5634
  }
5620
5635
  __name(isSameDate, "isSameDate");
5621
- function isSameHalfDay(a, b) {
5622
- if (!isSameDate(a, b)) {
5623
- return false;
5624
- }
5625
- const hour1 = a.getUTCHours();
5626
- const hour2 = b.getUTCHours();
5627
- return hour1 < 12 && hour2 < 12 || hour1 >= 12 && hour2 >= 12;
5628
- }
5629
- __name(isSameHalfDay, "isSameHalfDay");
5630
5636
  function convertUTCtoChinaTime(input) {
5631
5637
  const utcDate = new Date(input);
5632
5638
  if (isNaN(utcDate.getTime())) {
@@ -5654,17 +5660,26 @@ function createHpBar(current, max) {
5654
5660
  }
5655
5661
  __name(createHpBar, "createHpBar");
5656
5662
  async function activateNextBossGroup(ctx, currentBossId = null) {
5657
- let availableIndices = [];
5658
- bossPool.forEach((bossGroup, index) => {
5659
- if (currentBossId === null || bossGroup.id !== currentBossId) {
5660
- availableIndices.push(index);
5661
- }
5662
- });
5663
- if (availableIndices.length === 0) {
5664
- availableIndices = Array.from({ length: bossPool.length }, (_, i) => i);
5663
+ const allWeights = await ctx.database.get("ggcevo_boss_weights", {});
5664
+ let candidateWeights = allWeights;
5665
+ if (currentBossId !== null) {
5666
+ candidateWeights = allWeights.filter((w) => w.bossId !== currentBossId);
5667
+ }
5668
+ const totalWeight = candidateWeights.reduce((sum, w) => sum + w.weight, 0);
5669
+ let random = Math.random() * totalWeight;
5670
+ let selectedBossId;
5671
+ for (const weight of candidateWeights) {
5672
+ random -= weight.weight;
5673
+ if (random <= 0) {
5674
+ selectedBossId = weight.bossId;
5675
+ break;
5676
+ }
5677
+ }
5678
+ selectedBossId = selectedBossId || candidateWeights[candidateWeights.length - 1].bossId;
5679
+ const nextBossGroup = bossPool.find((g) => g.id === selectedBossId);
5680
+ if (!nextBossGroup) {
5681
+ throw new Error(`Boss group ${selectedBossId} not found in bossPool`);
5665
5682
  }
5666
- const randomIndex = availableIndices[Math.floor(Math.random() * availableIndices.length)];
5667
- const nextBossGroup = bossPool[randomIndex];
5668
5683
  const mainBoss = await ctx.database.create("ggcevo_boss", {
5669
5684
  name: nextBossGroup.main.name,
5670
5685
  type: nextBossGroup.main.type,
@@ -6386,6 +6401,44 @@ function privateChatCurfewCheck(session, config) {
6386
6401
  return true;
6387
6402
  }
6388
6403
  __name(privateChatCurfewCheck, "privateChatCurfewCheck");
6404
+ function getHalfDayIdentifier(date) {
6405
+ const year = date.getFullYear();
6406
+ const month = date.getMonth() + 1;
6407
+ const day = date.getDate();
6408
+ const period = date.getHours() < 12 ? "am" : "pm";
6409
+ return `${year}${month}${day}_${period}`;
6410
+ }
6411
+ __name(getHalfDayIdentifier, "getHalfDayIdentifier");
6412
+ async function initWeights(ctx) {
6413
+ for (let id = 1; id <= 12; id++) {
6414
+ await ctx.database.create("ggcevo_boss_weights", {
6415
+ bossId: id,
6416
+ weight: 100,
6417
+ lastSpawn: /* @__PURE__ */ new Date(0)
6418
+ // 设置为遥远的过去
6419
+ });
6420
+ }
6421
+ }
6422
+ __name(initWeights, "initWeights");
6423
+ async function updateWeights(ctx, selectedId) {
6424
+ const allWeights = await ctx.database.get("ggcevo_boss_weights", {});
6425
+ for (const weight of allWeights) {
6426
+ if (weight.bossId === selectedId) {
6427
+ const newWeight = Math.max(50, Math.floor(weight.weight / 2));
6428
+ await ctx.database.set("ggcevo_boss_weights", { bossId: weight.bossId }, {
6429
+ weight: newWeight,
6430
+ lastSpawn: /* @__PURE__ */ new Date()
6431
+ });
6432
+ } else {
6433
+ const newWeight = Math.min(200, Math.floor(weight.weight * 1.2));
6434
+ await ctx.database.set("ggcevo_boss_weights", { bossId: weight.bossId }, {
6435
+ weight: newWeight,
6436
+ lastSpawn: weight.lastSpawn
6437
+ });
6438
+ }
6439
+ }
6440
+ }
6441
+ __name(updateWeights, "updateWeights");
6389
6442
 
6390
6443
  // src/boss/damagecalculation.ts
6391
6444
  async function calculateTotalDamage(ctx, session, config, equippedWeapon, targetBoss, careerData) {
@@ -7088,6 +7141,11 @@ async function updateBossDamageRecord(ctx, handle, playerName, bossGroupId, dama
7088
7141
  attackCount: (existingRecord?.attackCount || 0) + 1,
7089
7142
  lastattackDate: /* @__PURE__ */ new Date()
7090
7143
  }], ["handle", "bossGroupId"]);
7144
+ await ctx.database.create("ggcevo_damage_logs", {
7145
+ handle,
7146
+ date: /* @__PURE__ */ new Date()
7147
+ // 使用当前时间戳
7148
+ });
7091
7149
  }
7092
7150
  __name(updateBossDamageRecord, "updateBossDamageRecord");
7093
7151
  async function updateTaskProgress(ctx, handle, taskUpdates) {
@@ -7297,33 +7355,9 @@ async function verifyFinalBlow(ctx, session, bossName, targetBoss) {
7297
7355
  verificationPassed: false
7298
7356
  };
7299
7357
  }
7300
- const verificationCode = Array(6).fill(0).map(
7301
- () => Math.floor(Math.random() * 10)
7302
- ).join("");
7303
- await session.send(
7304
- `<quote id="${session.messageId}"/>⚠️ ${bossName}进入斩杀阶段!每6小时周期(0点、6点、12点或18点)即可攻击一次,但需完成安全验证
7305
- 请在30秒内输入验证码:【${verificationCode}】`
7306
- );
7307
- const userInput = (await session.prompt(3e4))?.trim();
7308
- if (!userInput) {
7309
- await session.send("⏱️ 验证超时!请重新发起攻击。");
7310
- return { success: false };
7311
- }
7312
- if (userInput !== verificationCode) {
7313
- await session.send("❌ 验证码错误!攻击已中断。");
7314
- return { success: false };
7315
- }
7316
- const [updatedBoss] = await ctx.database.get("ggcevo_boss", {
7317
- name: bossName,
7318
- isActive: true
7319
- });
7320
- if (!updatedBoss) {
7321
- await session.send(`✅ 验证通过!但${bossName}已被其他玩家消灭。`);
7322
- return { success: false };
7323
- }
7324
7358
  return {
7325
7359
  success: true,
7326
- updatedBoss,
7360
+ updatedBoss: targetBoss,
7327
7361
  verificationPassed: true
7328
7362
  };
7329
7363
  }
@@ -7614,6 +7648,21 @@ function apply(ctx, config) {
7614
7648
  }, {
7615
7649
  primary: "handle"
7616
7650
  });
7651
+ ctx.model.extend("ggcevo_damage_logs", {
7652
+ id: "unsigned",
7653
+ handle: "string",
7654
+ date: "timestamp"
7655
+ }, {
7656
+ primary: "id",
7657
+ autoInc: true
7658
+ });
7659
+ ctx.model.extend("ggcevo_boss_weights", {
7660
+ bossId: "unsigned",
7661
+ weight: "unsigned",
7662
+ lastSpawn: "timestamp"
7663
+ }, {
7664
+ primary: "bossId"
7665
+ });
7617
7666
  ctx.model.extend("ggcevo_wish", {
7618
7667
  id: "unsigned",
7619
7668
  handle: "string",
@@ -7719,6 +7768,10 @@ function apply(ctx, config) {
7719
7768
  primary: ["handle", "itemId"]
7720
7769
  });
7721
7770
  ctx.setInterval(async () => {
7771
+ const weightCount = await ctx.database.get("ggcevo_boss_weights", {});
7772
+ if (!weightCount || weightCount.length === 0) {
7773
+ await initWeights(ctx);
7774
+ }
7722
7775
  const totalBosses = await ctx.database.select("ggcevo_boss").execute((row) => import_koishi.$.count(row.name));
7723
7776
  const groupIds = [...config.groupId];
7724
7777
  if (totalBosses === 0) {
@@ -7740,6 +7793,7 @@ function apply(ctx, config) {
7740
7793
  await ctx.database.set("ggcevo_weapons", {}, { comboCount: 0 });
7741
7794
  await ctx.database.set("ggcevo_weapons", {}, { pityCounter: 0 });
7742
7795
  const newBossGroup = await activateNextBossGroup(ctx, currentGroupId);
7796
+ await updateWeights(ctx, newBossGroup.groupId);
7743
7797
  const nextBossName = newBossGroup.name;
7744
7798
  const guessingRecords = await ctx.database.get("ggcevo_guess", {
7745
7799
  itemId: 1
@@ -10234,22 +10288,27 @@ ${discountDetails.join("\n")}`;
10234
10288
  const verifiedBoss = verification.updatedBoss || targetBoss;
10235
10289
  const unlimitedBossAttack = config.unlimitedBossAttack;
10236
10290
  if (!unlimitedBossAttack) {
10237
- const lastAttacks = await ctx.database.get("ggcevo_boss_damage", { handle });
10238
- if (lastAttacks.length > 0) {
10239
- const lastAttack = lastAttacks[0];
10240
- const lastDate = convertUTCtoChinaTime(new Date(lastAttack.lastattackDate));
10241
- const today = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
10242
- if (verification.verificationPassed) {
10243
- const lastQuarter = Math.floor(lastDate.getUTCHours() / 6);
10244
- const currentQuarter = Math.floor(today.getUTCHours() / 6);
10245
- const sameDay = lastDate.getUTCDate() === today.getUTCDate() && lastDate.getUTCMonth() === today.getUTCMonth() && lastDate.getUTCFullYear() === today.getUTCFullYear();
10246
- if (sameDay && lastQuarter === currentQuarter) {
10247
- return "您在当前时间段内已参与过斩杀攻击,请等待下一个6小时周期(0点、6点、12点或18点)再挑战!";
10248
- }
10291
+ const now = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
10292
+ const currentHalfDayIdentifier = getHalfDayIdentifier(now);
10293
+ const attackLogs = await ctx.database.select("ggcevo_damage_logs").where({ handle }).orderBy("date", "desc").limit(4).execute();
10294
+ let currentHalfDayCount = 0;
10295
+ for (const log of attackLogs) {
10296
+ const logTime = convertUTCtoChinaTime(log.date);
10297
+ if (getHalfDayIdentifier(logTime) === currentHalfDayIdentifier) {
10298
+ currentHalfDayCount++;
10249
10299
  } else {
10250
- if (isSameHalfDay(lastDate, today)) {
10251
- return "您在当前时段内已经攻击过了,请在12点或0点后再来挑战!";
10252
- }
10300
+ break;
10301
+ }
10302
+ }
10303
+ if (verification.verificationPassed) {
10304
+ if (currentHalfDayCount >= 2) {
10305
+ const nextResetHour = now.getHours() < 12 ? 12 : 24;
10306
+ return `您在当前时间段(${now.getHours() < 12 ? "0-12点" : "12-24点"})已攻击过2次(斩杀阶段),请${nextResetHour === 12 ? "中午12点" : "次日0点"}后再挑战!`;
10307
+ }
10308
+ } else {
10309
+ if (currentHalfDayCount >= 1) {
10310
+ const nextResetHour = now.getHours() < 12 ? 12 : 24;
10311
+ return `您在当前时间段(${now.getHours() < 12 ? "0-12点" : "12-24点"})已攻击过1次,请${nextResetHour === 12 ? "中午12点" : "次日0点"}后再挑战!`;
10253
10312
  }
10254
10313
  }
10255
10314
  }
@@ -10778,7 +10837,12 @@ ${testResult.passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
10778
10837
  const effect = pool[Math.floor(Math.random() * pool.length)];
10779
10838
  switch (effect.name) {
10780
10839
  case "金柚赐福":
10781
- newGold += 250;
10840
+ const [ResourceExchangeVoucher] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 8 });
10841
+ await ctx.database.upsert("ggcevo_backpack", [{
10842
+ handle,
10843
+ itemId: 8,
10844
+ quantity: (ResourceExchangeVoucher?.quantity || 0) + 3
10845
+ }]);
10782
10846
  break;
10783
10847
  case "酥手空空":
10784
10848
  newGold = Math.max(0, newGold - 50);
@@ -10787,10 +10851,10 @@ ${testResult.passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
10787
10851
  await ctx.broadcast(groupId, kfcMsg);
10788
10852
  break;
10789
10853
  case "夜市赠礼":
10790
- const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 8 });
10854
+ const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
10791
10855
  await ctx.database.upsert("ggcevo_backpack", [{
10792
10856
  handle,
10793
- itemId: 8,
10857
+ itemId: 1,
10794
10858
  quantity: (backpack?.quantity || 0) + 5
10795
10859
  }]);
10796
10860
  break;
@@ -13009,8 +13073,8 @@ PK同玩家限战:1次/日
13009
13073
  🦗 ​​蚱蜢优购​​:下一次购买武器(非传奇)享有20%的折扣
13010
13074
  🦊 ​​灵狐升运​​:下一次升级武器享有20%的折扣
13011
13075
  👑 ​​王权增幅​​:攻击伤害提高5%
13012
- 🍊 ​​金柚赐福​​:立即获得250枚金币
13013
- 🪙 ​​夜市赠礼​​:立即获得5张资源兑换券
13076
+ 🍊 ​​金柚赐福​​:立即获得3张资源兑换券
13077
+ 🪙 ​​夜市赠礼​​:立即获得5枚咕咕币
13014
13078
 
13015
13079
  🔮 ​​稀有祈愿池(5%概率)​​
13016
13080
  🗡️ ​​悲鸣之锋​​:攻击伤害提高10%,武器每等级提高5%伤害
package/lib/utils.d.ts CHANGED
@@ -7,7 +7,6 @@ export declare function checkSensitiveWord(ctx: Context, content: string): Promi
7
7
  export declare function getRandomInt(min: number, max: number): number;
8
8
  export declare function PetCapsuleToy(): "t3级宠物扭蛋" | "t2级宠物扭蛋" | "t1级宠物扭蛋" | "t0级宠物扭蛋";
9
9
  export declare function isSameDate(a: Date, b: Date): boolean;
10
- export declare function isSameHalfDay(a: Date, b: Date): boolean;
11
10
  export declare function convertUTCtoChinaTime(input: Date | string | number): Date;
12
11
  export declare function formatDate(d: Date): string;
13
12
  export declare function createHpBar(current: number, max: number): string;
@@ -51,3 +50,6 @@ export declare function fixedCurfewCheck(session: any, config: Config): true | f
51
50
  * @returns 是否允许私聊
52
51
  */
53
52
  export declare function privateChatCurfewCheck(session: any, config: Config): boolean;
53
+ export declare function getHalfDayIdentifier(date: any): string;
54
+ export declare function initWeights(ctx: any): Promise<void>;
55
+ export declare function updateWeights(ctx: Context, selectedId: number): Promise<void>;
package/lib/wish.d.ts CHANGED
@@ -10,10 +10,10 @@ export declare const wishConfig: {
10
10
  readonly effect: "攻击伤害提高5%";
11
11
  }, {
12
12
  readonly name: "金柚赐福";
13
- readonly effect: "立即获得250枚金币";
13
+ readonly effect: "立即获得3张资源兑换券";
14
14
  }, {
15
15
  readonly name: "夜市赠礼";
16
- readonly effect: "立即获得5张资源兑换券";
16
+ readonly effect: "立即获得3枚咕咕币";
17
17
  }];
18
18
  readonly rare: readonly [{
19
19
  readonly name: "悲鸣之锋";
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.62",
4
+ "version": "1.6.63",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [