feat(engine): GCD 체크 및 스킬 자동 장착 로직 구현

SkillService:
- canUseSkill()에 GCD 체크 추가
- selectAutoSkill() 확률 조정 (70% 일반공격, 30% 스킬)
- 버프/디버프 조건 강화 (HP>80%, 활성 효과 체크)

ProgressService:
- 스킬 사용 후 GCD 시작 로직 추가
- 장착된 스킬 슬롯에서 사용 가능 스킬 조회
- 비전투 태스크 시 currentCombat 초기화

GameMutations:
- winSpell()에서 스펠 획득 시 전투 스킬 자동 장착
This commit is contained in:
JiWoong Sul
2026-01-14 23:04:38 +09:00
parent c0d32b1c87
commit 02d4d1d397
3 changed files with 83 additions and 28 deletions

View File

@@ -512,6 +512,7 @@ class ProgressService {
caption: taskResult.caption,
type: TaskType.market,
),
currentCombat: null, // 비전투 태스크이므로 전투 상태 초기화
);
return (progress: progress, queue: queue);
}
@@ -536,6 +537,7 @@ class ProgressService {
caption: taskResult.caption,
type: TaskType.buying,
),
currentCombat: null, // 비전투 태스크이므로 전투 상태 초기화
);
return (progress: progress, queue: queue);
}
@@ -551,6 +553,7 @@ class ProgressService {
caption: taskResult.caption,
type: TaskType.neutral,
),
currentCombat: null, // 비전투 태스크이므로 전투 상태 초기화
);
return (progress: progress, queue: queue);
}
@@ -672,7 +675,7 @@ class ProgressService {
type: TaskType.kill,
monsterBaseName: monsterResult.baseName,
monsterPart: monsterResult.part,
monsterLevel: monsterResult.level,
monsterLevel: effectiveMonsterLevel,
monsterGrade: monsterResult.grade,
),
currentCombat: combatState,
@@ -1205,6 +1208,7 @@ class ProgressService {
);
final progress = taskResult.progress.copyWith(
currentTask: TaskInfo(caption: taskResult.caption, type: TaskType.sell),
currentCombat: null, // 비전투 태스크이므로 전투 상태 초기화
);
return (
state: state.copyWith(
@@ -1358,11 +1362,11 @@ class ProgressService {
// 플레이어 공격 체크
if (playerAccumulator >= playerStats.attackDelayMs) {
// SkillBook에서 사용 가능한 스킬 ID 목록 조회
var availableSkillIds = skillService.getAvailableSkillIdsFromSkillBook(
state.skillBook,
);
// SkillBook에 스킬이 없으면 기본 스킬 사용
// 장착된 스킬 슬롯에서 사용 가능한 스킬 ID 목록 조회
var availableSkillIds = state.skillSystem.equippedSkills.allSkills
.map((s) => s.id)
.toList();
// 장착된 스킬이 없으면 기본 스킬 사용
if (availableSkillIds.isEmpty) {
availableSkillIds = SkillData.defaultSkillIds;
}
@@ -1395,6 +1399,9 @@ class ProgressService {
totalDamageDealt += skillResult.result.damage;
updatedSkillSystem = skillResult.updatedSkillSystem;
// GCD 시작 (스킬 사용 후)
updatedSkillSystem = updatedSkillSystem.startGlobalCooldown();
// 스킬 공격 이벤트 생성
newEvents.add(
CombatEvent.playerSkill(
@@ -1417,6 +1424,9 @@ class ProgressService {
playerStats = skillResult.updatedPlayer;
updatedSkillSystem = skillResult.updatedSkillSystem;
// GCD 시작 (스킬 사용 후)
updatedSkillSystem = updatedSkillSystem.startGlobalCooldown();
// DOT 효과 추가
if (skillResult.dotEffect != null) {
activeDoTs.add(skillResult.dotEffect!);
@@ -1442,6 +1452,9 @@ class ProgressService {
playerStats = skillResult.updatedPlayer;
updatedSkillSystem = skillResult.updatedSkillSystem;
// GCD 시작 (스킬 사용 후)
updatedSkillSystem = updatedSkillSystem.startGlobalCooldown();
// 회복 이벤트 생성
newEvents.add(
CombatEvent.playerHeal(
@@ -1460,6 +1473,9 @@ class ProgressService {
playerStats = skillResult.updatedPlayer;
updatedSkillSystem = skillResult.updatedSkillSystem;
// GCD 시작 (스킬 사용 후)
updatedSkillSystem = updatedSkillSystem.startGlobalCooldown();
// 버프 이벤트 생성
newEvents.add(
CombatEvent.playerBuff(
@@ -1478,6 +1494,9 @@ class ProgressService {
playerStats = skillResult.updatedPlayer;
updatedSkillSystem = skillResult.updatedSkillSystem;
// GCD 시작 (스킬 사용 후)
updatedSkillSystem = updatedSkillSystem.startGlobalCooldown();
// 디버프 효과 추가 (기존 같은 디버프 제거 후)
if (skillResult.debuffEffect != null) {
activeDebuffs =
@@ -1708,8 +1727,10 @@ class ProgressService {
if (equippedNonWeaponSlots.isNotEmpty) {
lostCount = 1;
// 랜덤하게 1개 슬롯 선택
final sacrificeIndex = equippedNonWeaponSlots[
state.rng.nextInt(equippedNonWeaponSlots.length)];
final sacrificeIndex =
equippedNonWeaponSlots[state.rng.nextInt(
equippedNonWeaponSlots.length,
)];
final slot = EquipmentSlot.values[sacrificeIndex];
// 해당 슬롯을 빈 장비로 교체
@@ -1733,7 +1754,8 @@ class ProgressService {
// 보스전 사망 시 5분 레벨링 모드 진입
final bossLevelingEndTime = isBossDeath
? DateTime.now().millisecondsSinceEpoch + (5 * 60 * 1000) // 5분
? DateTime.now().millisecondsSinceEpoch +
(5 * 60 * 1000) // 5분
: null;
// 전투 상태 초기화 및 사망 횟수 증가