koishi-plugin-smmcat-gensokyo 0.0.34 → 0.0.35
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 +8 -5
- package/package.json +1 -1
package/lib/index.js
CHANGED
|
@@ -405,13 +405,16 @@ var random = /* @__PURE__ */ __name((min, max) => {
|
|
|
405
405
|
return Math.floor(Math.random() * (max - min + 1)) + min;
|
|
406
406
|
}, "random");
|
|
407
407
|
var generateHealthDisplay = /* @__PURE__ */ __name((current, total) => {
|
|
408
|
-
const ratio = current / total;
|
|
409
408
|
const displayLength = 10;
|
|
410
|
-
const
|
|
409
|
+
const filledChar = "■";
|
|
410
|
+
const unfilledChar = "□";
|
|
411
|
+
const clampedCurrent = Math.max(0, Math.min(current, total));
|
|
412
|
+
const ratio = clampedCurrent / total;
|
|
413
|
+
const filledLength = Math.max(0, Math.min(Math.floor(ratio * displayLength), displayLength));
|
|
411
414
|
const unfilledLength = displayLength - filledLength;
|
|
412
|
-
const filled =
|
|
413
|
-
const unfilled =
|
|
414
|
-
return filled
|
|
415
|
+
const filled = filledChar.repeat(filledLength);
|
|
416
|
+
const unfilled = unfilledChar.repeat(unfilledLength);
|
|
417
|
+
return `${filled}${unfilled} (${current}/${total})`;
|
|
415
418
|
}, "generateHealthDisplay");
|
|
416
419
|
var getFreeList = /* @__PURE__ */ __name((arr) => {
|
|
417
420
|
let arrAdd = [...arr];
|