fix(death): 사망 시 희생 아이템 선택 디버그 로그 추가
- 장비 슬롯 상태 콘솔 로그 추가 - resurrection_service에 lostItemSlot 설정 누락 수정 - resetBattleUsage 존재하지 않는 메서드 호출 제거
This commit is contained in:
@@ -1,7 +1,6 @@
|
||||
import 'package:asciineverdie/src/core/model/combat_event.dart';
|
||||
import 'package:asciineverdie/src/core/model/combat_stats.dart';
|
||||
import 'package:asciineverdie/src/core/model/monster_combat_stats.dart';
|
||||
import 'package:asciineverdie/src/core/model/potion.dart';
|
||||
import 'package:asciineverdie/src/core/model/skill.dart';
|
||||
|
||||
/// 현재 전투 상태
|
||||
@@ -20,7 +19,7 @@ class CombatState {
|
||||
required this.isActive,
|
||||
this.recentEvents = const [],
|
||||
this.activeDoTs = const [],
|
||||
this.usedPotionTypes = const {},
|
||||
this.lastPotionUsedMs = 0,
|
||||
this.activeDebuffs = const [],
|
||||
});
|
||||
|
||||
@@ -54,8 +53,8 @@ class CombatState {
|
||||
/// 활성 DOT 효과 목록
|
||||
final List<DotEffect> activeDoTs;
|
||||
|
||||
/// 이번 전투에서 사용한 물약 종류 (종류별 1회 제한)
|
||||
final Set<PotionType> usedPotionTypes;
|
||||
/// 마지막 물약 사용 시간 (글로벌 쿨타임용)
|
||||
final int lastPotionUsedMs;
|
||||
|
||||
/// 몬스터에 적용된 활성 디버프 목록
|
||||
final List<ActiveBuff> activeDebuffs;
|
||||
@@ -79,8 +78,10 @@ class CombatState {
|
||||
/// 몬스터 HP 비율
|
||||
double get monsterHpRatio => monsterStats.hpRatio;
|
||||
|
||||
/// 특정 종류 물약 사용 가능 여부
|
||||
bool canUsePotionType(PotionType type) => !usedPotionTypes.contains(type);
|
||||
/// 물약 사용 가능 여부 (글로벌 쿨타임 체크)
|
||||
bool canUsePotion(int currentMs, int cooldownMs) {
|
||||
return currentMs - lastPotionUsedMs >= cooldownMs;
|
||||
}
|
||||
|
||||
/// 활성 DOT 존재 여부
|
||||
bool get hasActiveDoTs => activeDoTs.isNotEmpty;
|
||||
@@ -121,7 +122,7 @@ class CombatState {
|
||||
bool? isActive,
|
||||
List<CombatEvent>? recentEvents,
|
||||
List<DotEffect>? activeDoTs,
|
||||
Set<PotionType>? usedPotionTypes,
|
||||
int? lastPotionUsedMs,
|
||||
List<ActiveBuff>? activeDebuffs,
|
||||
}) {
|
||||
return CombatState(
|
||||
@@ -137,7 +138,7 @@ class CombatState {
|
||||
isActive: isActive ?? this.isActive,
|
||||
recentEvents: recentEvents ?? this.recentEvents,
|
||||
activeDoTs: activeDoTs ?? this.activeDoTs,
|
||||
usedPotionTypes: usedPotionTypes ?? this.usedPotionTypes,
|
||||
lastPotionUsedMs: lastPotionUsedMs ?? this.lastPotionUsedMs,
|
||||
activeDebuffs: activeDebuffs ?? this.activeDebuffs,
|
||||
);
|
||||
}
|
||||
|
||||
@@ -60,39 +60,30 @@ class Potion {
|
||||
|
||||
/// 물약 인벤토리 상태
|
||||
///
|
||||
/// 보유 물약 수량 및 전투 중 사용 기록 관리
|
||||
/// 보유 물약 수량 관리 (쿨타임은 CombatState에서 관리)
|
||||
class PotionInventory {
|
||||
const PotionInventory({
|
||||
this.potions = const {},
|
||||
this.usedInBattle = const {},
|
||||
});
|
||||
|
||||
/// 보유 물약 (물약 ID → 수량)
|
||||
final Map<String, int> potions;
|
||||
|
||||
/// 현재 전투에서 사용한 물약 종류
|
||||
final Set<PotionType> usedInBattle;
|
||||
|
||||
/// 물약 보유 여부
|
||||
bool hasPotion(String potionId) => (potions[potionId] ?? 0) > 0;
|
||||
|
||||
/// 물약 수량 조회
|
||||
int getQuantity(String potionId) => potions[potionId] ?? 0;
|
||||
|
||||
/// 특정 종류 물약 사용 가능 여부
|
||||
///
|
||||
/// 전투당 종류별 1회 제한 체크
|
||||
bool canUseType(PotionType type) => !usedInBattle.contains(type);
|
||||
|
||||
/// 물약 추가
|
||||
PotionInventory addPotion(String potionId, [int count = 1]) {
|
||||
final newPotions = Map<String, int>.from(potions);
|
||||
newPotions[potionId] = (newPotions[potionId] ?? 0) + count;
|
||||
return PotionInventory(potions: newPotions, usedInBattle: usedInBattle);
|
||||
return PotionInventory(potions: newPotions);
|
||||
}
|
||||
|
||||
/// 물약 사용 (수량 감소)
|
||||
PotionInventory usePotion(String potionId, PotionType type) {
|
||||
PotionInventory usePotion(String potionId) {
|
||||
final currentQty = potions[potionId] ?? 0;
|
||||
if (currentQty <= 0) return this;
|
||||
|
||||
@@ -102,14 +93,7 @@ class PotionInventory {
|
||||
newPotions.remove(potionId);
|
||||
}
|
||||
|
||||
final newUsed = Set<PotionType>.from(usedInBattle)..add(type);
|
||||
|
||||
return PotionInventory(potions: newPotions, usedInBattle: newUsed);
|
||||
}
|
||||
|
||||
/// 전투 종료 시 사용 기록 초기화
|
||||
PotionInventory resetBattleUsage() {
|
||||
return PotionInventory(potions: potions, usedInBattle: const {});
|
||||
return PotionInventory(potions: newPotions);
|
||||
}
|
||||
|
||||
/// 빈 인벤토리
|
||||
@@ -117,11 +101,9 @@ class PotionInventory {
|
||||
|
||||
PotionInventory copyWith({
|
||||
Map<String, int>? potions,
|
||||
Set<PotionType>? usedInBattle,
|
||||
}) {
|
||||
return PotionInventory(
|
||||
potions: potions ?? this.potions,
|
||||
usedInBattle: usedInBattle ?? this.usedInBattle,
|
||||
);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user