도적 불가침 기능 추가

This commit is contained in:
2026-06-21 15:28:27 +09:00
parent 34531b184f
commit 5b7f7bb69f
11 changed files with 65 additions and 10 deletions

View File

@@ -148,7 +148,7 @@ export function simulateCombat(data, rng, stats) {
const exhaust = [];
let hand = [];
let pHp = PLAYER_HP, pBlock = 0;
let pStr = 0, pDex = 0, pThorns = 0, pWeak = 0, pVuln = 0;
let pStr = 0, pDex = 0, pThorns = 0, pWeak = 0, pVuln = 0, pIntangible = 0;
let blockGainMultiplier = 1;
let handCostZeroThisTurn = false;
let drawDisabledThisTurn = false;
@@ -338,6 +338,7 @@ export function simulateCombat(data, rng, stats) {
if (c.selfVuln) pVuln += c.selfVuln;
if (c.heal) pHp = Math.min(pHp + c.heal, PLAYER_HP);
if (c.gainEnergy) energy += c.gainEnergy;
if (c.intangible) pIntangible += c.intangible;
queueNextTurnEffects(c);
let drawnCards = [];
if (c.draw) drawnCards = drawnCards.concat(draw(c.draw));
@@ -476,6 +477,14 @@ export function simulateCombat(data, rng, stats) {
else discard.push(hid);
}
hand = kept;
for (const pid of powers) {
const pc = cards[pid];
if (pc?.endTurnDexLoss) {
pDex -= pc.endTurnDexLoss;
if (pDex < 0) pDex = 0;
}
}
if (pIntangible > 0) pIntangible--;
if (pHp <= 0) return { win: false, turns, playerHpRemaining: 0 };
// 플레이어 디버프 감소 — Lua EndPlayerTurn 동기화 (적 행동 전)
if (pWeak > 0) pWeak--;
@@ -495,7 +504,9 @@ export function simulateCombat(data, rng, stats) {
if (it.kind === 'Attack') {
const atk = calcAttack(it.value, m.str, m.weak, pVuln);
const beforeHp = pHp;
const r = applyDamage(pHp, pBlock, atk); pHp = r.hp; pBlock = r.block;
let incoming = atk;
if (pIntangible > 0 && incoming > 1) incoming = 1;
const r = applyDamage(pHp, pBlock, incoming); pHp = r.hp; pBlock = r.block;
if (beforeHp > pHp && pThorns > 0) {
m.hp -= pThorns;
if (m.hp <= 0) m.alive = false;

View File

@@ -823,6 +823,19 @@ test("simulateCombat: cardPlayedRandomDamage hits a random enemy on card play",
assert.equal(r.win, true);
});
test("simulateCombat: intangible cards reduce incoming damage and persist across turns", () => {
const data = {
cards: {
Wraith: { name: "WraithForm", cost: 3, kind: "Power", intangible: 2, endTurnDexLoss: 1, innate: true },
Strike: { name: "Strike", cost: 1, kind: "Attack", damage: 1 },
},
starterDeck: ["Wraith", "Strike"],
monsters: [{ name: "Dummy", maxHp: 1, intents: [{ kind: "Attack", value: 10 }] }],
};
const r = simulateCombat(data, () => 0.999999);
assert.equal(r.win, true);
});
test("simulateCombat: useAllEnergy skewer consumes all energy for damage", () => {
const data = {
cards: {