using CodeStage.AntiCheat.ObscuredTypes; using Newtonsoft.Json; using System.Collections.Generic; using UnityEngine; public class PCEvolutionMaxTableData : TableDataBase { public eStat e_Stat; public string s_Value, s_Rate; ObscuredFloat _Value; public float f_Value { get { return _Value; } set { _Value = value; _Value.RandomizeCryptoKey(); } } } public class table_PCEvolutionMax : table_base { public static table_PCEvolutionMax Ins; List tableDatas; Dictionary dic_Data = new Dictionary(); List list_rate = new List(); protected override void Awake() { Ins = this; base.Awake(); } protected override void Start() { tableDatas = JsonConvert.DeserializeObject>(json_last); for (int i = 0; i < tableDatas.Count; i++) { var temp = tableDatas[i]; temp.f_Value = Get_Value(temp.s_Value); list_rate.Add(Get_Value(temp.s_Rate)); dic_Data.Add(temp.e_Stat, temp); } base.Start(); } public List Get_DataList() { return tableDatas; } public PCEvolutionMaxTableData Get_Data(eStat stat) { return dic_Data[stat]; } public PCEvolutionMaxTableData Get_RandomData(int pcid) { // 확률 복사본 생성 List rates = new List(list_rate); var statinfo = MyValue.Get_PCActorStatInfo(pcid); for (int i = 0; i < tableDatas.Count; i++) { var data = tableDatas[i]; // 1) Attack_Min >= Attack_Max ? Attack_Min 제외 if (data.e_Stat == eStat.Attack_Min && statinfo.Get_TotalStat(eStat.Attack_Min) >= statinfo.Get_TotalStat(eStat.Attack_Max)) { rates[i] = 0; } // 2) 회피력 초과 → Avoid_Melee, Avoid_Range 제외 if (data.e_Stat == eStat.Avoid_Melee) { if (statinfo.Get_TotalStat(eStat.Avoid_Melee) >= MyValue.MaxAvoid) rates[i] = 0; } if (data.e_Stat == eStat.Avoid_Range) { if (statinfo.Get_TotalStat(eStat.Avoid_Range) >= MyValue.MaxAvoid) rates[i] = 0; } // 3) 치명타 확률 초과 if (data.e_Stat == eStat.Cri) { if (statinfo.Get_TotalStat(eStat.Cri) >= MyValue.MaxAvoid) rates[i] = 0; } } //// 모든 확률이 0이 될 경우 대비 //bool allZero = true; //foreach (float r in rates) //{ // if (r > 0) // { // allZero = false; // break; // } //} //// 모든 확률이 0이면 그냥 원래 리스트에서 랜덤 하나 뽑음 //if (allZero) // return tableDatas[Random.Range(0, tableDatas.Count)]; // 확률 기반 랜덤 선택 int index = DSUtil.Get_RandomIndex(rates); return tableDatas[index]; } }