- RaceTraits: 7종족 (Byte Human, Null Elf, Buffer Dwarf 등) - ClassTraits: 6클래스 (Bug Hunter, Compiler Mage 등) - StatCalculator: 종족/클래스 보정 계산 - CombatStats.fromStats: 종족/클래스 패시브 효과 통합 - 종족별 스탯 보정 및 패시브 (경험치, HP/MP, 크리티컬 등) - 클래스별 스탯 보정 및 패시브 (공격력, 방어력, 회피 등)
98 lines
1.9 KiB
Dart
98 lines
1.9 KiB
Dart
/// 스탯 타입 열거형 (stat type)
|
|
enum StatType {
|
|
str,
|
|
con,
|
|
dex,
|
|
intelligence,
|
|
wis,
|
|
cha,
|
|
}
|
|
|
|
/// 패시브 능력 타입 (passive ability type)
|
|
enum PassiveType {
|
|
/// 경험치 배율 보너스
|
|
expBonus,
|
|
|
|
/// 마법 데미지 배율 보너스
|
|
magicDamageBonus,
|
|
|
|
/// 방어력 배율 보너스
|
|
defenseBonus,
|
|
|
|
/// 크리티컬 확률 보너스
|
|
criticalBonus,
|
|
|
|
/// HP 배율 보너스
|
|
hpBonus,
|
|
|
|
/// MP 배율 보너스
|
|
mpBonus,
|
|
|
|
/// 사망 시 장비 보존
|
|
deathEquipmentPreserve,
|
|
}
|
|
|
|
/// 패시브 능력 (passive ability)
|
|
///
|
|
/// 종족이나 클래스가 제공하는 수동적 효과
|
|
class PassiveAbility {
|
|
const PassiveAbility({
|
|
required this.type,
|
|
required this.value,
|
|
this.description = '',
|
|
});
|
|
|
|
/// 패시브 타입
|
|
final PassiveType type;
|
|
|
|
/// 효과 값 (배율의 경우 0.1 = 10%)
|
|
final double value;
|
|
|
|
/// 설명
|
|
final String description;
|
|
}
|
|
|
|
/// 종족 특성 (race traits)
|
|
///
|
|
/// 각 종족이 가진 고유한 스탯 보정과 패시브 능력
|
|
class RaceTraits {
|
|
const RaceTraits({
|
|
required this.raceId,
|
|
required this.name,
|
|
required this.statModifiers,
|
|
this.passives = const [],
|
|
this.expMultiplier = 1.0,
|
|
});
|
|
|
|
/// 종족 식별자
|
|
final String raceId;
|
|
|
|
/// 종족 이름 (표시용)
|
|
final String name;
|
|
|
|
/// 스탯 보정치 맵
|
|
final Map<StatType, int> statModifiers;
|
|
|
|
/// 패시브 능력 목록
|
|
final List<PassiveAbility> passives;
|
|
|
|
/// 경험치 배율 (1.0 = 100%)
|
|
final double expMultiplier;
|
|
|
|
/// 특정 스탯의 보정치 반환
|
|
int getModifier(StatType type) => statModifiers[type] ?? 0;
|
|
|
|
/// 특정 패시브 타입의 값 반환 (없으면 0)
|
|
double getPassiveValue(PassiveType type) {
|
|
for (final passive in passives) {
|
|
if (passive.type == type) return passive.value;
|
|
}
|
|
return 0.0;
|
|
}
|
|
|
|
/// 특정 패시브 보유 여부
|
|
bool hasPassive(PassiveType type) {
|
|
return passives.any((p) => p.type == type);
|
|
}
|
|
}
|