42 lines
1.1 KiB
C#
Executable File
42 lines
1.1 KiB
C#
Executable File
using Cal.DataTable;
|
|
using System;
|
|
using System.Collections.Generic;
|
|
using System.Text;
|
|
|
|
namespace ET
|
|
{
|
|
public class AddEnergyGoodsEffect : GoodsEffect
|
|
{
|
|
private const int Energy_Limit = 2000;
|
|
public override string Init(Unit unit, GoodsBase goodsBase,bool isLock =false)
|
|
{
|
|
base.unit = unit;
|
|
GoodsBase = goodsBase;
|
|
return Run();
|
|
}
|
|
|
|
private string Run()
|
|
{
|
|
PlayerData data = unit.GetComponent<PlayerData>();
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
|
int energy = num.GetAsInt(NumericType.Energy);
|
|
energy += GoodsBase.CommonIncrease;
|
|
if (energy > Energy_Limit)
|
|
{
|
|
energy = Energy_Limit;
|
|
return $"行动值达到上限{Energy_Limit}";
|
|
}
|
|
num.Set(NumericType.Energy, energy);
|
|
data.ForbidExp = energy <= 0;
|
|
UnitHelper.SaveComponenet(data);
|
|
return string.Empty;
|
|
}
|
|
|
|
public override async ETVoid Execute()
|
|
{
|
|
await ETTask.CompletedTask;
|
|
|
|
}
|
|
}
|
|
}
|