From 306715ca265e641cdb13c7f26b178e733be7891a Mon Sep 17 00:00:00 2001 From: JiWoong Sul Date: Fri, 16 Jan 2026 00:17:08 +0900 Subject: [PATCH] =?UTF-8?q?feat(balance):=20=EB=A0=88=EB=B2=A8=20=EA=B8=B0?= =?UTF-8?q?=EB=B0=98=20=EC=9E=A5=EB=B9=84=20=EC=86=90=EC=8B=A4=20=ED=99=95?= =?UTF-8?q?=EB=A5=A0=20=EC=8B=9C=EC=8A=A4=ED=85=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 저레벨 사망 스파이럴 방지 - 장비 손실 확률 = (레벨 - 5) * 10% - Lv 1~5: 0% (절대 안전) - Lv 6: 10% - Lv 10: 50% - Lv 15+: 100% - 디버그 로그 추가 --- lib/src/core/engine/progress_service.dart | 70 +++++++++++++---------- 1 file changed, 40 insertions(+), 30 deletions(-) diff --git a/lib/src/core/engine/progress_service.dart b/lib/src/core/engine/progress_service.dart index 4832f2c..f91a157 100644 --- a/lib/src/core/engine/progress_service.dart +++ b/lib/src/core/engine/progress_service.dart @@ -974,40 +974,50 @@ class ProgressService { ItemRarity? lostItemRarity; if (!isBossDeath) { - // 무기(슬롯 0)를 제외한 장착된 장비 중 1개를 제물로 삭제 - final equippedNonWeaponSlots = []; - for (var i = 1; i < Equipment.slotCount; i++) { - final item = state.equipment.getItemByIndex(i); - // 디버그: 장비 슬롯 상태 확인 - // ignore: avoid_print - print('[Death] Slot $i: "${item.name}" isEmpty=${item.isEmpty}'); - if (item.isNotEmpty) { - equippedNonWeaponSlots.add(i); - } - } - // 디버그: 장착된 슬롯 목록 + // 레벨 기반 장비 손실 확률 계산 + // Lv 1~5: 0%, Lv 6: 10%, Lv 10: 50%, Lv 15+: 100% + final level = state.traits.level; + final lossChancePercent = ((level - 5) * 10).clamp(0, 100); + final roll = state.rng.nextInt(100); // 0~99 + final shouldLoseEquipment = roll < lossChancePercent; + // ignore: avoid_print - print('[Death] equippedNonWeaponSlots: $equippedNonWeaponSlots'); + print('[Death] Lv$level lossChance=$lossChancePercent% roll=$roll ' + 'shouldLose=$shouldLoseEquipment'); - if (equippedNonWeaponSlots.isNotEmpty) { - lostCount = 1; - // 랜덤하게 1개 슬롯 선택 - final sacrificeIndex = - equippedNonWeaponSlots[state.rng.nextInt( - equippedNonWeaponSlots.length, - )]; + if (shouldLoseEquipment) { + // 무기(슬롯 0)를 제외한 장착된 장비 중 1개를 제물로 삭제 + final equippedNonWeaponSlots = []; + for (var i = 1; i < Equipment.slotCount; i++) { + final item = state.equipment.getItemByIndex(i); + if (item.isNotEmpty) { + equippedNonWeaponSlots.add(i); + } + } - // 제물로 바칠 아이템 정보 저장 - final lostItem = state.equipment.getItemByIndex(sacrificeIndex); - lostItemName = lostItem.name; - lostItemSlot = EquipmentSlot.values[sacrificeIndex]; - lostItemRarity = lostItem.rarity; + if (equippedNonWeaponSlots.isNotEmpty) { + lostCount = 1; + // 랜덤하게 1개 슬롯 선택 + final sacrificeIndex = + equippedNonWeaponSlots[state.rng.nextInt( + equippedNonWeaponSlots.length, + )]; - // 해당 슬롯을 빈 장비로 교체 - newEquipment = newEquipment.setItemByIndex( - sacrificeIndex, - EquipmentItem.empty(lostItemSlot), - ); + // 제물로 바칠 아이템 정보 저장 + final lostItem = state.equipment.getItemByIndex(sacrificeIndex); + lostItemName = lostItem.name; + lostItemSlot = EquipmentSlot.values[sacrificeIndex]; + lostItemRarity = lostItem.rarity; + + // 해당 슬롯을 빈 장비로 교체 + newEquipment = newEquipment.setItemByIndex( + sacrificeIndex, + EquipmentItem.empty(lostItemSlot), + ); + + // ignore: avoid_print + print('[Death] Lost item: $lostItemName (slot: $lostItemSlot)'); + } } }