koishi-plugin-ggcevo-game 1.6.61 → 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
@@ -661,7 +661,7 @@ var SyndicatedItems = {
661
661
  price: 0,
662
662
  redCrystalCost: 30,
663
663
  condition: "辛迪加海盗阵营",
664
- effects: "主动发起的PK对战结果为胜利时将获得辛迪加海盗总部发放的等额抢夺金币作为奖励"
664
+ effects: "主动发起的PK对战结果为胜利时将获得辛迪加海盗总部发放的等额抢夺金币作为奖励(最多额外获得200金币)"
665
665
  },
666
666
  "自动采掘机器人": {
667
667
  id: 8,
@@ -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%)
@@ -5530,6 +5534,24 @@ var ggcevoUpdates = [
5530
5534
  - 优化探索掠夺机制,现在相同名称的飞船互相掠夺成功率固定为50%
5531
5535
  - 修改TX-12S隐形巡洋舰的机制,现在只有当掠夺金币加成≤0时,探索才不会被掠夺
5532
5536
  `.trim()
5537
+ },
5538
+ {
5539
+ version: "1.6.62",
5540
+ time: "2025-08-9",
5541
+ content: `
5542
+ - 削弱辛迪加海盗黑市设备工具“气喇叭”,现在最多额外获得200金币
5543
+ `.trim()
5544
+ },
5545
+ {
5546
+ version: "1.6.63",
5547
+ time: "2025-08-10",
5548
+ content: `
5549
+ - 修改了斩杀机制,现在进入斩杀阶段后变为攻击时段内可以攻击2次,而不是原来的分为4个攻击时段
5550
+ - 修改了主宰复活机制,现在采用权重计算
5551
+ - 削弱了燃烧机制,现在燃烧伤害会受到目标减伤效果的50%影响
5552
+ - 斩杀阶段删除了验证码机制
5553
+ - 同一用户攻击指令增加了5秒的使用冷却时间
5554
+ `.trim()
5533
5555
  }
5534
5556
  ];
5535
5557
  function compareVersions(a, b) {
@@ -5611,15 +5633,6 @@ function isSameDate(a, b) {
5611
5633
  return a.getUTCFullYear() === b.getUTCFullYear() && a.getUTCMonth() === b.getUTCMonth() && a.getUTCDate() === b.getUTCDate();
5612
5634
  }
5613
5635
  __name(isSameDate, "isSameDate");
5614
- function isSameHalfDay(a, b) {
5615
- if (!isSameDate(a, b)) {
5616
- return false;
5617
- }
5618
- const hour1 = a.getUTCHours();
5619
- const hour2 = b.getUTCHours();
5620
- return hour1 < 12 && hour2 < 12 || hour1 >= 12 && hour2 >= 12;
5621
- }
5622
- __name(isSameHalfDay, "isSameHalfDay");
5623
5636
  function convertUTCtoChinaTime(input) {
5624
5637
  const utcDate = new Date(input);
5625
5638
  if (isNaN(utcDate.getTime())) {
@@ -5647,17 +5660,26 @@ function createHpBar(current, max) {
5647
5660
  }
5648
5661
  __name(createHpBar, "createHpBar");
5649
5662
  async function activateNextBossGroup(ctx, currentBossId = null) {
5650
- let availableIndices = [];
5651
- bossPool.forEach((bossGroup, index) => {
5652
- if (currentBossId === null || bossGroup.id !== currentBossId) {
5653
- availableIndices.push(index);
5654
- }
5655
- });
5656
- if (availableIndices.length === 0) {
5657
- 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`);
5658
5682
  }
5659
- const randomIndex = availableIndices[Math.floor(Math.random() * availableIndices.length)];
5660
- const nextBossGroup = bossPool[randomIndex];
5661
5683
  const mainBoss = await ctx.database.create("ggcevo_boss", {
5662
5684
  name: nextBossGroup.main.name,
5663
5685
  type: nextBossGroup.main.type,
@@ -6379,6 +6401,44 @@ function privateChatCurfewCheck(session, config) {
6379
6401
  return true;
6380
6402
  }
6381
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");
6382
6442
 
6383
6443
  // src/boss/damagecalculation.ts
6384
6444
  async function calculateTotalDamage(ctx, session, config, equippedWeapon, targetBoss, careerData) {
@@ -7081,6 +7141,11 @@ async function updateBossDamageRecord(ctx, handle, playerName, bossGroupId, dama
7081
7141
  attackCount: (existingRecord?.attackCount || 0) + 1,
7082
7142
  lastattackDate: /* @__PURE__ */ new Date()
7083
7143
  }], ["handle", "bossGroupId"]);
7144
+ await ctx.database.create("ggcevo_damage_logs", {
7145
+ handle,
7146
+ date: /* @__PURE__ */ new Date()
7147
+ // 使用当前时间戳
7148
+ });
7084
7149
  }
