From eb773a68068a4dbece74326218978b71c6b3d9ac Mon Sep 17 00:00:00 2001 From: Adam Date: Mon, 14 Jul 2025 18:39:10 -0400 Subject: [PATCH] fixed bug regarding attack damage value switch --- Assets/Scripts/Ally/KnightOnHorse.cs | 11 +++++++---- 1 file changed, 7 insertions(+), 4 deletions(-) diff --git a/Assets/Scripts/Ally/KnightOnHorse.cs b/Assets/Scripts/Ally/KnightOnHorse.cs index ccad08b..a69c047 100644 --- a/Assets/Scripts/Ally/KnightOnHorse.cs +++ b/Assets/Scripts/Ally/KnightOnHorse.cs @@ -50,7 +50,7 @@ public class KnightOnHorse : Ally _detectionScript = _detection.GetComponent(); // keep originals to go back to them eventually - _originalAttackDamage = _chargeAttackDamage; + _originalAttackDamage = AttackDamage; _originalPos = transform.position; // makes sure the entity charges on creation @@ -59,6 +59,7 @@ public class KnightOnHorse : Ally public override void Update() { + Debug.Log(AttackDamage); // fade if charge done if (_isFading) { @@ -69,6 +70,8 @@ public class KnightOnHorse : Ally // check if charge is ready if (_timeSinceLastCharge > _chargeCooldown && !_isCharging) { + AttackDamage = _chargeAttackDamage; + SweepAttack(); _isCharging = true; @@ -105,6 +108,9 @@ public class KnightOnHorse : Ally Enemy = null; _chargeDetection.SetActive(false); + // attack damage + AttackDamage = _originalAttackDamage; + // start fading _isFading = true; } @@ -133,7 +139,6 @@ public class KnightOnHorse : Ally //Attack Cooldown if (AttackSpeedWait > AttackInterval) { - AttackDamage = _originalAttackDamage; Animation.PlayAttackAnim(); AttackSpeedWait = 0f; @@ -144,8 +149,6 @@ public class KnightOnHorse : Ally private void AttackEnemyRiding() { - AttackDamage = _chargeAttackDamage; - // call root attack cause no specific animation _rootScript.Attack(); _opponentsHit.Add(Enemy);