Clean up events, add weapon tag for weaker on swing

This commit is contained in:
2026-02-09 23:50:15 -08:00
parent aba325ff2b
commit 90d054a3c6
34 changed files with 301 additions and 125 deletions

View File

@@ -323,6 +323,12 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
AnimationPlayer.Play("hit_wall");
else if (!AnimationPlayer.IsPlaying())
PlayAttackAnimation();
else
return;
var weapon = EquipmentComponent.EquippedWeapon.Value as Weapon;
if (weapon.WeaponTag == WeaponTag.DegradeOnSwing)
_playerEffectService.Degrade();
}
private void ThrowItem()
@@ -367,6 +373,10 @@ public partial class Player : CharacterBody3D, IPlayer, IProvide<IPlayer>
CollisionDetector.AreaEntered -= CollisionDetector_AreaEntered;
HealthComponent.HealthReachedZero -= Die;
HealthTimer.Timeout -= OnHealthTimerTimeout;
HealthComponent.CurrentHP.Changed -= InverseHPToAttackPowerSync;
HealthComponent.HealthReachedZero -= Die;
ExperiencePointsComponent.PlayerLevelUp -= OnLevelUp;
PlayerFXAnimations.AnimationFinished -= PlayerFXAnimations_AnimationFinished;
}
private void Move(float delta)

View File

@@ -1,4 +1,5 @@
using Godot;
using Zennysoft.Game.Ma;
using Zennysoft.Ma.Adapter;
using Zennysoft.Ma.Adapter.Entity;
@@ -23,4 +24,12 @@ internal class PlayerEffectService
if (rand <= _player.TotalLuck)
enemy.Die();
}
public void Degrade()
{
var weapon = _player.EquipmentComponent.EquippedWeapon.Value as Weapon;
var newAttack = Mathf.Max(weapon.BonusAttack - 1, 0);
weapon.SetWeaponAttack(newAttack);
_player.EquipmentComponent.UpdateEquipment(weapon);
}
}