koishi-plugin-ggcevo-game 1.4.0 → 1.4.1

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.
@@ -20,6 +20,10 @@ export declare function handleScatterAttack(ctx: Context, session: any, config:
20
20
  }[];
21
21
  actuallyDead: string[];
22
22
  scatterBroadcast: any;
23
+ taskUpdates: {
24
+ taskId: number;
25
+ count: number;
26
+ }[];
23
27
  }>;
24
28
  export declare function applyAttackResults(ctx: Context, targetBoss: any, result: any): Promise<void>;
25
29
  export declare function handleDeathTargets(ctx: Context, deadTargets: any[], killerName: string, killerHandle: string): Promise<{
@@ -36,3 +40,7 @@ export declare function buildResultMessage(session: any, weaponName: string, tar
36
40
  export declare function handleBroadcasts(ctx: Context, groupIds: string[], scatterBroadcast: string | string[] | null, bossEventBroadcast: string[] | string | null, cleanerRewardBroadcast: string[] | null, isPrimaryAttack: boolean): Promise<void>;
37
41
  export declare function applyScatterResults(ctx: Context, session: any, equippedWeapon: any, targetBoss: any, scatterResult: any): Promise<string[]>;
38
42
  export declare function updateBossDamageRecord(ctx: Context, handle: string, playerName: string, bossGroupId: number, damageAmount: number): Promise<void>;
43
+ export declare function updateTaskProgress(ctx: Context, handle: string, taskUpdates: {
44
+ taskId: number;
45
+ count: number;
46
+ }[]): Promise<void>;
package/lib/index.js CHANGED
@@ -3250,6 +3250,7 @@ async function handleScatterAttack(ctx, session, config, equippedWeapon, targetB
3250
3250
  const scatterEffectMessages = [];
3251
3251
  const extraDamages = [];
3252
3252
  const actuallyDead = [];
3253
+ const taskUpdates = [];
3253
3254
  let scatterRatio = 0;
3254
3255
  if (weaponName === "碎骨步枪") {
3255
3256
  scatterEffectMessages.push("🔆 【光束曲射晶片】触发散射攻击!");
@@ -3288,6 +3289,15 @@ async function handleScatterAttack(ctx, session, config, equippedWeapon, targetB
3288
3289
  if (passiveResult.skillUpdates.length > 0) {
3289
3290
  await PassiveHandler.applySkillUpdates(ctx, passiveResult.skillUpdates);
3290
3291
  }
3292
+ if (passiveResult.radiationApplied) {
3293
+ taskUpdates.push({ taskId: 1, count: 1 });
3294
+ }
3295
+ if (passiveResult.freezing) {
3296
+ taskUpdates.push({ taskId: 2, count: 1 });
3297
+ }
3298
+ if (passiveResult.bileStacks >= 10) {
3299
+ taskUpdates.push({ taskId: 3, count: 1 });
3300
+ }
3291
3301
  const isDead = newHP <= 0;
3292
3302
  await ctx.database.set("ggcevo_boss", { name: secondaryTarget.name }, {
3293
3303
  HP: Math.max(newHP, 0),
@@ -3302,8 +3312,9 @@ async function handleScatterAttack(ctx, session, config, equippedWeapon, targetB
3302
3312
  scatterEffectMessages,
3303
3313
  extraDamages,
3304
3314
  actuallyDead,
3305
- scatterBroadcast: null
3315
+ scatterBroadcast: null,
3306
3316
  // 稍后处理广播
3317
+ taskUpdates
3307
3318
  };
3308
3319
  }
3309
3320
  __name(handleScatterAttack, "handleScatterAttack");
@@ -3512,6 +3523,20 @@ async function updateBossDamageRecord(ctx, handle, playerName, bossGroupId, dama
3512
3523
  }], ["handle", "bossGroupId"]);
3513
3524
  }
3514
3525
  __name(updateBossDamageRecord, "updateBossDamageRecord");
3526
+ async function updateTaskProgress(ctx, handle, taskUpdates) {
3527
+ for (const update of taskUpdates) {
3528
+ const [taskRecord] = await ctx.database.get("ggcevo_task", {
3529
+ handle,
3530
+ taskId: update.taskId
3531
+ });
3532
+ await ctx.database.upsert("ggcevo_task", [{
3533
+ handle,
3534
+ taskId: update.taskId,
3535
+ progress: (taskRecord?.progress || 0) + update.count
3536
+ }], ["handle", "taskId"]);
3537
+ }
3538
+ }
3539
+ __name(updateTaskProgress, "updateTaskProgress");
3515
3540
 
3516
3541
  // src/index.ts
3517
3542
  var name = "ggcevo-game";
@@ -6035,6 +6060,24 @@ ${validTypes.join("、")}`;
6035
6060
  totalDamage
6036
6061
  );
6037
6062
  await updateSignRecord(ctx, handle, finalReward);
6063
+ const taskUpdates = [];
6064
+ if (primaryAttackResult.radiationApplied) {
6065
+ taskUpdates.push({ taskId: 1, count: 1 });
6066
+ }
6067
+ if (primaryAttackResult.freezing) {
6068
+ taskUpdates.push({ taskId: 2, count: 1 });
6069
+ }
6070
+ if (primaryAttackResult.bileStacks >= 10) {
6071
+ taskUpdates.push({ taskId: 3, count: 1 });
6072
+ }
6073
+ if (scatterResult && scatterResult.taskUpdates) {
6074
+ scatterResult.taskUpdates.forEach((update) => {
6075
+ taskUpdates.push(update);
6076
+ });
6077
+ }
6078
+ if (taskUpdates.length > 0) {
6079
+ await updateTaskProgress(ctx, handle, taskUpdates);
6080
+ }
6038
6081
  const resultMessage = buildResultMessage(
6039
6082
  session,
6040
6083
  weaponName,
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.0",
4
+ "version": "1.4.1",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [