Files
noname-shuying/mengsan/cards/wither-card.js
T
Diuse 9e1732d2f8 fixed # 补全部分卡牌
fixed # 修复部分已知BUG
2026-10-04 19:32:38 +08:00

16 lines
869 B
JavaScript

// Enemy-only growth; ordinary player upgrades never use this field.
export const WITHER_CARD="mengsan_status_wither";
export const MAX_WITHER_LEVEL=Math.floor((Number.MAX_SAFE_INTEGER-3)/3);
export function witherDamage(card) {
const data=card?.storage?.mengsanCard_shuying||card,level=data?.witherLevel??0;
if(!Number.isSafeInteger(level)||level<0||level>MAX_WITHER_LEVEL)throw new RangeError("凋萎层数无效");
return 3+3*level;
}
export function growEnemyWither(card,amount=1) {
const data=card?.storage?.mengsanCard_shuying||card;
if(data?.name!==WITHER_CARD||!Number.isSafeInteger(amount)||amount<1)throw new TypeError("凋萎增长参数无效");
const next=(witherDamage(data)-3)/3+amount;
if(!Number.isSafeInteger(next)||next>MAX_WITHER_LEVEL)throw new RangeError("凋萎层数越界");
data.witherLevel=next;return next;
}