koishi-plugin-smmcat-gensokyo 0.0.24 → 0.0.26

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/damage.d.ts CHANGED
@@ -5,6 +5,7 @@ type DamageCallback = {
5
5
  evasion?: Callback;
6
6
  csp?: Callback;
7
7
  beforDef?: Callback;
8
+ beforEnd?: Callback;
8
9
  };
9
10
  /** 当前伤害回调函数 */
10
11
  interface Callback {
@@ -44,6 +45,8 @@ declare class Damage {
44
45
  csp(fn: (config: DamageConfig) => void): this;
45
46
  /** 防御结算 */
46
47
  beforDef(fn: (config: DamageConfig) => void): this;
48
+ /** 最终结算 */
49
+ beforEnd(fn: (config: DamageConfig) => void): this;
47
50
  result(fn?: DamageCallback): DamageConfig;
48
51
  }
49
52
  declare class BuffDamage {
package/lib/index.js CHANGED
@@ -204,15 +204,26 @@ var GensokyoMap = {
204
204
  needLv: 1,
205
205
  top: "绿野平原一",
206
206
  down: "野猪巢穴",
207
+ left: "绿野平原五",
208
+ right: "绿野平原六",
207
209
  monster: [{ name: "琪露诺", lv: 10 }]
208
210
  },
211
+ "绿野平原五": {
212
+ floor: 1,
213
+ areaName: "绿野平原五",
214
+ type: "冒险区" /* 冒险区 */,
215
+ needLv: 1,
216
+ top: "绿野平原二",
217
+ right: "绿野平原四"
218
+ },
209
219
  "绿野平原六": {
210
220
  floor: 1,
211
221
  areaName: "绿野平原六",
212
222
  type: "冒险区" /* 冒险区 */,
213
223
  needLv: 1,
214
224
  left: "绿野平原四",
215
- top: "绿野平原三"
225
+ top: "绿野平原三",
226
+ monster: [{ name: "绿毒蛇", lv: 12 }]
216
227
  },
217
228
  "野猪巢穴": {
218
229
  floor: 1,
@@ -222,6 +233,79 @@ var GensokyoMap = {
222
233
  top: "绿野平原四",
223
234
  monster: [{ name: "蓬莱山辉夜", lv: 20 }]
224
235
  }
236
+ },
237
+ 2: {
238
+ "传送门": {
239
+ floor: 2,
240
+ areaName: "传送门",
241
+ type: "传送门" /* 传送门 */,
242
+ needLv: 1,
243
+ right: "希望之泉"
244
+ },
245
+ "希望之泉": {
246
+ floor: 2,
247
+ areaName: "希望之泉",
248
+ type: "安全区" /* 安全区 */,
249
+ needLv: 1,
250
+ top: "爱之湖",
251
+ down: "农田",
252
+ left: "传送门",
253
+ right: "2层-商店"
254
+ },
255
+ "爱之湖": {
256
+ floor: 2,
257
+ areaName: "爱之湖",
258
+ type: "安全区" /* 安全区 */,
259
+ needLv: 1,
260
+ down: "希望之泉",
261
+ right: "旅馆"
262
+ },
263
+ "农田": {
264
+ floor: 2,
265
+ areaName: "农田",
266
+ type: "安全区" /* 安全区 */,
267
+ needLv: 1,
268
+ top: "希望之泉",
269
+ right: "银行"
270
+ },
271
+ "银行": {
272
+ floor: 2,
273
+ areaName: "银行",
274
+ type: "安全区" /* 安全区 */,
275
+ needLv: 1,
276
+ top: "2层-商店",
277
+ left: "农田"
278
+ },
279
+ "旅馆": {
280
+ floor: 2,
281
+ areaName: "旅馆",
282
+ type: "安全区" /* 安全区 */,
283
+ needLv: 1,
284
+ down: "2层-商店",
285
+ left: "爱之湖"
286
+ },
287
+ "2层-商店": {
288
+ floor: 2,
289
+ areaName: "2层-商店",
290
+ type: "安全区" /* 安全区 */,
291
+ needLv: 1,
292
+ right: "大草场"
293
+ },
294
+ "大草场": {
295
+ floor: 2,
296
+ areaName: "大草场",
297
+ type: "安全区" /* 安全区 */,
298
+ needLv: 1,
299
+ left: "2层-商店",
300
+ right: "森林岔口"
301
+ },
302
+ "森林岔口": {
303
+ floor: 2,
304
+ areaName: "森林岔口",
305
+ type: "安全区" /* 安全区 */,
306
+ needLv: 1,
307
+ left: "大草场"
308
+ }
225
309
  }
226
310
  };
227
311
  console.log(JSON.stringify(GensokyoMap.mapLocalData));
@@ -583,7 +667,7 @@ var monsterData = {
583
667
  chr: 100,
584
668
  csr: 0,
585
669
  evasion: 200,
586
- hit: 1e3,
670
+ hit: 100,
587
671
  ghd: 1.5,
588
672
  speed: 6,
589
673
  giveExp: 20,
@@ -592,6 +676,30 @@ var monsterData = {
592
676
  { name: "初级复活卷轴", val: 1, radomVal: 50 }
593
677
  ],
594
678
  fn: [{ name: "初级治愈", prob: 3 }, { name: "水炮", prob: 1 }]
679
+ },
680
+ "绿毒蛇": {
681
+ name: "绿毒蛇",
682
+ type: "野怪" /* 野怪 */,
683
+ info: "尖利的毒牙是它有利的武器,使用毒之牙技能造成群体伤害。",
684
+ pic: "http://smmcat.cn/run/gensokyo/绿毒蛇.png",
685
+ hp: 70,
686
+ maxHp: 70,
687
+ mp: 60,
688
+ maxMp: 60,
689
+ atk: 21,
690
+ def: 2,
691
+ chr: 120,
692
+ csr: 0,
693
+ evasion: 100,
694
+ hit: 30,
695
+ ghd: 1.6,
696
+ speed: 5,
697
+ giveExp: 16,
698
+ giveMonetary: 5,
699
+ giveProps: [
700
+ { name: "初级复活卷轴", val: 1, radomVal: 50 }
701
+ ],
702
+ fn: [{ name: "毒之牙", prob: 1 }]
595
703
  }
596
704
  };
597
705
 
@@ -702,6 +810,14 @@ var generateHealthDisplay = /* @__PURE__ */ __name((current, total) => {
702
810
  const unfilled = "□".repeat(unfilledLength);
703
811
  return filled + unfilled;
704
812
  }, "generateHealthDisplay");
813
+ var getFreeList = /* @__PURE__ */ __name((arr) => {
814
+ let arrAdd = [...arr];
815
+ for (let i = 1; i < arrAdd.length; i++) {
816
+ const random2 = Math.floor(Math.random() * (i + 1));
817
+ [arrAdd[i], arrAdd[random2]] = [arrAdd[random2], arrAdd[i]];
818
+ }
819
+ return arrAdd;
820
+ }, "getFreeList");
705
821
 
706
822
  // src/damage.ts
707
823
  var Damage = class {
@@ -779,6 +895,11 @@ var Damage = class {
779
895
  }
780
896
  return this;
781
897
  }
898
+ /** 最终结算 */
899
+ beforEnd(fn) {
900
+ fn && fn(this.config);
901
+ return this;
902
+ }
782
903
  result(fn) {
783
904
  this.before((val) => {
784
905
  fn?.before && fn.before(val);
@@ -790,6 +911,8 @@ var Damage = class {
790
911
  fn?.csp && fn.csp(val);
791
912
  }).beforDef((val) => {
792
913
  fn?.beforDef && fn.beforDef(val);
914
+ }).beforEnd((val) => {
915
+ fn?.beforEnd && fn.beforEnd(val);
793
916
  });
794
917
  return this.config;
795
918
  }
@@ -1181,6 +1304,39 @@ var skillFn = {
1181
1304
  });
