ThreeKingdomsSlingshot/Assets/Scripts/OutGame/Data/GoodsDb.cs

113 lines
4.3 KiB
C#
Raw Normal View History

컨텐츠별 재화 배치 — 보물 상자 등급 확률 · 하드 난이도 · 등용권 · 상점 · 탑 소탕 · 영입 · 떠돌이 상인(PD 2026-11-24 「커밋 푸시 해」) 1차 · 2차(개발 요청서 「재화배치」 §1 ~ §3) - 새 표 chest_drop · chest_loot · hard_mode · hero_unlock(자산 GoodsDb) · medal_shop - 보물 상자 = 수급처별 등급 확률 + 내용 줄(운철 · 도면 · 보옥 · 진영 비서) · 스킬서 폐기 - 임무 · 보급전 · 투기장 · 토벌전 · 연의 전기 · 순찰 보상 교체 · 출정 첫 클리어 보옥 0 - 메달 · 훈장 상점(진영 비서 · 불멸 장비) · 출정 하드 난이도 · 영웅 조각 영입(40 · 50 · 60) · 탑 층 추가 보상 · 소탕 PD 2차 결정(요청서 §6) - 등용 포인트 삭제 · 「등용권」(구 뽑기권) · 중복 영웅 = 그 영웅 조각을 영입 수만큼(hero_unlock) - 천장 = 픽업 배너는 픽업 영웅 확정(gacha pity_pickup_featured) · 상시 배너 하루 1회 무료(픽업 제외) - 하드 하루 횟수 = 클리어했을 때만 차감 · 하드 월드맵 색 필터(밤) + 장 이름 띠 「· 하드」(UI/worldmap_hard) - 떠돌이 상인 = 영웅 조각을 날마다 칸별 확률로(★1 · ★2 골드 · ★3 보옥 · wander_shop · WanderRules) - 거래 > 보물 상자의 획득처 문구 정리 테스트: GoodsTests 19 · RecruitTests 9 · AwakenTests 6 · MissionTests 8 · GachaCutsceneTests 4 통과 서버 모드: 하드 · 메달 상점 · 탑 소탕 · 영입 · 떠돌이 상인은 막음(서버 규칙 없음) Co-Authored-By: Claude Fable 5.2 <noreply@anthropic.com>
2026-11-24 00:41:12 +00:00
using System;
using System.Collections.Generic;
using UnityEngine;
namespace TKS.OutGame
{
/// <summary>
/// 컨텐츠별 재화 배치 표 4장(PD 2026-11-24 · 개발 요청서 「재화배치」 §1) — chest_drop(수급처 × 구간별 보물 상자 등급 가중치) ·
/// chest_loot(상자 등급별 더해지는 내용 줄) · hard_mode(장별 출정 하드 난이도) · hero_unlock(태생 ★ → 영입 조각).
/// 임포트 = TKS/Import OutGame Data(OutGameTables.Goods.cs · 참조 오류가 있으면 자산 불변) · 규칙 = GoodsRules.
/// </summary>
public class GoodsDb : ScriptableObject
{
/// <summary>상자가 나왔을 때의 등급 가중치 한 줄(s_source · n_from~n_to 구간 · f_&lt;상자 id&gt; 칸).</summary>
[Serializable]
public class ChestDrop
{
public string source = "";
public int from;
public int to;
public string[] chests = new string[0];
public float[] weights = new float[0];
}
/// <summary>상자를 열 때 더해지는 내용 한 줄(확률 % · 수량 범위) — 보물 굴림 · 골드는 chests 표 그대로.</summary>
[Serializable]
public class ChestLoot
{
public string chest = "";
public string item = "";
public float pct;
public int min;
public int max;
}
/// <summary>출정 하드 난이도 한 장(등급 가중치 · 군량 · 스테이지당 하루 횟수 · 적 능력치 배율 · 골드 · 경험 배율 · 보스 조각 % · 보물 상자 %).</summary>
[Serializable]
public class HardMode
{
public int chapter;
public string[] grades = new string[0];
public float[] weights = new float[0];
public int stamina;
public int staminaBoss;
public int dailyPerStage;
public float enemyMult = 1f;
public float goldExpMult = 1f;
public float bossShardPct;
public float chestPct;
}
[Serializable]
public class HeroUnlock
{
public int rarity;
public int shards;
}
public const string SourceStage = "stage_normal";
public const string SourceHard = "stage_hard";
public const string SourcePatrol = "patrol";
public const string SourceBandit = "bandit";
public static readonly string[] Sources = { SourceStage, SourceHard, SourcePatrol, SourceBandit };
public List<ChestDrop> chestDrops = new List<ChestDrop>();
public List<ChestLoot> chestLoots = new List<ChestLoot>();
public List<HardMode> hardModes = new List<HardMode>();
public List<HeroUnlock> heroUnlocks = new List<HeroUnlock>();
/// <summary>그 수급처 · 구간(장 또는 단계)의 등급 줄 — 구간 밖이면 가장 가까운 줄(표 끝을 넘는 장 = 마지막 구간) · 수급처가 없으면 null.</summary>
public ChestDrop DropFor(string source, int band)
{
ChestDrop best = null;
int bestGap = int.MaxValue;
foreach (var c in chestDrops)
{
if (c.source != source) continue;
int gap = band < c.from ? c.from - band : band > c.to ? band - c.to : 0;
if (gap < bestGap)
{
bestGap = gap;
best = c;
}
}
return best;
}
public List<ChestLoot> LootOf(string chest)
{
var res = new List<ChestLoot>();
foreach (var l in chestLoots)
if (l.chest == chest) res.Add(l);
return res;
}
/// <summary>그 장의 하드 난이도 줄(없으면 null = 하드 없음).</summary>
public HardMode HardFor(int chapter)
{
foreach (var h in hardModes)
if (h.chapter == chapter) return h;
return null;
}
/// <summary>태생 ★ 영웅을 조각으로 영입하는 데 드는 조각(표에 없으면 0 = 영입 불가).</summary>
public int UnlockShards(int rarity)
{
foreach (var u in heroUnlocks)
if (u.rarity == rarity) return u.shards;
return 0;
}
}
}