mirror of
https://github.com/Shu-Ying/noname-shuying.git
synced 2026-10-21 23:00:06 +08:00
fixed # 补全梦三怪物、卡牌
fixed # 修复天书乱斗中,过关技能不会重置次数的问题
This commit is contained in:
@@ -0,0 +1,27 @@
|
||||
// 缩小甲虫,灰机Wiki普通数值;缩小后大啃、践踏严格交替。
|
||||
export const SHRINKER_CHARACTER = "mengsan_shrinker_beetle_shuying";
|
||||
export const SHRINKER_MOVES = Object.freeze({
|
||||
shrink: Object.freeze({ id: "shrink", name: "缩小", debuff: "缩小", stacks: 1, shrink: true }),
|
||||
chomp: Object.freeze({ id: "chomp", name: "大啃", damage: 7 }),
|
||||
stomp: Object.freeze({ id: "stomp", name: "践踏", damage: 13 }),
|
||||
});
|
||||
const turnsOf = state => {
|
||||
const turns = state.turnsTaken ?? 0;
|
||||
if (!Number.isSafeInteger(turns) || turns < 0) throw new RangeError("缩小甲虫行动记录无效");
|
||||
return turns;
|
||||
};
|
||||
export function selectShrinkerMove(state = {}) {
|
||||
const turns = turnsOf(state);
|
||||
return turns === 0 ? SHRINKER_MOVES.shrink : turns % 2 ? SHRINKER_MOVES.chomp : SHRINKER_MOVES.stomp;
|
||||
}
|
||||
export function recordShrinkerAction(state = {}, advance = true) {
|
||||
const turns = turnsOf(state);
|
||||
if (typeof advance !== "boolean" || advance && turns === Number.MAX_SAFE_INTEGER) throw new RangeError("缩小甲虫行动推进无效");
|
||||
return { turnsTaken: turns + (advance ? 1 : 0) };
|
||||
}
|
||||
export function rollShrinkerHp(random) {
|
||||
const value = random();
|
||||
if (!Number.isFinite(value) || value < 0 || value >= 1) throw new RangeError("缩小甲虫随机数必须在[0,1)内");
|
||||
return 38 + Math.floor(value * 3);
|
||||
}
|
||||
export const isShrinker = player => player?.name === SHRINKER_CHARACTER && player.storage?.mengsanCamp_shuying === "enemy";
|
||||
Reference in New Issue
Block a user