做不出来

This commit is contained in:
SoulliesOfficial
2026-06-30 01:48:58 -04:00
parent 9a9e48f8a5
commit ddd387ef35
132 changed files with 8945 additions and 2943 deletions

View File

@@ -65,7 +65,8 @@ namespace Cielonos.MainGame.Characters
{
selfTimeSm?.SetUp(this);
Action<AttackAreaBase, CharacterBase, Attack.Result> onAttackHit = OnAttackHitRecoverEnergy;
eventSm.onFinishAttack.Add("AttackEnergyGain", onAttackHit.ToPrioritized());
}
protected virtual void Update()
@@ -263,11 +264,11 @@ namespace Cielonos.MainGame.Characters
public virtual void RecoverEnergy(float energyAmount, bool spawnText = true)
{
if (energyAmount <= 0) return;
if (Mathf.Abs(energyAmount) < 1e-5f) return;
if (!attributeSm.Has(CharacterAttribute.Energy) || !attributeSm.Has(CharacterAttribute.MaximumEnergy)) return;
attributeSm[CharacterAttribute.Energy] += energyAmount;
attributeSm[CharacterAttribute.Energy] = Mathf.Min(attributeSm[CharacterAttribute.Energy], attributeSm[CharacterAttribute.MaximumEnergy]);
attributeSm[CharacterAttribute.Energy] = Mathf.Clamp(attributeSm[CharacterAttribute.Energy], 0f, attributeSm[CharacterAttribute.MaximumEnergy]);
if (spawnText)
{
@@ -279,6 +280,18 @@ namespace Cielonos.MainGame.Characters
}
}
private void OnAttackHitRecoverEnergy(AttackAreaBase area, CharacterBase target, Attack.Result result)
{
if (attributeSm.Has(CharacterAttribute.EnergyGainByAttack))
{
float energyGain = attributeSm[CharacterAttribute.EnergyGainByAttack];
if (Mathf.Abs(energyGain) > 1e-5f)
{
RecoverEnergy(energyGain, true);
}
}
}
/// <summary>
/// 对角色施加韧性削减。适用于常规攻击造成的削韧。
/// </summary>