koishi-plugin-smmcat-gensokyo 0.0.2 → 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,9 +470,8 @@ var User = {
468
470
  const lv = UserData.lv;
469
471
  const benchmark = {
470
472
  10: {
471
- hp: 1.2,
473
+ maxExp: 2,
472
474
  maxHp: 1.2,
473
- mp: 1.1,
474
475
  maxMp: 1.1,
475
476
  atk: 1.12,
476
477
  def: 1.1,
@@ -481,9 +482,8 @@ var User = {
481
482
  speed: 1.05
482
483
  },
483
484
  20: {
484
- hp: 1.15,
485
+ maxExp: 1.8,
485
486
  maxHp: 1.15,
486
- mp: 1.1,
487
487
  maxMp: 1.1,
488
488
  atk: 1.1,
489
489
  def: 1.1,
@@ -494,9 +494,8 @@ var User = {
494
494
  speed: 1.05
495
495
  },
496
496
  40: {
497
- hp: 1.1,
497
+ maxExp: 1.5,
498
498
  maxHp: 1.1,
499
- mp: 1.05,
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
  };
@@ -1107,9 +1110,19 @@ function apply(ctx, config) {
1107
1110
  const userData = await User.getUserAttribute(session);
1108
1111
  if (!userData) return;
1109
1112
  GensokyoMap.initUserPoistion(session, userData);
1113
+ if (BattleData.isBattle(session)) {
1114
+ await session.send("您正在战斗中,无法移动!");
1115
+ return;
1116
+ }
1110
1117
  GensokyoMap.move(session, "top" /* 上 */, async (val) => {
1111
- await session.send("移动成功...");
1112
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
+ }
1113
1126
  });
1114
1127
  });
1115
1128
  ctx.command("幻想乡/移动.下").action(async ({ session }) => {
@@ -1117,9 +1130,19 @@ function apply(ctx, config) {
1117
1130
  const userData = await User.getUserAttribute(session);
1118
1131
  if (!userData) return;
1119
1132
  GensokyoMap.initUserPoistion(session, userData);
1133
+ if (BattleData.isBattle(session)) {
1134
+ await session.send("您正在战斗中,无法移动!");
1135
+ return;
1136
+ }
1120
1137
  GensokyoMap.move(session, "down" /* 下 */, async (val) => {
1121
- await session.send("移动成功...");
1122
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
+ }
1123
1146
  });
1124
1147
  });
1125
1148
  ctx.command("幻想乡/移动.左").action(async ({ session }) => {
@@ -1127,9 +1150,19 @@ function apply(ctx, config) {
1127
1150
  const userData = await User.getUserAttribute(session);
1128
1151
  if (!userData) return;
1129
1152
  GensokyoMap.initUserPoistion(session, userData);
1153
+ if (BattleData.isBattle(session)) {
1154
+ await session.send("您正在战斗中,无法移动!");
1155
+ return;
1156
+ }
1130
1157
  GensokyoMap.move(session, "left" /* 左 */, async (val) => {
1131
- await session.send("移动成功...");
1132
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
+ }
1133
1166
  });
1134
1167
  });
1135
1168
  ctx.command("幻想乡/移动.右").action(async ({ session }) => {
@@ -1137,9 +1170,19 @@ function apply(ctx, config) {
1137
1170
  const userData = await User.getUserAttribute(session);
1138
1171
  if (!userData) return;
1139
1172
  GensokyoMap.initUserPoistion(session, userData);
1173
+ if (BattleData.isBattle(session)) {
1174
+ await session.send("您正在战斗中,无法移动!");
1175
+ return;
1176
+ }
1140
1177
  GensokyoMap.move(session, "right" /* 右 */, async (val) => {
1141
- await session.send("移动成功...");
1142
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
+ }
1143
1186
  });
1144
1187
  });
1145
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.2",
4
+ "version": "0.0.3",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [