refactor(core): 밸런스 상수 및 진행 서비스 개선
- BalanceConstants 정리 - ProgressService 로직 개선
This commit is contained in:
@@ -104,7 +104,8 @@ class ProgressService {
|
||||
);
|
||||
|
||||
// ExpBar 초기화 (원본 743-746줄)
|
||||
final expBar = ProgressBarState(position: 0, max: pq_logic.levelUpTime(1));
|
||||
final expBar =
|
||||
ProgressBarState(position: 0, max: ExpConstants.requiredExp(1));
|
||||
|
||||
// PlotBar 초기화 - Prologue 5분 (300초)
|
||||
final plotBar = const ProgressBarState(position: 0, max: 300);
|
||||
@@ -253,6 +254,10 @@ class ProgressService {
|
||||
final gain = progress.currentTask.type == TaskType.kill;
|
||||
final incrementSeconds = progress.task.max ~/ 1000;
|
||||
|
||||
// 몬스터 경험치 미리 저장 (currentCombat이 null되기 전)
|
||||
final int monsterExpReward =
|
||||
progress.currentCombat?.monsterStats.expReward ?? 0;
|
||||
|
||||
// 킬 태스크 완료 시 전투 결과 반영 및 전리품 획득
|
||||
if (gain) {
|
||||
// 전투 결과에 따라 플레이어 HP 업데이트 + 전투 후 회복
|
||||
@@ -354,19 +359,26 @@ class ProgressService {
|
||||
}
|
||||
}
|
||||
|
||||
// Gain XP / level up.
|
||||
// Gain XP / level up (몬스터 경험치 기반)
|
||||
// 최대 레벨(100) 제한: 100레벨에서는 더 이상 레벨업하지 않음
|
||||
if (gain) {
|
||||
if (progress.exp.position >= progress.exp.max &&
|
||||
nextState.traits.level < 100) {
|
||||
if (gain && nextState.traits.level < 100 && monsterExpReward > 0) {
|
||||
final newExpPos = progress.exp.position + monsterExpReward;
|
||||
|
||||
// 레벨업 체크 (경험치가 필요량 이상일 때)
|
||||
if (newExpPos >= progress.exp.max) {
|
||||
// 초과 경험치 계산
|
||||
final overflowExp = newExpPos - progress.exp.max;
|
||||
nextState = _levelUp(nextState);
|
||||
leveledUp = true;
|
||||
progress = nextState.progress;
|
||||
} else if (nextState.traits.level < 100) {
|
||||
final uncappedExp = progress.exp.position + incrementSeconds;
|
||||
final int newExpPos = uncappedExp > progress.exp.max
|
||||
? progress.exp.max
|
||||
: uncappedExp;
|
||||
|
||||
// 초과 경험치를 다음 레벨에 적용
|
||||
if (overflowExp > 0 && nextState.traits.level < 100) {
|
||||
progress = progress.copyWith(
|
||||
exp: progress.exp.copyWith(position: overflowExp),
|
||||
);
|
||||
}
|
||||
} else {
|
||||
progress = progress.copyWith(
|
||||
exp: progress.exp.copyWith(position: newExpPos),
|
||||
);
|
||||
@@ -870,15 +882,18 @@ class ProgressService {
|
||||
nextState = _levelUp(nextState);
|
||||
}
|
||||
|
||||
final progress = nextState.progress.copyWith(
|
||||
// 태스크 바 완료 처리
|
||||
var progress = nextState.progress.copyWith(
|
||||
task: nextState.progress.task.copyWith(
|
||||
position: nextState.progress.task.max,
|
||||
),
|
||||
plot: nextState.progress.plot.copyWith(
|
||||
position: nextState.progress.plot.max,
|
||||
),
|
||||
);
|
||||
return nextState.copyWith(progress: progress);
|
||||
nextState = nextState.copyWith(progress: progress);
|
||||
|
||||
// 디버그 모드에서는 completeAct 직접 호출하여 plotStageCount 즉시 업데이트
|
||||
// 시네마틱은 생략하고 바로 다음 Act로 진입
|
||||
final actResult = completeAct(nextState);
|
||||
return actResult.state;
|
||||
}
|
||||
|
||||
GameState _applyReward(GameState state, pq_logic.RewardKind reward) {
|
||||
@@ -912,7 +927,7 @@ class ProgressService {
|
||||
|
||||
final expBar = ProgressBarState(
|
||||
position: 0,
|
||||
max: pq_logic.levelUpTime(nextLevel),
|
||||
max: ExpConstants.requiredExp(nextLevel),
|
||||
);
|
||||
final progress = nextState.progress.copyWith(exp: expBar);
|
||||
nextState = nextState.copyWith(progress: progress);
|
||||
|
||||
Reference in New Issue
Block a user