1182
1305
  return `${getLineupName(agent.self)} 对 ${getLineupName(agent.goal)} 释放治愈之光。`;
1183
1306
  }, "fn")
1307
+ },
1308
+ "毒之牙": {
1309
+ name: "毒之牙",
1310
+ type: "伤害技" /* 伤害技 */,
1311
+ info: "对敌方最多3个目标造成攻击力1.2倍伤害,造成伤害时有50%概率为敌方附加3回合中毒状态。",
1312
+ lv: 1,
1313
+ mp: 40,
1314
+ fn: /* @__PURE__ */ __name(function(agent, agentList, fn) {
1315
+ const goalList = getFreeList(agentList.goalList).slice(0, 3).filter((i) => i);
1316
+ const msgList = [`${getLineupName(agent.self)}释放了群体技能毒之牙!`];
1317
+ goalList.forEach((goal) => {
1318
+ let useBuff = false;
1319
+ const damageData = new Damage({ self: agent.self, goal }).result({
1320
+ before: /* @__PURE__ */ __name((val) => {
1321
+ val.default_harm += Math.floor(val.default_harm * 0.2);
1322
+ }, "before"),
1323
+ beforEnd: /* @__PURE__ */ __name((val) => {
1324
+ if (val.harm && random(0, 10) < 5) {
1325
+ useBuff = true;
1326
+ giveBuff(goal, { name: "中毒", timer: 3 });
1327
+ }
1328
+ }, "beforEnd")
1329
+ });
1330
+ fn({
1331
+ type: "伤害技" /* 伤害技 */,
1332
+ damage: damageData,
1333
+ isNext: false,
1334
+ target: [goal]
1335
+ });
1336
+ msgList.push(`对 ${getLineupName(goal)} 造成 ${damageData.harm} 伤害。${useBuff ? "(中毒)" : ""}` + moreDamageInfo(damageData));
1337
+ });
1338
+ return msgList.join("\n");
1339
+ }, "fn")
1184
1340
  }
1185
1341
  };
1186
1342
 
@@ -1657,10 +1813,10 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1657
1813
  });
1658
1814
  }
1659
1815
  });
