koishi-plugin-smmcat-gensokyo 0.0.1 → 0.0.3

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/index.js CHANGED
@@ -182,6 +182,7 @@ var GensokyoMap = {
182
182
  floor: 1,
183
183
  areaName: "绿野平原二",
184
184
  type: "冒险区" /* 冒险区 */,
185
+ monster: [{ name: "dora", lv: 2 }, { name: "dora", lv: 2 }, { name: "dora", lv: 3 }, { name: "dora", lv: 2 }],
185
186
  needLv: 1,
186
187
  right: "绿野平原一",
187
188
  down: "绿野平原五"
@@ -223,6 +224,7 @@ var GensokyoMap = {
223
224
  const userPoistionList = await ctx.database.get("smm_gensokyo_map_position", {});
224
225
  const poistionTemp = {};
225
226
  userPoistionList.forEach((poistion) => {
227
+ poistion.moveing = false;
226
228
  poistionTemp[poistion.userId] = poistion;
227
229
  });
228
230
  GensokyoMap.userCurrentLoal = poistionTemp;
@@ -468,35 +470,32 @@ var User = {
468
470
  const lv = UserData.lv;
469
471
  const benchmark = {
470
472
  10: {
471
- hp: 1.4,
472
- maxHp: 1.4,
473
- mp: 1.2,
474
- maxMp: 1.2,
475
- atk: 1.2,
473
+ maxExp: 2,
474
+ maxHp: 1.2,
475
+ maxMp: 1.1,
476
+ atk: 1.12,
476
477
  def: 1.1,
477
478
  chr: 1.1,
478
- evasion: 1.2,
479
- hit: 1.2,
479
+ evasion: 1.1,
480
+ hit: 1.1,
480
481
  ghd: 1,
481
482
  speed: 1.05
482
483
  },
483
484
  20: {
484
- hp: 1.35,
485
- maxHp: 1.35,
486
- mp: 1.1,
485
+ maxExp: 1.8,
486
+ maxHp: 1.15,
487
487
  maxMp: 1.1,
488
488
  atk: 1.1,
489
489
  def: 1.1,
490
490
  chr: 1.1,
491
491
  evasion: 1.1,
492
- hit: 1.1,
492
+ hit: 1.08,
493
493
  ghd: 1,
494
494
  speed: 1.05
495
495
  },
496
496
  40: {
497
- hp: 1.2,
498
- maxHp: 1.2,
499
- mp: 1.05,
497
+ maxExp: 1.5,
498
+ maxHp: 1.1,
500
499
  maxMp: 1.05,
501
500
  atk: 1.1,
502
501
  def: 1.05,
@@ -513,7 +512,11 @@ var User = {
513
512
  Object.keys(UserData).forEach((i) => {
514
513
  temp[i] = UserData[i];
515
514
  if (useBenchmark[i]) {
516
- temp[i] += Math.floor(temp[i] * (useBenchmark[i] - 1) * (lv - 1));
515
+ if (i == "maxExp") {
516
+ temp[i] = Math.floor(100 * useBenchmark[i] * (lv - 1)) || 100;
517
+ } else {
518
+ temp[i] += Math.floor(temp[i] * (useBenchmark[i] - 1) * (lv - 1));
519
+ }
517
520
  }
518
521
  });
519
522
  return temp;
@@ -745,16 +748,16 @@ var Monster = {
745
748
  const { name: name2, type, lv, hp, maxHp, mp, maxMp, atk, def, chr, evasion, hit, ghd, speed, info } = monster;
746
749
  const attributeText = `Lv.${lv}【${name2}】
747
750
 
748
- 怪物类型:${type}
749
- 生命值:${hp}/${maxHp}
750
- 魔法值:${mp}/${maxMp}
751
- 攻击力:${atk}
752
- 防御力:${def}
753
- 闪避值:${evasion}
754
- 命中值:${hit}
755
- 速度值:${speed}
756
- 暴击率:${(chr / 10).toFixed(1)}%
757
- 爆伤倍率:${(ghd * 100).toFixed(0)}%` + (info ? "\n\n" + info : "");
751
+ 【怪物类型】${type}
752
+ 【生命值】${hp}/${maxHp}
753
+ 【魔法值】${mp}/${maxMp}
754
+ 【攻击力】${atk}
755
+ 【防御力】${def}
756
+ 【闪避值】${evasion}
757
+ 【命中值】${hit}
758
+ 【速度值】${speed}
759
+ 【暴击率】${(chr / 10).toFixed(1)}%
760
+ 【爆伤倍率】${(ghd * 100).toFixed(0)}%` + (info ? "\n\n" + info : "");
758
761
  return attributeText;
759
762
  }
760
763
  };
@@ -807,7 +810,8 @@ var Damage = class {
807
810
  evasion(fn) {
808
811
  const { self, goal } = this.config.agent;
809
812
  if (this.config.isRealHarm) return this;
810
- const evaVal = (goal.evasion - (self.hit - 1e3)) / 10;
813
+ const lvSup = /* @__PURE__ */ __name(() => Math.floor((goal.lv - self.lv) / 5) * 20, "lvSup");
814
+ const evaVal = Math.min(95, (goal.evasion - (self.hit - 1e3) + lvSup()) / 10);
811
815
  if (random(0, 100) <= evaVal) {
812
816
  this.config.isEvasion = true;
813
817
  fn && fn(this.config);
@@ -926,7 +930,6 @@ var BattleData = {
926
930
  };
927
931
  });
928
932
  await session.send(`开始与 ${goal.map((i) => i.name).join("、")} 进行战斗`);
929
- console.log(BattleData.lastPlay[session.userId]);
930
933
  },
931
934
  /** 文本化当前战况 */
932
935
  battleSituationTextFormat(team) {
@@ -1003,29 +1006,7 @@ ${generateHealthDisplay(item.hp, item.maxHp + item.gain.maxHp)}(${item.hp}/${ite
1003
1006
  } else {
1004
1007
  selectGoal = lifeGoalList[Math.floor(Math.random() * lifeGoalList.length)];
1005
1008
  }
1006
- console.log(selectGoal);
1007
- const damageInfo = new Damage({ self: agent, goal: selectGoal }).result({
1008
- // 开始计算伤害前
1009
- before: /* @__PURE__ */ __name((val) => {
1010
- console.log(val);
1011
- }, "before"),
1012
- // 计算真实伤害前
1013
- beforRealHarm: /* @__PURE__ */ __name((val) => {
1014
- console.log(val);
1015
- }, "beforRealHarm"),
1016
- // 是否成功闪避
1017
- evasion: /* @__PURE__ */ __name((val) => {
1018
- console.log(val);
1019
- }, "evasion"),
1020
- // 是否成功暴击
1021
- csp: /* @__PURE__ */ __name((val) => {
1022
- console.log(val);
1023
- }, "csp"),
1024
- // 防御抵消前
1025
- beforDef: /* @__PURE__ */ __name((val) => {
1026
- console.log(val);
1027
- }, "beforDef")
1028
- });
1009
+ const damageInfo = new Damage({ self: agent, goal: selectGoal }).result();
1029
1010
  giveDamage(agent, selectGoal, damageInfo);
1030
1011
  msgList.push(
1031
1012
  `[${agent.type}]${agent.name} 使用普攻攻击了 [${selectGoal.type}]${selectGoal.name},造成了${damageInfo.harm}伤害。` + (damageInfo.isCsp ? `(暴击!)` : "") + (damageInfo.isEvasion ? `(闪避成功!)` : "") + (damageInfo.isBadDef ? `(未破防!)` : "")
@@ -1129,9 +1110,19 @@ function apply(ctx, config) {
1129
1110
  const userData = await User.getUserAttribute(session);
1130
1111
  if (!userData) return;
1131
1112
  GensokyoMap.initUserPoistion(session, userData);
1113
+ if (BattleData.isBattle(session)) {
1114
+ await session.send("您正在战斗中,无法移动!");
1115
+ return;
1116
+ }
1132
1117
  GensokyoMap.move(session, "top" /* 上 */, async (val) => {
1133
- await session.send("移动成功...");
1134
1118
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
1119
+ if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
1120
+ if (random(0, 10) <= 2) {
1121
+ const selectMonster = val.map.monster[random(0, val.map.monster.length)];
1122
+ await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制开启战斗!`);
1123
+ await BattleData.createBattleByMonster(session, [selectMonster]);
1124
+ }
1125
+ }
1135
1126
  });
1136
1127
  });
