feat(balance): 레벨 기반 장비 손실 확률 시스템
- 저레벨 사망 스파이럴 방지 - 장비 손실 확률 = (레벨 - 5) * 10% - Lv 1~5: 0% (절대 안전) - Lv 6: 10% - Lv 10: 50% - Lv 15+: 100% - 디버그 로그 추가
This commit is contained in:
@@ -974,40 +974,50 @@ class ProgressService {
|
|||||||
ItemRarity? lostItemRarity;
|
ItemRarity? lostItemRarity;
|
||||||
|
|
||||||
if (!isBossDeath) {
|
if (!isBossDeath) {
|
||||||
// 무기(슬롯 0)를 제외한 장착된 장비 중 1개를 제물로 삭제
|
// 레벨 기반 장비 손실 확률 계산
|
||||||
final equippedNonWeaponSlots = <int>[];
|
// Lv 1~5: 0%, Lv 6: 10%, Lv 10: 50%, Lv 15+: 100%
|
||||||
for (var i = 1; i < Equipment.slotCount; i++) {
|
final level = state.traits.level;
|
||||||
final item = state.equipment.getItemByIndex(i);
|
final lossChancePercent = ((level - 5) * 10).clamp(0, 100);
|
||||||
// 디버그: 장비 슬롯 상태 확인
|
final roll = state.rng.nextInt(100); // 0~99
|
||||||
// ignore: avoid_print
|
final shouldLoseEquipment = roll < lossChancePercent;
|
||||||
print('[Death] Slot $i: "${item.name}" isEmpty=${item.isEmpty}');
|
|
||||||
if (item.isNotEmpty) {
|
|
||||||
equippedNonWeaponSlots.add(i);
|
|
||||||
}
|
|
||||||
}
|
|
||||||
// 디버그: 장착된 슬롯 목록
|
|
||||||
// ignore: avoid_print
|
// ignore: avoid_print
|
||||||
print('[Death] equippedNonWeaponSlots: $equippedNonWeaponSlots');
|
print('[Death] Lv$level lossChance=$lossChancePercent% roll=$roll '
|
||||||
|
'shouldLose=$shouldLoseEquipment');
|
||||||
|
|
||||||
if (equippedNonWeaponSlots.isNotEmpty) {
|
if (shouldLoseEquipment) {
|
||||||
lostCount = 1;
|
// 무기(슬롯 0)를 제외한 장착된 장비 중 1개를 제물로 삭제
|
||||||
// 랜덤하게 1개 슬롯 선택
|
final equippedNonWeaponSlots = <int>[];
|
||||||
final sacrificeIndex =
|
for (var i = 1; i < Equipment.slotCount; i++) {
|
||||||
equippedNonWeaponSlots[state.rng.nextInt(
|
final item = state.equipment.getItemByIndex(i);
|
||||||
equippedNonWeaponSlots.length,
|
if (item.isNotEmpty) {
|
||||||
)];
|
equippedNonWeaponSlots.add(i);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
// 제물로 바칠 아이템 정보 저장
|
if (equippedNonWeaponSlots.isNotEmpty) {
|
||||||
final lostItem = state.equipment.getItemByIndex(sacrificeIndex);
|
lostCount = 1;
|
||||||
lostItemName = lostItem.name;
|
// 랜덤하게 1개 슬롯 선택
|
||||||
lostItemSlot = EquipmentSlot.values[sacrificeIndex];
|
final sacrificeIndex =
|
||||||
lostItemRarity = lostItem.rarity;
|
equippedNonWeaponSlots[state.rng.nextInt(
|
||||||
|
equippedNonWeaponSlots.length,
|
||||||
|
)];
|
||||||
|
|
||||||
// 해당 슬롯을 빈 장비로 교체
|
// 제물로 바칠 아이템 정보 저장
|
||||||
newEquipment = newEquipment.setItemByIndex(
|
final lostItem = state.equipment.getItemByIndex(sacrificeIndex);
|
||||||
sacrificeIndex,
|
lostItemName = lostItem.name;
|
||||||
EquipmentItem.empty(lostItemSlot),
|
lostItemSlot = EquipmentSlot.values[sacrificeIndex];
|
||||||
);
|
lostItemRarity = lostItem.rarity;
|
||||||
|
|
||||||
|
// 해당 슬롯을 빈 장비로 교체
|
||||||
|
newEquipment = newEquipment.setItemByIndex(
|
||||||
|
sacrificeIndex,
|
||||||
|
EquipmentItem.empty(lostItemSlot),
|
||||||
|
);
|
||||||
|
|
||||||
|
// ignore: avoid_print
|
||||||
|
print('[Death] Lost item: $lostItemName (slot: $lostItemSlot)');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
Reference in New Issue
Block a user