75 lines
3.8 KiB
C#
75 lines
3.8 KiB
C#
// ─────────────────────────────────────────────────────────────────────────────
|
|
// WLSkillTiming.cs — 원본 스킬 코드에 박힌 대기 시간(초)을 스킬 · 직업별로 바꾼다 (#976 · 2026-10-24)
|
|
//
|
|
// PD 원문: 「비수 기본 스킬 모으기 시간을 절반으로 줄이고, 마젠타 색상을 정상화 해줘.」
|
|
// ■ 원본 Skill_BrutalSlash.Co_Update = 0.1 초 뒤 발밑 모으기 이펙트 + 캐릭터 애니메이션 멈춤 1.0 초(모으기) → 베기 이펙트 · 판정
|
|
// → 원본 대기 줄을 훅 1줄 `WaitForSeconds(WLSkillTiming.Seconds(this, "charge", 1.0f))` 로 바꿔 규칙 값(없으면 원본 값 그대로)
|
|
// ■ 값 = Resources/WL/WLSkillTiming.json (C45) · rules[{skill(원본 스킬 클래스 이름), classId(0 = 모든 직업 · 직업 맞는 행 먼저), key, seconds}] · 끄기 = enabled 0
|
|
// 🔴 Debug.LogError 금지(원본 팝업).
|
|
// ─────────────────────────────────────────────────────────────────────────────
|
|
using UnityEngine;
|
|
|
|
namespace WL.Combat.Weapon
|
|
{
|
|
[System.Serializable]
|
|
public class WLSkillTimingRule
|
|
{
|
|
public string skill = "", key = "";
|
|
public int classId;
|
|
public float seconds = -1f;
|
|
public string note = "";
|
|
}
|
|
|
|
[System.Serializable]
|
|
public class WLSkillTimingJson
|
|
{
|
|
public int enabled = 1;
|
|
public WLSkillTimingRule[] rules = new WLSkillTimingRule[0];
|
|
}
|
|
|
|
public static class WLSkillTiming
|
|
{
|
|
public const string ResourcesPath = "WL/WLSkillTiming";
|
|
public static int Used;
|
|
public static string LastLog = "";
|
|
static WLSkillTimingJson s_cfg;
|
|
|
|
[RuntimeInitializeOnLoadMethod(RuntimeInitializeLoadType.SubsystemRegistration)] static void Reset() { s_cfg = null; }
|
|
|
|
static WLSkillTimingJson Cfg
|
|
{
|
|
get
|
|
{
|
|
if (s_cfg != null) return s_cfg;
|
|
s_cfg = new WLSkillTimingJson();
|
|
var ta = Resources.Load<TextAsset>(ResourcesPath);
|
|
if (ta == null) { LastLog = "설정 없음 " + ResourcesPath; return s_cfg; }
|
|
try { JsonUtility.FromJsonOverwrite(ta.text, s_cfg); } catch (System.Exception ex) { LastLog = "설정 파싱 실패 — " + ex.Message; }
|
|
return s_cfg;
|
|
}
|
|
}
|
|
|
|
/// <summary>원본 스킬 대기 시간 — 규칙(스킬 클래스 이름 · 시전자 직업 · 키)이 있으면 그 값, 없으면 원본 값(def).</summary>
|
|
public static float Seconds(ProjectileBase pb, string key, float def)
|
|
{
|
|
try
|
|
{
|
|
var c = Cfg; if (c.enabled == 0 || pb == null || c.rules == null) return def;
|
|
var pd = pb.Get_ProjectTileData();
|
|
int cls = pd != null && !DSUtil.CheckNull(pd.shooter) ? pd.shooter.Get_ID() : 0;
|
|
string sk = pb.GetType().Name; WLSkillTimingRule any = null;
|
|
foreach (var r in c.rules)
|
|
{
|
|
if (r == null || r.skill != sk || r.key != key || r.seconds < 0f) continue;
|
|
if (r.classId == cls) { any = r; break; }
|
|
if (r.classId == 0 && any == null) any = r;
|
|
}
|
|
if (any == null) return def;
|
|
Used++; LastLog = sk + " " + key + " " + def.ToString("0.##") + " → " + any.seconds.ToString("0.##") + " s(직업 " + cls + ")";
|
|
return any.seconds;
|
|
}
|
|
catch (System.Exception ex) { LastLog = "실패 — " + ex.Message; return def; }
|
|
}
|
|
}
|
|
}
|