Clean up events, add weapon tag for weaker on swing
This commit is contained in:
@@ -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)
|
||||
|
||||
@@ -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);
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user