koishi-plugin-smmcat-gensokyo 0.0.46 → 0.0.48

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.
@@ -43,13 +43,15 @@ interface BuffConfig<T extends BuffType = BuffType> {
43
43
  info: string;
44
44
  /** 印记 */
45
45
  key?: string;
46
- /** 被动函数 */
46
+ /** 附着时触发 */
47
47
  initFn?(agent: BattleAttribute, cb?: (val: Extract<BuffItemParams, {
48
48
  type: T;
49
49
  }>) => void): void;
50
+ /** 结算时触发 */
50
51
  fn(agent: BattleAttribute, cb?: (val: Extract<BuffItemParams, {
51
52
  type: T;
52
53
  }>) => void): void;
54
+ /** 被治疗时触发 */
53
55
  cureFn?(agent: BattleAttribute, cb?: (val: Extract<BuffItemParams, {
54
56
  type: T;
55
57
  }>) => void): string;
@@ -58,6 +60,8 @@ type BuffFnList = {
58
60
  [key: string]: BuffConfig;
59
61
  };
60
62
  export declare const BuffFn: BuffFnList;
63
+ /** BUFF状态持续时间格式化 */
64
+ export declare function buffTimeFormat(time: number): any;
61
65
  /** 为目标添加BUFF */
62
66
  export declare function giveBuff(agent: BattleAttribute, buff: {
63
67
  name: string;
package/lib/index.js CHANGED
@@ -281,7 +281,7 @@ var monsterData = {
281
281
  speed: 5,
282
282
  giveExp: 16,
283
283
  giveMonetary: 5,
284
- passiveList: [],
284
+ passiveList: ["剧毒"],
285
285
  giveProps: [
286
286
  { name: "初级复活卷轴", val: 1, radomVal: 50 }
287
287
  ],
@@ -668,17 +668,20 @@ var BuffFn = {
668
668
  }, "fn")
669
669
  }
670
670
  };
671
+ function buffTimeFormat(time) {
672
+ const dict = { 1: "¹", 2: "²", 3: "³", 4: "⁴", 5: "⁵", 6: "⁶", 7: "⁷", 8: "⁸", 9: "⁹" };
673
+ return dict[time] || "⁺";
674
+ }
675
+ __name(buffTimeFormat, "buffTimeFormat");
671
676
  function giveBuff(agent, buff) {
672
677
  const buffInfo = BuffFn[buff.name] || null;
673
678
  if (!buffInfo) return;
674
- if (buffInfo.type == "印记" /* 印记 */) {
675
- buffInfo.initFn?.(agent);
676
- }
679
+ buffInfo.initFn?.(agent);
677
680
  let again = false;
678
681
  if (agent.buff[buff.name]) again = true;
679
682
  agent.buff[buff.name] = buff;
680
683
  const dict = { 1: "¹", 2: "²", 3: "³", 4: "⁴", 5: "⁵", 6: "⁶", 7: "⁷", 8: "⁸", 9: "⁹" };
681
- return again ? `${getLineupName(agent)}被再次挂上了${buff.name}${dict[buff.timer] || "⁺"}` : `${getLineupName(agent)}被挂上了${buff.name}${dict[buff.timer] || "⁺"}`;
684
+ return again ? `${getLineupName(agent)}被再次挂上了${buff.name}${buffTimeFormat(buff.timer)}` : `${getLineupName(agent)}被挂上了${buff.name}${buffTimeFormat(buff.timer)}`;
682
685
  }
683
686
  __name(giveBuff, "giveBuff");
684
687
  function clearBuff(agent, buff) {
@@ -811,7 +814,7 @@ var PassiveFn = {
811
814
  const val = Math.floor(config.harm * 0.1);
812
815
  if (val) {
813
816
  const res = giveCure(config.linkAgent.self, val);
814
- return `‣ ${getLineupName(config.linkAgent.self)}:[${this.name}] HP+${res.val}`;
817
+ return `‣ ${getLineupName(config.linkAgent.self)}触发被动 ¦${this.name}¦ HP+${res.val}`;
815
818
  }
816
819
  return ``;
817
820
  }, "damageFn")
@@ -824,7 +827,7 @@ var PassiveFn = {
824
827
  const val = Math.floor(config.harm * 0.2);
825
828
  if (val && random(0, 10) <= 4) {
826
829
  const value = new BuffDamage(val, config.linkAgent.self, true).giveDamage();
827
- return `‣ ${getLineupName(config.linkAgent.self)}:[${this.name}] HP-${value}`;
830
+ return `‣ ${getLineupName(config.linkAgent.goal)}触发被动 ¦${this.name}¦ HP-${value}`;
828
831
  }
829
832
  return ``;
830
833
  }, "damageFn")
