## 스킬 시스템 개선 - skill_data.dart: 스킬 데이터 구조 전면 개편 (+1176 라인) - skill_service.dart: 스킬 발동 로직 확장 및 버프 시스템 연동 - skill.dart: 스킬 모델 개선, 쿨다운/효과 타입 추가 ## Canvas 애니메이션 리팩토링 - battle_composer.dart 삭제 (레거시 위젯 기반 렌더러) - monster_colors.dart 삭제 (AsciiCell 색상 시스템으로 통합) - canvas_battle_composer.dart: z-index 정렬 (몬스터 z=1, 캐릭터 z=2, 이펙트 z=3) - ascii_cell.dart, ascii_layer.dart: 코드 정리 ## UI/UX 개선 - hp_mp_bar.dart: l10n 적용, 몬스터 HP 바 컴팩트화 - death_overlay.dart: 사망 화면 개선 - equipment_stats_panel.dart: 장비 스탯 표시 확장 - active_buff_panel.dart: 버프 패널 개선 - notification_overlay.dart: 알림 시스템 개선 ## 다국어 지원 확장 - game_text_l10n.dart: 게임 텍스트 통합 (+758 라인) - 한국어/일본어/영어/중국어 번역 업데이트 - ARB 파일 동기화 ## 게임 로직 개선 - progress_service.dart: 진행 로직 리팩토링 - combat_calculator.dart: 전투 계산 로직 개선 - stat_calculator.dart: 스탯 계산 시스템 개선 - story_service.dart: 스토리 진행 로직 개선 ## 기타 - theme_preferences.dart 삭제 (미사용) - 테스트 파일 업데이트 - class_data.dart: 클래스 데이터 정리
128 lines
3.1 KiB
Dart
128 lines
3.1 KiB
Dart
/// 물약 종류
|
|
enum PotionType {
|
|
/// HP 회복 물약
|
|
hp,
|
|
|
|
/// MP 회복 물약
|
|
mp,
|
|
}
|
|
|
|
/// 물약 아이템
|
|
///
|
|
/// 전투 중 사용 가능한 소모품.
|
|
/// 전투당 종류별 1회만 사용 가능.
|
|
class Potion {
|
|
const Potion({
|
|
required this.id,
|
|
required this.name,
|
|
required this.type,
|
|
required this.tier,
|
|
this.healAmount = 0,
|
|
this.healPercent = 0.0,
|
|
this.price = 0,
|
|
});
|
|
|
|
/// 물약 ID
|
|
final String id;
|
|
|
|
/// 물약 이름
|
|
final String name;
|
|
|
|
/// 물약 종류 (hp / mp)
|
|
final PotionType type;
|
|
|
|
/// 물약 티어 (1~5, 높을수록 강력)
|
|
final int tier;
|
|
|
|
/// 고정 회복량
|
|
final int healAmount;
|
|
|
|
/// 비율 회복량 (0.0 ~ 1.0)
|
|
final double healPercent;
|
|
|
|
/// 구매 가격 (골드)
|
|
final int price;
|
|
|
|
/// HP 물약 여부
|
|
bool get isHpPotion => type == PotionType.hp;
|
|
|
|
/// MP 물약 여부
|
|
bool get isMpPotion => type == PotionType.mp;
|
|
|
|
/// 실제 회복량 계산
|
|
///
|
|
/// [maxValue] 최대 HP 또는 MP
|
|
int calculateHeal(int maxValue) {
|
|
final percentHeal = (maxValue * healPercent).round();
|
|
return healAmount + percentHeal;
|
|
}
|
|
}
|
|
|
|
/// 물약 인벤토리 상태
|
|
///
|
|
/// 보유 물약 수량 및 전투 중 사용 기록 관리
|
|
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);
|
|
}
|
|
|
|
/// 물약 사용 (수량 감소)
|
|
PotionInventory usePotion(String potionId, PotionType type) {
|
|
final currentQty = potions[potionId] ?? 0;
|
|
if (currentQty <= 0) return this;
|
|
|
|
final newPotions = Map<String, int>.from(potions);
|
|
newPotions[potionId] = currentQty - 1;
|
|
if (newPotions[potionId] == 0) {
|
|
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 {});
|
|
}
|
|
|
|
/// 빈 인벤토리
|
|
static const empty = PotionInventory();
|
|
|
|
PotionInventory copyWith({
|
|
Map<String, int>? potions,
|
|
Set<PotionType>? usedInBattle,
|
|
}) {
|
|
return PotionInventory(
|
|
potions: potions ?? this.potions,
|
|
usedInBattle: usedInBattle ?? this.usedInBattle,
|
|
);
|
|
}
|
|
}
|