做不出来
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Collections.Generic;
|
||||
using Cielonos.MainGame;
|
||||
using Cielonos.MainGame.Buffs.Character;
|
||||
using Cielonos.MainGame.Effects.Feedback;
|
||||
using Cielonos.MainGame.UI;
|
||||
@@ -197,9 +198,34 @@ namespace Cielonos.MainGame.Characters
|
||||
|
||||
public override void RecoverEnergy(float energyAmount, bool spawnText = true)
|
||||
{
|
||||
if (energyAmount <= 0) return;
|
||||
if (Mathf.Abs(energyAmount) < 1e-5f) return;
|
||||
|
||||
AddEnergy(energyAmount);
|
||||
if (energyAmount > 0)
|
||||
{
|
||||
float current = attributeSm[CharacterAttribute.Energy];
|
||||
float max = attributeSm[CharacterAttribute.MaximumEnergy];
|
||||
float availableSpace = max - current;
|
||||
|
||||
if (energyAmount > availableSpace)
|
||||
{
|
||||
attributeSm[CharacterAttribute.Energy] = max;
|
||||
|
||||
float conversionRate =
|
||||
attributeSm.Has(CharacterAttribute.OverloadConversionRate) ?
|
||||
attributeSm[CharacterAttribute.OverloadConversionRate] : 1f;
|
||||
float overflowEnergy = (energyAmount - availableSpace) * conversionRate;
|
||||
DistributeOverloadEnergy(overflowEnergy);
|
||||
}
|
||||
else
|
||||
{
|
||||
attributeSm[CharacterAttribute.Energy] += energyAmount;
|
||||
}
|
||||
}
|
||||
else
|
||||
{
|
||||
attributeSm[CharacterAttribute.Energy] += energyAmount;
|
||||
attributeSm[CharacterAttribute.Energy] = Mathf.Max(0, attributeSm[CharacterAttribute.Energy]);
|
||||
}
|
||||
|
||||
if (spawnText)
|
||||
{
|
||||
|
||||
Reference in New Issue
Block a user