feat(magician): 시뮬 메커니즘 동기화 + 산출물 재생성
- poison 틱(행동 시작·사망 시 행동 생략·전멸 승리 체크)·aoe(개별 취약/방어)·heal 클램프·draw - 테스트 4건 추가 — 전체 40건 통과 Co-Authored-By: Claude Opus 4.8 (1M context) <noreply@anthropic.com>
This commit is contained in:
@@ -280,3 +280,59 @@ test('simulateCombat: blockPerTurn 파워 — 매턴 방어로 약공 무효', (
|
||||
assert.equal(r.draw, true);
|
||||
assert.equal(r.playerHpRemaining, 77);
|
||||
});
|
||||
|
||||
test('simulateCombat: poison — 적 행동 시작 시 틱·1 감소·독 사망 시 승리 처리', () => {
|
||||
const data = {
|
||||
cards: { PB: { name: '포이즌', cost: 3, kind: 'Skill', poison: 4 } },
|
||||
starterDeck: ['PB', 'PB', 'PB', 'PB', 'PB'],
|
||||
monsters: [{ name: '적', maxHp: 10, intents: [{ kind: 'Defend', value: 0 }] }],
|
||||
};
|
||||
// T1: 독4 부여 → 틱 4 (hp 6, 독 3). T2: +4 → 7 틱 → hp 0 사망 → 승리
|
||||
const r = simulateCombat(data, mulberry32(1));
|
||||
assert.equal(r.win, true);
|
||||
assert.equal(r.turns, 2);
|
||||
});
|
||||
|
||||
test('simulateCombat: aoe — 모든 생존 적에게 피해', () => {
|
||||
const data = {
|
||||
cards: { TB: { name: '썬더 볼트', cost: 3, kind: 'Attack', damage: 6, aoe: true } },
|
||||
starterDeck: ['TB', 'TB', 'TB', 'TB', 'TB'],
|
||||
monsters: [
|
||||
{ name: 'A', maxHp: 6, intents: [{ kind: 'Attack', value: 5 }] },
|
||||
{ name: 'B', maxHp: 6, intents: [{ kind: 'Attack', value: 5 }] },
|
||||
{ name: 'C', maxHp: 6, intents: [{ kind: 'Attack', value: 5 }] },
|
||||
],
|
||||
};
|
||||
const r = simulateCombat(data, mulberry32(1));
|
||||
assert.equal(r.win, true);
|
||||
assert.equal(r.turns, 1);
|
||||
});
|
||||
|
||||
test('simulateCombat: heal — 최대 HP 클램프', () => {
|
||||
const data = {
|
||||
cards: { H: { name: '힐', cost: 1, kind: 'Skill', heal: 10 } },
|
||||
starterDeck: ['H', 'H', 'H', 'H', 'H'],
|
||||
monsters: [{ name: '적', maxHp: 9999, intents: [{ kind: 'Attack', value: 10 }] }],
|
||||
};
|
||||
// 매턴: 힐로 80까지 회복(클램프) → 적 10 → 70. MAX_TURNS 도달 시 hp 70
|
||||
const r = simulateCombat(data, mulberry32(1));
|
||||
assert.equal(r.draw, true);
|
||||
assert.equal(r.playerHpRemaining, 70);
|
||||
});
|
||||
|
||||
test('simulateCombat: draw — 카드 드로로 손패 보충', () => {
|
||||
const data = {
|
||||
cards: {
|
||||
D: { name: '텔레포트류', cost: 0, kind: 'Skill', draw: 1, block: 0 },
|
||||
Hit: { name: '타격', cost: 1, kind: 'Attack', damage: 1 },
|
||||
},
|
||||
starterDeck: ['D', 'D', 'D', 'D', 'D', 'Hit', 'Hit', 'Hit'],
|
||||
monsters: [{ name: '적', maxHp: 4, intents: [{ kind: 'Defend', value: 0 }] }],
|
||||
};
|
||||
// 드로 덕에 첫 턴 히트 3장 전부 접근 → 늦어도 2턴 내 처치 (시드 무관)
|
||||
for (let s = 1; s <= 10; s++) {
|
||||
const r = simulateCombat(data, mulberry32(s));
|
||||
assert.equal(r.win, true, `seed ${s}`);
|
||||
assert.ok(r.turns <= 2, `seed ${s}: ${r.turns}턴`);
|
||||
}
|
||||
});
|
||||
|
||||
Reference in New Issue
Block a user