koishi-plugin-smmcat-gensokyo 0.0.24 → 0.0.25

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.
Files changed (2) hide show
  1. package/lib/index.js +73 -5
  2. package/package.json +1 -1
package/lib/index.js CHANGED
@@ -2448,14 +2448,27 @@ function apply(ctx, config) {
2448
2448
  await session.send("您正在战斗中,无法移动!");
2449
2449
  return;
2450
2450
  }
2451
+ if (BattleData.isTeam(session) && BattleData.teamTemp[session.userId].identity !== "队长") {
2452
+ return `你在队伍中,请等待队长选择移动的位置!`;
2453
+ }
2451
2454
  if (User.isDie(session.userId)) {
2452
2455
  return `你已经阵亡,请发送 /补给 进行治疗。`;
2453
2456
  }
2454
2457
  GensokyoMap.move(session, "top" /* 上 */, async (val) => {
2458
+ if (BattleData.isTeam(session)) {
2459
+ const { userId } = session;
2460
+ Object.keys(BattleData.teamTemp).forEach((_userId) => {
2461
+ if (BattleData.teamTemp[userId].for == userId && userId !== _userId) {
2462
+ GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2463
+ GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2464
+ GensokyoMap.userCurrentLoal[_userId].moveing = false;
2465
+ }
2466
+ });
2467
+ }
2455
2468
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
2456
2469
  if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
2457
2470
  if (random(0, 10) <= 2) {
2458
- const selectMonster = val.map.monster[random(0, val.map.monster.length)];
2471
+ const selectMonster = val.map.monster[random(0, val.map.monster.length - 1)];
2459
2472
  await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制开启战斗!`);
2460
2473
  await BattleData.createBattleByMonster(session, [selectMonster]);
2461
2474
  }
@@ -2471,14 +2484,27 @@ function apply(ctx, config) {
2471
2484
  await session.send("您正在战斗中,无法移动!");
2472
2485
  return;
2473
2486
  }
2487
+ if (BattleData.isTeam(session) && BattleData.teamTemp[session.userId].identity !== "队长") {
2488
+ return `你在队伍中,请等待队长选择移动的位置!`;
2489
+ }
2474
2490
  if (User.isDie(session.userId)) {
2475
2491
  return `你已经阵亡,请发送 /补给 进行治疗。`;
2476
2492
  }
2477
2493
  GensokyoMap.move(session, "down" /* 下 */, async (val) => {
2494
+ if (BattleData.isTeam(session)) {
2495
+ const { userId } = session;
2496
+ Object.keys(BattleData.teamTemp).forEach((_userId) => {
2497
+ if (BattleData.teamTemp[userId].for == userId && userId !== _userId) {
2498
+ GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2499
+ GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2500
+ GensokyoMap.userCurrentLoal[_userId].moveing = false;
2501
+ }
2502
+ });
2503
+ }
2478
2504
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
2479
2505
  if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
2480
2506
  if (random(0, 10) <= 2) {
2481
- const selectMonster = val.map.monster[random(0, val.map.monster.length)];
2507
+ const selectMonster = val.map.monster[random(0, val.map.monster.length - 1)];
2482
2508
  await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
2483
2509
  await BattleData.createBattleByMonster(session, [selectMonster]);
2484
2510
  }
@@ -2494,14 +2520,27 @@ function apply(ctx, config) {
2494
2520
  await session.send("您正在战斗中,无法移动!");
2495
2521
  return;
2496
2522
  }
2523
+ if (BattleData.isTeam(session) && BattleData.teamTemp[session.userId].identity !== "队长") {
2524
+ return `你在队伍中,请等待队长选择移动的位置!`;
2525
+ }
2497
2526
  if (User.isDie(session.userId)) {
2498
2527
  return `你已经阵亡,请发送 /补给 进行治疗。`;
2499
2528
  }
2500
2529
  GensokyoMap.move(session, "left" /* 左 */, async (val) => {
2530
+ if (BattleData.isTeam(session)) {
2531
+ const { userId } = session;
2532
+ Object.keys(BattleData.teamTemp).forEach((_userId) => {
2533
+ if (BattleData.teamTemp[userId].for == userId && userId !== _userId) {
2534
+ GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2535
+ GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2536
+ GensokyoMap.userCurrentLoal[_userId].moveing = false;
2537
+ }
2538
+ });
2539
+ }
2501
2540
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
2502
2541
  if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
2503
2542
  if (random(0, 10) <= 2) {
2504
- const selectMonster = val.map.monster[random(0, val.map.monster.length)];
2543
+ const selectMonster = val.map.monster[random(0, val.map.monster.length - 1)];
2505
2544
  await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
2506
2545
  await BattleData.createBattleByMonster(session, [selectMonster]);
2507
2546
  }
@@ -2517,14 +2556,27 @@ function apply(ctx, config) {
2517
2556
  await session.send("您正在战斗中,无法移动!");
2518
2557
  return;
2519
2558
  }
2559
+ if (BattleData.isTeam(session) && BattleData.teamTemp[session.userId].identity !== "队长") {
2560
+ return `你在队伍中,请等待队长选择移动的位置!`;
2561
+ }
2520
2562
  if (User.isDie(session.userId)) {
2521
2563
  return `你已经阵亡,请发送 /补给 进行治疗。`;
2522
2564
  }
2523
2565
  GensokyoMap.move(session, "right" /* 右 */, async (val) => {
2566
+ if (BattleData.isTeam(session)) {
2567
+ const { userId } = session;
2568
+ Object.keys(BattleData.teamTemp).forEach((_userId) => {
2569
+ if (BattleData.teamTemp[userId].for == userId && userId !== _userId) {
2570
+ GensokyoMap.userCurrentLoal[_userId].areaName = GensokyoMap.userCurrentLoal[userId].areaName;
2571
+ GensokyoMap.userCurrentLoal[_userId].floor = GensokyoMap.userCurrentLoal[userId].floor;
2572
+ GensokyoMap.userCurrentLoal[_userId].moveing = false;
2573
+ }
2574
+ });
2575
+ }
2524
2576
  await session.send(GensokyoMap.userAreaTextFormat(userData.playName, val));
2525
2577
  if (val.map.type == "冒险区" /* 冒险区 */ && val.map.monster?.length) {
2526
2578
  if (random(0, 10) <= 2) {
2527
- const selectMonster = val.map.monster[random(0, val.map.monster.length)];
2579
+ const selectMonster = val.map.monster[random(0, val.map.monster.length - 1)];
2528
2580
  await session.send(`糟糕!你被 Lv.${selectMonster.lv} ${selectMonster.name} 发现,强制发生战斗!`);
2529
2581
  await BattleData.createBattleByMonster(session, [selectMonster]);
2530
2582
  }
@@ -2671,26 +2723,42 @@ function apply(ctx, config) {
2671
2723
  });
2672
2724
  ctx.command("幻想乡/队伍操作");
2673
2725
  ctx.command("队伍操作/队伍创建").action(async ({ session }) => {
2726
+ if (BattleData.isBattle(session)) {
2727
+ return `战斗中无法进行队伍创建操作!`;
2728
+ }
2674
2729
  await BattleData.creatTeam(session);
2675
2730
  });
2676
2731
  ctx.command("队伍操作/队伍信息").action(async ({ session }) => {
2677
2732
  const team = BattleData.teamListByUser(session.userId);
2678
2733
  if (!team.length) return `你还没有队伍...`;
2679
- return team.map((item) => `lv.${item.lv} ${item.playName} [${BattleData.teamTemp[item.userId].identity}]`).join("\n");
2734
+ return `当前队伍信息如下:
2735
+ ` + team.map((item) => `lv.${item.lv} ${item.playName} [${BattleData.teamTemp[item.userId].identity}]`).join("\n");
2680
2736
  });
2681
2737
  ctx.command("队伍操作/队伍邀请 <playName>").action(async ({ session }, playName) => {
2738
+ if (BattleData.isBattle(session)) {
2739
+ return `战斗中无法进行队伍邀请操作!`;
2740
+ }
2682
2741
  if (!playName) {
2683
2742
  return `请选择需要邀请的玩家昵称。例如 /队伍邀请 夜夜酱`;
2684
2743
  }
2685
2744
  await BattleData.invitationTeam(session, playName);
2686
2745
  });
2687
2746
  ctx.command("队伍操作/队伍加入").action(async ({ session }) => {
2747
+ if (BattleData.isBattle(session)) {
2748
+ return `战斗中无法进行队伍创建操作!`;
2749
+ }
2688
2750
  await BattleData.joinTeam(session);
2689
2751
  });
2690
2752
  ctx.command("队伍操作/队伍退出").action(async ({ session }) => {
2753
+ if (BattleData.isBattle(session)) {
2754
+ return `战斗中无法进行队伍退出操作!`;
2755
+ }
2691
2756
  await BattleData.exitTeam(session);
2692
2757
  });
2693
2758
  ctx.command("队伍操作/队伍解散").action(async ({ session }) => {
2759
+ if (BattleData.isBattle(session)) {
2760
+ return `战斗中无法进行队伍解散操作!`;
2761
+ }
2694
2762
  await BattleData.dissolveTeam(session);
2695
2763
  });
2696
2764
  }
package/package.json CHANGED
@@ -1,7 +1,7 @@
1
1
  {
2
2
  "name": "koishi-plugin-smmcat-gensokyo",
3
3
  "description": "名为《幻想乡》的文字冒险游戏",
4
- "version": "0.0.24",
4
+ "version": "0.0.25",
5
5
  "main": "lib/index.js",
6
6
  "typings": "lib/index.d.ts",
7
7
  "files": [