koishi-plugin-smmcat-gensokyo 0.0.25 → 0.0.27

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/battle.d.ts CHANGED
@@ -24,6 +24,8 @@ type TeamData = {
24
24
  };
25
25
  };
26
26
  export type BattleAttribute = {
27
+ /** 唯一标识 */
28
+ id: number;
27
29
  /** 阵容 */
28
30
  for?: 'self' | 'goal';
29
31
  /** 等级 */
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
 
@@ -1525,7 +1681,7 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1525
1681
  }
1526
1682
  }
1527
1683
  } else {
1528
- const fliteMyList = allAgentList.filter((item) => item.name !== agent.name && item.hp > 0);
1684
+ const fliteMyList = allAgentList.filter((item) => item.id !== agent.id && item.hp > 0);
1529
1685
  if (!fliteMyList.length) continue;
1530
1686
  selectGoal = fliteMyList[Math.random() * fliteMyList.length];
1531
1687
  }
@@ -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) => {
@@ -1700,6 +1856,7 @@ function initBattleAttribute(data) {
1700
1856
  if ("playName" in data) {
1701
1857
  const userData = data;
1702
1858
  const temp = {
1859
+ id: Date.now(),
1703
1860
  userId: userData.userId,
1704
1861
  name: userData.playName,
1705
1862
  lv: userData.lv,
@@ -1738,6 +1895,7 @@ function initBattleAttribute(data) {
1738
1895
  } else {
1739
1896
  const monsterData2 = data;
1740
1897
  const temp = {
1898
+ id: Date.now(),
1741
1899
  name: monsterData2.name,
1742
1900
  type: "怪物",
1743
1901
  selfType: monsterData2.type,
@@ -2462,6 +2620,7 @@ function apply(ctx, config) {
2462
2620
  GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2463
2621
  GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2464
2622
  GensokyoMap.userCurrentLoal[_userId].moveing = false;
2623
+ GensokyoMap.setLocalStoragePoistionData(_userId);
2465
2624
  }
2466
2625
  });
2467
2626
  }
@@ -2498,6 +2657,7 @@ function apply(ctx, config) {
2498
2657
  GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2499
2658
  GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2500
2659
  GensokyoMap.userCurrentLoal[_userId].moveing = false;
2660
+ GensokyoMap.setLocalStoragePoistionData(_userId);
2501
2661
  }
2502
2662
  });
2503
2663
  }
@@ -2534,6 +2694,7 @@ function apply(ctx, config) {
2534
2694
  GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2535
2695
  GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2536
2696
  GensokyoMap.userCurrentLoal[_userId].moveing = false;
2697
+ GensokyoMap.setLocalStoragePoistionData(_userId);
2537
2698
  }
2538
2699
  });
2539
2700
  }
@@ -2570,6 +2731,7 @@ function apply(ctx, config) {
2570
2731
  GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2571
2732
  GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2572
2733
  GensokyoMap.userCurrentLoal[_userId].moveing = false;
2734
+ GensokyoMap.setLocalStoragePoistionData(_userId);
2573
2735
  }
2574
2736
  });
2575
2737
  }
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.25",
4
+ "version": "0.0.27",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [