- ThreatUtility: 공통 위협 생성 유틸리티 (OverlapSphere 기반 반경 내 적 탐색) - OverlapSphereNonAlloc 버퍼 32→256 확장으로 씬 콜라이더 누락 수정 - 위협 배율 체인: SkillGem × ThreatController × Passive - HealEffect: flatThreat + (actualHeal × threatPercent) 공식 적용 - ShieldEffect: flatThreat + (actualShield × threatPercent) 공식 적용 - AbnormalityEffect: flatThreat 고정 위협 생성 - EditMode 유닛 테스트 9/9 통과 (SupportThreatTests) - 테스트 씬 UI 레이아웃 수정 사항 포함
74 lines
2.8 KiB
C#
74 lines
2.8 KiB
C#
using UnityEngine;
|
||
|
||
using Colosseum.Stats;
|
||
using Colosseum.Combat;
|
||
using Colosseum.Passives;
|
||
using Colosseum.Skills;
|
||
|
||
namespace Colosseum.Skills.Effects
|
||
{
|
||
/// <summary>
|
||
/// 치료 효과.
|
||
/// 회복량에 비례하여 적에게 위협을 생성할 수 있습니다.
|
||
/// </summary>
|
||
[CreateAssetMenu(fileName = "HealEffect", menuName = "Colosseum/Skills/Effects/Heal")]
|
||
public class HealEffect : SkillEffect
|
||
{
|
||
[Header("Heal Settings")]
|
||
[Min(0f)] [SerializeField] private float baseHeal = 10f;
|
||
[Tooltip("회복력 계수 (1.0 = 100%)")]
|
||
[Min(0f)] [SerializeField] private float healScaling = 1f;
|
||
|
||
[Header("Threat")]
|
||
[Tooltip("힐 사용 시 항상 생성할 고정 위협 수치")]
|
||
[Min(0f)] [SerializeField] private float flatThreatAmount = 5f;
|
||
[Tooltip("실제 회복량에 대한 위협 비율 (1.0 = 100%)")]
|
||
[Range(0f, 10f)] [SerializeField] private float threatPercentOfHeal = 0.5f;
|
||
[Tooltip("위협을 생성할 반경 (시전자 기준)")]
|
||
[Min(0f)] [SerializeField] private float threatRadius = 50f;
|
||
|
||
protected override void ApplyEffect(GameObject caster, GameObject target)
|
||
{
|
||
if (target == null) return;
|
||
|
||
// 회복량 계산
|
||
float totalHeal = CalculateHeal(caster);
|
||
|
||
// 타겟에 회복 적용 (IDamageable 인터페이스 사용)
|
||
var damageable = target.GetComponent<IDamageable>();
|
||
if (damageable != null)
|
||
{
|
||
float actualHeal = damageable.Heal(totalHeal);
|
||
CombatBalanceTracker.RecordHeal(caster, target, actualHeal);
|
||
|
||
// 위협 생성: 고정 수치 + (실제 회복량 × 비율)
|
||
float threat = flatThreatAmount + (actualHeal * threatPercentOfHeal);
|
||
if (threat > 0f)
|
||
{
|
||
ThreatUtility.GenerateThreatOnNearbyEnemies(caster, threat, threatRadius);
|
||
}
|
||
}
|
||
}
|
||
|
||
/// <summary>
|
||
/// 시전자 스탯 기반 회복량 계산
|
||
/// 공식: baseHeal + (healPower * healScaling)
|
||
/// </summary>
|
||
private float CalculateHeal(GameObject caster)
|
||
{
|
||
var stats = caster.GetComponent<CharacterStats>();
|
||
if (stats == null)
|
||
{
|
||
return baseHeal *
|
||
SkillRuntimeModifierUtility.GetHealMultiplier(caster) *
|
||
PassiveRuntimeModifierUtility.GetHealMultiplier(caster);
|
||
}
|
||
|
||
float resolvedHeal = baseHeal + (stats.HealPower * healScaling);
|
||
return resolvedHeal *
|
||
SkillRuntimeModifierUtility.GetHealMultiplier(caster) *
|
||
PassiveRuntimeModifierUtility.GetHealMultiplier(caster);
|
||
}
|
||
}
|
||
}
|