style: dart format 적용
- 전체 Dart 소스 및 테스트 파일 포매팅 통일 - trailing comma, 줄바꿈, 인덴트 정리
This commit is contained in:
@@ -16,9 +16,7 @@ import 'package:asciineverdie/src/core/util/pq_logic.dart' as pq_logic;
|
||||
///
|
||||
/// ProgressService에서 추출된 Act 완료, 보스 생성 등의 로직 담당.
|
||||
class ActProgressionService {
|
||||
const ActProgressionService({
|
||||
required this.config,
|
||||
});
|
||||
const ActProgressionService({required this.config});
|
||||
|
||||
final PqConfig config;
|
||||
|
||||
|
||||
@@ -64,8 +64,10 @@ class CharacterRollService {
|
||||
_resetUndoForNewSession();
|
||||
|
||||
_isInitialized = true;
|
||||
debugPrint('[CharacterRollService] Initialized: '
|
||||
'rolls=$_rollsRemaining, undo=$_undoRemaining');
|
||||
debugPrint(
|
||||
'[CharacterRollService] Initialized: '
|
||||
'rolls=$_rollsRemaining, undo=$_undoRemaining',
|
||||
);
|
||||
}
|
||||
|
||||
/// 저장된 상태 로드
|
||||
@@ -148,8 +150,10 @@ class CharacterRollService {
|
||||
// - 무료 유저: 1회 (광고 시청 필요)
|
||||
_undoRemaining = _isPaidUser ? maxUndoPaidUser : maxUndoFreeUser;
|
||||
|
||||
debugPrint('[CharacterRollService] Rolled: remaining=$_rollsRemaining, '
|
||||
'history=${_rollHistory.length}, undo=$_undoRemaining');
|
||||
debugPrint(
|
||||
'[CharacterRollService] Rolled: remaining=$_rollsRemaining, '
|
||||
'history=${_rollHistory.length}, undo=$_undoRemaining',
|
||||
);
|
||||
|
||||
return true;
|
||||
}
|
||||
@@ -214,8 +218,10 @@ class CharacterRollService {
|
||||
final snapshot = _rollHistory.removeAt(0);
|
||||
_undoRemaining--;
|
||||
|
||||
debugPrint('[CharacterRollService] Undo (paid): '
|
||||
'remaining=$_undoRemaining, history=${_rollHistory.length}');
|
||||
debugPrint(
|
||||
'[CharacterRollService] Undo (paid): '
|
||||
'remaining=$_undoRemaining, history=${_rollHistory.length}',
|
||||
);
|
||||
|
||||
return snapshot;
|
||||
}
|
||||
@@ -241,8 +247,10 @@ class CharacterRollService {
|
||||
);
|
||||
|
||||
if (adResult == AdResult.completed || adResult == AdResult.debugSkipped) {
|
||||
debugPrint('[CharacterRollService] Undo (free with ad): '
|
||||
'remaining=$_undoRemaining, history=${_rollHistory.length}');
|
||||
debugPrint(
|
||||
'[CharacterRollService] Undo (free with ad): '
|
||||
'remaining=$_undoRemaining, history=${_rollHistory.length}',
|
||||
);
|
||||
return result;
|
||||
}
|
||||
|
||||
|
||||
@@ -12,7 +12,7 @@ import 'package:asciineverdie/src/core/util/deterministic_random.dart';
|
||||
/// 상자 내용물 생성 및 오픈 로직 담당
|
||||
class ChestService {
|
||||
ChestService({DeterministicRandom? rng})
|
||||
: _rng = rng ?? DeterministicRandom(DateTime.now().millisecondsSinceEpoch);
|
||||
: _rng = rng ?? DeterministicRandom(DateTime.now().millisecondsSinceEpoch);
|
||||
|
||||
final DeterministicRandom _rng;
|
||||
|
||||
@@ -100,7 +100,9 @@ class ChestService {
|
||||
rarity: rarity,
|
||||
);
|
||||
|
||||
debugPrint('[ChestService] Equipment reward: ${item.name} (${rarity.name})');
|
||||
debugPrint(
|
||||
'[ChestService] Equipment reward: ${item.name} (${rarity.name})',
|
||||
);
|
||||
return ChestReward.equipment(item);
|
||||
}
|
||||
|
||||
@@ -132,7 +134,10 @@ class ChestService {
|
||||
ChestReward _generateGoldReward(int playerLevel) {
|
||||
final baseGold = playerLevel * _goldPerLevel;
|
||||
final variance = _rng.nextInt(_goldVariance * 2 + 1) - _goldVariance;
|
||||
final gold = (baseGold + (baseGold * variance / 100)).round().clamp(10, 99999);
|
||||
final gold = (baseGold + (baseGold * variance / 100)).round().clamp(
|
||||
10,
|
||||
99999,
|
||||
);
|
||||
|
||||
debugPrint('[ChestService] Gold reward: $gold');
|
||||
return ChestReward.gold(gold);
|
||||
@@ -142,7 +147,10 @@ class ChestService {
|
||||
ChestReward _generateExperienceReward(int playerLevel) {
|
||||
final baseExp = playerLevel * _expPerLevel;
|
||||
final variance = _rng.nextInt(_expVariance * 2 + 1) - _expVariance;
|
||||
final exp = (baseExp + (baseExp * variance / 100)).round().clamp(10, 999999);
|
||||
final exp = (baseExp + (baseExp * variance / 100)).round().clamp(
|
||||
10,
|
||||
999999,
|
||||
);
|
||||
|
||||
debugPrint('[ChestService] Experience reward: $exp');
|
||||
return ChestReward.experience(exp);
|
||||
@@ -208,49 +216,49 @@ class ChestService {
|
||||
|
||||
return switch (slot) {
|
||||
EquipmentSlot.weapon => ItemStats(
|
||||
atk: baseValue * 2,
|
||||
criRate: 0.01 * (level ~/ 5),
|
||||
parryRate: 0.005 * level,
|
||||
),
|
||||
atk: baseValue * 2,
|
||||
criRate: 0.01 * (level ~/ 5),
|
||||
parryRate: 0.005 * level,
|
||||
),
|
||||
EquipmentSlot.shield => ItemStats(
|
||||
def: baseValue,
|
||||
blockRate: 0.02 * (level ~/ 3).clamp(1, 10),
|
||||
),
|
||||
def: baseValue,
|
||||
blockRate: 0.02 * (level ~/ 3).clamp(1, 10),
|
||||
),
|
||||
EquipmentSlot.helm => ItemStats(
|
||||
def: baseValue ~/ 2,
|
||||
magDef: baseValue ~/ 2,
|
||||
intBonus: level ~/ 10,
|
||||
),
|
||||
def: baseValue ~/ 2,
|
||||
magDef: baseValue ~/ 2,
|
||||
intBonus: level ~/ 10,
|
||||
),
|
||||
EquipmentSlot.hauberk => ItemStats(def: baseValue, hpBonus: level * 2),
|
||||
EquipmentSlot.brassairts => ItemStats(
|
||||
def: baseValue ~/ 2,
|
||||
strBonus: level ~/ 15,
|
||||
),
|
||||
def: baseValue ~/ 2,
|
||||
strBonus: level ~/ 15,
|
||||
),
|
||||
EquipmentSlot.vambraces => ItemStats(
|
||||
def: baseValue ~/ 2,
|
||||
dexBonus: level ~/ 15,
|
||||
),
|
||||
def: baseValue ~/ 2,
|
||||
dexBonus: level ~/ 15,
|
||||
),
|
||||
EquipmentSlot.gauntlets => ItemStats(
|
||||
atk: baseValue ~/ 2,
|
||||
def: baseValue ~/ 4,
|
||||
),
|
||||
atk: baseValue ~/ 2,
|
||||
def: baseValue ~/ 4,
|
||||
),
|
||||
EquipmentSlot.gambeson => ItemStats(
|
||||
def: baseValue ~/ 2,
|
||||
conBonus: level ~/ 15,
|
||||
),
|
||||
def: baseValue ~/ 2,
|
||||
conBonus: level ~/ 15,
|
||||
),
|
||||
EquipmentSlot.cuisses => ItemStats(
|
||||
def: baseValue ~/ 2,
|
||||
evasion: 0.005 * level,
|
||||
),
|
||||
def: baseValue ~/ 2,
|
||||
evasion: 0.005 * level,
|
||||
),
|
||||
EquipmentSlot.greaves => ItemStats(
|
||||
def: baseValue ~/ 2,
|
||||
evasion: 0.003 * level,
|
||||
),
|
||||
def: baseValue ~/ 2,
|
||||
evasion: 0.003 * level,
|
||||
),
|
||||
EquipmentSlot.sollerets => ItemStats(
|
||||
def: baseValue ~/ 3,
|
||||
evasion: 0.002 * level,
|
||||
dexBonus: level ~/ 20,
|
||||
),
|
||||
def: baseValue ~/ 3,
|
||||
evasion: 0.002 * level,
|
||||
dexBonus: level ~/ 20,
|
||||
),
|
||||
};
|
||||
}
|
||||
|
||||
|
||||
@@ -210,7 +210,8 @@ class CombatTickService {
|
||||
MonsterCombatStats monsterStats,
|
||||
int totalDamageDealt,
|
||||
List<CombatEvent> events,
|
||||
}) _processDotTicks({
|
||||
})
|
||||
_processDotTicks({
|
||||
required List<DotEffect> activeDoTs,
|
||||
required MonsterCombatStats monsterStats,
|
||||
required int elapsedMs,
|
||||
@@ -272,7 +273,8 @@ class CombatTickService {
|
||||
int lastPotionUsedMs,
|
||||
PotionInventory potionInventory,
|
||||
List<CombatEvent> events,
|
||||
})? _tryEmergencyPotion({
|
||||
})?
|
||||
_tryEmergencyPotion({
|
||||
required CombatStats playerStats,
|
||||
required PotionInventory potionInventory,
|
||||
required int lastPotionUsedMs,
|
||||
@@ -371,7 +373,8 @@ class CombatTickService {
|
||||
int totalDamageDealt,
|
||||
List<CombatEvent> events,
|
||||
bool isFirstPlayerAttack,
|
||||
}) _processPlayerAttack({
|
||||
})
|
||||
_processPlayerAttack({
|
||||
required GameState state,
|
||||
required CombatStats playerStats,
|
||||
required MonsterCombatStats monsterStats,
|
||||
@@ -508,10 +511,13 @@ class CombatTickService {
|
||||
newSkillSystem = skillResult.updatedSkillSystem.startGlobalCooldown();
|
||||
|
||||
if (skillResult.debuffEffect != null) {
|
||||
newActiveBuffs = newActiveBuffs
|
||||
.where((d) => d.effect.id != skillResult.debuffEffect!.effect.id)
|
||||
.toList()
|
||||
..add(skillResult.debuffEffect!);
|
||||
newActiveBuffs =
|
||||
newActiveBuffs
|
||||
.where(
|
||||
(d) => d.effect.id != skillResult.debuffEffect!.effect.id,
|
||||
)
|
||||
.toList()
|
||||
..add(skillResult.debuffEffect!);
|
||||
}
|
||||
|
||||
events.add(
|
||||
@@ -601,11 +607,8 @@ class CombatTickService {
|
||||
}
|
||||
|
||||
/// 몬스터 공격 처리
|
||||
({
|
||||
CombatStats playerStats,
|
||||
int totalDamageTaken,
|
||||
List<CombatEvent> events,
|
||||
}) _processMonsterAttack({
|
||||
({CombatStats playerStats, int totalDamageTaken, List<CombatEvent> events})
|
||||
_processMonsterAttack({
|
||||
required CombatStats playerStats,
|
||||
required MonsterCombatStats monsterStats,
|
||||
required List<ActiveBuff> activeDebuffs,
|
||||
|
||||
@@ -131,9 +131,7 @@ class IAPService {
|
||||
final response = await _iap.queryProductDetails(IAPProductIds.all);
|
||||
|
||||
if (response.notFoundIDs.isNotEmpty) {
|
||||
debugPrint(
|
||||
'[IAPService] Products not found: ${response.notFoundIDs}',
|
||||
);
|
||||
debugPrint('[IAPService] Products not found: ${response.notFoundIDs}');
|
||||
}
|
||||
|
||||
for (final product in response.productDetails) {
|
||||
@@ -238,14 +236,10 @@ class IAPService {
|
||||
}
|
||||
|
||||
// 구매 요청
|
||||
final purchaseParam = PurchaseParam(
|
||||
productDetails: _removeAdsProduct!,
|
||||
);
|
||||
final purchaseParam = PurchaseParam(productDetails: _removeAdsProduct!);
|
||||
|
||||
try {
|
||||
final success = await _iap.buyNonConsumable(
|
||||
purchaseParam: purchaseParam,
|
||||
);
|
||||
final success = await _iap.buyNonConsumable(purchaseParam: purchaseParam);
|
||||
debugPrint('[IAPService] Purchase initiated: $success');
|
||||
return success ? IAPResult.success : IAPResult.failed;
|
||||
} catch (e) {
|
||||
|
||||
@@ -164,8 +164,9 @@ class ItemService {
|
||||
final magDef = hasMagDef ? (def * 0.7).round() : 0;
|
||||
|
||||
// HP 보너스 (Uncommon 이상)
|
||||
final hpBonus =
|
||||
rarity.index >= ItemRarity.uncommon.index ? baseValue ~/ 3 : 0;
|
||||
final hpBonus = rarity.index >= ItemRarity.uncommon.index
|
||||
? baseValue ~/ 3
|
||||
: 0;
|
||||
|
||||
// CON 보너스 (Rare 이상)
|
||||
final conBonus = rarity.index >= ItemRarity.rare.index ? rarity.index : 0;
|
||||
@@ -273,8 +274,7 @@ class ItemService {
|
||||
EquipmentSlot.greaves => ItemStats(
|
||||
def: def,
|
||||
hpBonus: rarity.index >= ItemRarity.rare.index ? baseValue ~/ 3 : 0,
|
||||
conBonus:
|
||||
rarity.index >= ItemRarity.rare.index ? rarity.index - 1 : 0,
|
||||
conBonus: rarity.index >= ItemRarity.rare.index ? rarity.index - 1 : 0,
|
||||
evasion: rarity.index >= ItemRarity.epic.index ? 0.01 : 0.0,
|
||||
),
|
||||
|
||||
|
||||
@@ -9,10 +9,7 @@ import 'package:asciineverdie/src/core/util/pq_logic.dart' as pq_logic;
|
||||
|
||||
/// 판매 처리 결과
|
||||
class SellResult {
|
||||
const SellResult({
|
||||
required this.state,
|
||||
required this.continuesSelling,
|
||||
});
|
||||
const SellResult({required this.state, required this.continuesSelling});
|
||||
|
||||
final GameState state;
|
||||
final bool continuesSelling;
|
||||
|
||||
@@ -193,7 +193,11 @@ class ProgressService {
|
||||
}
|
||||
|
||||
// 5. 시장/판매/구매 태스크 완료 처리
|
||||
final marketResult = _handleMarketTaskCompletion(nextState, progress, queue);
|
||||
final marketResult = _handleMarketTaskCompletion(
|
||||
nextState,
|
||||
progress,
|
||||
queue,
|
||||
);
|
||||
if (marketResult.earlyReturn != null) return marketResult.earlyReturn!;
|
||||
nextState = marketResult.state;
|
||||
progress = marketResult.progress;
|
||||
@@ -209,7 +213,11 @@ class ProgressService {
|
||||
|
||||
// 7. 퀘스트 진행 처리
|
||||
final questResult = _handleQuestProgress(
|
||||
nextState, progress, queue, gain, incrementSeconds,
|
||||
nextState,
|
||||
progress,
|
||||
queue,
|
||||
gain,
|
||||
incrementSeconds,
|
||||
);
|
||||
nextState = questResult.state;
|
||||
progress = questResult.progress;
|
||||
@@ -217,9 +225,7 @@ class ProgressService {
|
||||
questDone = questResult.completed;
|
||||
|
||||
// 8. 플롯 진행 및 Act Boss 소환 처리
|
||||
progress = _handlePlotProgress(
|
||||
nextState, progress, gain, incrementSeconds,
|
||||
);
|
||||
progress = _handlePlotProgress(nextState, progress, gain, incrementSeconds);
|
||||
|
||||
// 9. 다음 태스크 디큐/생성
|
||||
final dequeueResult = _handleTaskDequeue(nextState, progress, queue);
|
||||
@@ -341,7 +347,8 @@ class ProgressService {
|
||||
ProgressState progress,
|
||||
QueueState queue,
|
||||
ProgressTickResult? earlyReturn,
|
||||
}) _handleKillTaskCompletion(
|
||||
})
|
||||
_handleKillTaskCompletion(
|
||||
GameState state,
|
||||
ProgressState progress,
|
||||
QueueState queue,
|
||||
@@ -358,8 +365,9 @@ class ProgressService {
|
||||
|
||||
final klass = ClassData.findById(nextState.traits.classId);
|
||||
if (klass != null) {
|
||||
final postCombatHealRate =
|
||||
klass.getPassiveValue(ClassPassiveType.postCombatHeal);
|
||||
final postCombatHealRate = klass.getPassiveValue(
|
||||
ClassPassiveType.postCombatHeal,
|
||||
);
|
||||
if (postCombatHealRate > 0) {
|
||||
healAmount += (maxHp * postCombatHealRate).round();
|
||||
}
|
||||
@@ -446,7 +454,8 @@ class ProgressService {
|
||||
ProgressState progress,
|
||||
QueueState queue,
|
||||
ProgressTickResult? earlyReturn,
|
||||
}) _handleMarketTaskCompletion(
|
||||
})
|
||||
_handleMarketTaskCompletion(
|
||||
GameState state,
|
||||
ProgressState progress,
|
||||
QueueState queue,
|
||||
@@ -520,12 +529,8 @@ class ProgressService {
|
||||
}
|
||||
|
||||
/// 퀘스트 진행 처리
|
||||
({
|
||||
GameState state,
|
||||
ProgressState progress,
|
||||
QueueState queue,
|
||||
bool completed,
|
||||
}) _handleQuestProgress(
|
||||
({GameState state, ProgressState progress, QueueState queue, bool completed})
|
||||
_handleQuestProgress(
|
||||
GameState state,
|
||||
ProgressState progress,
|
||||
QueueState queue,
|
||||
@@ -603,7 +608,8 @@ class ProgressService {
|
||||
QueueState queue,
|
||||
bool actDone,
|
||||
bool gameComplete,
|
||||
}) _handleTaskDequeue(
|
||||
})
|
||||
_handleTaskDequeue(
|
||||
GameState state,
|
||||
ProgressState progress,
|
||||
QueueState queue,
|
||||
@@ -705,10 +711,7 @@ class ProgressService {
|
||||
4 * 1000,
|
||||
);
|
||||
final updatedProgress = taskResult.progress.copyWith(
|
||||
currentTask: TaskInfo(
|
||||
caption: taskResult.caption,
|
||||
type: TaskType.market,
|
||||
),
|
||||
currentTask: TaskInfo(caption: taskResult.caption, type: TaskType.market),
|
||||
currentCombat: null,
|
||||
);
|
||||
return (progress: updatedProgress, queue: queue);
|
||||
@@ -1171,8 +1174,10 @@ class ProgressService {
|
||||
final shouldLoseEquipment = roll < lossChancePercent;
|
||||
|
||||
// ignore: avoid_print
|
||||
print('[Death] Lv$level lossChance=$lossChancePercent% roll=$roll '
|
||||
'shouldLose=$shouldLoseEquipment');
|
||||
print(
|
||||
'[Death] Lv$level lossChance=$lossChancePercent% roll=$roll '
|
||||
'shouldLose=$shouldLoseEquipment',
|
||||
);
|
||||
|
||||
if (shouldLoseEquipment) {
|
||||
// 무기(슬롯 0)를 제외한 장착된 장비 중 1개를 제물로 삭제
|
||||
|
||||
@@ -346,7 +346,10 @@ class ResurrectionService {
|
||||
|
||||
// 해당 슬롯에 아이템 복원
|
||||
final slotIndex = lostSlot.index;
|
||||
final updatedEquipment = state.equipment.setItemByIndex(slotIndex, lostItem);
|
||||
final updatedEquipment = state.equipment.setItemByIndex(
|
||||
slotIndex,
|
||||
lostItem,
|
||||
);
|
||||
|
||||
// DeathInfo에서 상실 아이템 정보 제거 (복구 완료)
|
||||
final updatedDeathInfo = deathInfo.copyWith(
|
||||
|
||||
@@ -94,8 +94,10 @@ class ReturnRewardsService {
|
||||
// 보너스 상자 (광고 시청 시 동일 개수 추가)
|
||||
final bonusChestCount = chestCount;
|
||||
|
||||
debugPrint('[ReturnRewards] $hoursAway hours away, '
|
||||
'chests=$chestCount, bonus=$bonusChestCount, paid=$isPaidUser');
|
||||
debugPrint(
|
||||
'[ReturnRewards] $hoursAway hours away, '
|
||||
'chests=$chestCount, bonus=$bonusChestCount, paid=$isPaidUser',
|
||||
);
|
||||
|
||||
return ReturnChestReward(
|
||||
hoursAway: hoursAway,
|
||||
@@ -125,9 +127,14 @@ class ReturnRewardsService {
|
||||
/// [reward] 복귀 보상 데이터
|
||||
/// [playerLevel] 플레이어 레벨
|
||||
/// Returns: 오픈된 상자 보상 목록
|
||||
List<ChestReward> claimBasicReward(ReturnChestReward reward, int playerLevel) {
|
||||
List<ChestReward> claimBasicReward(
|
||||
ReturnChestReward reward,
|
||||
int playerLevel,
|
||||
) {
|
||||
if (!reward.hasReward) return [];
|
||||
debugPrint('[ReturnRewards] Basic reward claimed: ${reward.chestCount} chests');
|
||||
debugPrint(
|
||||
'[ReturnRewards] Basic reward claimed: ${reward.chestCount} chests',
|
||||
);
|
||||
return openChests(reward.chestCount, playerLevel);
|
||||
}
|
||||
|
||||
@@ -146,8 +153,10 @@ class ReturnRewardsService {
|
||||
|
||||
// 유료 유저는 무료 보너스
|
||||
if (IAPService.instance.isAdRemovalPurchased) {
|
||||
debugPrint('[ReturnRewards] Bonus claimed (paid user): '
|
||||
'${reward.bonusChestCount} chests');
|
||||
debugPrint(
|
||||
'[ReturnRewards] Bonus claimed (paid user): '
|
||||
'${reward.bonusChestCount} chests',
|
||||
);
|
||||
return openChests(reward.bonusChestCount, playerLevel);
|
||||
}
|
||||
|
||||
@@ -161,8 +170,10 @@ class ReturnRewardsService {
|
||||
);
|
||||
|
||||
if (adResult == AdResult.completed || adResult == AdResult.debugSkipped) {
|
||||
debugPrint('[ReturnRewards] Bonus claimed (free user with ad): '
|
||||
'${bonusRewards.length} chests');
|
||||
debugPrint(
|
||||
'[ReturnRewards] Bonus claimed (free user with ad): '
|
||||
'${bonusRewards.length} chests',
|
||||
);
|
||||
return bonusRewards;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user