1137
1128
  ctx.command("幻想乡/移动.下").action(async ({ session }) => {
@@ -1139,9 +1130,19 @@ function apply(ctx, config) {
1139
1130
  const userData = await User.getUserAttribute(session);
1140
1131
  if (!userData) return;
1141
1132
  GensokyoMap.initUserPoistion(session, userData);
1133
+ if (BattleData.isBattle(session)) {
1134
+ await session.send("您正在战斗中,无法移动!");
1135
+ return;
1136
+ }
1142
1137
  GensokyoMap.move(session, "down" /* 下 */, async (val) => {
1143
- await session.send("移动成功...");
1144
1138
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
1139
+ if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
1140
+ if (random(0, 10) <= 2) {
1141
+ const selectMonster = val.map.monster[random(0, val.map.monster.length)];
1142
+ await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
1143
+ await BattleData.createBattleByMonster(session, [selectMonster]);
1144
+ }
1145
+ }
1145
1146
  });
1146
1147
  });
1147
1148
  ctx.command("幻想乡/移动.左").action(async ({ session }) => {
@@ -1149,9 +1150,19 @@ function apply(ctx, config) {
1149
1150
  const userData = await User.getUserAttribute(session);
1150
1151
  if (!userData) return;
1151
1152
  GensokyoMap.initUserPoistion(session, userData);
1153
+ if (BattleData.isBattle(session)) {
1154
+ await session.send("您正在战斗中,无法移动!");
1155
+ return;
1156
+ }
1152
1157
  GensokyoMap.move(session, "left" /* 左 */, async (val) => {
1153
- await session.send("移动成功...");
1154
1158
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
1159
+ if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
1160
+ if (random(0, 10) <= 2) {
1161
+ const selectMonster = val.map.monster[random(0, val.map.monster.length)];
1162
+ await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
1163
+ await BattleData.createBattleByMonster(session, [selectMonster]);
1164
+ }
1165
+ }
1155
1166
  });
1156
1167
  });
