fix(death): 사망 시 희생 아이템 선택 디버그 로그 추가

- 장비 슬롯 상태 콘솔 로그 추가
- resurrection_service에 lostItemSlot 설정 누락 수정
- resetBattleUsage 존재하지 않는 메서드 호출 제거
This commit is contained in:
JiWoong Sul
2026-01-15 23:33:31 +09:00
parent 7e1936b34f
commit b8a4d73461
6 changed files with 117 additions and 101 deletions

View File

@@ -10,11 +10,14 @@ import 'package:asciineverdie/src/core/model/potion.dart';
class PotionService {
const PotionService();
/// 글로벌 물약 쿨타임 (1배속 기준 3초)
static const int globalPotionCooldownMs = 3000;
/// 긴급 물약 사용 HP 임계치 (30%)
static const double emergencyHpThreshold = 0.30;
/// 긴급 물약 사용 MP 임계치 (20%)
static const double emergencyMpThreshold = 0.20;
/// 긴급 물약 사용 MP 임계치 (50%)
static const double emergencyMpThreshold = 0.50;
// ============================================================================
// 물약 사용 가능 여부
@@ -40,11 +43,6 @@ class PotionService {
return (false, PotionUseFailReason.outOfStock);
}
// 전투당 종류별 1회 제한 체크
if (!inventory.canUseType(potion.type)) {
return (false, PotionUseFailReason.alreadyUsedThisBattle);
}
return (true, null);
}
@@ -88,7 +86,7 @@ class PotionService {
healedAmount = newMp - currentMp; // 실제 회복량
}
final newInventory = inventory.usePotion(potionId, potion.type);
final newInventory = inventory.usePotion(potionId);
return PotionUseResult(
success: true,
@@ -121,9 +119,6 @@ class PotionService {
final hpRatio = currentHp / maxHp;
if (hpRatio > emergencyHpThreshold) return null;
// 전투 중 이미 HP 물약 사용했으면 불가
if (!inventory.canUseType(PotionType.hp)) return null;
// 적정 티어 계산
final targetTier = PotionData.tierForLevel(playerLevel);
@@ -159,9 +154,6 @@ class PotionService {
final mpRatio = currentMp / maxMp;
if (mpRatio > emergencyMpThreshold) return null;
// 전투 중 이미 MP 물약 사용했으면 불가
if (!inventory.canUseType(PotionType.mp)) return null;
// 적정 티어 계산
final targetTier = PotionData.tierForLevel(playerLevel);
@@ -188,11 +180,6 @@ class PotionService {
// 인벤토리 관리
// ============================================================================
/// 전투 종료 시 사용 기록 초기화
PotionInventory resetBattleUsage(PotionInventory inventory) {
return inventory.resetBattleUsage();
}
/// 물약 드랍 추가
PotionInventory addPotionDrop(
PotionInventory inventory,
@@ -470,8 +457,8 @@ enum PotionUseFailReason {
/// 보유 물약 없음 (재고 부족)
outOfStock,
/// 이번 전투에서 이미 해당 종류 물약 사용
alreadyUsedThisBattle,
/// 글로벌 쿨타임 중
onCooldown,
}
/// 물약 구매 결과