Files
Colosseum/Assets/_Game/Scripts/Skills/SkillLoadoutEntry.cs
dal4segno 24b284ad7e feat: 젬 테스트 경로 및 보스 기절 디버그 추가
- 다중 젬 슬롯용 타입을 별도 스크립트로 분리하고 테스트 젬/로드아웃 자산 생성 경로를 정리

- 젬 테스트 전용 공격 스킬과 분리된 애니메이션 자산을 추가해 베이스 스킬 검증 경로를 마련

- PlayerSkillDebugMenu와 MPP 디버그 메뉴를 보강해 젬 프리셋 적용, 원격 테스트, 보스 기절 디버그 메뉴를 추가

- BossCombatBehaviorContext와 공통 BT 액션이 기절 상태를 존중하도록 수정해 보스 추적과 패턴 실행을 중단

- Unity 리프레시와 외부 빌드 통과를 확인하고 드로그전 및 MPP 기준 젬 프리셋 적용 흐름을 검증
2026-03-25 18:38:12 +09:00

227 lines
6.8 KiB
C#

using System.Collections.Generic;
using UnityEngine;
namespace Colosseum.Skills
{
/// <summary>
/// 단일 슬롯에서 사용할 스킬과 장착된 젬 조합입니다.
/// </summary>
[System.Serializable]
public class SkillLoadoutEntry
{
private const int DefaultGemSlotCount = 2;
[Tooltip("이 슬롯의 기반 스킬")]
[SerializeField] private SkillData baseSkill;
[Tooltip("기반 스킬에 장착된 젬")]
[SerializeField] private SkillGemData[] socketedGems = new SkillGemData[DefaultGemSlotCount];
public SkillData BaseSkill => baseSkill;
public IReadOnlyList<SkillGemData> SocketedGems => socketedGems;
public static SkillLoadoutEntry CreateTemporary(SkillData skill)
{
SkillLoadoutEntry entry = new SkillLoadoutEntry();
entry.SetBaseSkill(skill);
entry.EnsureGemSlotCapacity();
return entry;
}
public SkillLoadoutEntry CreateCopy()
{
SkillLoadoutEntry copy = new SkillLoadoutEntry();
copy.baseSkill = baseSkill;
copy.socketedGems = new SkillGemData[socketedGems != null ? socketedGems.Length : DefaultGemSlotCount];
if (socketedGems != null)
{
for (int i = 0; i < socketedGems.Length; i++)
{
copy.socketedGems[i] = socketedGems[i];
}
}
return copy;
}
public void EnsureGemSlotCapacity(int slotCount = -1)
{
if (slotCount < 0)
{
slotCount = baseSkill != null ? baseSkill.MaxGemSlotCount : DefaultGemSlotCount;
}
slotCount = Mathf.Max(0, slotCount);
if (socketedGems != null && socketedGems.Length == slotCount)
return;
SkillGemData[] resized = new SkillGemData[slotCount];
if (socketedGems != null)
{
int copyCount = Mathf.Min(socketedGems.Length, resized.Length);
for (int i = 0; i < copyCount; i++)
{
resized[i] = socketedGems[i];
}
}
socketedGems = resized;
}
public void SetBaseSkill(SkillData skill)
{
baseSkill = skill;
EnsureGemSlotCapacity();
}
public void SetGem(int slotIndex, SkillGemData gem)
{
EnsureGemSlotCapacity();
if (slotIndex < 0 || slotIndex >= socketedGems.Length)
return;
socketedGems[slotIndex] = gem;
}
public SkillGemData GetGem(int slotIndex)
{
EnsureGemSlotCapacity();
if (slotIndex < 0 || slotIndex >= socketedGems.Length)
return null;
return socketedGems[slotIndex];
}
public float GetResolvedManaCost()
{
if (baseSkill == null)
return 0f;
float resolved = baseSkill.ManaCost;
if (socketedGems == null)
return resolved;
for (int i = 0; i < socketedGems.Length; i++)
{
SkillGemData gem = socketedGems[i];
if (gem == null)
continue;
resolved *= gem.ManaCostMultiplier;
}
return resolved;
}
public float GetResolvedCooldown()
{
if (baseSkill == null)
return 0f;
float resolved = baseSkill.Cooldown;
if (socketedGems == null)
return resolved;
for (int i = 0; i < socketedGems.Length; i++)
{
SkillGemData gem = socketedGems[i];
if (gem == null)
continue;
resolved *= gem.CooldownMultiplier;
}
return resolved;
}
public void CollectCastStartEffects(List<SkillEffect> destination)
{
if (destination == null)
return;
if (baseSkill != null && baseSkill.CastStartEffects != null)
{
for (int i = 0; i < baseSkill.CastStartEffects.Count; i++)
{
SkillEffect effect = baseSkill.CastStartEffects[i];
if (effect != null)
destination.Add(effect);
}
}
if (socketedGems == null)
return;
for (int i = 0; i < socketedGems.Length; i++)
{
SkillGemData gem = socketedGems[i];
if (gem == null || gem.CastStartEffects == null)
continue;
for (int j = 0; j < gem.CastStartEffects.Count; j++)
{
SkillEffect effect = gem.CastStartEffects[j];
if (effect != null)
destination.Add(effect);
}
}
}
public void CollectTriggeredEffects(Dictionary<int, List<SkillEffect>> destination)
{
if (destination == null)
return;
if (baseSkill != null && baseSkill.Effects != null)
{
for (int i = 0; i < baseSkill.Effects.Count; i++)
{
SkillEffect effect = baseSkill.Effects[i];
if (effect == null)
continue;
AddTriggeredEffect(destination, i, effect);
}
}
if (socketedGems == null)
return;
for (int i = 0; i < socketedGems.Length; i++)
{
SkillGemData gem = socketedGems[i];
if (gem == null || gem.TriggeredEffects == null)
continue;
for (int j = 0; j < gem.TriggeredEffects.Count; j++)
{
SkillGemTriggeredEffectEntry entry = gem.TriggeredEffects[j];
if (entry == null || entry.Effects == null)
continue;
for (int k = 0; k < entry.Effects.Count; k++)
{
SkillEffect effect = entry.Effects[k];
if (effect == null)
continue;
AddTriggeredEffect(destination, entry.TriggerIndex, effect);
}
}
}
}
private static void AddTriggeredEffect(Dictionary<int, List<SkillEffect>> destination, int triggerIndex, SkillEffect effect)
{
if (!destination.TryGetValue(triggerIndex, out List<SkillEffect> effectList))
{
effectList = new List<SkillEffect>();
destination.Add(triggerIndex, effectList);
}
effectList.Add(effect);
}
}
}