koishi-plugin-smmcat-gensokyo 0.0.39 → 0.0.41

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
@@ -61,7 +61,10 @@ declare class BuffDamage {
61
61
  /** 给予目标伤害 */
62
62
  declare function giveDamage(self: BattleAttribute, goal: BattleAttribute, damage: DamageConfig): number;
63
63
  /** 治疗目标 */
64
- declare function giveCure(goal: BattleAttribute, val: number): number;
64
+ declare function giveCure(goal: BattleAttribute, val: number, fn?: (msg: string) => void): {
65
+ val: number;
66
+ buffMsg: string;
67
+ };
65
68
  /** 伤害额外信息 */
66
- export declare function moreDamageInfo(damage: DamageConfig): string;
67
- export { Damage, BuffDamage, giveDamage, giveCure };
69
+ declare function moreDamageInfo(damage: DamageConfig): string;
70
+ export { Damage, BuffDamage, giveDamage, giveCure, moreDamageInfo };
@@ -0,0 +1,10 @@
1
+ import { DamageConfig } from "../damage";
2
+ export type PassiveDict = {
3
+ [keys: string]: PassiveItem;
4
+ };
5
+ export type PassiveItem = {
6
+ name: string;
7
+ info: string;
8
+ damageFn: (config: DamageConfig) => void;
9
+ };
10
+ 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
@@ -72,7 +72,7 @@ var monsterBenchmark = {
72
72
  };
73
73
  var userBenchmark = {
74
74
  10: {
75
- maxExp: 1.5,
75
+ maxExp: 1.3,
76
76
  maxHp: 1.13,
77
77
  maxMp: 1.13,
78
78
  atk: 1.1,
@@ -84,7 +84,7 @@ var userBenchmark = {
84
84
  speed: 1.05
85
85
  },
86
86
  20: {
87
- maxExp: 1.3,
87
+ maxExp: 1.2,
88
88
  maxHp: 1.08,
89
89
  maxMp: 1.08,
90
90
  atk: 1.08,
@@ -96,7 +96,7 @@ var userBenchmark = {
96
96
  speed: 1.05
97
97
  },
98
98
  40: {
99
- maxExp: 1.2,
99
+ maxExp: 1.1,
100
100
  maxHp: 1.05,
101
101
  maxMp: 1.05,
102
102
  atk: 1.05,
@@ -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
  ],
@@ -501,165 +510,6 @@ var AsyncOperationQueue = class {
501
510
  }
502
511
  };
503
512
 
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
513
  // src/data/buffFn.ts
664
514
  var BuffFn = {
665
515
  "治愈": {
@@ -772,6 +622,14 @@ var BuffFn = {
772
622
  if (!agent.expand["curse-buff"]) agent.expand["curse-buff"] = { val: 0 };
773
623
  agent.expand["curse-buff"].val++;
774
624
  }, "initFn"),
625
+ cureFn: /* @__PURE__ */ __name(function(agent, fn) {
626
+ if (random(0, 1)) {
627
+ clearImprint(agent, { name: "咒" });
628
+ return ` 治疗状态下 ⌈咒⌋ 被成功驱散`;
629
+ } else {
630
+ return ``;
631
+ }
632
+ }, "cureFn"),
775
633
  fn: /* @__PURE__ */ __name(function(agent, fn) {
776
634
  fn && fn({
777
635
  type: "印记" /* 印记 */,
@@ -787,7 +645,7 @@ function giveBuff(agent, buff) {
787
645
  const buffInfo = BuffFn[buff.name] || null;
788
646
  if (!buffInfo) return;
789
647
  if (buffInfo.type == "印记" /* 印记 */) {
790
- buffInfo?.initFn(agent);
648
+ buffInfo.initFn?.(agent);
791
649
  }
792
650
  let again = false;
793
651
  if (agent.buff[buff.name]) again = true;
@@ -833,8 +691,10 @@ function settlementBuff(agent) {
833
691
  agent.gain.maxMp = 0;
834
692
  agent.gain.speed = 0;
835
693
  agent.gain.reduction = 0;
694
+ agent.gain.TreatmentUp = 0;
836
695
  agent.gain.dizziness = false;
837
696
  agent.gain.chaos = false;
697
+ agent.gain.silence = false;
838
698
  const msgList = [];
839
699
  const gainDict = {
840
700
  atk: "攻击",
@@ -861,7 +721,7 @@ function settlementBuff(agent) {
861
721
  case "治疗" /* 治疗 */:
862
722
  buffInfo.fn(agent, (val) => {
863
723
  const value = giveCure(agent, val.val);
864
- msgList.push(`${buffInfo.name}+${value}HP`);
724
+ msgList.push(`${buffInfo.name}+${value.val}HP。` + (value.buffMsg ? value.buffMsg : ""));
865
725
  });
866
726
  break;
867
727
  case "增益" /* 增益 */:
@@ -914,6 +774,191 @@ function settlementBuff(agent) {
914
774
  }
915
775
  __name(settlementBuff, "settlementBuff");
916
776
 
777
+ // src/data/PassiveFn.ts
778
+ var PassiveFn = {
779
+ "吸血": {
780
+ name: "吸血",
781
+ info: "造成伤害时,汲取10%该次伤害的值转为生命值",
782
+ damageFn: /* @__PURE__ */ __name(function(config) {
783
+ const val = Math.floor(config.harm * 0.1);
784
+ }, "damageFn")
785
+ }
786
+ };
787
+
788
+ // src/damage.ts
789
+ var Damage = class {
790
+ static {
791
+ __name(this, "Damage");
792
+ }
793
+ config;
794
+ constructor(agent, realHarm = false) {
795
+ this.config = {
796
+ agent: { self: { ...agent.self }, goal: { ...agent.goal } },
797
+ harm: 0,
798
+ default_harm: 0,
799
+ isRealHarm: realHarm,
800
+ isEvasion: false,
801
+ isCsp: false,
802
+ isBadDef: false,
803
+ reductionVal: 0
804
+ };
805
+ }
806
+ /** 伤害判定前 */
807
+ before(fn) {
808
+ this.config.default_harm = this.config.agent.self.atk + this.config.agent.self.gain.atk;
809
+ fn && fn(this.config);
810
+ return this;
811
+ }
812
+ /** 真实伤害判定 */
813
+ beforRealHarm(fn) {
814
+ fn && fn(this.config);
815
+ if (this.config.isRealHarm) {
816
+ this.config.harm = this.config.default_harm;
817
+ }
818
+ return this;
819
+ }
820
+ /** 是否闪避判定 */
821
+ evasion(fn) {
822
+ const { self, goal } = this.config.agent;
823
+ if (this.config.isRealHarm) return this;
824
+ const lvSup = /* @__PURE__ */ __name(() => Math.floor((goal.lv - self.lv) / 5) * 20, "lvSup");
825
+ const evaVal = Math.min(95, (goal.evasion + goal.gain.evasion - (self.hit - 1e3) + lvSup()) / 10);
826
+ if (random(0, 100) <= evaVal) {
827
+ this.config.isEvasion = true;
828
+ fn && fn(this.config);
829
+ return this;
830
+ }
831
+ fn && fn(this.config);
832
+ return this;
833
+ }
834
+ /** 是否暴击判定 */
835
+ csp(fn) {
836
+ const { self, goal } = this.config.agent;
837
+ if (this.config.isRealHarm) return this;
838
+ if (this.config.isEvasion) return this;
839
+ const cspVal = (self.chr + self.gain.chr - goal.csr) / 10;
840
+ if (random(0, 100) <= cspVal) {
841
+ this.config.isCsp = true;
842
+ this.config.harm = Math.floor(this.config.default_harm * (self.ghd + self.gain.ghd));
843
+ fn && fn(this.config);
844
+ return this;
845
+ }
846
+ this.config.harm = this.config.default_harm;
847
+ fn && fn(this.config);
848
+ return this;
849
+ }
850
+ /** 防御结算 */
851
+ beforDef(fn) {
852
+ const { goal } = this.config.agent;
853
+ if (this.config.isRealHarm) return this;
854
+ if (this.config.isEvasion) return this;
855
+ const dpVal = goal.def + goal.gain.def;
856
+ fn && fn(this.config);
857
+ if (this.config.harm - dpVal > 0) {
858
+ this.config.harm -= dpVal;
859
+ } else {
860
+ this.config.isBadDef = true;
861
+ this.config.harm = 1;
862
+ }
863
+ return this;
864
+ }
865
+ /** 最终结算 伤害减免 */
866
+ beforEnd(fn) {
867
+ if (!this.config.isRealHarm) {
868
+ this.config.reductionVal = Math.floor(this.config.agent.goal.gain.reduction * this.config.harm);
869
+ this.config.harm -= this.config.reductionVal;
870
+ if (this.config.harm < 0) {
871
+ this.config.harm = 0;
872
+ }
873
+ }
874
+ fn && fn(this.config);
875
+ if (this.config.agent.self.passiveList?.length) {
876
+ this.config.agent.self.passiveList.forEach((passiveName) => {
877
+ PassiveFn[passiveName].damageFn(this.config);
878
+ });
879
+ }
880
+ return this;
881
+ }
882
+ result(fn) {
883
+ this.before((val) => {
884
+ fn?.before && fn.before(val);
885
+ }).beforRealHarm((val) => {
886
+ fn?.beforRealHarm && fn.beforRealHarm(val);
887
+ }).evasion((val) => {
888
+ fn?.evasion && fn.evasion(val);
889
+ }).csp((val) => {
890
+ fn?.csp && fn.csp(val);
891
+ }).beforDef((val) => {
892
+ fn?.beforDef && fn.beforDef(val);
893
+ }).beforEnd((val) => {
894
+ fn?.beforEnd && fn.beforEnd(val);
895
+ });
896
+ return this.config;
897
+ }
898
+ };
899
+ var BuffDamage = class {
900
+ static {
901
+ __name(this, "BuffDamage");
902
+ }
903
+ goal;
904
+ val;
905
+ isRealHarm;
906
+ constructor(val, goal, isRealHarm = false) {
907
+ this.goal = goal;
908
+ this.val = val;
909
+ this.isRealHarm = isRealHarm;
910
+ }
911
+ giveDamage() {
912
+ if (this.isRealHarm) {
913
+ const val = this.goal.hp - this.val > 0 ? this.val : this.goal.hp;
914
+ this.goal.hp -= val;
915
+ return val;
916
+ } else {
917
+ const def = this.goal.def + this.goal.gain.def;
918
+ const val = this.goal.hp + def - this.val > 0 ? this.val - def : this.goal.hp;
919
+ this.goal.hp -= val;
920
+ return val;
921
+ }
922
+ }
923
+ };
924
+ function giveDamage(self, goal, damage) {
925
+ if (goal.hp - damage.harm > 0) {
926
+ goal.hp -= damage.harm;
927
+ return damage.harm;
928
+ } else {
929
+ const lostHp = goal.hp;
930
+ goal.hp = 0;
931
+ return lostHp;
932
+ }
933
+ }
934
+ __name(giveDamage, "giveDamage");
935
+ function giveCure(goal, val, fn) {
936
+ const buffMsg = [];
937
+ console.log(goal.buff);
938
+ Object.keys(goal.buff).forEach((buff) => {
939
+ if (BuffFn[buff]?.cureFn) {
940
+ const msg = BuffFn[buff].cureFn(goal);
941
+ msg && buffMsg.push(msg);
942
+ }
943
+ });
944
+ const upVal = goal.hp + val;
945
+ if (upVal < goal.maxHp + goal.gain.maxHp) {
946
+ goal.hp = upVal;
947
+ fn && fn(buffMsg.join("、"));
948
+ return { val, buffMsg: buffMsg.join("、") };
949
+ } else {
950
+ const abHp = goal.maxHp + goal.gain.maxHp - goal.hp;
951
+ goal.hp += abHp;
952
+ fn && fn(buffMsg.join("、"));
953
+ return { val: abHp, buffMsg: buffMsg.join("、") };
954
+ }
955
+ }
956
+ __name(giveCure, "giveCure");
957
+ function moreDamageInfo(damage) {
958
+ return (damage.isCsp ? `(暴击!)` : "") + (damage.isEvasion ? `(闪避成功!)` : "") + (damage.isBadDef ? `(未破防!)` : "") + (damage.isRealHarm ? `(真实伤害)` : "");
959
+ }
960
+ __name(moreDamageInfo, "moreDamageInfo");
961
+
917
962
  // src/data/skillFn.ts
918
963
  var skillFn = {
919
964
  "重砍": {
@@ -1183,7 +1228,7 @@ var skillFn = {
1183
1228
  "紧闭的恋之瞳": {
1184
1229
  name: "紧闭的恋之瞳",
1185
1230
  type: "减益技" /* 减益技 */,
1186
- info: "[减益技]怪物特有技能:为玩家目标添加5回合的⌈咒⌋印记,当对方持有3个⌈咒⌋印记,将直接死亡。",
1231
+ info: "[减益技]怪物特有技能:为玩家目标添加5回合的⌈咒⌋印记,当对方持有3个⌈咒⌋印记,将直接死亡。⌈咒⌋可以有50%概率会被技能类型的治疗驱散",
1187
1232
  lv: 5,
1188
1233
  mp: 40,
1189
1234
  fn: /* @__PURE__ */ __name(function(agent, agentList, fn) {
@@ -1204,9 +1249,9 @@ var skillFn = {
1204
1249
  if (agent.goal.expand[key].val >= 3) {
1205
1250
  agent.goal.hp = 0;
1206
1251
  clearImprint(agent.goal, { name: "咒" });
1207
- return `${getLineupName(agent.self)}释放紧闭的恋之瞳,目标⌈咒⌋层达到3层,目标立即死亡`;
1252
+ return `${getLineupName(agent.self)}释放紧闭的恋之瞳,${getLineupName(agent.goal)}⌈咒⌋层达到3层,立即死亡!`;
1208
1253
  }
1209
- return `${getLineupName(agent.self)}释放紧闭的恋之瞳,目标⌈咒⌋层数${agent.goal.expand[key].val}层`;
1254
+ return `${getLineupName(agent.self)}释放紧闭的恋之瞳,${getLineupName(agent.goal)}⌈咒⌋层数${agent.goal.expand[key].val}层`;
1210
1255
  }, "fn")
1211
1256
  },
1212
1257
  "无意识行动": {
@@ -1284,7 +1329,7 @@ var BattleData = {
1284
1329
  const _userId = BattleData.teamTemp[userId].for;
1285
1330
  Object.keys(BattleData.teamTemp).forEach((item) => {
1286
1331
  if (BattleData.teamTemp[item].for == _userId) {
1287
- teamList.push(User.getUserAttributeByUserId(item));
1332
+ teamList.push({ ...User.getUserAttributeByUserId(item), duties: BattleData.teamTemp[item].duties });
1288
1333
  }
1289
1334
  });
1290
1335
  return teamList;
@@ -1293,11 +1338,12 @@ var BattleData = {
1293
1338
  async creatTeam(session) {
1294
1339
  const { userId } = session;
1295
1340
  if (BattleData.isTeamByUserId(userId)) {
1296
- await session.send(`${User.getUserName(userId)}:你已经加入了${BattleData.teamTemp[userId].for}的队伍,需要退出才可以重新创建!`);
1341
+ await session.send(`${User.getUserName(userId)}:你已经加入了${User.getUserName(BattleData.teamTemp[userId].for)}的队伍,需要退出才可以重新创建!`);
1297
1342
  return;
1298
1343
  }
1299
1344
  BattleData.teamTemp[userId] = {
1300
1345
  for: userId,
1346
+ duties: "后排",
1301
1347
  identity: "队长"
1302
1348
  };
1303
1349
  await session.send("创建队伍成功!发送 /队伍邀请 昵称 \n可对周围对应昵称玩家进行组队邀请!");
@@ -1355,6 +1401,7 @@ var BattleData = {
1355
1401
  }
1356
1402
  BattleData.teamTemp[userId] = {
1357
1403
  for: invInfo.for,
1404
+ duties: "后排",
1358
1405
  identity: "队员"
1359
1406
  };
1360
1407
  await session.send(`加入${invInfo.playName}的队伍成功!
@@ -1392,6 +1439,39 @@ var BattleData = {
1392
1439
  });
1393
1440
  await session.send("操作成功,已经解散你创建的小队。");
1394
1441
  },
1442
+ /** 查看职责 */
1443
+ async getTeamDuties(session) {
1444
+ const { userId } = session;
1445
+ if (!BattleData.isTeamByUserId(userId)) {
1446
+ await session.send("你还没有加入任何队伍!");
1447
+ return;
1448
+ }
1449
+ const team = BattleData.teamListByUser(userId);
1450
+ await session.send(`当前队伍职责:
1451
+ ` + team.map((agent) => {
1452
+ return `Lv.${agent.lv} ` + agent.playName + ` [${agent.duties}]`;
1453
+ }).join("\n"));
1454
+ },
1455
+ /** 设置职责 */
1456
+ async settingTeamDuties(session, playName, duties) {
1457
+ const { userId } = session;
1458
+ if (!BattleData.isTeamByUserId(userId)) {
1459
+ await session.send("你还没有加入任何队伍!");
1460
+ return;
1461
+ }
1462
+ if (BattleData.teamTemp[userId].identity == "队员") {
1463
+ await session.send("你不是小队队长,无法配置职责。");
1464
+ return;
1465
+ }
1466
+ const isUpdate = Object.keys(BattleData.teamTemp).some((item) => {
1467
+ if (BattleData.teamTemp[item].for == userId && item == User.getUserIdByPlayName(playName)) {
1468
+ BattleData.teamTemp[item].duties = duties;
1469
+ return true;
1470
+ }
1471
+ return false;
1472
+ });
1473
+ await session.send(isUpdate ? "修改成功!" : "修改失败,可能原因:小队中不存在此人!");
1474
+ },
1395
1475
  /** 创建战斗-与怪物 */
1396
1476
  async createBattleByMonster(session, goal) {
1397
1477
  if (BattleData.isBattle(session)) {
@@ -1614,8 +1694,13 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1614
1694
  } else if (agent.type == "玩家") {
1615
1695
  selectGoal = lifeGoalList[Math.floor(Math.random() * lifeGoalList.length)];
1616
1696
  } else {
1617
- selectGoal = lifeGoalList[Math.floor(Math.random() * lifeGoalList.length)];
1618
- if (random(0, 10) < 10 && agent.fn?.length) {
1697
+ const fistGoal = lifeGoalList.filter((item) => item.duties == "前排");
1698
+ if (!fistGoal.length) {
1699
+ selectGoal = lifeGoalList[Math.floor(Math.random() * lifeGoalList.length)];
1700
+ } else {
1701
+ selectGoal = fistGoal[Math.floor(Math.random() * fistGoal.length)];
1702
+ }
1703
+ if (random(0, 10) < 4 && agent.fn?.length) {
1619
1704
  funType = getSkillFn(agent.fn);
1620
1705
  }
1621
1706
  }
@@ -1640,6 +1725,7 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1640
1725
  _selectGoal = lifeSelfList.find((item) => item.name == select) || agent;
1641
1726
  }
1642
1727
  const selectFn = skillFn[funType];
1728
+ let buffmsg = "";
1643
1729
  if (selectFn.mp == 0 || agent.mp - selectFn.mp >= 0) {
1644
1730
  agent.mp -= selectFn.mp;
1645
1731
  let isNext = false;
@@ -1656,7 +1742,11 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1656
1742
  case "治疗技" /* 治疗技 */:
1657
1743
  val.target.map((goal) => {
1658
1744
  val.value += val.value * (1 - agent.gain.TreatmentUp);
1659
- giveCure(goal, val.value);
1745
+ giveCure(goal, val.value, (msg) => {
1746
+ if (msg) {
1747
+ buffmsg = "。" + msg;
1748
+ }
1749
+ });
1660
1750
  });
1661
1751
  break;
1662
1752
  case "增益技" /* 增益技 */:
@@ -1673,7 +1763,7 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
1673
1763
  isNext = val.isNext;
1674
1764
  }
1675
1765
  );
1676
- fnMsg && msgList.push(fnMsg);
1766
+ fnMsg && msgList.push(fnMsg + buffmsg);
1677
1767
  isNext && noralAtk();
1678
1768
  } else {
1679
1769
  isMy && await session.send(`MP不足,释放失败!`);
@@ -1809,6 +1899,7 @@ function initBattleAttribute(data) {
1809
1899
  id: Date.now(),
1810
1900
  userId: userData.userId,
1811
1901
  name: userData.playName,
1902
+ duties: BattleData.isTeamByUserId(userData.userId) ? BattleData.teamTemp[userData.userId].duties : "前排",
1812
1903
  lv: userData.lv,
1813
1904
  type: "玩家",
1814
1905
  selfType: userData.type,
@@ -1842,6 +1933,7 @@ function initBattleAttribute(data) {
1842
1933
  },
1843
1934
  buff: {},
1844
1935
  fn: [],
1936
+ passiveList: [],
1845
1937
  expand: {}
1846
1938
  };
1847
1939
  return temp;
@@ -1882,6 +1974,7 @@ function initBattleAttribute(data) {
1882
1974
  reduction: 0
1883
1975
  },
1884
1976
  buff: {},
1977
+ passiveList: monsterData2.passiveList || [],
1885
1978
  fn: monsterData2.fn ? JSON.parse(JSON.stringify(monsterData2.fn)).filter((item) => {
1886
1979
  return skillFn[item.name] && monsterData2.lv >= skillFn[item.name].lv;
1887
1980
  }) : [],
@@ -2158,6 +2251,7 @@ var User = {
2158
2251
  config: {},
2159
2252
  ctx: {},
2160
2253
  userTempData: {},
2254
+ userNameTemp: {},
2161
2255
  async init(config, ctx) {
2162
2256
  User.config = config;
2163
2257
  User.ctx = ctx;
@@ -2183,6 +2277,7 @@ var User = {
2183
2277
  const temp = {};
2184
2278
  userData.forEach((item) => {
2185
2279
  temp[item.userId] = item;
2280
+ User.userNameTemp[item.playName] = item.userId;
2186
2281
  });
2187
2282
  User.userTempData = temp;
2188
2283
  },
@@ -2190,6 +2285,10 @@ var User = {
2190
2285
  getUserName(userId) {
2191
2286
  return User.userTempData[userId].playName || null;
2192
2287
  },
2288
+ /** 获取玩家userId */
2289
+ getUserIdByPlayName(playName) {
2290
+ return User.userNameTemp[playName] || null;
2291
+ },
2193
2292
  /** 获取角色基础属性 */
2194
2293
  async getUserAttribute(session) {
2195
2294
  if (!User.userTempData[session.userId]) {
@@ -2315,6 +2414,7 @@ ${Object.keys(UserOccDict).map((i) => `【${i}】:${UserOccDict[i].info}`).join(
2315
2414
  };
2316
2415
  User.ctx.database.create("smm_gensokyo_user_attribute", temp);
2317
2416
  User.userTempData[session.userId] = temp;
2417
+ User.userNameTemp[temp.playName] = temp.userId;
2318
2418
  await Props.initUserPropsData(session.userId);
2319
2419
  await session.send("创建成功!\n" + User.userAttributeTextFormat(session.userId));
2320
2420
  },
@@ -2877,7 +2977,7 @@ var GensokyoMap = {
2877
2977
  type: "BOSS区" /* BOSS区 */,
2878
2978
  needLv: 1,
2879
2979
  left: "大草场",
2880
- monster: [{ name: "古明地恋", lv: 10 }]
2980
+ monster: [{ name: "古明地恋", lv: 25 }]
2881
2981
  }
2882
2982
  }
2883
2983
  };
@@ -3669,7 +3769,7 @@ function apply(ctx, config) {
3669
3769
  const team = BattleData.teamListByUser(session.userId);
3670
3770
  if (!team.length) return `你还没有队伍...`;
3671
3771
  return `当前队伍信息如下:
3672
- ` + team.map((item) => `lv.${item.lv} ${item.playName} [${BattleData.teamTemp[item.userId].identity}]`).join("\n");
3772
+ ` + team.map((item) => `lv.${item.lv} ${item.playName} [${BattleData.teamTemp[item.userId].identity}] 【${item.duties}】`).join("\n");
3673
3773
  });
3674
3774
  ctx.command("队伍操作/队伍邀请 <playName>").action(async ({ session }, playName) => {
3675
3775
  const userData = await User.getUserAttribute(session);
@@ -3710,6 +3810,26 @@ function apply(ctx, config) {
3710
3810
  }
3711
3811
  await BattleData.dissolveTeam(session);
3712
3812
  });
3813
+ ctx.command("队伍操作/队伍职责").action(async ({ session }) => {
3814
+ const userData = await User.getUserAttribute(session);
3815
+ if (!userData) return;
3816
+ GensokyoMap.initUserPoistion(session, userData);
3817
+ await BattleData.getTeamDuties(session);
3818
+ });
3819
+ ctx.command("队伍操作/队伍调整 <goal> <type>").action(async ({ session }, goal, type) => {
3820
+ const userData = await User.getUserAttribute(session);
3821
+ if (!userData) return;
3822
+ GensokyoMap.initUserPoistion(session, userData);
3823
+ if (!(goal && type)) {
3824
+ return `请携带队伍中成员的名字和职责进行操作!
3825
+ 例如 /队伍调整 张三 前排`;
3826
+ }
3827
+ if (!["前排", "后排"].includes(type)) {
3828
+ return `设置失败,目前只有 前排 和 后排职责。`;
3829
+ } else {
3830
+ await BattleData.settingTeamDuties(session, goal, type);
3831
+ }
3832
+ });
3713
3833
  ctx.command("幻想乡/地图").action(async ({ session }) => {
3714
3834
  const userData = await User.getUserAttribute(session);
3715
3835
  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.39",
4
+ "version": "0.0.41",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [