2
0
Fork 0
You cannot select more than 25 topics Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.

38 lines
1.1 KiB
C#

using Articy.Touhou;
using Articy.Unity;
namespace Game
{
public static partial class UtilBuff
{
public static bool BuffPreCheck(int owner, int target, string buffId)
{
var buffCfg = Util.GetBuffConfig(buffId);
foreach (var obj in buffCfg.Buff.BuffPreCheck)
{
var ret = true;
if (obj is IObjectWithFeatureBuffPreCheckHasBuff)
{
ret = BuffPreCheckHasBuff(owner, target, obj);
}
if (!ret)
{
return false;
}
}
return true;
}
private static bool BuffPreCheckHasBuff(int owner, int target, ArticyObject buffObj)
{
var buffHasBuff = ((IObjectWithFeatureBuffPreCheckHasBuff)buffObj).GetFeatureBuffPreCheckHasBuff();
var e = Util.GetEntity(target);
if (e == null)
{
return false;
}
return Util.HasBuff(target, buffHasBuff.Buff.TechnicalName) == buffHasBuff.BooleanValue;
}
}
}