2021-04-08 20:09:59 +08:00
|
|
|
|
using Cal;
|
|
|
|
|
using Cal.DataTable;
|
|
|
|
|
using System;
|
|
|
|
|
using System.Collections.Generic;
|
|
|
|
|
using System.Text;
|
|
|
|
|
|
|
|
|
|
namespace ET
|
|
|
|
|
{
|
|
|
|
|
public class AddMpGoodsEffect : GoodsEffect
|
|
|
|
|
{
|
|
|
|
|
public override string Init(Unit unit, GoodsBase goodsBase,bool isLock =false)
|
|
|
|
|
{
|
|
|
|
|
base.unit = unit;
|
|
|
|
|
GoodsBase = goodsBase;
|
|
|
|
|
return Run();
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
private string Run()
|
|
|
|
|
{
|
|
|
|
|
ModifierContainerComponent modifierContainerComponent = unit.GetComponent<ModifierContainerComponent>();
|
|
|
|
|
if (modifierContainerComponent.HasState(ModifierStateType.禁用药水))
|
|
|
|
|
{
|
|
|
|
|
return "禁用药水";
|
|
|
|
|
}
|
2021-04-11 19:50:39 +08:00
|
|
|
|
NumericComponent num = unit.GetComponent<NumericComponent>();
|
2021-04-08 20:09:59 +08:00
|
|
|
|
if(num.GetAsInt(NumericType.Mp) >= num.GetAsInt(NumericType.MaxMp))
|
|
|
|
|
{
|
|
|
|
|
return "Mp已满,无法使用!";
|
|
|
|
|
}
|
|
|
|
|
int mp = MathHelper.RoundToInt(GoodsBase.PercentMp * num.GetAsInt(NumericType.MaxMp)) + GoodsBase.FixedMp;
|
|
|
|
|
num.AddSet(NumericType.Mp, mp);
|
|
|
|
|
Game.EventSystem.Publish(new EventType.ChangeUnitCharacter { unit = unit }).Coroutine();
|
|
|
|
|
return string.Empty;
|
|
|
|
|
}
|
|
|
|
|
|
|
|
|
|
public override async ETVoid Execute()
|
|
|
|
|
{
|
|
|
|
|
|
|
|
|
|
await ETTask.CompletedTask;
|
|
|
|
|
}
|
|
|
|
|
}
|
|
|
|
|
}
|