using System.Collections.Generic; using System.Globalization; using System.Xml.Linq; public class GeneticsCompareRebirth : TargetedCompareRequirementBase { public override bool IsValid(MinEventParams _params) { if (!this.ParamsValid(_params)) { return false; } int level = (int)RebirthVariables.localVariables["$varFuriousRamsay" + genetic + "PercUnit"]; //Log.Out("GeneticsCompareRebirth-IsValid level: " + level); if (this.invert) { return !RequirementBase.compareValues(level, this.operation, this.value); } return RequirementBase.compareValues(level, this.operation, this.value); } public override void GetInfoStrings(ref List list) { list.Add(string.Format("cvar.{0} {1} {2}", genetic, this.operation.ToStringCached(), this.value.ToCultureInvariantString())); } public override bool ParseXAttribute(XAttribute _attribute) { string localName = _attribute.Name.LocalName; if (localName == "operation") { this.operation = EnumUtils.Parse(_attribute.Value, true); return true; } else if (localName == "value") { if (_attribute.Value.StartsWith("@")) { this.useCVar = true; this.refCvarName = _attribute.Value.Substring(1); } else { this.value = StringParsers.ParseFloat(_attribute.Value, 0, -1, NumberStyles.Any); } fullValue = _attribute.Value; return true; } else if (localName == "invert") { this.invert = StringParsers.ParseBool(_attribute.Value, 0, -1, true); return true; } else if (localName == "target") { this.targetType = EnumUtils.Parse(_attribute.Value, true); return true; } else if (localName == "genetic") { genetic = _attribute.Value; return true; } else { return false; } } protected string genetic; protected string fullValue; }