docs: 게임 시스템 개편 계획 문서 분리
- 121KB 단일 문서를 22개 태스크 문서로 분리 - 메인 인덱스 문서 (game-system-overhaul-index.md) 생성 - Phase 1-10 태스크 문서 10개 분리 - 추가 시스템 태스크 문서 10개 분리 - 재미 요소 설계 문서 1개 분리 - 기존 문서는 archive/ 폴더로 이동
This commit is contained in:
122
doc/task-phase-01-combat.md
Normal file
122
doc/task-phase-01-combat.md
Normal file
@@ -0,0 +1,122 @@
|
||||
# Phase 1: 핵심 전투 시스템
|
||||
|
||||
> 메인 문서: [game-system-overhaul-index.md](game-system-overhaul-index.md)
|
||||
|
||||
---
|
||||
|
||||
## 1. 목표
|
||||
Stats가 전투에 실제 영향을 미치도록 전투 계산 로직을 구현한다.
|
||||
|
||||
## 2. 새로운 Stats 구조
|
||||
|
||||
```dart
|
||||
class CombatStats {
|
||||
// 기본 스탯 (캐릭터 고유)
|
||||
final int str; // 힘: 물리 공격력 보정
|
||||
final int con; // 체력: HP, 방어력 보정
|
||||
final int dex; // 민첩: 회피율, 크리티컬율, 명중률
|
||||
final int intelligence; // 지능: 마법 공격력, MP
|
||||
final int wis; // 지혜: 마법 방어력, MP 회복
|
||||
final int cha; // 매력: 상점 가격, 드롭율 보정
|
||||
|
||||
// 파생 스탯 (장비 + 기본 스탯으로 계산)
|
||||
final int atk; // 공격력
|
||||
final int def; // 방어력
|
||||
final int magAtk; // 마법 공격력
|
||||
final int magDef; // 마법 방어력
|
||||
final double criRate; // 크리티컬 확률 (0.0 ~ 1.0)
|
||||
final double criDamage; // 크리티컬 데미지 배율 (1.5 ~ 3.0)
|
||||
final double evasion; // 회피율 (0.0 ~ 0.5)
|
||||
final double accuracy; // 명중률 (0.8 ~ 1.0)
|
||||
final double blockRate; // 방패 방어율 (0.0 ~ 0.4)
|
||||
final double parryRate; // 무기로 쳐내기 확률 (0.0 ~ 0.3)
|
||||
|
||||
// 자원
|
||||
final int hpMax;
|
||||
final int hpCurrent;
|
||||
final int mpMax;
|
||||
final int mpCurrent;
|
||||
}
|
||||
```
|
||||
|
||||
## 3. 전투 계산 공식
|
||||
|
||||
```
|
||||
1. 명중 판정
|
||||
명중 = random() < (공격자.accuracy - 방어자.evasion)
|
||||
|
||||
2. 방어 판정 (명중 시)
|
||||
방패 방어 = random() < 방어자.blockRate
|
||||
무기 쳐내기 = random() < 방어자.parryRate
|
||||
|
||||
3. 데미지 계산
|
||||
기본 데미지 = 공격자.atk * (1 + random() * 0.2) - 방어자.def * 0.5
|
||||
|
||||
크리티컬 판정 = random() < 공격자.criRate
|
||||
if (크리티컬) 데미지 *= 공격자.criDamage
|
||||
|
||||
if (방패 방어) 데미지 *= 0.3
|
||||
if (무기 쳐내기) 데미지 *= 0.5
|
||||
|
||||
최종 데미지 = max(1, 데미지)
|
||||
|
||||
4. 전투 결과
|
||||
방어자.hp -= 최종 데미지
|
||||
if (방어자.hp <= 0) 전투 종료
|
||||
```
|
||||
|
||||
## 4. 전투 틱 시스템
|
||||
|
||||
```
|
||||
현재: 2초 후 자동 승리
|
||||
변경: 매 틱(200ms)마다 공격 교환, HP가 0이 되면 승패 결정
|
||||
|
||||
전투 흐름:
|
||||
1. 플레이어 턴 (atk 기반 공격)
|
||||
2. 몬스터 턴 (몬스터 레벨 기반 공격)
|
||||
3. HP 체크
|
||||
4. 반복 또는 종료
|
||||
```
|
||||
|
||||
### 4.1 공격 속도 시스템
|
||||
|
||||
```dart
|
||||
class AttackSpeed {
|
||||
final int baseDelayMs; // 기본 공격 딜레이 (1000ms)
|
||||
final double speedModifier; // DEX 기반 속도 배율
|
||||
|
||||
int get actualDelayMs => (baseDelayMs / speedModifier).round();
|
||||
}
|
||||
|
||||
// 공격 속도 계산
|
||||
double calculateSpeedModifier(int dex) {
|
||||
// DEX 10 = 1.0배, DEX 20 = 1.2배, DEX 50 = 1.8배
|
||||
return 1.0 + (dex - 10) * 0.02;
|
||||
}
|
||||
```
|
||||
|
||||
| DEX | 공격 속도 배율 | 실제 딜레이 |
|
||||
|-----|---------------|------------|
|
||||
| 10 | 1.0x | 1000ms |
|
||||
| 20 | 1.2x | 833ms |
|
||||
| 30 | 1.4x | 714ms |
|
||||
| 50 | 1.8x | 556ms |
|
||||
| 100 | 2.8x | 357ms |
|
||||
|
||||
**몬스터 공격 속도**: 몬스터 타입별로 고정 (빠름/보통/느림)
|
||||
|
||||
## 5. 수정 대상 파일
|
||||
|
||||
| 파일 | 변경 내용 |
|
||||
|------|----------|
|
||||
| `core/model/game_state.dart` | CombatStats 클래스 추가, Stats 구조 변경 |
|
||||
| `core/engine/progress_service.dart` | 전투 틱 로직 변경 |
|
||||
| `core/util/pq_logic.dart` | 전투 계산 함수 추가 |
|
||||
| `core/engine/combat_calculator.dart` | **신규** - 전투 계산 전담 |
|
||||
|
||||
## 6. 예상 작업량
|
||||
- 예상 파일 수: 4-5개
|
||||
- 신규 코드: ~400 LOC
|
||||
- 수정 코드: ~200 LOC
|
||||
|
||||
---
|
||||
Reference in New Issue
Block a user