63 lines
1.7 KiB
C#
63 lines
1.7 KiB
C#
using System.Collections.Generic;
|
|
using System.Xml.Linq;
|
|
|
|
public class HasBuffLike : TargetedCompareRequirementBase
|
|
{
|
|
public override bool IsValid(MinEventParams _params)
|
|
{
|
|
//Log.Out("HasBuffLike-IsValid START");
|
|
if (!base.ParamsValid(_params))
|
|
{
|
|
//Log.Out("HasBuffLike-IsValid 1");
|
|
return false;
|
|
}
|
|
|
|
bool result = false;
|
|
|
|
//Log.Out("HasBuffLike-IsValid this.buffName: " + this.buffName);
|
|
|
|
var buffs = this.buffName.Split(',');
|
|
for (int x = 0; x < buffs.Length; x++)
|
|
{
|
|
//Log.Out("HasBuffLike-IsValid buffs[x]: " + buffs[x]);
|
|
if (RebirthUtilities.HasBuffLike(this.target, buffs[x]))
|
|
{
|
|
//Log.Out("HasBuffLike-IsValid IS LIKE");
|
|
result = true;
|
|
break;
|
|
}
|
|
}
|
|
|
|
if (!this.invert)
|
|
{
|
|
//Log.Out("HasBuffLike-IsValid 2, result: " + result);
|
|
return result;
|
|
}
|
|
|
|
//Log.Out("HasBuffLike-IsValid 3, result: " + !result);
|
|
return !result;
|
|
}
|
|
|
|
public override bool ParseXAttribute(XAttribute _attribute)
|
|
{
|
|
bool flag = base.ParseXAttribute(_attribute);
|
|
if (!flag)
|
|
{
|
|
string name = _attribute.Name.LocalName;
|
|
if (name != null && name == "buff")
|
|
{
|
|
this.buffName = _attribute.Value.ToLower();
|
|
return true;
|
|
}
|
|
}
|
|
return flag;
|
|
}
|
|
|
|
public override void GetInfoStrings(ref List<string> list)
|
|
{
|
|
list.Add(string.Format("Target does {0}have buff '{1}'", this.invert ? "NOT " : "", this.buffName));
|
|
}
|
|
|
|
private string buffName;
|
|
}
|