koishi-plugin-ggcevo-game 1.4.36 → 1.4.37

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.
@@ -1,12 +1,13 @@
1
1
  import { Context } from 'koishi';
2
2
  import { Config } from '../index';
3
- export declare function handlePrimaryAttack(ctx: Context, session: any, handle: any, config: Config, equippedWeapon: any, targetBoss: any, activeBosses: any[], weaponName: string): Promise<{
3
+ export declare function handlePrimaryAttack(ctx: Context, session: any, handle: string, config: Config, equippedWeapon: any, targetBoss: any, activeBosses: any[], weaponName: string): Promise<{
4
4
  initialDamage: number;
5
5
  currentHP: number;
6
6
  isDefeated: boolean;
7
7
  hasCrit: boolean;
8
8
  effectMessage: string[];
9
9
  passiveMessages: string[];
10
+ ignoreMessage: any[];
10
11
  radiationApplied: boolean;
11
12
  freezing: boolean;
12
13
  bileStacks: boolean;
@@ -15,6 +16,7 @@ export declare function handlePrimaryAttack(ctx: Context, session: any, handle:
15
16
  }>;
16
17
  export declare function handleScatterAttack(ctx: Context, session: any, handle: string, config: Config, equippedWeapon: any, targetBoss: any, weaponName: string, activeBosses: any[]): Promise<{
17
18
  scatterEffectMessages: string[];
19
+ ignoreMessage: string[];
18
20
  extraDamages: {
19
21
  name: string;
20
22
  damage: number;
@@ -36,8 +38,8 @@ export declare function calculateRewards(ctx: Context, handle: string, totalDama
36
38
  techMessage: string;
37
39
  }>;
38
40
  export declare function updateSignRecord(ctx: Context, handle: string, reward: number): Promise<void>;
39
- export declare function buildResultMessage(session: any, weaponName: string, targetBoss: any, primaryResult: any, scatterResult: any, finalReward: number, maxHP: number, careerMessage: string, techMessage: string, redcrystalMessage: string): string;
40
- export declare function handleBroadcasts(ctx: Context, groupIds: string[], bossEventBroadcast: string[] | string | null, cleanerRewardBroadcast: string[] | null, isPrimaryAttack: boolean): Promise<void>;
41
+ export declare function buildResultMessage(session: any, weaponName: string, targetBoss: any, primaryResult: any, scatterResult: any, finalReward: number, careerMessage: string, techMessage: string, redcrystalMessage: string): string;
42
+ export declare function handleBroadcasts(ctx: Context, groupIds: string[], bossEventBroadcast: string[] | string | null, cleanerRewardBroadcast: string[] | null): Promise<void>;
41
43
  export declare function updateBossDamageRecord(ctx: Context, handle: string, playerName: string, bossGroupId: number, damageAmount: number): Promise<void>;
42
44
  export declare function updateTaskProgress(ctx: Context, handle: string, taskUpdates: {
43
45
  taskId: number;
package/lib/index.js CHANGED
@@ -3817,7 +3817,7 @@ var BattleEffectProcessor = {
3817
3817
  const effectiveLayers = Math.min(currentLayers, 20);
3818
3818
  const buffMultiplier = effectiveLayers * 0.025;
3819
3819
  if (effectiveLayers > 0) {
3820
- messages.push(`☢️ 【辐射增伤】:当前${currentLayers}层,伤害提升${(effectiveLayers * 2.5).toFixed(1)}%`);
3820
+ messages.push(`☢️ 【辐射增伤】:当前${currentLayers}层,所受伤害提升${(effectiveLayers * 2.5).toFixed(1)}%`);
3821
3821
  if (currentLayers > 20) {
3822
3822
  messages.push(`☢️ 注意:超过20层的辐射无效,不会提供额外增伤`);
3823
3823
  }
@@ -3853,7 +3853,7 @@ var BattleEffectProcessor = {
3853
3853
  const effectiveLayers = Math.min(currentLayers, 20);
3854
3854
  const buffMultiplier = effectiveLayers * 0.025;
3855
3855
  if (effectiveLayers > 0) {
3856
- messages.push(`❄️ 【寒冷增伤】:当前${currentLayers}层,伤害提升${(effectiveLayers * 2.5).toFixed(1)}%`);
3856
+ messages.push(`❄️ 【寒冷增伤】:当前${currentLayers}层,所受伤害提升${(effectiveLayers * 2.5).toFixed(1)}%`);
3857
3857
  if (currentLayers > 20) {
3858
3858
  messages.push(`❄️ 注意:超过20层的寒冷无效,不会提供额外增伤`);
3859
3859
  }
@@ -4188,7 +4188,7 @@ function applyPassiveEffects(targetBoss, activeBosses, weaponName, damage, ignor
4188
4188
  if (!immune) {
4189
4189
  let adjustedNerfMultiplier = totalNerfMultiplier * (1 - ignoreRate);
4190
4190
  if (ignoreRate > 0 && totalNerfMultiplier > 0) {
4191
- messages.push(`🛡️ 无视减伤: 无视了${(ignoreRate * 100).toFixed(1)}%减伤效果`);
4191
+ messages.push(`🗡️ 无视减伤: 无视了${(ignoreRate * 100).toFixed(1)}%减伤效果`);
4192
4192
  messages.push(` 减伤系数由${(totalNerfMultiplier * 100).toFixed(1)}%降低至${(adjustedNerfMultiplier * 100).toFixed(1)}%`);
4193
4193
  }
4194
4194
  const damageMultiplier = 1 + totalBuffMultiplier - adjustedNerfMultiplier;
@@ -4387,6 +4387,7 @@ async function handlePrimaryAttack(ctx, session, handle, config, equippedWeapon,
4387
4387
  hasCrit: damageResult.hasCrit,
4388
4388
  effectMessage: damageResult.effectMessage,
4389
4389
  passiveMessages: EffectProcessor.messages,
4390
+ ignoreMessage: ignoreReduction.messages,
4390
4391
  radiationApplied: EffectProcessor.radiationLayerAdded,
4391
4392
  freezing: EffectProcessor.coldLayerAdded,
4392
4393
  bileStacks: EffectProcessor.bileDetonationTrigger,
@@ -4398,6 +4399,7 @@ __name(handlePrimaryAttack, "handlePrimaryAttack");
4398
4399
  async function handleScatterAttack(ctx, session, handle, config, equippedWeapon, targetBoss, weaponName, activeBosses) {
4399
4400
  const secondaryTargets = activeBosses.filter((boss) => boss.name !== targetBoss.name);
4400
4401
  const scatterEffectMessages = [];
4402
+ const ignoreMessage = [];
4401
4403
  const extraDamages = [];
4402
4404
  const actuallyDead = [];
4403
4405
  const taskUpdates = [];
@@ -4418,11 +4420,11 @@ async function handleScatterAttack(ctx, session, handle, config, equippedWeapon,
4418
4420
  secondaryTarget
4419
4421
  );
4420
4422
  const secondaryDamage = Math.round(damageResult.damage * scatterRatio);
4421
- const ignoreReduction = await handleIgnoreReductionEffects(ctx, handle, weaponName, targetBoss);
4422
- const EffectProcessor = applyPassiveEffects(targetBoss, activeBosses, weaponName, secondaryDamage, ignoreReduction.ignoreRate);
4423
+ const ignoreReduction = await handleIgnoreReductionEffects(ctx, handle, weaponName, secondaryTarget);
4424
+ const EffectProcessor = applyPassiveEffects(secondaryTarget, activeBosses, weaponName, secondaryDamage, ignoreReduction.ignoreRate);
4423
4425
  const actualDamage = EffectProcessor.finalDamage;
4424
4426
  await saveAndClearStats(ctx);
4425
- const [currentboss] = await ctx.database.get("ggcevo_boss", { name: targetBoss.name });
4427
+ const [currentboss] = await ctx.database.get("ggcevo_boss", { name: secondaryTarget.name });
4426
4428
  const currentHP = currentboss.HP;
4427
4429
  extraDamages.push({
4428
4430
  name: secondaryTarget.name,
@@ -4445,12 +4447,14 @@ async function handleScatterAttack(ctx, session, handle, config, equippedWeapon,
4445
4447
  }
4446
4448
  const isDead = currentHP <= 0;
4447
4449
  scatterEffectMessages.push(...EffectProcessor.messages.map((m) => ` 对 ${secondaryTarget.name} ${m}`));
4450
+ ignoreMessage.push(...ignoreReduction.messages.map((m) => ` 对 ${secondaryTarget.name} ${m}`));
4448
4451
  if (isDead) {
4449
4452
  actuallyDead.push(secondaryTarget.name);
4450
4453
  }
4451
4454
  }
4452
4455
  return {
4453
4456
  scatterEffectMessages,
4457
+ ignoreMessage,
4454
4458
  extraDamages,
4455
4459
  actuallyDead,
4456
4460
  taskUpdates
@@ -4539,7 +4543,6 @@ async function calculateRewards(ctx, handle, totalDamage) {
4539
4543
  careerMessage,
4540
4544
  redcrystalMessage,
4541
4545
  techMessage
4542
- // 新增:独立返回科技奖励信息
4543
4546
  };
4544
4547
  }
4545
4548
  __name(calculateRewards, "calculateRewards");
@@ -4551,12 +4554,17 @@ async function updateSignRecord(ctx, handle, reward) {
4551
4554
  }], ["handle"]);
4552
4555
  }
4553
4556
  __name(updateSignRecord, "updateSignRecord");
4554
- function buildResultMessage(session, weaponName, targetBoss, primaryResult, scatterResult, finalReward, maxHP, careerMessage, techMessage, redcrystalMessage) {
4557
+ function buildResultMessage(session, weaponName, targetBoss, primaryResult, scatterResult, finalReward, careerMessage, techMessage, redcrystalMessage) {
4558
+ const maxHP = getMaxHPByName2(targetBoss.name);
4555
4559
  const messages = [
4556
4560
  `🔥 ${session.username} 使用武器 ${weaponName} 对 ${targetBoss.name} 发起攻击!`,
4557
4561
  ...primaryResult.effectMessage.length > 0 ? [
4558
4562
  `⚡ 攻击效果:
4559
4563
  ${primaryResult.effectMessage.map((m) => `▸ ${m}`).join("\n")}`
4564
+ ] : [],
4565
+ ...primaryResult.ignoreMessage.length > 0 ? [
4566
+ `🗡️ 无视减伤效果:
4567
+ ${primaryResult.ignoreMessage.map((m) => `▸ ${m}`).join("\n")}`
4560
4568
  ] : [],
4561
4569
  ...primaryResult.passiveMessages.length > 0 ? [
4562
4570
  `🛡️ 被动效果:
@@ -4566,6 +4574,10 @@ ${primaryResult.passiveMessages.map((m) => `▸ ${m}`).join("\n")}`
4566
4574
  ];
4567
4575
  if (scatterResult) {
4568
4576
  messages.push(
4577
+ ...scatterResult.ignoreMessage.length > 0 ? [
4578
+ `🗡️ 无视减伤效果:
4579
+ ${scatterResult.ignoreMessage.map((m) => `▸ ${m}`).join("\n")}`
4580
+ ] : [],
4569
4581
  `⚡ 散射效果:
4570
4582
  ${scatterResult.scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`,
4571
4583
  `散射伤害:`,
@@ -4596,7 +4608,7 @@ ${scatterResult.scatterEffectMessages.map((m) => `▸ ${m}`).join("\n")}`,
4596
4608
  return messages.filter((line) => line).join("\n");
4597
4609
  }
4598
4610
  __name(buildResultMessage, "buildResultMessage");
4599
- async function handleBroadcasts(ctx, groupIds, bossEventBroadcast, cleanerRewardBroadcast, isPrimaryAttack) {
4611
+ async function handleBroadcasts(ctx, groupIds, bossEventBroadcast, cleanerRewardBroadcast) {
4600
4612
  const broadcastMessages = [];
4601
4613
  if (bossEventBroadcast) {
4602
4614
  const bossMsg = Array.isArray(bossEventBroadcast) ? bossEventBroadcast.join("\n") : bossEventBroadcast;
@@ -7287,11 +7299,6 @@ ${validTypes.join("、")}`;
7287
7299
  if (!weaponData.isantiair && targetBoss.groupId === 5) {
7288
7300
  return "您当前装备的武器无法攻击空中目标!";
7289
7301
  }
7290
- const bossGroup = bossPool.find(
7291
- (g) => g.main.name === targetBoss.name || g.minions.some((m) => m.name === targetBoss.name)
7292
- );
7293
- if (!bossGroup) return "无法获取异形组配置。";
7294
- const maxHP = targetBoss.type === "主宰" ? bossGroup.main.maxHP : bossGroup.minions.find((m) => m.name === targetBoss.name)?.maxHP || 0;
7295
7302
  const primaryAttackResult = await handlePrimaryAttack(
7296
7303
  ctx,
7297
7304
  session,
@@ -7374,7 +7381,6 @@ ${validTypes.join("、")}`;
7374
7381
  primaryAttackResult,
7375
7382
  scatterResult,
7376
7383
  finalReward,
7377
- maxHP,
7378
7384
  careerMessage,
7379
7385
  techMessage,
7380
7386
  redcrystalMessage
@@ -7385,8 +7391,7 @@ ${validTypes.join("、")}`;
7385
7391
  ctx,
7386
7392
  groupId,
7387
7393
  bossEventBroadcast,
7388
- cleanerRewardBroadcast,
7389
- !isScatterAttack
7394
+ cleanerRewardBroadcast
7390
7395
  );
7391
7396
  });
7392
7397
  ctx.command("ggcevo/攻击假人").option("tags", "-t <tags:string> 添加BOSS标签(逗号分隔)").action(async (argv) => {
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.4.36",
4
+ "version": "1.4.37",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [