- 애니메이션 이벤트 기반 방어/유지/해제 흐름과 HUD 피드백, 방어 디버그 로그를 추가했다. - 드로그 기본기1 테스트 패턴을 정리하고 공격 판정을 OnEffect 기반으로 옮기며 드로그 범위 효과의 타겟 레이어를 정상화했다. - 플레이어 퀵슬롯 테스트 세팅과 적-플레이어 겹침 방지 로직을 조정해 충돌 시 적이 수평 이동을 멈추고 최소 분리만 수행하게 했다.
98 lines
3.6 KiB
C#
98 lines
3.6 KiB
C#
using UnityEngine;
|
|
|
|
using Colosseum.Combat;
|
|
using Colosseum.Player;
|
|
using Colosseum.Stats;
|
|
using Colosseum.Weapons;
|
|
|
|
namespace Colosseum.Skills.Effects
|
|
{
|
|
/// <summary>
|
|
/// 피격 제어 상태에 따라 추가 피해를 줄 수 있는 대미지 효과입니다.
|
|
/// 현재는 다운 상태인 대상에게 추가 배율을 적용합니다.
|
|
/// </summary>
|
|
[CreateAssetMenu(fileName = "HitReactionDamageEffect", menuName = "Colosseum/Skills/Effects/HitReaction Damage")]
|
|
public class HitReactionDamageEffect : SkillEffect
|
|
{
|
|
[Header("Damage Settings")]
|
|
[Min(0f)] [SerializeField] private float baseDamage = 10f;
|
|
[SerializeField] private DamageType damageType = DamageType.Physical;
|
|
[Tooltip("스탯 계수 (1.0 = 100%)")]
|
|
[Min(0f)] [SerializeField] private float statScaling = 1f;
|
|
|
|
[Header("Hit Reaction Bonus")]
|
|
[Tooltip("다운 상태인 대상에게 추가 배율을 적용할지 여부")]
|
|
[SerializeField] private bool bonusAgainstDownedTarget = true;
|
|
|
|
[Tooltip("다운 상태 대상에게 적용되는 추가 피해 배율")]
|
|
[Min(1f)] [SerializeField] private float downedDamageMultiplier = 1.5f;
|
|
|
|
[Header("Mitigation")]
|
|
[Tooltip("이 피해가 방어/회피 규칙에서 어떤 판정으로 처리되는지 설정합니다.")]
|
|
[SerializeField] private DamageMitigationTier mitigationTier = DamageMitigationTier.Normal;
|
|
|
|
protected override void ApplyEffect(GameObject caster, GameObject target)
|
|
{
|
|
if (target == null)
|
|
return;
|
|
|
|
IDamageable damageable = target.GetComponent<IDamageable>();
|
|
if (damageable == null)
|
|
return;
|
|
|
|
float totalDamage = CalculateDamage(caster);
|
|
|
|
HitReactionController hitReactionController = target.GetComponent<HitReactionController>();
|
|
if (hitReactionController == null)
|
|
hitReactionController = target.GetComponentInParent<HitReactionController>();
|
|
|
|
if (bonusAgainstDownedTarget
|
|
&& hitReactionController != null
|
|
&& hitReactionController.IsDowned)
|
|
{
|
|
totalDamage *= downedDamageMultiplier;
|
|
}
|
|
|
|
damageable.TakeDamage(new DamageContext(totalDamage, caster, mitigationTier));
|
|
}
|
|
|
|
/// <summary>
|
|
/// 시전자 스탯 기반 대미지 계산
|
|
/// 공식: baseDamage + (statDamage * scaling)
|
|
/// </summary>
|
|
private float CalculateDamage(GameObject caster)
|
|
{
|
|
if (damageType == DamageType.True)
|
|
{
|
|
return baseDamage;
|
|
}
|
|
|
|
CharacterStats stats = caster != null ? caster.GetComponent<CharacterStats>() : null;
|
|
if (stats == null)
|
|
{
|
|
return baseDamage;
|
|
}
|
|
|
|
float statDamage = damageType switch
|
|
{
|
|
DamageType.Physical => stats.PhysicalDamage,
|
|
DamageType.Magical => stats.MagicDamage,
|
|
DamageType.Ranged => stats.Dexterity.FinalValue * 2f,
|
|
_ => 0f,
|
|
};
|
|
|
|
float baseTotal = baseDamage + (statDamage * statScaling);
|
|
return baseTotal * GetDamageMultiplier(caster);
|
|
}
|
|
|
|
/// <summary>
|
|
/// 시전자의 무기 데미지 배율 조회
|
|
/// </summary>
|
|
private float GetDamageMultiplier(GameObject caster)
|
|
{
|
|
WeaponEquipment weaponEquipment = caster != null ? caster.GetComponent<WeaponEquipment>() : null;
|
|
return weaponEquipment != null ? weaponEquipment.DamageMultiplier : 1f;
|
|
}
|
|
}
|
|
}
|