ThreeKingdomsSlingshot/Assets/Scripts/OutGame/Domestic/TrainingTable.cs

69 lines
1.9 KiB
C#
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

using System;
using System.Collections.Generic;
using UnityEngine;
namespace TKS.OutGame
{
/// <summary>내정 훈련(training.csv + training_ranks.csv · 기획서 §7) — 병종 × 항목(hp|atk|def) × Lv 의 골드·누적 % · 랭크(이름 · 랭크 보너스 % · 승급 골드 · 비용 배율).</summary>
public class TrainingTable : ScriptableObject
{
public static readonly string[] Stats = { "hp", "atk", "def" };
[Serializable]
public class Row
{
public UnitType type;
public string stat;
public int lv;
[Tooltip("이 Lv 로 올리는 골드(랭크 1 기준 · × cost_mult)")]
public int goldCost;
[Tooltip("이 Lv 까지의 누적 보너스 %")]
public float statPct;
}
[Serializable]
public class Rank
{
public int rank;
public string nameKo;
public float rankPct;
[Tooltip("다음 랭크 승급 골드(최종 랭크 = 0)")]
public int promoteGold;
public float costMult = 1f;
}
public List<Row> rows = new List<Row>();
public List<Rank> ranks = new List<Rank>();
public Row Get(UnitType t, string stat, int lv)
{
foreach (var r in rows)
if (r.type == t && r.stat == stat && r.lv == lv) return r;
return null;
}
/// <summary>항목당 최대 Lv.</summary>
public int MaxLevel
{
get
{
int m = 0;
foreach (var r in rows) m = Mathf.Max(m, r.lv);
return m;
}
}
public Rank RankOf(int rank)
{
foreach (var r in ranks)
if (r.rank == rank) return r;
return null;
}
public int MaxRank
{
get { return ranks.Count; }
}
}
}