feat: 보호막 타입 분리 및 드로그 시그니처 전조 정리
- 보호막을 단일 수치에서 타입별 독립 인스턴스 구조로 리팩터링하고 같은 타입만 갱신되도록 정리 - 플레이어/보스 보호막 상태를 이상상태와 연동해 HUD 및 보스 UI에서 타입별로 식별 가능하게 보강 - 드로그 집행 개시 전조를 집행 준비 이상상태 기반으로 재구성하고 관련 데이터와 보스 컨텍스트를 정리 - 전투 밸런스 계측기와 디버그 메뉴를 추가해 피해, 치유, 보호막, 위협, 패턴 사용량 측정 경로를 마련 - 테스트용 보호막 A/B와 시그니처 전조 자산을 추가하고 기본 포트 7777 원복 후 빌드 및 런타임 검증을 완료
This commit is contained in:
@@ -21,11 +21,16 @@ namespace Colosseum.Player
|
||||
[Tooltip("이상상태 관리자 (없으면 자동 검색)")]
|
||||
[SerializeField] private AbnormalityManager abnormalityManager;
|
||||
|
||||
[Header("Shield")]
|
||||
[Tooltip("보호막 타입이 지정되지 않았을 때 사용할 기본 보호막 이상상태 데이터")]
|
||||
[SerializeField] private AbnormalityData shieldStateAbnormality;
|
||||
|
||||
// 네트워크 동기화 변수
|
||||
private NetworkVariable<float> currentHealth = new NetworkVariable<float>(100f);
|
||||
private NetworkVariable<float> currentMana = new NetworkVariable<float>(50f);
|
||||
private NetworkVariable<bool> isDead = new NetworkVariable<bool>(false);
|
||||
private NetworkVariable<float> currentShield = new NetworkVariable<float>(0f);
|
||||
private readonly ShieldCollection shieldCollection = new ShieldCollection();
|
||||
|
||||
public float Health => currentHealth.Value;
|
||||
public float Mana => currentMana.Value;
|
||||
@@ -72,8 +77,19 @@ namespace Colosseum.Player
|
||||
{
|
||||
currentHealth.Value = MaxHealth;
|
||||
currentMana.Value = MaxMana;
|
||||
currentShield.Value = 0f;
|
||||
isDead.Value = false;
|
||||
RefreshShieldState();
|
||||
}
|
||||
}
|
||||
|
||||
private void Update()
|
||||
{
|
||||
if (!IsServer || isDead.Value)
|
||||
return;
|
||||
|
||||
if (shieldCollection.Tick(Time.deltaTime))
|
||||
{
|
||||
RefreshShieldState();
|
||||
}
|
||||
}
|
||||
|
||||
@@ -112,17 +128,7 @@ namespace Colosseum.Player
|
||||
[Rpc(SendTo.Server)]
|
||||
public void TakeDamageRpc(float damage)
|
||||
{
|
||||
if (isDead.Value || IsDamageImmune()) return;
|
||||
|
||||
float finalDamage = damage * GetIncomingDamageMultiplier();
|
||||
float mitigatedDamage = ConsumeShield(finalDamage);
|
||||
float actualDamage = Mathf.Min(mitigatedDamage, currentHealth.Value);
|
||||
currentHealth.Value = Mathf.Max(0f, currentHealth.Value - actualDamage);
|
||||
|
||||
if (currentHealth.Value <= 0f)
|
||||
{
|
||||
HandleDeath();
|
||||
}
|
||||
ApplyDamageInternal(damage, null);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -179,7 +185,8 @@ namespace Colosseum.Player
|
||||
if (isDead.Value) return;
|
||||
|
||||
isDead.Value = true;
|
||||
currentShield.Value = 0f;
|
||||
shieldCollection.Clear();
|
||||
RefreshShieldState();
|
||||
|
||||
// 사망 시 활성 이상 상태를 정리해 리스폰 시 잔존하지 않게 합니다.
|
||||
if (abnormalityManager != null)
|
||||
@@ -245,7 +252,8 @@ namespace Colosseum.Player
|
||||
isDead.Value = false;
|
||||
currentHealth.Value = MaxHealth;
|
||||
currentMana.Value = MaxMana;
|
||||
currentShield.Value = 0f;
|
||||
shieldCollection.Clear();
|
||||
RefreshShieldState();
|
||||
|
||||
// 이동 재활성화
|
||||
var movement = GetComponent<PlayerMovement>();
|
||||
@@ -298,19 +306,7 @@ namespace Colosseum.Player
|
||||
/// </summary>
|
||||
public float TakeDamage(float damage, object source = null)
|
||||
{
|
||||
if (!IsServer || isDead.Value || IsDamageImmune()) return 0f;
|
||||
|
||||
float finalDamage = damage * GetIncomingDamageMultiplier();
|
||||
float mitigatedDamage = ConsumeShield(finalDamage);
|
||||
float actualDamage = Mathf.Min(mitigatedDamage, currentHealth.Value);
|
||||
currentHealth.Value = Mathf.Max(0f, currentHealth.Value - actualDamage);
|
||||
|
||||
if (currentHealth.Value <= 0f)
|
||||
{
|
||||
HandleDeath();
|
||||
}
|
||||
|
||||
return actualDamage;
|
||||
return ApplyDamageInternal(damage, source);
|
||||
}
|
||||
|
||||
/// <summary>
|
||||
@@ -329,18 +325,15 @@ namespace Colosseum.Player
|
||||
/// <summary>
|
||||
/// 보호막을 적용합니다.
|
||||
/// </summary>
|
||||
public void ApplyShield(float amount, float duration)
|
||||
public float ApplyShield(float amount, float duration, AbnormalityData shieldAbnormality = null, GameObject source = null)
|
||||
{
|
||||
if (!IsServer || isDead.Value || amount <= 0f)
|
||||
return;
|
||||
return 0f;
|
||||
|
||||
currentShield.Value = Mathf.Max(currentShield.Value, amount);
|
||||
|
||||
if (duration > 0f)
|
||||
{
|
||||
CancelInvoke(nameof(ClearShield));
|
||||
Invoke(nameof(ClearShield), duration);
|
||||
}
|
||||
AbnormalityData shieldType = shieldAbnormality != null ? shieldAbnormality : shieldStateAbnormality;
|
||||
float actualAppliedShield = shieldCollection.ApplyShield(shieldType, amount, duration, source);
|
||||
RefreshShieldState();
|
||||
return actualAppliedShield;
|
||||
}
|
||||
|
||||
private bool IsDamageImmune()
|
||||
@@ -361,17 +354,39 @@ namespace Colosseum.Player
|
||||
if (incomingDamage <= 0f || currentShield.Value <= 0f)
|
||||
return incomingDamage;
|
||||
|
||||
float shieldAbsorb = Mathf.Min(currentShield.Value, incomingDamage);
|
||||
currentShield.Value = Mathf.Max(0f, currentShield.Value - shieldAbsorb);
|
||||
return Mathf.Max(0f, incomingDamage - shieldAbsorb);
|
||||
float remainingDamage = shieldCollection.ConsumeDamage(incomingDamage);
|
||||
RefreshShieldState();
|
||||
return remainingDamage;
|
||||
}
|
||||
|
||||
private void ClearShield()
|
||||
private float ApplyDamageInternal(float damage, object source)
|
||||
{
|
||||
if (!IsServer)
|
||||
return;
|
||||
if (!IsServer || isDead.Value || IsDamageImmune())
|
||||
return 0f;
|
||||
|
||||
currentShield.Value = 0f;
|
||||
float finalDamage = damage * GetIncomingDamageMultiplier();
|
||||
float mitigatedDamage = ConsumeShield(finalDamage);
|
||||
float actualDamage = Mathf.Min(mitigatedDamage, currentHealth.Value);
|
||||
currentHealth.Value = Mathf.Max(0f, currentHealth.Value - actualDamage);
|
||||
|
||||
CombatBalanceTracker.RecordDamage(source as GameObject, gameObject, actualDamage);
|
||||
|
||||
if (currentHealth.Value <= 0f)
|
||||
{
|
||||
HandleDeath();
|
||||
}
|
||||
|
||||
return actualDamage;
|
||||
}
|
||||
|
||||
private void RefreshShieldState()
|
||||
{
|
||||
currentShield.Value = shieldCollection.TotalAmount;
|
||||
|
||||
ShieldAbnormalityUtility.SyncShieldAbnormalities(
|
||||
abnormalityManager,
|
||||
shieldCollection.ActiveShields,
|
||||
gameObject);
|
||||
}
|
||||
#endregion
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user