feat # 继续补全遗物系统

This commit is contained in:
2026-10-08 23:46:57 +08:00
parent 623f53a1d2
commit 1c93c77f4f
335 changed files with 11528 additions and 1797 deletions
+2
View File
@@ -1,6 +1,7 @@
import { cardDefinitions, canAcquireCard } from "./card-definitions.js";
import { cardUpgradeRule } from "./upgrades.js";
import { WITHER_CARD, MAX_WITHER_LEVEL } from "./wither-card.js";
import { afterRelicDeckAdd } from "../relics/hooks.js";
const suits = ["spade", "heart", "club", "diamond"];
@@ -51,5 +52,6 @@ export function addCardToDeck(run, spec) {
if (!Array.isArray(run?.player?.deck)) throw new Error("梦三牌组无效");
if (run.player.deck.some(existing => existing.id === card.id)) throw new Error(`梦三牌 ID 重复:${card.id}`);
run.player.deck.push(card);
afterRelicDeckAdd(run, card);
return card;
}
+2 -1
View File
@@ -1,5 +1,6 @@
// 轻量桥接模块:不导入牌注册表或引擎,避免费用/牌堆/运行时循环依赖。
import { sharedStrengthPenalty } from "./shared-hooks.js";
import { flushRelicExhaust } from "../relics/hooks.js";
const bindings = new WeakMap(), owners = new Map();
export function bindIroncladHooks(player, session, hooks) {
const entry = {player,session,hooks};
@@ -26,7 +27,7 @@ export const ironcladCost = (player,card,cost) => ironcladHooks(player)?.cost(ca
export const ironcladCardIsFree = (player,card) => Boolean(ironcladHooks(player)?.isFree(card));
export const ironcladStrengthPenalty = player => (ironcladHooks(player)?.strengthPenalty() || 0) + sharedStrengthPenalty(player);
export const queueIroncladExhaust = (player,card) => ironcladHooks(player)?.queueExhaust(card);
export const flushIroncladExhaust = async player => { await ironcladHooks(player)?.flushExhaust(); };
export const flushIroncladExhaust = async player => { await ironcladHooks(player)?.flushExhaust(); await flushRelicExhaust(player); };
export const afterIroncladDraw = async (player,cards) => { await ironcladHooks(player)?.afterDraw(cards); };
export const afterIroncladVulnerable = (source,target) => ironcladHooks(source)?.queueVulnerable(target);
export const beforeIroncladBlock = (player,num,event) => ironcladHooks(player)?.blockAmount(num,event) ?? num;
+3 -1
View File
@@ -12,6 +12,7 @@ import { isAttackCard } from "../../../monsters/vine-tangled.js";
import { applyMengsanDebuff, consumeArtifact } from "../../../monsters/artifact-status.js";
import { isStunned } from "../../../battle/stun-intent.js";
import { canPayCard, isActiveCardUse, authorizeFreeCardUse, takeXCardUse, cardCost } from "../../../battle/combat-rules.js";
import { grantGold } from "../../../relics/progression.js";
const BRIDGE="mengsan_shared_bridge_shuying", RULES="mengsan_shared_rules_shuying", END="mengsan_shared_end_shuying", LIMIT="mengsan_shared_limit_shuying", AFTER="mengsan_shared_after_shuying";
const safe=n=>Number.isSafeInteger(n) && n>=0;
@@ -586,7 +587,8 @@ export function createSharedCardRuntime({game,get,lib,status,getBattle,battleEne
seen.add(e);const entry=kills.get(e);if(!entry||entry.claimed||entry.target!==event.player)continue;
entry.claimed=true;const {s,gold}=entry;
if(valid(s.player,s.token)&&s.player===game.me&&entry.target.isDead()){
const run=s.token.run;add(run.player,"gold",gold);add(run.statistics,"goldEarned",gold);
const run=s.token.run,before=run.player.maxHp;grantGold(run,gold);
if(run.player.maxHp>before)await s.player.gainMaxHp(run.player.maxHp-before);
}break;
}
},
+3 -1
View File
@@ -6,6 +6,7 @@ import { cardDefinitions } from "./card-definitions.js";
import { hasCardAffix } from "./intrinsic-affixes.js";
import { sharedHooks } from "./shared-hooks.js";
import { queueIroncladExhaust, flushIroncladExhaust, ironcladSkillExhausts, ironcladHooks } from "./ironclad-hooks.js";
import { queueRelicExhaust, queueRelicShuffle } from "../relics/hooks.js";
export function installPersonalPiles(session, owner, battle, run, resources, env) {
@@ -25,7 +26,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
if (card.storage?.mengsanExhausted_shuying) return false;
card.storage.mengsanExhausted_shuying = true;
battle.exhaustPile.push(snapshot(card)); exhaustTotal++;
queueIroncladExhaust(owner, card); refresh(); return true;
queueIroncladExhaust(owner, card); queueRelicExhaust(owner, card); refresh(); return true;
}
const personal = () => {
if (released || forcedPublic) return false;
@@ -125,6 +126,7 @@ export function installPersonalPiles(session, owner, battle, run, resources, env
const cards = [...draw.childNodes, ...discard.childNodes];
if (!cards.length) return false;
shuffle(run, cards);
queueRelicShuffle(owner);
for (const card of cards) { card.fix?.(); draw.appendChild(card); }
refresh();
return true;