1816
+ await session.send(`小队获得${val}EXP、${monetary}货币!`);
1660
1817
  for (const agent of selfList) {
1661
1818
  aynchronize(agent);
1662
1819
  if (overInfo.win == "self") {
1663
- await session.send(`小队获得${val}EXP、${monetary}货币!`);
1664
1820
  await User.giveExp(agent.userId, val, async (val2) => await msg(val2));
1665
1821
  await User.giveMonetary(agent.userId, monetary);
1666
1822
  props.length && await User.giveProps(agent.userId, props, async (val2) => {
@@ -2448,14 +2604,28 @@ function apply(ctx, config) {
2448
2604
  await session.send("您正在战斗中,无法移动!");
2449
2605
  return;
2450
2606
  }
2607
+ if (BattleData.isTeam(session) && BattleData.teamTemp[session.userId].identity !== "队长") {
2608
+ return `你在队伍中,请等待队长选择移动的位置!`;
2609
+ }
2451
2610
  if (User.isDie(session.userId)) {
2452
2611
  return `你已经阵亡,请发送 /补给 进行治疗。`;
2453
2612
  }
2454
2613
  GensokyoMap.move(session, "top" /* 上 */, async (val) => {
2614
+ if (BattleData.isTeam(session)) {
2615
+ const { userId } = session;
2616
+ Object.keys(BattleData.teamTemp).forEach((_userId) => {
2617
+ if (BattleData.teamTemp[userId].for == userId && userId !== _userId) {
2618
+ GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2619
+ GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2620
+ GensokyoMap.userCurrentLoal[_userId].moveing = false;
2621
+ GensokyoMap.setLocalStoragePoistionData(_userId);
2622
+ }
2623
+ });
2624
+ }
2455
2625
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
2456
2626
  if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
2457
2627
  if (random(0, 10) <= 2) {
2458
- const selectMonster = val.map.monster[random(0, val.map.monster.length)];
2628
+ const selectMonster = val.map.monster[random(0, val.map.monster.length - 1)];
2459
2629
  await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制开启战斗!`);
2460
2630
  await BattleData.createBattleByMonster(session, [selectMonster]);
2461
2631
  }
@@ -2471,14 +2641,28 @@ function apply(ctx, config) {
2471
2641
  await session.send("您正在战斗中,无法移动!");
2472
2642
  return;
2473
2643
  }
2644
+ if (BattleData.isTeam(session) && BattleData.teamTemp[session.userId].identity !== "队长") {
2645
+ return `你在队伍中,请等待队长选择移动的位置!`;
2646
+ }
2474
2647
  if (User.isDie(session.userId)) {
2475
2648
  return `你已经阵亡,请发送 /补给 进行治疗。`;
2476
2649
  }
2477
2650
  GensokyoMap.move(session, "down" /* 下 */, async (val) => {
2651
+ if (BattleData.isTeam(session)) {
2652
+ const { userId } = session;
2653
+ Object.keys(BattleData.teamTemp).forEach((_userId) => {
2654
+ if (BattleData.teamTemp[userId].for == userId && userId !== _userId) {
2655
+ GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2656
+ GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2657
+ GensokyoMap.userCurrentLoal[_userId].moveing = false;
2658
+ GensokyoMap.setLocalStoragePoistionData(_userId);
2659
+ }
2660
+ });
2661
+ }
2478
2662
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
2479
2663
  if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
2480
2664
  if (random(0, 10) <= 2) {
2481
- const selectMonster = val.map.monster[random(0, val.map.monster.length)];
2665
+ const selectMonster = val.map.monster[random(0, val.map.monster.length - 1)];
2482
2666
  await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
2483
2667
  await BattleData.createBattleByMonster(session, [selectMonster]);
2484
2668
  }
@@ -2494,14 +2678,28 @@ function apply(ctx, config) {
2494
2678
  await session.send("您正在战斗中,无法移动!");
2495
2679
  return;
2496
2680
  }
2681
+ if (BattleData.isTeam(session) && BattleData.teamTemp[session.userId].identity !== "队长") {
2682
+ return `你在队伍中,请等待队长选择移动的位置!`;
2683
+ }
2497
2684
  if (User.isDie(session.userId)) {
2498
2685
  return `你已经阵亡,请发送 /补给 进行治疗。`;
2499
2686
  }
2500
2687
  GensokyoMap.move(session, "left" /* 左 */, async (val) => {
2688
+ if (BattleData.isTeam(session)) {
2689
+ const { userId } = session;
2690
+ Object.keys(BattleData.teamTemp).forEach((_userId) => {
2691
+ if (BattleData.teamTemp[userId].for == userId && userId !== _userId) {
2692
+ GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2693
+ GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2694
+ GensokyoMap.userCurrentLoal[_userId].moveing = false;
2695
+ GensokyoMap.setLocalStoragePoistionData(_userId);
2696
+ }
2697
+ });
2698
+ }
2501
2699
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
2502
2700
  if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
2503
2701
  if (random(0, 10) <= 2) {
2504
- const selectMonster = val.map.monster[random(0, val.map.monster.length)];
2702
+ const selectMonster = val.map.monster[random(0, val.map.monster.length - 1)];
2505
2703
  await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
2506
2704
  await BattleData.createBattleByMonster(session, [selectMonster]);
2507
2705
  }
@@ -2517,14 +2715,28 @@ function apply(ctx, config) {
2517
2715
  await session.send("您正在战斗中,无法移动!");
2518
2716
  return;
2519
2717
  }
2718
+ if (BattleData.isTeam(session) && BattleData.teamTemp[session.userId].identity !== "队长") {
2719
+ return `你在队伍中,请等待队长选择移动的位置!`;
2720
+ }
2520
2721
  if (User.isDie(session.userId)) {
2521
2722
  return `你已经阵亡,请发送 /补给 进行治疗。`;
2522
2723
  }
2523
2724
  GensokyoMap.move(session, "right" /* 右 */, async (val) => {
2725
+ if (BattleData.isTeam(session)) {
2726
+ const { userId } = session;
2727
+ Object.keys(BattleData.teamTemp).forEach((_userId) => {
2728
+ if (BattleData.teamTemp[userId].for == userId && userId !== _userId) {
2729
+ GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2730
+ GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2731
+ GensokyoMap.userCurrentLoal[_userId].moveing = false;
2732
+ GensokyoMap.setLocalStoragePoistionData(_userId);
2733
+ }
2734
+ });
2735
+ }
2524
2736
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
2525
2737
  if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
2526
2738
  if (random(0, 10) <= 2) {
2527
- const selectMonster = val.map.monster[random(0, val.map.monster.length)];
2739
+ const selectMonster = val.map.monster[random(0, val.map.monster.length - 1)];
2528
2740
  await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
2529
2741
  await BattleData.createBattleByMonster(session, [selectMonster]);
2530
2742
  }
@@ -2671,26 +2883,42 @@ function apply(ctx, config) {
2671
2883
  });
2672
2884
  ctx.command("幻想乡/队伍操作");
2673
2885
  ctx.command("队伍操作/队伍创建").action(async ({ session }) => {
2886
+ if (BattleData.isBattle(session)) {
2887
+ return `战斗中无法进行队伍创建操作!`;
2888
+ }
2674
2889
  await BattleData.creatTeam(session);
2675
2890
  });
2676
2891
  ctx.command("队伍操作/队伍信息").action(async ({ session }) => {
2677
2892
  const team = BattleData.teamListByUser(session.userId);
2678
2893
  if (!team.length) return `你还没有队伍...`;
2679
- return team.map((item) => `lv.${item.lv} ${item.playName} [${BattleData.teamTemp[item.userId].identity}]`).join("\n");
2894
+ return `当前队伍信息如下:
2895
+ ` + team.map((item) => `lv.${item.lv} ${item.playName} [${BattleData.teamTemp[item.userId].identity}]`).join("\n");
2680
2896
  });
2681
2897
  ctx.command("队伍操作/队伍邀请 <playName>").action(async ({ session }, playName) => {
2898
+ if (BattleData.isBattle(session)) {
2899
+ return `战斗中无法进行队伍邀请操作!`;
2900
+ }
2682
2901
  if (!playName) {
2683
2902
  return `请选择需要邀请的玩家昵称。例如 /队伍邀请 夜夜酱`;
2684
2903
  }
2685
2904
  await BattleData.invitationTeam(session, playName);
2686
2905
  });
2687
2906
  ctx.command("队伍操作/队伍加入").action(async ({ session }) => {
2907
+ if (BattleData.isBattle(session)) {
2908
+ return `战斗中无法进行队伍创建操作!`;
2909
+ }
2688
2910
  await BattleData.joinTeam(session);
2689
2911
  });
2690
2912
  ctx.command("队伍操作/队伍退出").action(async ({ session }) => {
2913
+ if (BattleData.isBattle(session)) {
2914
+ return `战斗中无法进行队伍退出操作!`;
2915
+ }
2691
2916
  await BattleData.exitTeam(session);
2692
2917
  });
2693
2918
  ctx.command("队伍操作/队伍解散").action(async ({ session }) => {
2919
+ if (BattleData.isBattle(session)) {
2920
+ return `战斗中无法进行队伍解散操作!`;
2921
+ }
2694
2922
  await BattleData.dissolveTeam(session);
2695
2923
  });
2696
2924
  }
package/lib/utlis.d.ts CHANGED
@@ -1,3 +1,4 @@
1
1
  export declare const random: (min: number, max: number) => number;
2
2
  /** 血量可视化 */
3
3
  export declare const generateHealthDisplay: (current: number, total: number) => string;
4
+ export declare const getFreeList: (arr: any[]) => any[];
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-smmcat-gensokyo",
3
3
  "description": "名为《幻想乡》的文字冒险游戏",
4
- "version": "0.0.24",
4
+ "version": "0.0.26",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [