koishi-plugin-smmcat-gensokyo 0.0.16 → 0.0.17
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/initProps.d.ts +1 -0
- package/lib/index.js +80 -10
- package/lib/props.d.ts +1 -0
- package/lib/users.d.ts +3 -1
- package/package.json +1 -1
package/lib/data/initProps.d.ts
CHANGED
package/lib/index.js
CHANGED
|
@@ -202,7 +202,8 @@ var GensokyoMap = {
|
|
|
202
202
|
type: "冒险区" /* 冒险区 */,
|
|
203
203
|
needLv: 1,
|
|
204
204
|
top: "绿野平原一",
|
|
205
|
-
down: "野猪巢穴"
|
|
205
|
+
down: "野猪巢穴",
|
|
206
|
+
monster: [{ name: "琪露诺", lv: 10 }]
|
|
206
207
|
},
|
|
207
208
|
"绿野平原六": {
|
|
208
209
|
floor: 1,
|
|
@@ -492,6 +493,23 @@ var propsData = {
|
|
|
492
493
|
await session.send(msg);
|
|
493
494
|
});
|
|
494
495
|
}, "fn")
|
|
496
|
+
},
|
|
497
|
+
"初级复活卷轴": {
|
|
498
|
+
name: "初级复活卷轴",
|
|
499
|
+
type: "消耗类" /* 消耗类 */,
|
|
500
|
+
info: "复活玩家,复活时保留 20% 血量。(该道具使用完需要冷却 6 分钟)",
|
|
501
|
+
price: 10,
|
|
502
|
+
cooling: 3600,
|
|
503
|
+
fn: /* @__PURE__ */ __name(function(session) {
|
|
504
|
+
if (!User.isDie(session.userId)) {
|
|
505
|
+
session.send(`啊哈...你还没有阵亡,使用失败!`);
|
|
506
|
+
return;
|
|
507
|
+
}
|
|
508
|
+
const { maxHp } = User.getUserAttributeByUserId(session.userId);
|
|
509
|
+
User.giveLife(session.userId, Math.floor(maxHp * 0.2), async (val) => {
|
|
510
|
+
await session.send(`复活成功,当前血量:${val.currentHP}`);
|
|
511
|
+
});
|
|
512
|
+
}, "fn")
|
|
495
513
|
}
|
|
496
514
|
};
|
|
497
515
|
|
|
@@ -549,22 +567,39 @@ var Props = {
|
|
|
549
567
|
await Props.ctx.database.set("smm_gensokyo_user_props", { userId }, temp);
|
|
550
568
|
}
|
|
551
569
|
},
|
|
570
|
+
/** 使用指定道具 */
|
|
552
571
|
async userProps(session, propsName) {
|
|
553
|
-
const
|
|
572
|
+
const userId = session.userId;
|
|
573
|
+
const userPropsData = Props.userPorpsTemp[userId];
|
|
554
574
|
if (!userPropsData) return;
|
|
555
575
|
if (!userPropsData[propsName]) {
|
|
556
576
|
await session.send(`您似乎没有${propsName}这个道具...`);
|
|
557
577
|
return;
|
|
558
578
|
}
|
|
559
|
-
|
|
579
|
+
if (propsData[propsName].cooling) {
|
|
580
|
+
if (!coolingTemp[userId]) coolingTemp[userId] = {};
|
|
581
|
+
if (!coolingTemp[userId][propsName]) coolingTemp[userId][propsName] = 0;
|
|
582
|
+
const gapTime = Date.now() - coolingTemp[userId][propsName];
|
|
583
|
+
if (gapTime < propsData[propsName].cooling) {
|
|
584
|
+
await session.send(`该道具冷却还未结束,请等待${Math.ceil((coolingTemp[userId][propsName] - gapTime) / 60)}秒!`);
|
|
585
|
+
return;
|
|
586
|
+
} else {
|
|
587
|
+
coolingTemp[userId][propsName] = Date.now();
|
|
588
|
+
}
|
|
589
|
+
}
|
|
590
|
+
User.loseProps(userId, { name: propsName, val: 1 }, async (val) => {
|
|
560
591
|
if (val.err) {
|
|
561
592
|
await session.send(val.err);
|
|
562
593
|
return;
|
|
563
594
|
}
|
|
595
|
+
if (propsData[propsName].cooling) {
|
|
596
|
+
coolingTemp[userId];
|
|
597
|
+
}
|
|
564
598
|
propsData[propsName].fn(session);
|
|
565
599
|
});
|
|
566
600
|
}
|
|
567
601
|
};
|
|
602
|
+
var coolingTemp = {};
|
|
568
603
|
|
|
569
604
|
// src/monster.ts
|
|
570
605
|
var import_koishi = require("koishi");
|
|
@@ -585,7 +620,7 @@ var monsterData = {
|
|
|
585
620
|
chr: 50,
|
|
586
621
|
csr: 0,
|
|
587
622
|
evasion: 100,
|
|
588
|
-
hit:
|
|
623
|
+
hit: 0,
|
|
589
624
|
ghd: 1.2,
|
|
590
625
|
speed: 4,
|
|
591
626
|
giveExp: 10,
|
|
@@ -608,7 +643,7 @@ var monsterData = {
|
|
|
608
643
|
chr: 50,
|
|
609
644
|
csr: 0,
|
|
610
645
|
evasion: 150,
|
|
611
|
-
hit:
|
|
646
|
+
hit: 0,
|
|
612
647
|
ghd: 1.2,
|
|
613
648
|
speed: 4,
|
|
614
649
|
giveExp: 12,
|
|
@@ -631,7 +666,7 @@ var monsterData = {
|
|
|
631
666
|
chr: 200,
|
|
632
667
|
csr: 0,
|
|
633
668
|
evasion: 200,
|
|
634
|
-
hit:
|
|
669
|
+
hit: 0,
|
|
635
670
|
ghd: 1.2,
|
|
636
671
|
speed: 4,
|
|
637
672
|
giveExp: 15,
|
|
@@ -640,6 +675,29 @@ var monsterData = {
|
|
|
640
675
|
{ name: "蓝药", val: 3, radomVal: 30 },
|
|
641
676
|
{ name: "初级万能药", val: 2, radomVal: 90, const: true, lv: 5 }
|
|
642
677
|
]
|
|
678
|
+
},
|
|
679
|
+
"琪露诺": {
|
|
680
|
+
name: "琪露诺",
|
|
681
|
+
type: "野怪" /* 野怪 */,
|
|
682
|
+
info: "常常被称呼笨蛋的冰之妖精,有时也被叫⑨",
|
|
683
|
+
pic: "http://smmcat.cn/run/gensokyo/琪露诺.png",
|
|
684
|
+
hp: 100,
|
|
685
|
+
maxHp: 100,
|
|
686
|
+
mp: 40,
|
|
687
|
+
maxMp: 40,
|
|
688
|
+
atk: 22,
|
|
689
|
+
def: 5,
|
|
690
|
+
chr: 100,
|
|
691
|
+
csr: 0,
|
|
692
|
+
evasion: 100,
|
|
693
|
+
hit: -800,
|
|
694
|
+
ghd: 1.2,
|
|
695
|
+
speed: 4,
|
|
696
|
+
giveExp: 15,
|
|
697
|
+
giveMonetary: 3,
|
|
698
|
+
giveProps: [
|
|
699
|
+
{ name: "初级复活卷轴", val: 1, radomVal: 50 }
|
|
700
|
+
]
|
|
643
701
|
}
|
|
644
702
|
};
|
|
645
703
|
|
|
@@ -700,7 +758,18 @@ var Monster = {
|
|
|
700
758
|
Object.keys(monster).forEach((i) => {
|
|
701
759
|
temp[i] = monster[i];
|
|
702
760
|
if (useBenchmark[i]) {
|
|
703
|
-
|
|
761
|
+
const upVal = Math.floor(temp[i] * (useBenchmark[i] - 1) * (lv - 1));
|
|
762
|
+
if (upVal > 0) {
|
|
763
|
+
temp[i] += upVal;
|
|
764
|
+
} else {
|
|
765
|
+
switch (i) {
|
|
766
|
+
case "hit":
|
|
767
|
+
temp[i] += 20 * (lv - 1);
|
|
768
|
+
break;
|
|
769
|
+
default:
|
|
770
|
+
break;
|
|
771
|
+
}
|
|
772
|
+
}
|
|
704
773
|
}
|
|
705
774
|
});
|
|
706
775
|
return temp;
|
|
@@ -717,8 +786,8 @@ var Monster = {
|
|
|
717
786
|
【攻击力】${atk}
|
|
718
787
|
【防御力】${def}
|
|
719
788
|
【闪避值】${evasion}
|
|
720
|
-
【命中值】${hit}
|
|
721
789
|
【速度值】${speed}
|
|
790
|
+
【命中率】${(hit / 10 + 100).toFixed(1)}%
|
|
722
791
|
【暴击率】${(chr / 10).toFixed(1)}%
|
|
723
792
|
【爆伤倍率】${(ghd * 100).toFixed(0)}%` + (propsList?.length ? `
|
|
724
793
|
【概率掉落道具】` + propsList.join("、") : "") + (info ? "\n\n" + info : "");
|
|
@@ -1335,7 +1404,7 @@ MP:${item.mp}/${item.maxMp + item.gain.maxMp}`);
|
|
|
1335
1404
|
props.length && await User.giveProps(agent.userId, props, async (val2) => {
|
|
1336
1405
|
const propsDict = {};
|
|
1337
1406
|
val2.currentProps.forEach((item) => {
|
|
1338
|
-
if (!propsDict[item.name]) propsDict[item.name] =
|
|
1407
|
+
if (!propsDict[item.name]) propsDict[item.name] = 0;
|
|
1339
1408
|
propsDict[item.name]++;
|
|
1340
1409
|
});
|
|
1341
1410
|
const msg2 = Object.keys(propsDict).map((item) => {
|
|
@@ -1692,7 +1761,7 @@ ${Object.keys(UserOccDict).map((i) => `【${i}】:${UserOccDict[i].info}`).join(
|
|
|
1692
1761
|
await User.setDatabaseUserAttribute(userId);
|
|
1693
1762
|
},
|
|
1694
1763
|
/** 给予玩家复活 */
|
|
1695
|
-
async giveLife(userId, val) {
|
|
1764
|
+
async giveLife(userId, val, fn) {
|
|
1696
1765
|
const userInfo = User.userTempData[userId];
|
|
1697
1766
|
if (!val) {
|
|
1698
1767
|
const { maxHp } = User.getUserAttributeByUserId(userId);
|
|
@@ -1701,6 +1770,7 @@ ${Object.keys(UserOccDict).map((i) => `【${i}】:${UserOccDict[i].info}`).join(
|
|
|
1701
1770
|
userInfo.hp = val;
|
|
1702
1771
|
}
|
|
1703
1772
|
await User.setDatabaseUserAttribute(userId);
|
|
1773
|
+
fn && await fn({ currentHP: userInfo.hp });
|
|
1704
1774
|
},
|
|
1705
1775
|
/** 给予玩家血量或者蓝量 */
|
|
1706
1776
|
async giveHPMP(userId, value, fn) {
|
package/lib/props.d.ts
CHANGED
package/lib/users.d.ts
CHANGED
|
@@ -105,7 +105,9 @@ export declare const User: {
|
|
|
105
105
|
/** 给予玩家死亡 */
|
|
106
106
|
giveDie(userId: string): Promise<void>;
|
|
107
107
|
/** 给予玩家复活 */
|
|
108
|
-
giveLife(userId: string, val?: number
|
|
108
|
+
giveLife(userId: string, val?: number, fn?: (updata: {
|
|
109
|
+
currentHP: number;
|
|
110
|
+
}) => Promise<void>): Promise<void>;
|
|
109
111
|
/** 给予玩家血量或者蓝量 */
|
|
110
112
|
giveHPMP(userId: string, value: {
|
|
111
113
|
hp?: number;
|