feat(death): Phase 4 사망/부활 시스템 구현
- DeathInfo, DeathCause 클래스 정의 (game_state.dart) - 사망 원인, 상실 장비 수, 사망 시점 정보 기록 - ShopService 구현 (shop_service.dart) - 장비 가격 계산 (레벨 * 50 * 희귀도 배율) - 슬롯별 장비 생성 (프로그래밍 테마) - 자동 구매 (빈 슬롯에 Common 장비) - ResurrectionService 구현 (resurrection_service.dart) - 사망 처리: 모든 장비 상실, 기본 무기만 유지 - 부활 처리: HP/MP 회복, 자동 장비 구매 - progress_service.dart 사망 판정 로직 추가 - 전투 중 HP <= 0 시 사망 처리 - ProgressTickResult에 playerDied 플래그 추가 - progress_loop.dart 사망 시 루프 정지 - onPlayerDied 콜백 추가 - 사망 상태에서 틱 진행 방지 - DeathOverlay 위젯 구현 (death_overlay.dart) - ASCII 스컬 아트, 사망 원인, 상실 정보 표시 - 부활 버튼 - GameSessionController 사망/부활 상태 관리 - GameSessionStatus.dead 상태 추가 - resurrect() 메서드로 부활 처리
This commit is contained in:
@@ -22,6 +22,7 @@ class GameState {
|
||||
ProgressState? progress,
|
||||
QueueState? queue,
|
||||
SkillSystemState? skillSystem,
|
||||
this.deathInfo,
|
||||
}) : rng = DeterministicRandom.clone(rng),
|
||||
traits = traits ?? Traits.empty(),
|
||||
stats = stats ?? Stats.empty(),
|
||||
@@ -42,6 +43,7 @@ class GameState {
|
||||
ProgressState? progress,
|
||||
QueueState? queue,
|
||||
SkillSystemState? skillSystem,
|
||||
DeathInfo? deathInfo,
|
||||
}) {
|
||||
return GameState(
|
||||
rng: DeterministicRandom(seed),
|
||||
@@ -53,6 +55,7 @@ class GameState {
|
||||
progress: progress,
|
||||
queue: queue,
|
||||
skillSystem: skillSystem,
|
||||
deathInfo: deathInfo,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -68,6 +71,12 @@ class GameState {
|
||||
/// 스킬 시스템 상태 (Phase 3)
|
||||
final SkillSystemState skillSystem;
|
||||
|
||||
/// 사망 정보 (Phase 4, null이면 생존 중)
|
||||
final DeathInfo? deathInfo;
|
||||
|
||||
/// 사망 여부
|
||||
bool get isDead => deathInfo != null;
|
||||
|
||||
GameState copyWith({
|
||||
DeterministicRandom? rng,
|
||||
Traits? traits,
|
||||
@@ -78,6 +87,8 @@ class GameState {
|
||||
ProgressState? progress,
|
||||
QueueState? queue,
|
||||
SkillSystemState? skillSystem,
|
||||
DeathInfo? deathInfo,
|
||||
bool clearDeathInfo = false,
|
||||
}) {
|
||||
return GameState(
|
||||
rng: rng ?? DeterministicRandom.clone(this.rng),
|
||||
@@ -89,10 +100,73 @@ class GameState {
|
||||
progress: progress ?? this.progress,
|
||||
queue: queue ?? this.queue,
|
||||
skillSystem: skillSystem ?? this.skillSystem,
|
||||
deathInfo: clearDeathInfo ? null : (deathInfo ?? this.deathInfo),
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 사망 정보 (Phase 4)
|
||||
///
|
||||
/// 사망 시점의 정보와 상실한 장비 목록을 기록
|
||||
class DeathInfo {
|
||||
const DeathInfo({
|
||||
required this.cause,
|
||||
required this.killerName,
|
||||
required this.lostEquipmentCount,
|
||||
required this.goldAtDeath,
|
||||
required this.levelAtDeath,
|
||||
required this.timestamp,
|
||||
});
|
||||
|
||||
/// 사망 원인
|
||||
final DeathCause cause;
|
||||
|
||||
/// 사망시킨 몬스터/원인 이름
|
||||
final String killerName;
|
||||
|
||||
/// 상실한 장비 개수
|
||||
final int lostEquipmentCount;
|
||||
|
||||
/// 사망 시점 골드
|
||||
final int goldAtDeath;
|
||||
|
||||
/// 사망 시점 레벨
|
||||
final int levelAtDeath;
|
||||
|
||||
/// 사망 시각 (밀리초)
|
||||
final int timestamp;
|
||||
|
||||
DeathInfo copyWith({
|
||||
DeathCause? cause,
|
||||
String? killerName,
|
||||
int? lostEquipmentCount,
|
||||
int? goldAtDeath,
|
||||
int? levelAtDeath,
|
||||
int? timestamp,
|
||||
}) {
|
||||
return DeathInfo(
|
||||
cause: cause ?? this.cause,
|
||||
killerName: killerName ?? this.killerName,
|
||||
lostEquipmentCount: lostEquipmentCount ?? this.lostEquipmentCount,
|
||||
goldAtDeath: goldAtDeath ?? this.goldAtDeath,
|
||||
levelAtDeath: levelAtDeath ?? this.levelAtDeath,
|
||||
timestamp: timestamp ?? this.timestamp,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
/// 사망 원인
|
||||
enum DeathCause {
|
||||
/// 몬스터에 의한 사망
|
||||
monster,
|
||||
|
||||
/// 자해 스킬에 의한 사망
|
||||
selfDamage,
|
||||
|
||||
/// 환경 피해에 의한 사망
|
||||
environment,
|
||||
}
|
||||
|
||||
/// 스킬 시스템 상태 (Phase 3)
|
||||
///
|
||||
/// 스킬 쿨타임, 활성 버프, 게임 경과 시간 등을 관리
|
||||
|
||||
Reference in New Issue
Block a user