feat(system-gaps): 복합 카드(피해+방어)·런 종료 후 메뉴 복귀(EndRun)
Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
This commit is contained in:
@@ -120,7 +120,8 @@ export function simulateCombat(data, rng, stats) {
|
||||
const r = applyDamage(target.hp, target.block, c.damage || 0);
|
||||
target.hp = r.hp; target.block = r.block;
|
||||
if (target.hp <= 0) target.alive = false;
|
||||
if (stats) stats[id] = bump(stats[id], c.cost, c.damage || 0, 0);
|
||||
if (c.block) pBlock += c.block;
|
||||
if (stats) stats[id] = bump(stats[id], c.cost, c.damage || 0, c.block || 0);
|
||||
} else {
|
||||
pBlock += c.block || 0;
|
||||
if (stats) stats[id] = bump(stats[id], c.cost, 0, c.block || 0);
|
||||
|
||||
@@ -118,3 +118,16 @@ test('runBatch: 집계 필드·승률 범위', () => {
|
||||
test('runBatch: 동일 시드 동일 결과', () => {
|
||||
assert.deepEqual(runBatch(100, 7), runBatch(100, 7));
|
||||
});
|
||||
|
||||
test('simulateCombat: 복합 카드(공격+방어) 블록이 적 공격을 흡수', () => {
|
||||
const data = {
|
||||
cards: { Combo: { name: '콤보', cost: 1, kind: 'Attack', damage: 1, block: 3 } },
|
||||
starterDeck: ['Combo', 'Combo', 'Combo', 'Combo', 'Combo'],
|
||||
monsters: [{ name: '적', maxHp: 9999, intents: [{ kind: 'Attack', value: 9 }] }],
|
||||
};
|
||||
const r = simulateCombat(data, mulberry32(1));
|
||||
// 매 턴 3장(에너지3) → 블록 9 = 적 공격 9 전부 흡수 → 무피해로 MAX_TURNS 도달(draw), HP 유지.
|
||||
// 블록 미적용이면 매턴 -9로 사망(win=false, draw 아님).
|
||||
assert.equal(r.draw, true);
|
||||
assert.equal(r.playerHpRemaining, 80);
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user