@@ -838,7 +841,7 @@ var PassiveFn = {
838
841
  const upVal = Math.floor(config.harm * 0.3);
839
842
  if (upVal) {
840
843
  config.harm += Math.floor(config.harm * 0.3);
841
- return `‣ ${getLineupName(config.linkAgent.self)}:[${this.name}] 伤害+${upVal}`;
844
+ return `‣ ${getLineupName(config.linkAgent.self)}触发被动 ¦${this.name}¦ 伤害+${upVal}`;
842
845
  }
843
846
  return ``;
844
847
  }
@@ -854,7 +857,7 @@ var PassiveFn = {
854
857
  const upVal = Math.floor(config.harm * 0.3);
855
858
  if (upVal) {
856
859
  config.harm += Math.floor(config.harm * 0.3);
857
- return `‣ ${getLineupName(config.linkAgent.self)}:[${this.name}] 伤害+${upVal}`;
860
+ return `‣ ${getLineupName(config.linkAgent.self)}触发被动 ¦${this.name}¦ 伤害+${upVal}`;
858
861
  }
859
862
  return ``;
860
863
  }
@@ -863,22 +866,42 @@ var PassiveFn = {
863
866
  },
864
867
  "针女": {
865
868
  name: "针女",
866
- info: "攻击时有40%概率额外造成敌方5%血量真实伤害(伤害最大不超过使用者攻击力的120%)",
869
+ info: "造成暴击有50%概率额外造成敌方5%血量真实伤害(伤害最大不超过使用者攻击力的120%)",
867
870
  type: "atk",
868
871
  damageFn: /* @__PURE__ */ __name(function(config) {
869
- if (random(0, 10) <= 4) {
872
+ if (config.isCsp && random(0, 10) <= 5) {
870
873
  const upVal = Math.min(
871
- config.linkAgent.self.atk + config.linkAgent.self.gain.atk,
874
+ Math.floor((config.linkAgent.self.atk + config.linkAgent.self.gain.atk) * 1.2),
872
875
  Math.floor(config.linkAgent.goal.maxHp * 0.05)
873
876
  );
874
877
  if (upVal) {
875
878
  const value = new BuffDamage(upVal, config.linkAgent.goal, true).giveDamage();
876
- return `‣ ${getLineupName(config.linkAgent.goal)}:[${this.name}] HP-${value}`;
879
+ return `‣ ${getLineupName(config.linkAgent.self)}触发被动 ¦${this.name}¦ HP-${value}`;
877
880
  }
878
881
  return ``;
879
882
  }
880
883
  return ``;
881
884
  }, "damageFn")
885
+ },
886
+ "剧毒": {
887
+ name: "剧毒",
888
+ info: "造成伤害时有20%概率为目标附加中毒状态2回合,对已在中毒状态的目标 80% 概率直接催化中毒(结算剩余中毒总计伤害)",
889
+ type: "atk",
890
+ damageFn: /* @__PURE__ */ __name(function(config) {
891
+ if (config.linkAgent.goal.buff["中毒"] && random(0, 10) <= 8) {
892
+ const timeVal = config.linkAgent.goal.buff["中毒"].timer;
893
+ clearBuff(config.linkAgent.goal, { name: "中毒" });
894
+ const upDamage = Math.min(20, Math.floor((config.agent.goal.maxHp + config.agent.goal.maxHp) * 0.05) || 1) * timeVal;
895
+ const value = new BuffDamage(upDamage, config.linkAgent.goal, true).giveDamage();
896
+ return `‣ ${getLineupName(config.linkAgent.self)}触发被动 ¦${this.name}¦ 催化中毒${buffTimeFormat(timeVal)} 目标HP-${value}`;
897
+ } else {
898
+ if (random(0, 10) <= 2) {
899
+ giveBuff(config.linkAgent.goal, { name: "中毒", timer: 2 });
900
+ return `‣ ${getLineupName(config.linkAgent.self)}触发被动 ¦${this.name}¦ 附着2回合⌈中毒⌋`;
901
+ }
902
+ return ``;
903
+ }
904
+ }, "damageFn")
882
905
  }
883
906
  };
