fixed bug regarding attack damage value switch

This commit is contained in:
Adam Salah 2025-07-14 18:39:10 -04:00
parent cf1f88f43a
commit eb773a6806

View File

@ -50,7 +50,7 @@ public class KnightOnHorse : Ally
_detectionScript = _detection.GetComponent<Detection>();
// 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);