1157
1168
  ctx.command("幻想乡/移动.右").action(async ({ session }) => {
@@ -1159,9 +1170,19 @@ function apply(ctx, config) {
1159
1170
  const userData = await User.getUserAttribute(session);
1160
1171
  if (!userData) return;
1161
1172
  GensokyoMap.initUserPoistion(session, userData);
1173
+ if (BattleData.isBattle(session)) {
1174
+ await session.send("您正在战斗中,无法移动!");
1175
+ return;
1176
+ }
1162
1177
  GensokyoMap.move(session, "right" /* 右 */, async (val) => {
1163
- await session.send("移动成功...");
1164
1178
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
1179
+ if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
1180
+ if (random(0, 10) <= 2) {
1181
+ const selectMonster = val.map.monster[random(0, val.map.monster.length)];
1182
+ await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
1183
+ await BattleData.createBattleByMonster(session, [selectMonster]);
1184
+ }
1185
+ }
1165
1186
  });
1166
1187
  });
1167
1188
  ctx.command("幻想乡/位置").action(async ({ session }) => {
package/lib/map.d.ts CHANGED
@@ -2,7 +2,7 @@ import { Context, Session } from "koishi";
2
2
  import { Config } from ".";
3
3
  import { UserBaseAttribute } from "./users";
4
4
  /** 区域类型枚举 */
5
- declare enum AreaType {
5
+ export declare enum AreaType {
6
6
  安全区 = "\u5B89\u5168\u533A",
7
7
  冒险区 = "\u5192\u9669\u533A",
8
8
  商店 = "\u5546\u5E97",
package/lib/users.d.ts CHANGED
@@ -51,6 +51,30 @@ export type UserBaseAttribute = {
51
51
  /** 出手速度 */
52
52
  speed: number;
53
53
  };
54
+ export type UserBenchmark = {
55
+ [keys: number]: {
56
+ /** 最大经验 */
57
+ maxExp: number;
58
+ /** 最大血量 */
59
+ maxHp: number;
60
+ /** 最大蓝量 */
61
+ maxMp: number;
62
+ /** 攻击力 */
63
+ atk: number;
64
+ /** 防御力 */
65
+ def: number;
66
+ /** 暴击率 */
67
+ chr: number;
68
+ /** 暴击伤害 */
69
+ ghd: number;
70
+ /** 闪避值 */
71
+ evasion: number;
72
+ /** 命中值 */
73
+ hit: number;
74
+ /** 出手速度 */
75
+ speed: number;
76
+ };
77
+ };
54
78
  export type DatabaseUserAttribute = {
55
79
  /** 凭据ID */
56
80
  userId: string;
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-smmcat-gensokyo",
3
3
  "description": "名为《幻想乡》的文字冒险游戏",
4
- "version": "0.0.1",
4
+ "version": "0.0.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [