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

128 lines
4.3 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>
/// 스킬 표(skills.csv 전 열 + skill_levels.csv) = 스킬 DB. 영웅 화면 표시(A) + 전투 처리기(B · Runtime/Skills 의 SkillCatalog 가 effect_key·p1~p3·lv_scale 을 읽음).
/// skill_levels.csv(lv · books · gold) = levels(스킬 레벨 표 · 스킬 레벨업 비용).
/// </summary>
public class SkillInfoDb : ScriptableObject
{
[Serializable]
public class Skill
{
public string id;
public string heroId;
[Tooltip("active|passive")]
public string kind;
public string nameKo;
public string hanja;
public string trigger;
public int cooldown;
public int lvMax;
[Tooltip("desc_ko (끝 [ ] 메모 포함 원문)")]
public string descKo;
[Tooltip("effect_key 원문(효과 여럿 = ; 로 나열 · p1~p3 = 키 순서)")]
public string effectKey;
public float p1;
public float p2;
public float p3;
[Tooltip("p 칸이 비어 있지 않은가(bit0 = p1 · bit1 = p2 · bit2 = p3)")]
public int pMask;
[Tooltip("수치 × (1 + lv_scale·(lv−1))")]
public float lvScale;
[Tooltip("신규 처리기(반경 안 유닛 · HP 소모 · 이동 · 교전 반응 정지)")]
public bool needsImpl;
public string[] EffectKeys
{
get { return string.IsNullOrEmpty(effectKey) ? new string[0] : effectKey.Split(';'); }
}
public bool HasP(int i)
{
return (pMask & (1 << i)) != 0;
}
public float P(int i)
{
return i == 0 ? p1 : i == 1 ? p2 : p3;
}
}
[Serializable]
public class LevelCost
{
public int lv;
public int books;
public int gold;
}
/// <summary>skill_effects.csv 1행 = 스킬 효과 1줄(2026-11-10 #1112 · 키 · 대상 · 조건 · 지속 · p1~p3 · 뜻 = Runtime/Skills/SkillKeys).</summary>
[Serializable]
public class Effect
{
public string skillId;
public string key;
[Tooltip("빈칸 = 자신 · allies · camp:<진영>[:<병종>] · camp_male:<진영> · radius:<r> · range · aura")]
public string target;
[Tooltip("crit · vs_status · vs_bleed · vs_confused · vs_stunned · vs_type:<병종> · vs_male · vs_male_hero · vs_female_hero · turn_le:<n> · armed")]
public string cond;
[Tooltip("0 = 상시·장착 중·1회 · n = n 라운드")]
public int dur;
public float p1;
public float p2;
public float p3;
public int pMask;
public string note;
public bool HasP(int i)
{
return (pMask & (1 << i)) != 0;
}
}
public List<Skill> skills = new List<Skill>();
public List<LevelCost> levels = new List<LevelCost>();
public List<Effect> effects = new List<Effect>();
public Skill Get(string id)
{
if (string.IsNullOrEmpty(id)) return null;
foreach (var s in skills)
if (s.id == id) return s;
return null;
}
/// <summary>그 레벨이 되는 비용(skill_levels.csv lv 행 · 없으면 null = 최고).</summary>
public LevelCost CostTo(int lv)
{
foreach (var c in levels)
if (c.lv == lv) return c;
return null;
}
public int MaxLevel
{
get
{
int m = 1;
foreach (var c in levels) m = Mathf.Max(m, c.lv);
return m;
}
}
/// <summary>표시용 설명 — 끝의 [p1 … ] 개발 메모를 뺀다.</summary>
public static string DisplayDesc(Skill s)
{
if (s == null || string.IsNullOrEmpty(s.descKo)) return "";
var d = s.descKo;
int b = d.LastIndexOf('[');
if (b > 0 && d.TrimEnd().EndsWith("]")) d = d.Substring(0, b);
return d.Trim();
}
}
}