From 535b730f3421337190993bba29306e6e89b8bbbe Mon Sep 17 00:00:00 2001 From: dal4segno Date: Thu, 12 Mar 2026 19:56:12 +0900 Subject: [PATCH] =?UTF-8?q?feat:=20=EB=AC=B4=EA=B8=B0=20=EB=B0=B0=EC=9C=A8?= =?UTF-8?q?=20=EC=8B=9C=EC=8A=A4=ED=85=9C=20=ED=86=B5=ED=95=A9?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - DamageEffect: 무기 데미지 배율 적용 (GetDamageMultiplier) - PlayerSkillInput: 무기 마나 소모 배율 적용 (GetActualManaCost) - SkillEffect: 무기 사거리 배율 적용 (가상 메서드로 구현) Ultraworked with [Sisyphus](https://github.com/code-yeongyu/oh-my-opencode) Co-authored-by: Sisyphus --- Assets/Scripts/Player/PlayerSkillInput.cs | 38 ++++++++++++++++--- Assets/Scripts/Skills/Effects/DamageEffect.cs | 20 +++++++++- Assets/Scripts/Skills/SkillEffect.cs | 8 +++- 3 files changed, 57 insertions(+), 9 deletions(-) diff --git a/Assets/Scripts/Player/PlayerSkillInput.cs b/Assets/Scripts/Player/PlayerSkillInput.cs index 4bdf5164..c69f2798 100644 --- a/Assets/Scripts/Player/PlayerSkillInput.cs +++ b/Assets/Scripts/Player/PlayerSkillInput.cs @@ -1,7 +1,9 @@ using UnityEngine; using UnityEngine.InputSystem; using Unity.Netcode; + using Colosseum.Skills; +using Colosseum.Weapons; namespace Colosseum.Player { @@ -20,6 +22,8 @@ namespace Colosseum.Player [SerializeField] private SkillController skillController; [Tooltip("PlayerNetworkController (없으면 자동 검색)")] [SerializeField] private PlayerNetworkController networkController; + [Tooltip("WeaponEquipment (없으면 자동 검색)")] + [SerializeField] private WeaponEquipment weaponEquipment; private InputSystem_Actions inputActions; @@ -51,6 +55,12 @@ namespace Colosseum.Player networkController = GetComponent(); } + // WeaponEquipment 참조 확인 + if (weaponEquipment == null) + { + weaponEquipment = GetComponent(); + } + InitializeInputActions(); } @@ -110,8 +120,9 @@ namespace Colosseum.Player return; } - // 마나 비용 체크 - if (networkController != null && networkController.Mana < skill.ManaCost) + // 마나 비용 체크 (무기 배율 적용) + float actualManaCost = GetActualManaCost(skill); + if (networkController != null && networkController.Mana < actualManaCost) { Debug.Log($"Not enough mana for skill: {skill.SkillName}"); return; @@ -137,13 +148,15 @@ namespace Colosseum.Player if (skillController.IsExecutingSkill || skillController.IsOnCooldown(skill)) return; - if (networkController != null && networkController.Mana < skill.ManaCost) + // 마나 비용 체크 (무기 배율 적용) + float actualManaCost = GetActualManaCost(skill); + if (networkController != null && networkController.Mana < actualManaCost) return; - // 마나 소모 - if (networkController != null && skill.ManaCost > 0) + // 마나 소모 (무기 배율 적용) + if (networkController != null && actualManaCost > 0) { - networkController.UseManaRpc(skill.ManaCost); + networkController.UseManaRpc(actualManaCost); } // 모든 클라이언트에 스킬 실행 전파 @@ -166,6 +179,19 @@ namespace Colosseum.Player skillController.ExecuteSkill(skill); } + /// + /// 무기 마나 배율이 적용된 실제 마나 비용 계산 + /// + private float GetActualManaCost(SkillData skill) + { + if (skill == null) return 0f; + + float baseCost = skill.ManaCost; + float multiplier = weaponEquipment != null ? weaponEquipment.ManaCostMultiplier : 1f; + + return baseCost * multiplier; + } + /// /// 스킬 슬롯 접근자 /// diff --git a/Assets/Scripts/Skills/Effects/DamageEffect.cs b/Assets/Scripts/Skills/Effects/DamageEffect.cs index e867c6e7..e5e97da2 100644 --- a/Assets/Scripts/Skills/Effects/DamageEffect.cs +++ b/Assets/Scripts/Skills/Effects/DamageEffect.cs @@ -2,6 +2,7 @@ using UnityEngine; using Colosseum.Stats; using Colosseum.Combat; +using Colosseum.Weapons; namespace Colosseum.Skills.Effects { @@ -68,7 +69,24 @@ namespace Colosseum.Skills.Effects _ => 0f, }; - return baseDamage + (statDamage * statScaling); + float baseTotal = baseDamage + (statDamage * statScaling); + + // 무기 데미지 배율 적용 + float damageMultiplier = GetDamageMultiplier(caster); + return baseTotal * damageMultiplier; + } + + /// + /// 시전자의 무기 데미지 배율 조회 + /// + private float GetDamageMultiplier(GameObject caster) + { + var weaponEquipment = caster.GetComponent(); + if (weaponEquipment != null) + { + return weaponEquipment.DamageMultiplier; + } + return 1f; } } } diff --git a/Assets/Scripts/Skills/SkillEffect.cs b/Assets/Scripts/Skills/SkillEffect.cs index e5de1a58..700f5670 100644 --- a/Assets/Scripts/Skills/SkillEffect.cs +++ b/Assets/Scripts/Skills/SkillEffect.cs @@ -1,5 +1,7 @@ +using System.Collections.Generic; using UnityEngine; using Colosseum; +using Colosseum.Weapons; namespace Colosseum.Skills { @@ -106,12 +108,13 @@ namespace Colosseum.Skills { Vector3 center = GetAreaCenter(caster); Collider[] hits = Physics.OverlapSphere(center, Mathf.Max(areaRadius, fanRadius), targetLayers); - + // 같은 GameObject가 여러 콜라이더를 가질 수 있으므로 중복 제거 + HashSet processedTargets = new HashSet(); foreach (var hit in hits) { if (hit.gameObject == caster) continue; if (!IsCorrectTeam(caster, hit.gameObject)) continue; - + if (processedTargets.Contains(hit.gameObject)) continue; // 부채꼴 판정 if (areaShape == AreaShapeType.Fan) { @@ -119,6 +122,7 @@ namespace Colosseum.Skills continue; } + processedTargets.Add(hit.gameObject); ApplyEffect(caster, hit.gameObject); } }