7085
7150
  __name(updateBossDamageRecord, "updateBossDamageRecord");
7086
7151
  async function updateTaskProgress(ctx, handle, taskUpdates) {
@@ -7290,33 +7355,9 @@ async function verifyFinalBlow(ctx, session, bossName, targetBoss) {
7290
7355
  verificationPassed: false
7291
7356
  };
7292
7357
  }
7293
- const verificationCode = Array(6).fill(0).map(
7294
- () => Math.floor(Math.random() * 10)
7295
- ).join("");
7296
- await session.send(
7297
- `<quote id="${session.messageId}"/>⚠️ ${bossName}进入斩杀阶段!每6小时周期(0点、6点、12点或18点)即可攻击一次,但需完成安全验证
7298
- 请在30秒内输入验证码:【${verificationCode}】`
7299
- );
7300
- const userInput = (await session.prompt(3e4))?.trim();
7301
- if (!userInput) {
7302
- await session.send("⏱️ 验证超时!请重新发起攻击。");
7303
- return { success: false };
7304
- }
7305
- if (userInput !== verificationCode) {
7306
- await session.send("❌ 验证码错误!攻击已中断。");
7307
- return { success: false };
7308
- }
7309
- const [updatedBoss] = await ctx.database.get("ggcevo_boss", {
7310
- name: bossName,
7311
- isActive: true
7312
- });
7313
- if (!updatedBoss) {
7314
- await session.send(`✅ 验证通过!但${bossName}已被其他玩家消灭。`);
7315
- return { success: false };
7316
- }
7317
7358
  return {
7318
7359
  success: true,
7319
- updatedBoss,
7360
+ updatedBoss: targetBoss,
7320
7361
  verificationPassed: true
7321
7362
  };
7322
7363
  }
@@ -7345,7 +7386,7 @@ var spaceship = {
7345
7386
  description: "TX-12S是标准星际巡洋舰的改型",
7346
7387
  miningbonus: 0,
7347
7388
  explorebonus: 20,
7348
- effect: "探索的成功率提高20%;探索发生掠夺的概率提高10%;掠夺的成功率提高10%",
7389
+ effect: "探索的成功率提高20%;探索发生掠夺的概率提高10%;掠夺其他飞船的成功率提高10%",
7349
7390
  price: 2e3
7350
7391
  },
7351
7392
  "庞兽号歼星舰": {
@@ -7353,7 +7394,7 @@ var spaceship = {
7353
7394
  description: "巨兽级歼星舰的小型化版本",
7354
7395
  miningbonus: 0,
7355
7396
  explorebonus: 30,
7356
- effect: "探索的成功率提高60%;探索发生掠夺的概率提高30%;掠夺的成功率提高30%;被非庞兽号歼星舰掠夺的成功率降低30%",
7397
+ effect: "探索的成功率提高60%;探索发生掠夺的概率提高30%;掠夺其他飞船的成功率提高30%;被非庞兽号歼星舰掠夺的成功率降低30%",
7357
7398
  price: 6e3
7358
7399
  }
7359
7400
  };
@@ -7607,6 +7648,21 @@ function apply(ctx, config) {
7607
7648
  }, {
7608
7649
  primary: "handle"
7609
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
+ });
7610
7666
  ctx.model.extend("ggcevo_wish", {
7611
7667
  id: "unsigned",
7612
7668
  handle: "string",
@@ -7712,6 +7768,10 @@ function apply(ctx, config) {
7712
7768
  primary: ["handle", "itemId"]
7713
7769
  });
7714
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
+ }
7715
7775
  const totalBosses = await ctx.database.select("ggcevo_boss").execute((row) => import_koishi.$.count(row.name));
7716
7776
  const groupIds = [...config.groupId];
