koishi-plugin-smmcat-gensokyo 0.0.40 → 0.0.42

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
@@ -20,6 +20,7 @@ type BattleHistory = {
20
20
  type TeamData = {
21
21
  [keys: string]: {
22
22
  for: string;
23
+ duties: '前排' | '后排';
23
24
  identity: '队员' | '队长';
24
25
  };
25
26
  };
@@ -28,6 +29,7 @@ export type BattleAttribute = {
28
29
  id: number;
29
30
  /** 阵容 */
30
31
  for?: 'self' | 'goal';
32
+ duties?: '前排' | '后排';
31
33
  /** 等级 */
32
34
  lv: number;
33
35
  /** 单位名称 */
@@ -76,6 +78,8 @@ export type BattleAttribute = {
76
78
  name: string;
77
79
  prob: number;
78
80
  }[];
81
+ /** 被动技能 */
82
+ passiveList?: string[];
79
83
  /** 拓展数据 */
80
84
  expand: {
81
85
  [keys: string]: any;
@@ -143,7 +147,9 @@ export declare const BattleData: {
143
147
  isTeam(session: Session): boolean;
144
148
  /** 玩家是否在队伍中 通过UserId */
145
149
  isTeamByUserId(userId: string): boolean;
146
- teamListByUser(userId: string): UserBaseAttribute[];
150
+ teamListByUser(userId: string): (UserBaseAttribute & {
151
+ duties: "\u524D\u6392" | "\u540E\u6392";
152
+ })[];
147
153
  /** 创建队伍 */
148
154
  creatTeam(session: Session): Promise<void>;
149
155
  /** 邀请加入队伍 */
@@ -154,6 +160,10 @@ export declare const BattleData: {
154
160
  exitTeam(session: Session): Promise<void>;
155
161
  /** 解散队伍 */
156
162
  dissolveTeam(session: Session): Promise<void>;
163
+ /** 查看职责 */
164
+ getTeamDuties(session: Session): Promise<void>;
165
+ /** 设置职责 */
166
+ settingTeamDuties(session: Session, playName: string, duties: "\u524D\u6392" | "\u540E\u6392"): Promise<void>;
157
167
  /** 创建战斗-与怪物 */
158
168
  createBattleByMonster(session: Session, goal: {
159
169
  name: string;
package/lib/damage.d.ts CHANGED
@@ -16,6 +16,11 @@ export type DamageConfig = {
16
16
  self: BattleAttribute;
17
17
  goal: BattleAttribute;
18
18
  };
19
+ /** 浅拷贝数据 */
20
+ linkAgent: {
21
+ self: BattleAttribute;
22
+ goal: BattleAttribute;
23
+ };
19
24
  /** 实际伤害数据 */
20
25
  harm: number;
21
26
  /** 原始伤害数据 */
@@ -30,6 +35,8 @@ export type DamageConfig = {
30
35
  isBadDef: boolean;
31
36
  /** 减免伤害 */
32
37
  reductionVal: number;
38
+ /** 被动技能触发文本 */
39
+ passiveMsg: string[];
33
40
  };
34
41
  declare class Damage {
35
42
  config: DamageConfig;
@@ -61,7 +68,12 @@ declare class BuffDamage {
61
68
  /** 给予目标伤害 */
62
69
  declare function giveDamage(self: BattleAttribute, goal: BattleAttribute, damage: DamageConfig): number;
63
70
  /** 治疗目标 */
64
- declare function giveCure(goal: BattleAttribute, val: number): number;
71
+ declare function giveCure(goal: BattleAttribute, val: number, fn?: (msg: string) => void): {
72
+ val: number;
73
+ buffMsg: string;
74
+ };
65
75
  /** 伤害额外信息 */
66
- export declare function moreDamageInfo(damage: DamageConfig): string;
67
- export { Damage, BuffDamage, giveDamage, giveCure };
76
+ declare function moreDamageInfo(damage: DamageConfig): string;
77
+ /** 更多的伤害提示信息 */
78
+ declare function baseMoreDamage(damageInfo: DamageConfig): string;
79
+ export { Damage, BuffDamage, giveDamage, giveCure, moreDamageInfo, baseMoreDamage };
@@ -1,12 +1,11 @@
1
- import { BattleAttribute } from "../battle";
1
+ import { DamageConfig } from "../damage";
2
2
  export type PassiveDict = {
3
3
  [keys: string]: PassiveItem;
4
4
  };
5
5
  export type PassiveItem = {
6
6
  name: string;
7
7
  info: string;
8
- damageFn: (agent: {
9
- self: BattleAttribute;
10
- goal: BattleAttribute;
11
- }) => void;
8
+ type: 'atk' | 'hit';
9
+ damageFn: (config: DamageConfig) => string;
12
10
  };
11
+ export declare const PassiveFn: PassiveDict;
@@ -50,6 +50,9 @@ interface BuffConfig<T extends BuffType = BuffType> {
50
50
  fn(agent: BattleAttribute, cb?: (val: Extract<BuffItemParams, {
51
51
  type: T;
52
52
  }>) => void): void;
53
+ cureFn?(agent: BattleAttribute, cb?: (val: Extract<BuffItemParams, {
54
+ type: T;
55
+ }>) => void): string;
53
56
  }
54
57
  type BuffFnList = {
55
58
  [key: string]: BuffConfig;
@@ -60,6 +60,8 @@ export type MonsterBaseAttribute = {
60
60
  /** 触发概率 */
61
61
  prob: number;
62
62
  }[];
63
+ /** 被动技能 */
64
+ passiveList?: string[];
63
65
  };
64
66
  export type MonsterTempData = {
65
67
  [keys: string]: MonsterBaseAttribute;
package/lib/index.js CHANGED
@@ -136,7 +136,8 @@ var monsterData = {
136
136
  giveProps: [
137
137
  { name: "红药", val: 3, radomVal: 30 }
138
138
  ],
139
- fn: [{ name: "垂死挣扎", prob: 1 }]
139
+ fn: [{ name: "垂死挣扎", prob: 1 }],
140
+ passiveList: []
140
141
  },
141
142
  "小蜘蛛": {
142
143
  name: "小蜘蛛",
@@ -159,7 +160,8 @@ var monsterData = {
159
160
  giveMonetary: 2,
160
161
  giveProps: [
161
162
  { name: "蓝药", val: 3, radomVal: 30 }
162
- ]
163
+ ],
164
+ passiveList: []
163
165
  },
164
166
  "dora": {
165
167
  name: "dora",
@@ -184,7 +186,8 @@ var monsterData = {
184
186
  { name: "蓝药", val: 3, radomVal: 30 },
185
187
  { name: "初级万能药", val: 2, radomVal: 90, const: true, lv: 5 }
186
188
  ],
187
- fn: [{ name: "治愈之光", prob: 1 }]
189
+ fn: [{ name: "治愈之光", prob: 1 }],
190
+ passiveList: []
188
191
  },
189
192
  "琪露诺": {
190
193
  name: "琪露诺",
@@ -205,6 +208,7 @@ var monsterData = {
205
208
  speed: 4,
206
209
  giveExp: 15,
207
210
  giveMonetary: 3,
211
+ passiveList: [],
208
212
  giveProps: [
209
213
  { name: "初级复活卷轴", val: 1, radomVal: 50 }
210
214
  ]
@@ -228,6 +232,7 @@ var monsterData = {
228
232
  speed: 5,
229
233
  giveExp: 15,
230
234
  giveMonetary: 3,
235
+ passiveList: [],
231
236
  giveProps: [
232
237
  { name: "初级复活卷轴", val: 1, radomVal: 50 }
233
238
  ]
@@ -251,6 +256,7 @@ var monsterData = {
251
256
  speed: 6,
252
257
  giveExp: 20,
253
258
  giveMonetary: 5,
259
+ passiveList: [],
254
260
  giveProps: [
255
261
  { name: "初级复活卷轴", val: 1, radomVal: 50 }
256
262
  ],
@@ -275,6 +281,7 @@ var monsterData = {
275
281
  speed: 5,
276
282
  giveExp: 16,
277
283
  giveMonetary: 5,
284
+ passiveList: [],
278
285
  giveProps: [
279
286
  { name: "初级复活卷轴", val: 1, radomVal: 50 }
280
287
  ],
@@ -299,6 +306,7 @@ var monsterData = {
299
306
  speed: 8,
300
307
  giveExp: 20,
301
308
  giveMonetary: 8,
309
+ passiveList: [],
302
310
  giveProps: [
303
311
  { name: "初级复活卷轴", val: 1, radomVal: 50 }
304
312
  ],
@@ -323,6 +331,7 @@ var monsterData = {
323
331
  speed: 8,
324
332
  giveExp: 20,
325
333
  giveMonetary: 8,
334
+ passiveList: ["反伤"],
326
335
  giveProps: [
327
336
  { name: "大红药", val: 2, radomVal: 50 }
328
337
  ],
@@ -423,7 +432,7 @@ var Monster = {
423
432
  },
424
433
  /** 格式化怪物属性数据 */
425
434
  monsterAttributeTextFormat(monster) {
426
- const { name: name2, type, lv, hp, maxHp, mp, maxMp, atk, def, chr, evasion, hit, ghd, speed, info, pic, giveProps } = monster;
435
+ const { name: name2, type, lv, hp, maxHp, mp, maxMp, atk, def, chr, evasion, hit, ghd, speed, info, pic, giveProps, passiveList } = monster;
427
436
  const propsList = giveProps.filter((item) => item.lv ? lv >= item.lv : true).map((item) => item.name);
428
437
  const attributeText = (pic ? import_koishi.h.image(pic) + "\n" : "") + `Lv.${lv}【${name2}】
429
438
 
@@ -436,7 +445,8 @@ var Monster = {
436
445
  【速度值】${speed}
437
446
  【命中率】${(100 + (hit - 1e3) / 10).toFixed(1)}%
438
447
  【暴击率】${(chr / 10).toFixed(1)}%
439
- 【爆伤倍率】${(ghd * 100).toFixed(0)}%` + (propsList?.length ? `
448
+ 【爆伤倍率】${(ghd * 100).toFixed(0)}%` + (passiveList.length ? `
449
+ 【被动技能】${passiveList.join("、")}` : "") + (propsList?.length ? `
440
450
  【概率掉落道具】` + propsList.join("、") : "") + (info ? "\n\n" + info : "");
441
451
  return attributeText;
442
452
  }
@@ -501,165 +511,6 @@ var AsyncOperationQueue = class {
501
511
  }
502
512
  };
503
513
 
504
- // src/damage.ts
505
- var Damage = class {
506
- static {
507
- __name(this, "Damage");
508
- }
509
- config;
510
- constructor(agent, realHarm = false) {
511
- this.config = {
512
- agent: { self: { ...agent.self }, goal: { ...agent.goal } },
513
- harm: 0,
514
- default_harm: 0,
515
- isRealHarm: realHarm,
516
- isEvasion: false,
517
- isCsp: false,
518
- isBadDef: false,
519
- reductionVal: 0
520
- };
521
- }
522
- /** 伤害判定前 */
523
- before(fn) {
524
- this.config.default_harm = this.config.agent.self.atk + this.config.agent.self.gain.atk;
525
- fn && fn(this.config);
526
- return this;
527
- }
528
- /** 真实伤害判定 */
529
- beforRealHarm(fn) {
530
- fn && fn(this.config);
531
- if (this.config.isRealHarm) {
532
- this.config.harm = this.config.default_harm;
533
- }
534
- return this;
535
- }
536
- /** 是否闪避判定 */
537
- evasion(fn) {
538
- const { self, goal } = this.config.agent;
539
- if (this.config.isRealHarm) return this;
540
- const lvSup = /* @__PURE__ */ __name(() => Math.floor((goal.lv - self.lv) / 5) * 20, "lvSup");
541
- const evaVal = Math.min(95, (goal.evasion + goal.gain.evasion - (self.hit - 1e3) + lvSup()) / 10);
542
- if (random(0, 100) <= evaVal) {
543
- this.config.isEvasion = true;
544
- fn && fn(this.config);
545
- return this;
546
- }
547
- fn && fn(this.config);
548
- return this;
549
- }
550
- /** 是否暴击判定 */
551
- csp(fn) {
552
- const { self, goal } = this.config.agent;
553
- if (this.config.isRealHarm) return this;
554
- if (this.config.isEvasion) return this;
555
- const cspVal = (self.chr + self.gain.chr - goal.csr) / 10;
556
- if (random(0, 100) <= cspVal) {
557
- this.config.isCsp = true;
558
- this.config.harm = Math.floor(this.config.default_harm * (self.ghd + self.gain.ghd));
559
- fn && fn(this.config);
560
- return this;
561
- }
562
- this.config.harm = this.config.default_harm;
563
- fn && fn(this.config);
564
- return this;
565
- }
566
- /** 防御结算 */
567
- beforDef(fn) {
568
- const { goal } = this.config.agent;
569
- if (this.config.isRealHarm) return this;
570
- if (this.config.isEvasion) return this;
571
- const dpVal = goal.def + goal.gain.def;
572
- fn && fn(this.config);
573
- if (this.config.harm - dpVal > 0) {
574
- this.config.harm -= dpVal;
575
- } else {
576
- this.config.isBadDef = true;
577
- this.config.harm = 1;
578
- }
579
- return this;
580
- }
581
- /** 最终结算 伤害减免 */
582
- beforEnd(fn) {
583
- if (!this.config.isRealHarm) {
584
- this.config.reductionVal = Math.floor(this.config.agent.goal.gain.reduction * this.config.harm);
585
- this.config.harm -= this.config.reductionVal;
586
- if (this.config.harm < 0) {
587
- this.config.harm = 0;
588
- }
589
- }
590
- fn && fn(this.config);
591
- return this;
592
- }
593
- result(fn) {
594
- this.before((val) => {
595
- fn?.before && fn.before(val);
596
- }).beforRealHarm((val) => {
597
- fn?.beforRealHarm && fn.beforRealHarm(val);
598
- }).evasion((val) => {
599
- fn?.evasion && fn.evasion(val);
600
- }).csp((val) => {
601
- fn?.csp && fn.csp(val);
602
- }).beforDef((val) => {
603
- fn?.beforDef && fn.beforDef(val);
604
- }).beforEnd((val) => {
605
- fn?.beforEnd && fn.beforEnd(val);
606
- });
607
- return this.config;
608
- }
609
- };
610
- var BuffDamage = class {
611
- static {
612
- __name(this, "BuffDamage");
613
- }
614
- goal;
615
- val;
616
- isRealHarm;
617
- constructor(val, goal, isRealHarm = false) {
618
- this.goal = goal;
619
- this.val = val;
620
- this.isRealHarm = isRealHarm;
621
- }
622
- giveDamage() {
623
- if (this.isRealHarm) {
624
- const val = this.goal.hp - this.val > 0 ? this.val : this.goal.hp;
625
- this.goal.hp -= val;
626
- return val;
627
- } else {
628
- const def = this.goal.def + this.goal.gain.def;
629
- const val = this.goal.hp + def - this.val > 0 ? this.val - def : this.goal.hp;
630
- this.goal.hp -= val;
631
- return val;
632
- }
633
- }
634
- };
635
- function giveDamage(self, goal, damage) {
636
- if (goal.hp - damage.harm > 0) {
637
- goal.hp -= damage.harm;
638
- return damage.harm;
639
- } else {
640
- const lostHp = goal.hp;
641
- goal.hp = 0;
642
- return lostHp;
643
- }
644
- }
645
- __name(giveDamage, "giveDamage");
646
- function giveCure(goal, val) {
647
- const upVal = goal.hp + val;
648
- if (upVal < goal.maxHp + goal.gain.maxHp) {
649
- goal.hp = upVal;
650
- return val;
651
- } else {
652
- const abHp = goal.maxHp + goal.gain.maxHp - goal.hp;
653
- goal.hp += abHp;
654
- return abHp;
655
- }
656
- }
657
- __name(giveCure, "giveCure");
658
- function moreDamageInfo(damage) {
659
- return (damage.isCsp ? `(暴击!)` : "") + (damage.isEvasion ? `(闪避成功!)` : "") + (damage.isBadDef ? `(未破防!)` : "");
660
- }
661
- __name(moreDamageInfo, "moreDamageInfo");
662
-
663
514
  // src/data/buffFn.ts
664
515
  var BuffFn = {
665
516
  "治愈": {
@@ -772,6 +623,14 @@ var BuffFn = {
772
623
  if (!agent.expand["curse-buff"]) agent.expand["curse-buff"] = { val: 0 };
773
624
  agent.expand["curse-buff"].val++;
774
625
  }, "initFn"),
626
+ cureFn: /* @__PURE__ */ __name(function(agent, fn) {
627
+ if (random(0, 1)) {
628
+ clearImprint(agent, { name: "咒" });
629
+ return ` 治疗状态下 ⌈咒⌋ 被成功驱散`;
630
+ } else {
631
+ return ``;
632
+ }
633
+ }, "cureFn"),
775
634
  fn: /* @__PURE__ */ __name(function(agent, fn) {
776
635
  fn && fn({
777
636
  type: "印记" /* 印记 */,
@@ -787,7 +646,7 @@ function giveBuff(agent, buff) {
787
646
  const buffInfo = BuffFn[buff.name] || null;
788
647
  if (!buffInfo) return;
789
648
  if (buffInfo.type == "印记" /* 印记 */) {
790
- buffInfo?.initFn(agent);
649
+ buffInfo.initFn?.(agent);
791
650
  }
792
651
  let again = false;
793
652
  if (agent.buff[buff.name]) again = true;
@@ -833,8 +692,10 @@ function settlementBuff(agent) {
833
692
  agent.gain.maxMp = 0;
834
693
  agent.gain.speed = 0;
835
694
  agent.gain.reduction = 0;
695
+ agent.gain.TreatmentUp = 0;
836
696
  agent.gain.dizziness = false;
837
697
  agent.gain.chaos = false;
698
+ agent.gain.silence = false;
838
699
  const msgList = [];
839
700
  const gainDict = {
840
701
  atk: "攻击",
@@ -861,7 +722,7 @@ function settlementBuff(agent) {
861
722
  case "治疗" /* 治疗 */:
862
723
  buffInfo.fn(agent, (val) => {
863
724
  const value = giveCure(agent, val.val);
864
- msgList.push(`${buffInfo.name}+${value}HP`);
725
+ msgList.push(`${buffInfo.name}+${value.val}HP。` + (value.buffMsg ? value.buffMsg : ""));
865
726
  });
866
727
  break;
867
728
  case "增益" /* 增益 */:
@@ -914,6 +775,279 @@ function settlementBuff(agent) {
914
775
  }
915
776
  __name(settlementBuff, "settlementBuff");
916
777
 
778
+ // src/data/PassiveFn.ts
779
+ var PassiveFn = {
780
+ "吸血": {
781
+ name: "吸血",
782
+ info: "造成伤害时,汲取10%该次伤害的值治疗自己",
783
+ type: "atk",
784
+ damageFn: /* @__PURE__ */ __name(function(config) {
785
+ const val = Math.floor(config.harm * 0.1);
786
+ if (val) {
787
+ const res = giveCure(config.linkAgent.self, val);
788
+ return `‣ ${getLineupName(config.linkAgent.self)}:[${this.name}] HP+${res.val}`;
789
+ }
790
+ return ``;
791
+ }, "damageFn")
792
+ },
793
+ "反伤": {
794
+ name: "反伤",
795
+ info: "有40%概率直接反弹本次伤害的20%(真实伤害)",
796
+ type: "hit",
797
+ damageFn: /* @__PURE__ */ __name(function(config) {
798
+ const val = Math.floor(config.harm * 0.2);
799
+ if (val && random(0, 10) <= 4) {
800
+ const value = new BuffDamage(val, config.linkAgent.self, true).giveDamage();
801
+ console.log(config.linkAgent.self);
802
+ return `‣ ${getLineupName(config.linkAgent.self)}:[${this.name}] HP-${value}`;
803
+ }
804
+ return ``;
805
+ }, "damageFn")
806
+ },
807
+ "破势": {
808
+ name: "破势",
809
+ info: "敌方血量大于70%时,造成的伤害提高30%",
810
+ type: "atk",
811
+ damageFn: /* @__PURE__ */ __name(function(config) {
812
+ if (config.linkAgent.goal.hp / config.linkAgent.goal.maxHp > 0.7) {
813
+ const upVal = Math.floor(config.harm * 0.3);
814
+ if (upVal) {
815
+ config.harm += Math.floor(config.harm * 0.3);
816
+ return `‣ ${getLineupName(config.linkAgent.self)}:[${this.name}] 伤害+${upVal}`;
817
+ }
818
+ return ``;
819
+ }
820
+ return ``;
821
+ }, "damageFn")
822
+ },
823
+ "心眼": {
824
+ name: "心眼",
825
+ info: "敌方血量小于40%时,造成的伤害提高30%",
826
+ type: "atk",
827
+ damageFn: /* @__PURE__ */ __name(function(config) {
828
+ if (config.linkAgent.goal.hp / config.linkAgent.goal.maxHp < 0.4) {
829
+ const upVal = Math.floor(config.harm * 0.3);
830
+ if (upVal) {
831
+ config.harm += Math.floor(config.harm * 0.3);
832
+ return `‣ ${getLineupName(config.linkAgent.self)}:[${this.name}] 伤害+${upVal}`;
833
+ }
834
+ return ``;
835
+ }
836
+ return ``;
837
+ }, "damageFn")
838
+ },
839
+ "针女": {
840
+ name: "针女",
841
+ info: "攻击时有40%概率额外造成敌方5%血量真实伤害(伤害最大不超过使用者攻击力的120%)",
842
+ type: "atk",
843
+ damageFn: /* @__PURE__ */ __name(function(config) {
844
+ if (random(0, 10) <= 4) {
845
+ const upVal = Math.min(
846
+ config.linkAgent.self.atk + config.linkAgent.self.gain.atk,
847
+ Math.floor(config.linkAgent.goal.maxHp * 0.05)
848
+ );
849
+ if (upVal) {
850
+ const value = new BuffDamage(upVal, config.linkAgent.goal, true).giveDamage();
851
+ return `‣ ${getLineupName(config.linkAgent.goal)}:[${this.name}] HP-${value}`;
852
+ }
853
+ return ``;
854
+ }
855
+ return ``;
856
+ }, "damageFn")
857
+ }
858
+ };
859
+
860
+ // src/damage.ts
861
+ var Damage = class {
862
+ static {
863
+ __name(this, "Damage");
864
+ }
865
+ config;
866
+ constructor(agent, realHarm = false) {
867
+ this.config = {
868
+ agent: { self: { ...agent.self }, goal: { ...agent.goal } },
869
+ linkAgent: { self: agent.self, goal: agent.goal },
870
+ harm: 0,
871
+ default_harm: 0,
872
+ isRealHarm: realHarm,
873
+ isEvasion: false,
874
+ isCsp: false,
875
+ isBadDef: false,
876
+ reductionVal: 0,
877
+ passiveMsg: []
878
+ };
879
+ }
880
+ /** 伤害判定前 */
881
+ before(fn) {
882
+ this.config.default_harm = this.config.agent.self.atk + this.config.agent.self.gain.atk;
883
+ fn && fn(this.config);
884
+ return this;
885
+ }
886
+ /** 真实伤害判定 */
887
+ beforRealHarm(fn) {
888
+ fn && fn(this.config);
889
+ if (this.config.isRealHarm) {
890
+ this.config.harm = this.config.default_harm;
891
+ }
892
+ return this;
893
+ }
894
+ /** 是否闪避判定 */
895
+ evasion(fn) {
896
+ const { self, goal } = this.config.agent;
897
+ if (this.config.isRealHarm) return this;
898
+ const lvSup = /* @__PURE__ */ __name(() => Math.floor((goal.lv - self.lv) / 5) * 20, "lvSup");
899
+ const evaVal = Math.min(95, (goal.evasion + goal.gain.evasion - (self.hit - 1e3) + lvSup()) / 10);
900
+ if (random(0, 100) <= evaVal) {
901
+ this.config.isEvasion = true;
902
+ fn && fn(this.config);
903
+ return this;
904
+ }
905
+ fn && fn(this.config);
906
+ return this;
907
+ }
908
+ /** 是否暴击判定 */
909
+ csp(fn) {
910
+ const { self, goal } = this.config.agent;
911
+ if (this.config.isRealHarm) return this;
912
+ if (this.config.isEvasion) return this;
913
+ const cspVal = (self.chr + self.gain.chr - goal.csr) / 10;
914
+ if (random(0, 100) <= cspVal) {
915
+ this.config.isCsp = true;
916
+ this.config.harm = Math.floor(this.config.default_harm * (self.ghd + self.gain.ghd));
917
+ fn && fn(this.config);
918
+ return this;
919
+ }
920
+ this.config.harm = this.config.default_harm;
921
+ fn && fn(this.config);
922
+ return this;
923
+ }
924
+ /** 防御结算 */
925
+ beforDef(fn) {
926
+ const { goal } = this.config.agent;
927
+ if (this.config.isRealHarm) return this;
928
+ if (this.config.isEvasion) return this;
929
+ const dpVal = goal.def + goal.gain.def;
930
+ fn && fn(this.config);
931
+ if (this.config.harm - dpVal > 0) {
932
+ this.config.harm -= dpVal;
933
+ } else {
934
+ this.config.isBadDef = true;
935
+ this.config.harm = 1;
936
+ }
937
+ return this;
938
+ }
939
+ /** 最终结算 伤害减免 */
940
+ beforEnd(fn) {
941
+ if (!this.config.isRealHarm) {
942
+ this.config.reductionVal = Math.floor(this.config.agent.goal.gain.reduction * this.config.harm);
943
+ this.config.harm -= this.config.reductionVal;
944
+ if (this.config.harm < 0) {
945
+ this.config.harm = 0;
946
+ }
947
+ }
948
+ fn && fn(this.config);
949
+ if (this.config.linkAgent.self.passiveList?.length) {
950
+ this.config.linkAgent.self.passiveList.forEach((passiveName) => {
951
+ if (PassiveFn[passiveName].type == "atk") {
952
+ const msg = PassiveFn[passiveName].damageFn(this.config);
953
+ msg && this.config.passiveMsg.push(msg);
954
+ }
955
+ });
956
+ }
957
+ return this;
958
+ }
959
+ result(fn) {
960
+ this.before((val) => {
961
+ fn?.before && fn.before(val);
962
+ }).beforRealHarm((val) => {
963
+ fn?.beforRealHarm && fn.beforRealHarm(val);
964
+ }).evasion((val) => {
965
+ fn?.evasion && fn.evasion(val);
966
+ }).csp((val) => {
967
+ fn?.csp && fn.csp(val);
968
+ }).beforDef((val) => {
969
+ fn?.beforDef && fn.beforDef(val);
970
+ }).beforEnd((val) => {
971
+ fn?.beforEnd && fn.beforEnd(val);
972
+ });
973
+ return this.config;
974
+ }
975
+ };
976
+ var BuffDamage = class {
977
+ static {
978
+ __name(this, "BuffDamage");
979
+ }
980
+ goal;
981
+ val;
982
+ isRealHarm;
983
+ constructor(val, goal, isRealHarm = false) {
984
+ this.goal = goal;
985
+ this.val = val;
986
+ this.isRealHarm = isRealHarm;
987
+ }
988
+ giveDamage() {
989
+ if (this.isRealHarm) {
990
+ const val = this.goal.hp - this.val > 0 ? this.val : this.goal.hp;
991
+ this.goal.hp -= val;
992
+ return val;
993
+ } else {
994
+ const def = this.goal.def + this.goal.gain.def;
995
+ const val = this.goal.hp + def - this.val > 0 ? this.val - def : this.goal.hp;
996
+ this.goal.hp -= val;
997
+ return val;
998
+ }
999
+ }
1000
+ };
1001
+ function giveDamage(self, goal, damage) {
1002
+ if (damage.linkAgent.goal.passiveList?.length) {
1003
+ damage.linkAgent.goal.passiveList.forEach((passiveName) => {
1004
+ if (PassiveFn[passiveName].type == "hit") {
1005
+ const msg = PassiveFn[passiveName].damageFn(damage);
1006
+ msg && damage.passiveMsg.push(msg);
1007
+ }
1008
+ });
1009
+ }
1010
+ if (goal.hp - damage.harm > 0) {
1011
+ goal.hp -= damage.harm;
1012
+ return damage.harm;
1013
+ } else {
1014
+ const lostHp = goal.hp;
1015
+ goal.hp = 0;
1016
+ return lostHp;
1017
+ }
1018
+ }
1019
+ __name(giveDamage, "giveDamage");
1020
+ function giveCure(goal, val, fn) {
1021
+ const buffMsg = [];
1022
+ console.log(goal.buff);
1023
+ Object.keys(goal.buff).forEach((buff) => {
1024
+ if (BuffFn[buff]?.cureFn) {
1025
+ const msg = BuffFn[buff].cureFn(goal);
1026
+ msg && buffMsg.push(msg);
1027
+ }
1028
+ });
1029
+ const upVal = goal.hp + val;
1030
+ if (upVal < goal.maxHp + goal.gain.maxHp) {
1031
+ goal.hp = upVal;
1032
+ fn && fn(buffMsg.join("、"));
1033
+ return { val, buffMsg: buffMsg.join("、") };
1034
+ } else {
1035
+ const abHp = goal.maxHp + goal.gain.maxHp - goal.hp;
1036
+ goal.hp += abHp;
1037
+ fn && fn(buffMsg.join("、"));
1038
+ return { val: abHp, buffMsg: buffMsg.join("、") };
1039
+ }
1040
+ }
1041
+ __name(giveCure, "giveCure");
1042
+ function moreDamageInfo(damage) {
1043
+ return (damage.isCsp ? `(暴击!)` : "") + (damage.isEvasion ? `(闪避!)` : "") + (damage.isBadDef ? `(未破防!)` : "") + (damage.isRealHarm ? `(真实伤害)` : "");
1044
+ }
1045
+ __name(moreDamageInfo, "moreDamageInfo");
1046
+ function baseMoreDamage(damageInfo) {
1047
+ return moreDamageInfo(damageInfo) + (damageInfo.passiveMsg.length ? "\n" + damageInfo.passiveMsg.join("‣") : "");
1048
+ }
1049
+ __name(baseMoreDamage, "baseMoreDamage");
1050
+
917
1051
  // src/data/skillFn.ts
918
1052
  var skillFn = {
919
1053
  "重砍": {
@@ -936,7 +1070,7 @@ var skillFn = {
936
1070
  target: [agent.goal],
937
1071
  isNext: false
938
1072
  });
939
- return `${getLineupName(agent.self)} 释放重砍,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + moreDamageInfo(damageData);
1073
+ return `${getLineupName(agent.self)} 释放重砍,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + baseMoreDamage(damageData);
940
1074
  }, "fn")
941
1075
  },
942
1076
  "突刺": {
@@ -959,7 +1093,7 @@ var skillFn = {
959
1093
  target: [agent.goal],
960
1094
  isNext: false
961
1095
  });
962
- return `${getLineupName(agent.self)} 释放突刺,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + moreDamageInfo(damageData);
1096
+ return `${getLineupName(agent.self)} 释放突刺,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + baseMoreDamage(damageData);
963
1097
  }, "fn")
964
1098
  },
965
1099
  "水炮": {
@@ -981,7 +1115,7 @@ var skillFn = {
981
1115
  target: [agent.goal],
982
1116
  isNext: false
983
1117
  });
984
- return `${getLineupName(agent.self)} 释放水炮,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + moreDamageInfo(damageData);
1118
+ return `${getLineupName(agent.self)} 释放水炮,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + baseMoreDamage(damageData);
985
1119
  }, "fn")
986
1120
  },
987
1121
  "濒死一击": {
@@ -1004,7 +1138,7 @@ var skillFn = {
1004
1138
  target: [agent.goal],
1005
1139
  isNext: false
1006
1140
  });
1007
- return `${getLineupName(agent.self)} 释放濒死一击,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + moreDamageInfo(damageData);
1141
+ return `${getLineupName(agent.self)} 释放濒死一击,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + baseMoreDamage(damageData);
1008
1142
  } else {
1009
1143
  fn({
1010
1144
  type: "释放失败" /* 释放失败 */,
@@ -1053,7 +1187,7 @@ var skillFn = {
1053
1187
  target: [agent.goal],
1054
1188
  isNext: false
1055
1189
  });
1056
- return `${getLineupName(agent.self)} 进行垂死挣扎,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + moreDamageInfo(damageData);
1190
+ return `${getLineupName(agent.self)} 进行垂死挣扎,对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。` + baseMoreDamage(damageData);
1057
1191
  }, "fn")
1058
1192
  },
1059
1193
  "治愈之光": {
@@ -1099,7 +1233,7 @@ var skillFn = {
1099
1233
  isNext: false,
1100
1234
  target: [goal]
1101
1235
  });
1102
- msgList.push(`- 对 ${getLineupName(goal)} 造成 ${damageData.harm} 伤害。${useBuff ? "(中毒)" : ""}` + moreDamageInfo(damageData));
1236
+ msgList.push(`- 对 ${getLineupName(goal)} 造成 ${damageData.harm} 伤害。${useBuff ? "(中毒)" : ""}` + baseMoreDamage(damageData));
1103
1237
  });
1104
1238
  return msgList.join("\n");
1105
1239
  }, "fn")
@@ -1129,7 +1263,7 @@ var skillFn = {
1129
1263
  isNext: false,
1130
1264
  target: [agent.goal]
1131
1265
  });
1132
- return `${getLineupName(agent.self)} 发动恐怖催眠术!对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。${useBuff ? "(晕眩)" : ""}` + moreDamageInfo(damageData);
1266
+ return `${getLineupName(agent.self)} 发动恐怖催眠术!对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。${useBuff ? "(晕眩)" : ""}` + baseMoreDamage(damageData);
1133
1267
  }, "fn")
1134
1268
  },
1135
1269
  "恐怖的回忆": {
@@ -1183,7 +1317,7 @@ var skillFn = {
1183
1317
  "紧闭的恋之瞳": {
1184
1318
  name: "紧闭的恋之瞳",
1185
1319
  type: "减益技" /* 减益技 */,
1186
- info: "[减益技]怪物特有技能:为玩家目标添加5回合的⌈咒⌋印记,当对方持有3个⌈咒⌋印记,将直接死亡。",
1320
+ info: "[减益技]怪物特有技能:为玩家目标添加5回合的⌈咒⌋印记,当对方持有3个⌈咒⌋印记,将直接死亡。⌈咒⌋可以有50%概率会被技能类型的治疗驱散",
1187
1321
  lv: 5,
1188
1322
  mp: 40,
1189
1323
  fn: /* @__PURE__ */ __name(function(agent, agentList, fn) {
@@ -1204,9 +1338,9 @@ var skillFn = {
1204
1338
  if (agent.goal.expand[key].val >= 3) {
1205
1339
  agent.goal.hp = 0;
1206
1340
  clearImprint(agent.goal, { name: "咒" });
1207
- return `${getLineupName(agent.self)}释放紧闭的恋之瞳,目标⌈咒⌋层达到3层,目标立即死亡`;
1341
+ return `${getLineupName(agent.self)}释放紧闭的恋之瞳,${getLineupName(agent.goal)}⌈咒⌋层达到3层,立即死亡!`;
1208
1342
  }
1209
- return `${getLineupName(agent.self)}释放紧闭的恋之瞳,目标⌈咒⌋层数${agent.goal.expand[key].val}层`;
1343
+ return `${getLineupName(agent.self)}释放紧闭的恋之瞳,${getLineupName(agent.goal)}⌈咒⌋层数${agent.goal.expand[key].val}层`;
1210
1344
  }, "fn")
1211
1345
  },
1212
1346
  "无意识行动": {
@@ -1242,7 +1376,7 @@ var skillFn = {
1242
1376
  isNext: false,
1243
1377
  target: [agent.goal]
1244
1378
  });
1245
- return `${getLineupName(agent.self)} 发动无意识行动!对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。${useBuff ? "(沉默)" : ""}` + moreDamageInfo(damageData);
1379
+ return `${getLineupName(agent.self)} 发动无意识行动!对 ${getLineupName(agent.goal)} 造成 ${damageData.harm} 伤害。${useBuff ? "(沉默)" : ""}` + baseMoreDamage(damageData);
1246
1380
  }, "fn")
1247
1381
  }
1248
1382
  };
@@ -1284,7 +1418,7 @@ var BattleData = {
1284
1418
  const _userId = BattleData.teamTemp[userId].for;
1285
1419
  Object.keys(BattleData.teamTemp).forEach((item) => {
1286
1420
  if (BattleData.teamTemp[item].for == _userId) {
1287
- teamList.push(User.getUserAttributeByUserId(item));
1421
+ teamList.push({ ...User.getUserAttributeByUserId(item), duties: BattleData.teamTemp[item].duties });
1288
1422
  }
1289
1423
  });
1290
1424
  return teamList;
@@ -1293,11 +1427,12 @@ var BattleData = {
1293
1427
  async creatTeam(session) {
1294
1428
  const { userId } = session;
1295
1429
  if (BattleData.isTeamByUserId(userId)) {
1296
- await session.send(`${User.getUserName(userId)}:你已经加入了${BattleData.teamTemp[userId].for}的队伍,需要退出才可以重新创建!`);
1430
+ await session.send(`${User.getUserName(userId)}:你已经加入了${User.getUserName(BattleData.teamTemp[userId].for)}的队伍,需要退出才可以重新创建!`);
1297
1431
  return;
1298
1432
  }
1299
1433
  BattleData.teamTemp[userId] = {
1300
1434
  for: userId,
1435
+ duties: "后排",
1301
1436
  identity: "队长"
1302
1437
  };
1303
1438
  await session.send("创建队伍成功!发送 /队伍邀请 昵称 \n可对周围对应昵称玩家进行组队邀请!");
@@ -1355,6 +1490,7 @@ var BattleData = {
1355
1490
  }
1356
1491
  BattleData.teamTemp[userId] = {
1357
1492
  for: invInfo.for,
1493
+ duties: "后排",
1358
1494
  identity: "队员"
1359
1495
  };
1360
1496
  await session.send(`加入${invInfo.playName}的队伍成功!
@@ -1392,6 +1528,39 @@ var BattleData = {
1392
1528
  });
1393
1529
  await session.send("操作成功,已经解散你创建的小队。");
1394
1530
  },
1531
+ /** 查看职责 */
1532
+ async getTeamDuties(session) {
1533
+ const { userId } = session;
1534
+ if (!BattleData.isTeamByUserId(userId)) {
1535
+ await session.send("你还没有加入任何队伍!");
1536
+ return;
1537
+ }
1538
+ const team = BattleData.teamListByUser(userId);
1539
+ await session.send(`当前队伍职责:
1540
+ ` + team.map((agent) => {
1541
+ return `Lv.${agent.lv} ` + agent.playName + ` [${agent.duties}]`;
1542
+ }).join("\n"));
1543
+ },
1544
+ /** 设置职责 */
1545
+ async settingTeamDuties(session, playName, duties) {
1546
+ const { userId } = session;
1547
+ if (!BattleData.isTeamByUserId(userId)) {
1548
+ await session.send("你还没有加入任何队伍!");
1549
+ return;
1550
+ }
1551
+ if (BattleData.teamTemp[userId].identity == "队员") {
1552
+ await session.send("你不是小队队长,无法配置职责。");
1553
+ return;
1554
+ }
1555
+ const isUpdate = Object.keys(BattleData.teamTemp).some((item) => {
1556
+ if (BattleData.teamTemp[item].for == userId && item == User.getUserIdByPlayName(playName)) {
1557
+ BattleData.teamTemp[item].duties = duties;
1558
+ return true;
1559
+ }
1560
+ return false;
1561
+ });
1562
+ await session.send(isUpdate ? "修改成功!" : "修改失败,可能原因:小队中不存在此人!");
1563
+ },
1395
1564
  /** 创建战斗-与怪物 */
1396
1565
  async createBattleByMonster(session, goal) {
1397
1566
  if (BattleData.isBattle(session)) {
@@ -1614,7 +1783,12 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1614
1783
  } else if (agent.type == "玩家") {
1615
1784
  selectGoal = lifeGoalList[Math.floor(Math.random() * lifeGoalList.length)];
1616
1785
  } else {
1617
- selectGoal = lifeGoalList[Math.floor(Math.random() * lifeGoalList.length)];
1786
+ const fistGoal = lifeGoalList.filter((item) => item.duties == "前排");
1787
+ if (!fistGoal.length) {
1788
+ selectGoal = lifeGoalList[Math.floor(Math.random() * lifeGoalList.length)];
1789
+ } else {
1790
+ selectGoal = fistGoal[Math.floor(Math.random() * fistGoal.length)];
1791
+ }
1618
1792
  if (random(0, 10) < 4 && agent.fn?.length) {
1619
1793
  funType = getSkillFn(agent.fn);
1620
1794
  }
@@ -1628,7 +1802,7 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1628
1802
  const damageInfo = new Damage({ self: agent, goal: selectGoal }).result();
1629
1803
  giveDamage(agent, selectGoal, damageInfo);
1630
1804
  msgList.push(
1631
- `${getLineupName(agent)} 使用普攻攻击了 ${getLineupName(selectGoal)},造成了${damageInfo.harm}伤害。` + moreDamageInfo(damageInfo)
1805
+ `${getLineupName(agent)} 使用普攻攻击了 ${getLineupName(selectGoal)},造成了${damageInfo.harm}伤害。` + baseMoreDamage(damageInfo)
1632
1806
  );
1633
1807
  }, "noralAtk");
1634
1808
  if (funType == "普攻" || agent.gain.silence) {
@@ -1640,6 +1814,7 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1640
1814
  _selectGoal = lifeSelfList.find((item) => item.name == select) || agent;
1641
1815
  }
1642
1816
  const selectFn = skillFn[funType];
1817
+ let buffmsg = "";
1643
1818
  if (selectFn.mp == 0 || agent.mp - selectFn.mp >= 0) {
1644
1819
  agent.mp -= selectFn.mp;
1645
1820
  let isNext = false;
@@ -1656,7 +1831,11 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1656
1831
  case "治疗技" /* 治疗技 */:
1657
1832
  val.target.map((goal) => {
1658
1833
  val.value += val.value * (1 - agent.gain.TreatmentUp);
1659
- giveCure(goal, val.value);
1834
+ giveCure(goal, val.value, (msg) => {
1835
+ if (msg) {
1836
+ buffmsg = "。" + msg;
1837
+ }
1838
+ });
1660
1839
  });
1661
1840
  break;
1662
1841
  case "增益技" /* 增益技 */:
@@ -1673,7 +1852,7 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1673
1852
  isNext = val.isNext;
1674
1853
  }
1675
1854
  );
1676
- fnMsg && msgList.push(fnMsg);
1855
+ fnMsg && msgList.push(fnMsg + buffmsg);
1677
1856
  isNext && noralAtk();
1678
1857
  } else {
1679
1858
  isMy && await session.send(`MP不足,释放失败!`);
@@ -1809,6 +1988,7 @@ function initBattleAttribute(data) {
1809
1988
  id: Date.now(),
1810
1989
  userId: userData.userId,
1811
1990
  name: userData.playName,
1991
+ duties: BattleData.isTeamByUserId(userData.userId) ? BattleData.teamTemp[userData.userId].duties : "前排",
1812
1992
  lv: userData.lv,
1813
1993
  type: "玩家",
1814
1994
  selfType: userData.type,
@@ -1842,6 +2022,7 @@ function initBattleAttribute(data) {
1842
2022
  },
1843
2023
  buff: {},
1844
2024
  fn: [],
2025
+ passiveList: [],
1845
2026
  expand: {}
1846
2027
  };
1847
2028
  return temp;
@@ -1882,6 +2063,7 @@ function initBattleAttribute(data) {
1882
2063
  reduction: 0
1883
2064
  },
1884
2065
  buff: {},
2066
+ passiveList: monsterData2.passiveList || [],
1885
2067
  fn: monsterData2.fn ? JSON.parse(JSON.stringify(monsterData2.fn)).filter((item) => {
1886
2068
  return skillFn[item.name] && monsterData2.lv >= skillFn[item.name].lv;
1887
2069
  }) : [],
@@ -2158,6 +2340,7 @@ var User = {
2158
2340
  config: {},
2159
2341
  ctx: {},
2160
2342
  userTempData: {},
2343
+ userNameTemp: {},
2161
2344
  async init(config, ctx) {
2162
2345
  User.config = config;
2163
2346
  User.ctx = ctx;
@@ -2183,6 +2366,7 @@ var User = {
2183
2366
  const temp = {};
2184
2367
  userData.forEach((item) => {
2185
2368
  temp[item.userId] = item;
2369
+ User.userNameTemp[item.playName] = item.userId;
2186
2370
  });
2187
2371
  User.userTempData = temp;
2188
2372
  },
@@ -2190,6 +2374,10 @@ var User = {
2190
2374
  getUserName(userId) {
2191
2375
  return User.userTempData[userId].playName || null;
2192
2376
  },
2377
+ /** 获取玩家userId */
2378
+ getUserIdByPlayName(playName) {
2379
+ return User.userNameTemp[playName] || null;
2380
+ },
2193
2381
  /** 获取角色基础属性 */
2194
2382
  async getUserAttribute(session) {
2195
2383
  if (!User.userTempData[session.userId]) {
@@ -2315,6 +2503,7 @@ ${Object.keys(UserOccDict).map((i) => `【${i}】:${UserOccDict[i].info}`).join(
2315
2503
  };
2316
2504
  User.ctx.database.create("smm_gensokyo_user_attribute", temp);
2317
2505
  User.userTempData[session.userId] = temp;
2506
+ User.userNameTemp[temp.playName] = temp.userId;
2318
2507
  await Props.initUserPropsData(session.userId);
2319
2508
  await session.send("创建成功!\n" + User.userAttributeTextFormat(session.userId));
2320
2509
  },
@@ -3624,7 +3813,20 @@ function apply(ctx, config) {
3624
3813
  if (!goal) return `请输入技能名,例如 /技能查询 重砍`;
3625
3814
  if (!skillFn[goal]) return `没有存在 ${goal} 技能!`;
3626
3815
  return `[${goal}]信息如下:
3627
- ` + skillFn[goal].info;
3816
+ ` + skillFn[goal].info + `
3817
+ 消耗MP:${skillFn[goal].mp}`;
3818
+ });
3819
+ ctx.command("幻想乡/被动查询 <goal>").action(async ({ session }, goal) => {
3820
+ if (!goal) return `请输入被动名,例如 /被动查询 吸血`;
3821
+ if (!PassiveFn[goal]) return `没有存在 ${goal} 被动!`;
3822
+ return `[${goal}]信息如下:
3823
+ ` + PassiveFn[goal].info;
3824
+ });
3825
+ ctx.command("幻想乡/状态查询 <goal>").action(async ({ session }, goal) => {
3826
+ if (!goal) return `请输入技能名,例如 /状态查询 治愈`;
3827
+ if (!BuffFn[goal]) return `没有存在 ${goal} 状态!`;
3828
+ return `[${goal}]信息如下:
3829
+ ` + BuffFn[goal].info;
3628
3830
  });
3629
3831
  const temp = {};
3630
3832
  ctx.command("幻想乡/补给").action(async ({ session }) => {
@@ -3669,7 +3871,7 @@ function apply(ctx, config) {
3669
3871
  const team = BattleData.teamListByUser(session.userId);
3670
3872
  if (!team.length) return `你还没有队伍...`;
3671
3873
  return `当前队伍信息如下:
3672
- ` + team.map((item) => `lv.${item.lv} ${item.playName} [${BattleData.teamTemp[item.userId].identity}]`).join("\n");
3874
+ ` + team.map((item) => `lv.${item.lv} ${item.playName} [${BattleData.teamTemp[item.userId].identity}] 【${item.duties}】`).join("\n");
3673
3875
  });
3674
3876
  ctx.command("队伍操作/队伍邀请 <playName>").action(async ({ session }, playName) => {
3675
3877
  const userData = await User.getUserAttribute(session);
@@ -3710,6 +3912,26 @@ function apply(ctx, config) {
3710
3912
  }
3711
3913
  await BattleData.dissolveTeam(session);
3712
3914
  });
3915
+ ctx.command("队伍操作/队伍职责").action(async ({ session }) => {
3916
+ const userData = await User.getUserAttribute(session);
3917
+ if (!userData) return;
3918
+ GensokyoMap.initUserPoistion(session, userData);
3919
+ await BattleData.getTeamDuties(session);
3920
+ });
3921
+ ctx.command("队伍操作/队伍调整 <goal> <type>").action(async ({ session }, goal, type) => {
3922
+ const userData = await User.getUserAttribute(session);
3923
+ if (!userData) return;
3924
+ GensokyoMap.initUserPoistion(session, userData);
3925
+ if (!(goal && type)) {
3926
+ return `请携带队伍中成员的名字和职责进行操作!
3927
+ 例如 /队伍调整 张三 前排`;
3928
+ }
3929
+ if (!["前排", "后排"].includes(type)) {
3930
+ return `设置失败,目前只有 前排 和 后排职责。`;
3931
+ } else {
3932
+ await BattleData.settingTeamDuties(session, goal, type);
3933
+ }
3934
+ });
3713
3935
  ctx.command("幻想乡/地图").action(async ({ session }) => {
3714
3936
  const userData = await User.getUserAttribute(session);
3715
3937
  if (!userData) return;
package/lib/users.d.ts CHANGED
@@ -80,9 +80,14 @@ export declare const User: {
80
80
  config: Config;
81
81
  ctx: Context;
82
82
  userTempData: UserTempData;
83
+ userNameTemp: {
84
+ [keys: string]: string;
85
+ };
83
86
  init(config: Config, ctx: Context): Promise<void>;
84
87
  /** 获取玩家名字 */
85
88
  getUserName(userId: string): string;
89
+ /** 获取玩家userId */
90
+ getUserIdByPlayName(playName: string): string;
86
91
  /** 获取角色基础属性 */
87
92
  getUserAttribute(session: Session): Promise<UserBaseAttribute>;
88
93
  /** 获取角色实际等级属性数据 */
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-smmcat-gensokyo",
3
3
  "description": "名为《幻想乡》的文字冒险游戏",
4
- "version": "0.0.40",
4
+ "version": "0.0.42",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [