feat(core): i18n 및 핵심 로직 개선

- 수익화 관련 텍스트 추가
- item_service 수정
- progress_service 수정
This commit is contained in:
JiWoong Sul
2026-01-16 20:10:36 +09:00
parent c95fb7f4b4
commit c95e4de5a4
3 changed files with 69 additions and 19 deletions

View File

@@ -60,23 +60,26 @@ class ItemService {
// 희귀도 결정
// ============================================================================
/// 희귀도 결정 (레벨 기반 확률)
/// 희귀도 결정 (고정 확률)
///
/// 레벨이 높을수록 희귀한 아이템 확률 증가
/// 확률 분포:
/// - Common: 34%
/// - Uncommon: 40%
/// - Rare: 20%
/// - Epic: 5%
/// - Legendary: 1%
ItemRarity determineRarity(int level) {
final roll = rng.nextInt(100);
final legendaryChance = (level * 0.5).clamp(0, 5).toInt(); // 최대 5%
final epicChance = (level * 1.0).clamp(0, 10).toInt(); // 최대 10%
final rareChance = (level * 2.0).clamp(0, 20).toInt(); // 최대 20%
final uncommonChance = (level * 3.0).clamp(0, 30).toInt(); // 최대 30%
if (roll < legendaryChance) return ItemRarity.legendary;
if (roll < legendaryChance + epicChance) return ItemRarity.epic;
if (roll < legendaryChance + epicChance + rareChance)
return ItemRarity.rare;
if (roll < legendaryChance + epicChance + rareChance + uncommonChance) {
return ItemRarity.uncommon;
}
// Legendary: 0-0 (1%)
if (roll < 1) return ItemRarity.legendary;
// Epic: 1-5 (5%)
if (roll < 6) return ItemRarity.epic;
// Rare: 6-25 (20%)
if (roll < 26) return ItemRarity.rare;
// Uncommon: 26-65 (40%)
if (roll < 66) return ItemRarity.uncommon;
// Common: 66-99 (34%)
return ItemRarity.common;
}

View File

@@ -972,12 +972,16 @@ class ProgressService {
String? lostItemName;
EquipmentSlot? lostItemSlot;
ItemRarity? lostItemRarity;
EquipmentItem? lostEquipmentItem; // 광고 부활 시 복구용
if (!isBossDeath) {
// 레벨 기반 장비 손실 확률 계산
// Lv 1~5: 0%, Lv 6: 10%, Lv 10: 50%, Lv 15+: 100%
// Lv 1: 20%, Lv 5: ~56%, Lv 10+: 100%
// 공식: 20 + (level - 1) * 80 / 9
final level = state.traits.level;
final lossChancePercent = ((level - 5) * 10).clamp(0, 100);
final lossChancePercent = level >= 10
? 100
: (20 + ((level - 1) * 80 ~/ 9)).clamp(0, 100);
final roll = state.rng.nextInt(100); // 0~99
final shouldLoseEquipment = roll < lossChancePercent;
@@ -1004,10 +1008,10 @@ class ProgressService {
)];
// 제물로 바칠 아이템 정보 저장
final lostItem = state.equipment.getItemByIndex(sacrificeIndex);
lostItemName = lostItem.name;
lostEquipmentItem = state.equipment.getItemByIndex(sacrificeIndex);
lostItemName = lostEquipmentItem.name;
lostItemSlot = EquipmentSlot.values[sacrificeIndex];
lostItemRarity = lostItem.rarity;
lostItemRarity = lostEquipmentItem.rarity;
// 해당 슬롯을 빈 장비로 교체
newEquipment = newEquipment.setItemByIndex(
@@ -1029,6 +1033,7 @@ class ProgressService {
lostItemName: lostItemName,
lostItemSlot: lostItemSlot,
lostItemRarity: lostItemRarity,
lostItem: lostEquipmentItem, // 광고 부활 시 복구용
goldAtDeath: state.inventory.gold,
levelAtDeath: state.traits.level,
timestamp: state.skillSystem.elapsedMs,