koishi-plugin-smmcat-gensokyo 0.0.10 → 0.0.12
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/data/initMonster.d.ts +3 -0
- package/lib/index.js +52 -41
- package/lib/monster.d.ts +2 -0
- package/package.json +1 -1
|
@@ -7,6 +7,7 @@ export declare const monsterData: {
|
|
|
7
7
|
name: string;
|
|
8
8
|
type: MonsterOccupation;
|
|
9
9
|
info: string;
|
|
10
|
+
pic: string;
|
|
10
11
|
hp: number;
|
|
11
12
|
maxHp: number;
|
|
12
13
|
mp: number;
|
|
@@ -24,6 +25,7 @@ export declare const monsterData: {
|
|
|
24
25
|
name: string;
|
|
25
26
|
type: MonsterOccupation;
|
|
26
27
|
info: string;
|
|
28
|
+
pic: string;
|
|
27
29
|
hp: number;
|
|
28
30
|
maxHp: number;
|
|
29
31
|
mp: number;
|
|
@@ -41,6 +43,7 @@ export declare const monsterData: {
|
|
|
41
43
|
name: string;
|
|
42
44
|
type: MonsterOccupation;
|
|
43
45
|
info: string;
|
|
46
|
+
pic: string;
|
|
44
47
|
hp: number;
|
|
45
48
|
maxHp: number;
|
|
46
49
|
mp: number;
|
package/lib/index.js
CHANGED
|
@@ -26,7 +26,7 @@ __export(src_exports, {
|
|
|
26
26
|
name: () => name
|
|
27
27
|
});
|
|
28
28
|
module.exports = __toCommonJS(src_exports);
|
|
29
|
-
var
|
|
29
|
+
var import_koishi2 = require("koishi");
|
|
30
30
|
|
|
31
31
|
// src/map.ts
|
|
32
32
|
var delay = /* @__PURE__ */ __name((ms) => new Promise((resolve) => setTimeout(resolve, ms)), "delay");
|
|
@@ -483,6 +483,7 @@ var User = {
|
|
|
483
483
|
...UserOccDict[UserDict.type].initStatus,
|
|
484
484
|
lv: UserDict.lv,
|
|
485
485
|
hp: UserDict.hp,
|
|
486
|
+
mp: UserDict.mp,
|
|
486
487
|
exp: UserDict.exp,
|
|
487
488
|
pp: UserDict.pp,
|
|
488
489
|
playName: UserDict.playName,
|
|
@@ -496,9 +497,9 @@ var User = {
|
|
|
496
497
|
maxMp: 1.1,
|
|
497
498
|
atk: 1.12,
|
|
498
499
|
def: 1.1,
|
|
499
|
-
chr: 1.
|
|
500
|
-
evasion: 1.
|
|
501
|
-
hit: 1.
|
|
500
|
+
chr: 1.08,
|
|
501
|
+
evasion: 1.08,
|
|
502
|
+
hit: 1.08,
|
|
502
503
|
ghd: 1,
|
|
503
504
|
speed: 1.05
|
|
504
505
|
},
|
|
@@ -508,9 +509,9 @@ var User = {
|
|
|
508
509
|
maxMp: 1.1,
|
|
509
510
|
atk: 1.1,
|
|
510
511
|
def: 1.1,
|
|
511
|
-
chr: 1.
|
|
512
|
-
evasion: 1.
|
|
513
|
-
hit: 1.
|
|
512
|
+
chr: 1.04,
|
|
513
|
+
evasion: 1.04,
|
|
514
|
+
hit: 1.04,
|
|
514
515
|
ghd: 1,
|
|
515
516
|
speed: 1.05
|
|
516
517
|
},
|
|
@@ -520,9 +521,9 @@ var User = {
|
|
|
520
521
|
maxMp: 1.05,
|
|
521
522
|
atk: 1.1,
|
|
522
523
|
def: 1.05,
|
|
523
|
-
chr: 1.
|
|
524
|
-
evasion: 1.
|
|
525
|
-
hit: 1.
|
|
524
|
+
chr: 1.03,
|
|
525
|
+
evasion: 1.03,
|
|
526
|
+
hit: 1.03,
|
|
526
527
|
ghd: 1.05,
|
|
527
528
|
speed: 1.05
|
|
528
529
|
}
|
|
@@ -657,12 +658,16 @@ ${Object.keys(UserOccDict).map((i) => `【${i}】:${UserOccDict[i].info}`).join(
|
|
|
657
658
|
}
|
|
658
659
|
};
|
|
659
660
|
|
|
661
|
+
// src/monster.ts
|
|
662
|
+
var import_koishi = require("koishi");
|
|
663
|
+
|
|
660
664
|
// src/data/initMonster.ts
|
|
661
665
|
var monsterData = {
|
|
662
666
|
"小蜜蜂": {
|
|
663
667
|
name: "小蜜蜂",
|
|
664
668
|
type: "野怪" /* 野怪 */,
|
|
665
669
|
info: "幻想乡一层常见的生物",
|
|
670
|
+
pic: "http://smmcat.cn/run/gensokyo/小蜜蜂.png",
|
|
666
671
|
hp: 50,
|
|
667
672
|
maxHp: 50,
|
|
668
673
|
mp: 30,
|
|
@@ -680,6 +685,7 @@ var monsterData = {
|
|
|
680
685
|
name: "小蜘蛛",
|
|
681
686
|
type: "野怪" /* 野怪 */,
|
|
682
687
|
info: "幻想乡一层常见的生物",
|
|
688
|
+
pic: "http://smmcat.cn/run/gensokyo/小蜘蛛.png",
|
|
683
689
|
hp: 55,
|
|
684
690
|
maxHp: 55,
|
|
685
691
|
mp: 30,
|
|
@@ -687,7 +693,7 @@ var monsterData = {
|
|
|
687
693
|
atk: 10,
|
|
688
694
|
def: 3,
|
|
689
695
|
chr: 50,
|
|
690
|
-
evasion:
|
|
696
|
+
evasion: 150,
|
|
691
697
|
hit: 1e3,
|
|
692
698
|
ghd: 1.2,
|
|
693
699
|
speed: 4,
|
|
@@ -697,6 +703,7 @@ var monsterData = {
|
|
|
697
703
|
name: "dora",
|
|
698
704
|
type: "野怪" /* 野怪 */,
|
|
699
705
|
info: "偶尔出没在一层世界的奇怪生物",
|
|
706
|
+
pic: "http://smmcat.cn/run/gensokyo/dora.png",
|
|
700
707
|
hp: 88,
|
|
701
708
|
maxHp: 88,
|
|
702
709
|
mp: 10,
|
|
@@ -704,7 +711,7 @@ var monsterData = {
|
|
|
704
711
|
atk: 20,
|
|
705
712
|
def: 5,
|
|
706
713
|
chr: 200,
|
|
707
|
-
evasion:
|
|
714
|
+
evasion: 200,
|
|
708
715
|
hit: 1e3,
|
|
709
716
|
ghd: 1.2,
|
|
710
717
|
speed: 4,
|
|
@@ -771,8 +778,8 @@ var Monster = {
|
|
|
771
778
|
atk: 1.2,
|
|
772
779
|
def: 1.1,
|
|
773
780
|
chr: 1.1,
|
|
774
|
-
evasion: 1.
|
|
775
|
-
hit: 1.
|
|
781
|
+
evasion: 1.1,
|
|
782
|
+
hit: 1.1,
|
|
776
783
|
ghd: 1,
|
|
777
784
|
speed: 1.05
|
|
778
785
|
},
|
|
@@ -783,9 +790,9 @@ var Monster = {
|
|
|
783
790
|
maxMp: 1.1,
|
|
784
791
|
atk: 1.1,
|
|
785
792
|
def: 1.1,
|
|
786
|
-
chr: 1.
|
|
787
|
-
evasion: 1.
|
|
788
|
-
hit: 1.
|
|
793
|
+
chr: 1.08,
|
|
794
|
+
evasion: 1.08,
|
|
795
|
+
hit: 1.08,
|
|
789
796
|
ghd: 1,
|
|
790
797
|
speed: 1.05
|
|
791
798
|
},
|
|
@@ -817,8 +824,8 @@ var Monster = {
|
|
|
817
824
|
},
|
|
818
825
|
/** 格式化怪物属性数据 */
|
|
819
826
|
monsterAttributeTextFormat(monster) {
|
|
820
|
-
const { name: name2, type, lv, hp, maxHp, mp, maxMp, atk, def, chr, evasion, hit, ghd, speed, info } = monster;
|
|
821
|
-
const attributeText = `Lv.${lv}【${name2}】
|
|
827
|
+
const { name: name2, type, lv, hp, maxHp, mp, maxMp, atk, def, chr, evasion, hit, ghd, speed, info, pic } = monster;
|
|
828
|
+
const attributeText = (pic ? import_koishi.h.image(pic) + "\n" : "") + `Lv.${lv}【${name2}】
|
|
822
829
|
|
|
823
830
|
【怪物类型】${type}
|
|
824
831
|
【生命值】${hp}/${maxHp}
|
|
@@ -1262,17 +1269,13 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
|
|
|
1262
1269
|
},
|
|
1263
1270
|
/** 清理战场 */
|
|
1264
1271
|
clearBattleData(session) {
|
|
1265
|
-
|
|
1266
|
-
|
|
1267
|
-
|
|
1268
|
-
|
|
1269
|
-
|
|
1270
|
-
|
|
1271
|
-
|
|
1272
|
-
});
|
|
1273
|
-
} else {
|
|
1274
|
-
delete BattleData.lastPlay[session.userId];
|
|
1275
|
-
}
|
|
1272
|
+
const currentBattle = BattleData.lastPlay[session.userId];
|
|
1273
|
+
const allAgentList = [...currentBattle.goal, ...currentBattle.self];
|
|
1274
|
+
allAgentList.forEach((item) => {
|
|
1275
|
+
if (item.type == "玩家") {
|
|
1276
|
+
delete BattleData.lastPlay[item.userId];
|
|
1277
|
+
}
|
|
1278
|
+
});
|
|
1276
1279
|
},
|
|
1277
1280
|
async play(session, atkType, select) {
|
|
1278
1281
|
if (!BattleData.isBattle(session)) {
|
|
@@ -1371,6 +1374,7 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
|
|
|
1371
1374
|
},
|
|
1372
1375
|
/** 结算奖励 */
|
|
1373
1376
|
async settlement(tempData, overInfo, session) {
|
|
1377
|
+
const allList = [...tempData.self, ...tempData.goal].filter((item) => item.type == "玩家");
|
|
1374
1378
|
const selfList = tempData.self.filter((item) => item.type == "玩家");
|
|
1375
1379
|
const goalList = tempData.goal.filter((item) => item.type == "玩家");
|
|
1376
1380
|
const msg = /* @__PURE__ */ __name(async (val) => {
|
|
@@ -1388,15 +1392,19 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
|
|
|
1388
1392
|
if (tempData.isPK) {
|
|
1389
1393
|
if (overInfo.win == "self") {
|
|
1390
1394
|
await session.send("攻击方获得20EXP");
|
|
1391
|
-
for (const agent of
|
|
1395
|
+
for (const agent of allList) {
|
|
1392
1396
|
aynchronize(agent);
|
|
1393
|
-
|
|
1397
|
+
if (agent.for == "self") {
|
|
1398
|
+
await User.giveExp(agent.userId, 20, async (val) => await msg(val));
|
|
1399
|
+
}
|
|
1394
1400
|
}
|
|
1395
1401
|
} else if (overInfo.win == "goal") {
|
|
1396
1402
|
await session.send("防御方获得20EXP");
|
|
1397
|
-
for (const agent of
|
|
1403
|
+
for (const agent of allList) {
|
|
1398
1404
|
aynchronize(agent);
|
|
1399
|
-
|
|
1405
|
+
if (agent.for == "goal") {
|
|
1406
|
+
await User.giveExp(agent.userId, 20, async (val) => await msg(val));
|
|
1407
|
+
}
|
|
1400
1408
|
}
|
|
1401
1409
|
}
|
|
1402
1410
|
} else {
|
|
@@ -1405,13 +1413,15 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
|
|
|
1405
1413
|
monsterName.forEach((item) => {
|
|
1406
1414
|
const monster = Monster.monsterTempData[item.name];
|
|
1407
1415
|
if (monster) {
|
|
1408
|
-
val += monster.giveExp + monster.giveExp * (item.lv - 1) * 0.2;
|
|
1416
|
+
val += Math.floor(monster.giveExp + monster.giveExp * (item.lv - 1) * 0.2);
|
|
1409
1417
|
}
|
|
1410
1418
|
});
|
|
1411
1419
|
for (const agent of selfList) {
|
|
1412
1420
|
aynchronize(agent);
|
|
1413
|
-
|
|
1414
|
-
|
|
1421
|
+
if (overInfo.win == "self") {
|
|
1422
|
+
await session.send(`小队获得${val}EXP`);
|
|
1423
|
+
await User.giveExp(agent.userId, val, async (val2) => await msg(val2));
|
|
1424
|
+
}
|
|
1415
1425
|
}
|
|
1416
1426
|
}
|
|
1417
1427
|
}
|
|
@@ -1497,7 +1507,7 @@ var name = "smmcat-gensokyo";
|
|
|
1497
1507
|
var inject = {
|
|
1498
1508
|
required: ["monetary", "database"]
|
|
1499
1509
|
};
|
|
1500
|
-
var Config =
|
|
1510
|
+
var Config = import_koishi2.Schema.object({});
|
|
1501
1511
|
function apply(ctx, config) {
|
|
1502
1512
|
ctx.on("ready", () => {
|
|
1503
1513
|
GensokyoMap.init(config, ctx);
|
|
@@ -1622,8 +1632,7 @@ function apply(ctx, config) {
|
|
|
1622
1632
|
if (!lv) lv = 1;
|
|
1623
1633
|
const result = Monster.getMonsterAttributeData(monster, lv);
|
|
1624
1634
|
if (!result) return `没有找到该怪物信息...`;
|
|
1625
|
-
return
|
|
1626
|
-
` + Monster.monsterAttributeTextFormat(result);
|
|
1635
|
+
return Monster.monsterAttributeTextFormat(result);
|
|
1627
1636
|
});
|
|
1628
1637
|
ctx.command("幻想乡/打怪遇敌 <goal>").action(async ({ session }, goal) => {
|
|
1629
1638
|
const userData = await User.getUserAttribute(session);
|
|
@@ -1699,12 +1708,14 @@ function apply(ctx, config) {
|
|
|
1699
1708
|
}
|
|
1700
1709
|
const useTime = Date.now() - temp[session.userId];
|
|
1701
1710
|
if (useTime < 36e4) {
|
|
1702
|
-
return `请等待下一个补给时间!剩余${Math.floor(useTime / 6e4)}分钟。`;
|
|
1711
|
+
return `请等待下一个补给时间!剩余${Math.floor(36e4 - useTime / 6e4)}分钟。`;
|
|
1703
1712
|
}
|
|
1704
1713
|
temp[session.userId] = Date.now();
|
|
1705
1714
|
const { maxHp, maxMp, playName } = User.getUserAttributeByUserId(session.userId);
|
|
1715
|
+
console.log(maxMp);
|
|
1706
1716
|
User.userTempData[session.userId].hp = maxHp;
|
|
1707
1717
|
User.userTempData[session.userId].mp = maxMp;
|
|
1718
|
+
console.log(User.userTempData[session.userId]);
|
|
1708
1719
|
await User.setDatabaseUserAttribute(session.userId);
|
|
1709
1720
|
return playName + `通过补给,目前已恢复HP和MP`;
|
|
1710
1721
|
});
|
package/lib/monster.d.ts
CHANGED