feat(skill): DamageType 및 magAtk/magDef 스킬 시스템 추가

- DamageType enum 추가 (physical/magical)
- 스킬별 데미지 타입 지정 기능 구현
- 마법 스킬 데미지에 magAtk/magDef 적용
- 장비 아이템에서 magAtk/magDef 스탯 추출
- 관련 테스트 업데이트
This commit is contained in:
JiWoong Sul
2026-01-15 23:22:36 +09:00
parent 525e231c06
commit b0913a24ff
8 changed files with 254 additions and 39 deletions

View File

@@ -131,6 +131,7 @@ class DeathInfo {
required this.levelAtDeath,
required this.timestamp,
this.lostItemName,
this.lostItemSlot,
this.lastCombatEvents = const [],
});
@@ -146,6 +147,9 @@ class DeathInfo {
/// 제물로 바친 아이템 이름 (null이면 없음)
final String? lostItemName;
/// 제물로 바친 아이템 슬롯 (null이면 없음)
final EquipmentSlot? lostItemSlot;
/// 사망 시점 골드
final int goldAtDeath;
@@ -163,6 +167,7 @@ class DeathInfo {
String? killerName,
int? lostEquipmentCount,
String? lostItemName,
EquipmentSlot? lostItemSlot,
int? goldAtDeath,
int? levelAtDeath,
int? timestamp,
@@ -173,6 +178,7 @@ class DeathInfo {
killerName: killerName ?? this.killerName,
lostEquipmentCount: lostEquipmentCount ?? this.lostEquipmentCount,
lostItemName: lostItemName ?? this.lostItemName,
lostItemSlot: lostItemSlot ?? this.lostItemSlot,
goldAtDeath: goldAtDeath ?? this.goldAtDeath,
levelAtDeath: levelAtDeath ?? this.levelAtDeath,
timestamp: timestamp ?? this.timestamp,

View File

@@ -22,6 +22,7 @@ class MonsterCombatStats {
required this.level,
required this.atk,
required this.def,
required this.magDef,
required this.hpMax,
required this.hpCurrent,
required this.criRate,
@@ -41,9 +42,12 @@ class MonsterCombatStats {
/// 공격력
final int atk;
/// 방어력
/// 물리 방어력
final int def;
/// 마법 방어력
final int magDef;
/// 최대 HP
final int hpMax;
@@ -96,6 +100,7 @@ class MonsterCombatStats {
int? level,
int? atk,
int? def,
int? magDef,
int? hpMax,
int? hpCurrent,
double? criRate,
@@ -110,6 +115,7 @@ class MonsterCombatStats {
level: level ?? this.level,
atk: atk ?? this.atk,
def: def ?? this.def,
magDef: magDef ?? this.magDef,
hpMax: hpMax ?? this.hpMax,
hpCurrent: hpCurrent ?? this.hpCurrent,
criRate: criRate ?? this.criRate,
@@ -173,11 +179,16 @@ class MonsterCombatStats {
MonsterSpeedType.slow => 1400,
};
// 마법 방어력: 물리 방어력의 70~130% (레벨에 따라 변동)
final magDefRatio = 0.7 + (level % 60) * 0.01; // 0.7 ~ 1.3
final magDef = (baseStats.def * magDefRatio).round();
return MonsterCombatStats(
name: name,
level: level,
atk: baseStats.atk,
def: baseStats.def,
magDef: magDef,
hpMax: adjustedHp,
hpCurrent: adjustedHp,
criRate: criRate,
@@ -202,6 +213,7 @@ class MonsterCombatStats {
level: bossLevel,
atk: bossStats.atk,
def: bossStats.def,
magDef: (bossStats.def * 1.2).round(), // 보스는 마법 방어력 20% 증가
hpMax: bossStats.hp,
hpCurrent: bossStats.hp,
criRate: 0.25, // 보스 크리티컬 확률 25%
@@ -244,6 +256,7 @@ class MonsterCombatStats {
level: 1,
atk: 8,
def: 3,
magDef: 3,
hpMax: 35,
hpCurrent: 35,
criRate: 0.02,
@@ -264,6 +277,7 @@ class MonsterCombatStats {
level: 0, // PvP에서는 레벨 페널티 없음
atk: stats.atk,
def: stats.def,
magDef: stats.magDef,
hpMax: stats.hpMax,
hpCurrent: stats.hpMax, // 풀 HP로 시작
criRate: stats.criRate,

View File

@@ -4,8 +4,9 @@
/// 스펠 랭크에 따른 스킬 배율 계산
///
/// 랭크 1: 1.0x, 랭크 2: 1.15x, 랭크 3: 1.30x, ...
double getRankMultiplier(int rank) => 1.0 + (rank - 1) * 0.15;
/// 랭크 1: 1.0x, 랭크 2: 1.08x, 랭크 3: 1.16x, ... 최대 1.72x (rank 10)
/// Phase 3 밸런스: 0.15 → 0.08로 하향
double getRankMultiplier(int rank) => 1.0 + (rank - 1) * 0.08;
/// 랭크에 따른 쿨타임 감소율 계산
///
@@ -38,6 +39,18 @@ enum SkillType {
debuff,
}
/// 데미지 타입 (물리/마법 구분)
enum DamageType {
/// 물리 공격 - STR + atk 기반, 적 def로 방어
physical,
/// 마법 공격 - INT + magAtk 기반, 적 magDef로 방어
magical,
/// 하이브리드 - (atk + magAtk) / 2, (def + magDef) / 2
hybrid,
}
/// 스킬 속성 (하이브리드: 코드 + 시스템)
enum SkillElement {
/// 논리 (Logic) - 순수 데미지
@@ -118,6 +131,7 @@ class Skill {
required this.cooldownMs,
required this.power,
this.tier = 1,
this.damageType = DamageType.physical,
this.damageMultiplier = 1.0,
this.healAmount = 0,
this.healPercent = 0.0,
@@ -137,6 +151,9 @@ class Skill {
/// 스킬 티어 (1~5, 높을수록 강함)
final int tier;
/// 데미지 타입 (물리/마법/하이브리드)
final DamageType damageType;
/// 스킬 ID
final String id;