884
907
 
@@ -971,7 +994,7 @@ var Damage = class {
971
994
  }
972
995
  }
973
996
  fn && fn(this.config);
974
- if (this.config.linkAgent.self.passiveList?.length) {
997
+ if (!this.config.isRealHarm && this.config.linkAgent.self.passiveList?.length) {
975
998
  this.config.linkAgent.self.passiveList.forEach((passiveName) => {
976
999
  if (PassiveFn[passiveName].type == "atk") {
977
1000
  const msg = PassiveFn[passiveName].damageFn(this.config);
@@ -1024,7 +1047,7 @@ var BuffDamage = class {
1024
1047
  }
1025
1048
  };
1026
1049
  function giveDamage(self, goal, damage) {
1027
- if (damage.linkAgent.goal.passiveList?.length) {
1050
+ if (!damage.isRealHarm && damage.linkAgent.goal.passiveList?.length) {
1028
1051
  damage.linkAgent.goal.passiveList.forEach((passiveName) => {
1029
1052
  if (PassiveFn[passiveName].type == "hit") {
1030
1053
  const msg = PassiveFn[passiveName].damageFn(damage);
@@ -1434,7 +1457,7 @@ var skillFn = {
1434
1457
  });
1435
1458
  msgList.push(`- ${getLineupName(agent.goal)} 受到 ${damageData.harm} 伤害。` + baseMoreDamage(damageData));
1436
1459
  }
1437
- while (random(0, 10) <= 4) {
1460
+ while (random(0, 10) <= 4 && agent.goal.hp > 0) {
1438
1461
  const damageData = new Damage(agent).result({
1439
1462
  before: /* @__PURE__ */ __name((val) => {
1440
1463
  val.default_harm = Math.floor((agent.self.atk + agent.self.gain.atk) * 0.3) + Math.floor(agent.self.mp * 0.05);
@@ -3056,7 +3079,7 @@ var GensokyoMap = {
3056
3079
  needLv: 1,
3057
3080
  left: "绿野平原四",
3058
3081
  top: "绿野平原三",
3059
- monster: [{ name: "绿毒蛇", lv: 12 }]
3082
+ monster: [{ name: "绿毒蛇", lv: 32 }]
3060
3083
  },
3061
3084
  "野猪巢穴": {
3062
3085
  floor: 1,
@@ -3870,6 +3893,10 @@ function apply(ctx, config) {
3870
3893
  ctx.command("幻想乡/查询怪物 <monster> <lv:posint>").action(async ({ session }, monster, lv) => {
3871
3894
  if (!monster) return `请输入要查询的怪物!`;
3872
3895
  if (!lv) lv = 1;
3896
+ if (lv > 60) {
3897
+ await session.send(`抱歉,目前最高只能查询怪物 lv60 级的属性`);
3898
+ lv = 60;
3899
+ }
3873
3900
  const result = Monster.getMonsterAttributeData(monster, lv);
3874
3901
  if (!result) return `没有找到该怪物信息...`;
3875
3902
  return Monster.monsterAttributeTextFormat(result);
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-smmcat-gensokyo",
3
3
  "description": "名为《幻想乡》的文字冒险游戏",
4
- "version": "0.0.46",
4
+ "version": "0.0.48",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [