feat(core): SkillSystemState에 GCD 및 스킬 슬롯 추가
- globalCooldownEndMs: GCD 종료 시점 추적 - globalCooldownDuration: 1500ms 상수 정의 - equippedSkills: 장착된 스킬 슬롯 (SkillSlots) - isGlobalCooldownActive, remainingGlobalCooldown getter - startGlobalCooldown() 메서드 추가
This commit is contained in:
@@ -8,6 +8,7 @@ import 'package:asciineverdie/src/core/model/item_stats.dart';
|
|||||||
import 'package:asciineverdie/src/core/model/monster_grade.dart';
|
import 'package:asciineverdie/src/core/model/monster_grade.dart';
|
||||||
import 'package:asciineverdie/src/core/model/potion.dart';
|
import 'package:asciineverdie/src/core/model/potion.dart';
|
||||||
import 'package:asciineverdie/src/core/model/skill.dart';
|
import 'package:asciineverdie/src/core/model/skill.dart';
|
||||||
|
import 'package:asciineverdie/src/core/model/skill_slots.dart';
|
||||||
import 'package:asciineverdie/src/core/util/deterministic_random.dart';
|
import 'package:asciineverdie/src/core/util/deterministic_random.dart';
|
||||||
|
|
||||||
/// Minimal skeletal state to mirror Progress Quest structures.
|
/// Minimal skeletal state to mirror Progress Quest structures.
|
||||||
@@ -193,14 +194,19 @@ enum DeathCause {
|
|||||||
|
|
||||||
/// 스킬 시스템 상태 (Phase 3)
|
/// 스킬 시스템 상태 (Phase 3)
|
||||||
///
|
///
|
||||||
/// 스킬 쿨타임, 활성 버프, 게임 경과 시간 등을 관리
|
/// 스킬 쿨타임, 활성 버프, 게임 경과 시간, 장착 스킬 등을 관리
|
||||||
class SkillSystemState {
|
class SkillSystemState {
|
||||||
const SkillSystemState({
|
const SkillSystemState({
|
||||||
required this.skillStates,
|
required this.skillStates,
|
||||||
required this.activeBuffs,
|
required this.activeBuffs,
|
||||||
required this.elapsedMs,
|
required this.elapsedMs,
|
||||||
|
this.equippedSkills = const SkillSlots(),
|
||||||
|
this.globalCooldownEndMs = 0,
|
||||||
});
|
});
|
||||||
|
|
||||||
|
/// 글로벌 쿨타임 (GCD) 상수: 1500ms
|
||||||
|
static const int globalCooldownDuration = 1500;
|
||||||
|
|
||||||
/// 스킬별 쿨타임 상태
|
/// 스킬별 쿨타임 상태
|
||||||
final List<SkillState> skillStates;
|
final List<SkillState> skillStates;
|
||||||
|
|
||||||
@@ -210,8 +216,26 @@ class SkillSystemState {
|
|||||||
/// 게임 진행 경과 시간 (밀리초, 스킬 쿨타임 계산용)
|
/// 게임 진행 경과 시간 (밀리초, 스킬 쿨타임 계산용)
|
||||||
final int elapsedMs;
|
final int elapsedMs;
|
||||||
|
|
||||||
factory SkillSystemState.empty() =>
|
/// 장착된 스킬 슬롯 (타입별 제한 있음)
|
||||||
const SkillSystemState(skillStates: [], activeBuffs: [], elapsedMs: 0);
|
final SkillSlots equippedSkills;
|
||||||
|
|
||||||
|
/// 글로벌 쿨타임 종료 시점 (elapsedMs 기준)
|
||||||
|
final int globalCooldownEndMs;
|
||||||
|
|
||||||
|
/// GCD가 활성화 중인지 확인
|
||||||
|
bool get isGlobalCooldownActive => elapsedMs < globalCooldownEndMs;
|
||||||
|
|
||||||
|
/// 남은 GCD 시간 (ms)
|
||||||
|
int get remainingGlobalCooldown =>
|
||||||
|
isGlobalCooldownActive ? globalCooldownEndMs - elapsedMs : 0;
|
||||||
|
|
||||||
|
factory SkillSystemState.empty() => const SkillSystemState(
|
||||||
|
skillStates: [],
|
||||||
|
activeBuffs: [],
|
||||||
|
elapsedMs: 0,
|
||||||
|
equippedSkills: SkillSlots(),
|
||||||
|
globalCooldownEndMs: 0,
|
||||||
|
);
|
||||||
|
|
||||||
/// 특정 스킬 상태 가져오기
|
/// 특정 스킬 상태 가져오기
|
||||||
SkillState? getSkillState(String skillId) {
|
SkillState? getSkillState(String skillId) {
|
||||||
@@ -254,13 +278,22 @@ class SkillSystemState {
|
|||||||
List<SkillState>? skillStates,
|
List<SkillState>? skillStates,
|
||||||
List<ActiveBuff>? activeBuffs,
|
List<ActiveBuff>? activeBuffs,
|
||||||
int? elapsedMs,
|
int? elapsedMs,
|
||||||
|
SkillSlots? equippedSkills,
|
||||||
|
int? globalCooldownEndMs,
|
||||||
}) {
|
}) {
|
||||||
return SkillSystemState(
|
return SkillSystemState(
|
||||||
skillStates: skillStates ?? this.skillStates,
|
skillStates: skillStates ?? this.skillStates,
|
||||||
activeBuffs: activeBuffs ?? this.activeBuffs,
|
activeBuffs: activeBuffs ?? this.activeBuffs,
|
||||||
elapsedMs: elapsedMs ?? this.elapsedMs,
|
elapsedMs: elapsedMs ?? this.elapsedMs,
|
||||||
|
equippedSkills: equippedSkills ?? this.equippedSkills,
|
||||||
|
globalCooldownEndMs: globalCooldownEndMs ?? this.globalCooldownEndMs,
|
||||||
);
|
);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/// GCD 시작 (스킬 사용 후 호출)
|
||||||
|
SkillSystemState startGlobalCooldown() {
|
||||||
|
return copyWith(globalCooldownEndMs: elapsedMs + globalCooldownDuration);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
/// 태스크 타입 (원본 fTask.Caption 값들에 대응)
|
/// 태스크 타입 (원본 fTask.Caption 값들에 대응)
|
||||||
@@ -594,8 +627,11 @@ class Equipment {
|
|||||||
}
|
}
|
||||||
|
|
||||||
/// 초보자 방어구 생성 헬퍼
|
/// 초보자 방어구 생성 헬퍼
|
||||||
static EquipmentItem _starterArmor(String name, EquipmentSlot slot,
|
static EquipmentItem _starterArmor(
|
||||||
{required int def}) {
|
String name,
|
||||||
|
EquipmentSlot slot, {
|
||||||
|
required int def,
|
||||||
|
}) {
|
||||||
return EquipmentItem(
|
return EquipmentItem(
|
||||||
name: name,
|
name: name,
|
||||||
slot: slot,
|
slot: slot,
|
||||||
|
|||||||
Reference in New Issue
Block a user