feat(combat): 디버프 시스템 추가

- CombatEventType.playerDebuff 추가
- CombatState에 activeDebuffs 목록 추가
- SkillService.useDebuffSkill() 구현
- 스킬 자동 선택에 디버프 우선순위 추가
- 밸런스 상수 업데이트
This commit is contained in:
JiWoong Sul
2025-12-30 15:58:03 +09:00
parent bdd3b45329
commit 80b6cd63e3
5 changed files with 294 additions and 51 deletions

View File

@@ -27,6 +27,9 @@ enum CombatEventType {
/// 플레이어 버프
playerBuff,
/// 플레이어 디버프 (적에게 적용)
playerDebuff,
/// DOT 틱 데미지
dotTick,
@@ -209,6 +212,20 @@ class CombatEvent {
);
}
/// 디버프 이벤트 생성 (적에게 디버프 적용)
factory CombatEvent.playerDebuff({
required int timestamp,
required String skillName,
required String targetName,
}) {
return CombatEvent(
type: CombatEventType.playerDebuff,
timestamp: timestamp,
skillName: skillName,
targetName: targetName,
);
}
/// DOT 틱 이벤트 생성
factory CombatEvent.dotTick({
required int timestamp,

View File

@@ -21,6 +21,7 @@ class CombatState {
this.recentEvents = const [],
this.activeDoTs = const [],
this.usedPotionTypes = const {},
this.activeDebuffs = const [],
});
/// 플레이어 전투 스탯
@@ -56,6 +57,9 @@ class CombatState {
/// 이번 전투에서 사용한 물약 종류 (종류별 1회 제한)
final Set<PotionType> usedPotionTypes;
/// 몬스터에 적용된 활성 디버프 목록
final List<ActiveBuff> activeDebuffs;
// ============================================================================
// 유틸리티
// ============================================================================
@@ -88,6 +92,24 @@ class CombatState {
});
}
/// 활성 디버프 존재 여부
bool get hasActiveDebuffs => activeDebuffs.isNotEmpty;
/// 몬스터에 적용된 총 디버프 효과 계산
///
/// 디버프 효과는 몬스터 ATK/DEF에 부정적 배율로 적용됨
({double atkMod, double defMod}) get totalDebuffModifiers {
double atkMod = 0;
double defMod = 0;
for (final debuff in activeDebuffs) {
atkMod += debuff.effect.atkModifier;
defMod += debuff.effect.defModifier;
}
return (atkMod: atkMod, defMod: defMod);
}
CombatState copyWith({
CombatStats? playerStats,
MonsterCombatStats? monsterStats,
@@ -100,6 +122,7 @@ class CombatState {
List<CombatEvent>? recentEvents,
List<DotEffect>? activeDoTs,
Set<PotionType>? usedPotionTypes,
List<ActiveBuff>? activeDebuffs,
}) {
return CombatState(
playerStats: playerStats ?? this.playerStats,
@@ -115,6 +138,7 @@ class CombatState {
recentEvents: recentEvents ?? this.recentEvents,
activeDoTs: activeDoTs ?? this.activeDoTs,
usedPotionTypes: usedPotionTypes ?? this.usedPotionTypes,
activeDebuffs: activeDebuffs ?? this.activeDebuffs,
);
}