7717
7777
  if (totalBosses === 0) {
@@ -7733,6 +7793,7 @@ function apply(ctx, config) {
7733
7793
  await ctx.database.set("ggcevo_weapons", {}, { comboCount: 0 });
7734
7794
  await ctx.database.set("ggcevo_weapons", {}, { pityCounter: 0 });
7735
7795
  const newBossGroup = await activateNextBossGroup(ctx, currentGroupId);
7796
+ await updateWeights(ctx, newBossGroup.groupId);
7736
7797
  const nextBossName = newBossGroup.name;
7737
7798
  const guessingRecords = await ctx.database.get("ggcevo_guess", {
7738
7799
  itemId: 1
@@ -9329,7 +9390,7 @@ ${protectionList}
9329
9390
  });
9330
9391
  if (hornItem && hornItem.quantity > 0) {
9331
9392
  hornEffect = true;
9332
- extraGold = goldTransfer;
9393
+ extraGold = Math.min(goldTransfer, 200);
9333
9394
  }
9334
9395
  }
9335
9396
  await ctx.database.withTransaction(async () => {
@@ -10227,22 +10288,27 @@ ${discountDetails.join("\n")}`;
10227
10288
  const verifiedBoss = verification.updatedBoss || targetBoss;
10228
10289
  const unlimitedBossAttack = config.unlimitedBossAttack;
10229
10290
  if (!unlimitedBossAttack) {
10230
- const lastAttacks = await ctx.database.get("ggcevo_boss_damage", { handle });
10231
- if (lastAttacks.length > 0) {
10232
- const lastAttack = lastAttacks[0];
10233
- const lastDate = convertUTCtoChinaTime(new Date(lastAttack.lastattackDate));
10234
- const today = convertUTCtoChinaTime(/* @__PURE__ */ new Date());
10235
- if (verification.verificationPassed) {
10236
- const lastQuarter = Math.floor(lastDate.getUTCHours() / 6);
10237
- const currentQuarter = Math.floor(today.getUTCHours() / 6);
10238
- const sameDay = lastDate.getUTCDate() === today.getUTCDate() && lastDate.getUTCMonth() === today.getUTCMonth() && lastDate.getUTCFullYear() === today.getUTCFullYear();
10239
- if (sameDay && lastQuarter === currentQuarter) {
10240
- return "您在当前时间段内已参与过斩杀攻击,请等待下一个6小时周期(0点、6点、12点或18点)再挑战!";
10241
- }
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++;
10242
10299
  } else {
10243
- if (isSameHalfDay(lastDate, today)) {
10244
- return "您在当前时段内已经攻击过了,请在12点或0点后再来挑战!";
10245
- }
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点"}后再挑战!`;
10246
10312
  }
10247
10313
  }
10248
10314
  }
@@ -10771,7 +10837,12 @@ ${testResult.passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
10771
10837
  const effect = pool[Math.floor(Math.random() * pool.length)];
10772
10838
  switch (effect.name) {
10773
10839
  case "金柚赐福":
10774
- 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
+ }]);
10775
10846
  break;
10776
10847
  case "酥手空空":
10777
10848
  newGold = Math.max(0, newGold - 50);
@@ -10780,10 +10851,10 @@ ${testResult.passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
10780
10851
  await ctx.broadcast(groupId, kfcMsg);
10781
10852
  break;
10782
10853
  case "夜市赠礼":
10783
- const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 8 });
10854
+ const [backpack] = await ctx.database.get("ggcevo_backpack", { handle, itemId: 1 });
10784
10855
  await ctx.database.upsert("ggcevo_backpack", [{
10785
10856
  handle,
10786
- itemId: 8,
10857
+ itemId: 1,
10787
10858
  quantity: (backpack?.quantity || 0) + 5
10788
10859
  }]);
10789
10860
  break;
@@ -13002,8 +13073,8 @@ PK同玩家限战:1次/日
13002
13073
  🦗 ​​蚱蜢优购​​:下一次购买武器(非传奇)享有20%的折扣
13003
13074
  🦊 ​​灵狐升运​​:下一次升级武器享有20%的折扣
13004
13075
  👑 ​​王权增幅​​:攻击伤害提高5%
13005
- 🍊 ​​金柚赐福​​:立即获得250枚金币
13006
- 🪙 ​​夜市赠礼​​:立即获得5张资源兑换券
13076
+ 🍊 ​​金柚赐福​​:立即获得3张资源兑换券
13077
+ 🪙 ​​夜市赠礼​​:立即获得5枚咕咕币
13007
13078
 
13008
13079
  🔮 ​​稀有祈愿池(5%概率)​​
13009
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.61",
4
+ "version": "1.6.63",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [