public static bool HasMark(IRibbonIndex pk, out RibbonIndex result) { result = default; for (var mark = RibbonIndex.MarkLunchtime; mark <= RibbonIndex.MarkSlump; mark++) { if (pk.GetRibbon((int)mark)) { result = mark; return(true); } } return(false); }
private static bool HasMark(IRibbonIndex pk, MarkIndex target, bool specific) { if (!specific) { for (var mark = RibbonIndex.MarkLunchtime; mark <= RibbonIndex.MarkSlump; mark++) { if ((!specific && pk.GetRibbon((int)mark)) || (specific && pk.GetRibbon((int)mark) && mark.Equals(target))) { return(true); } } } else if (specific && pk.GetRibbon((int)target)) { return(true); } return(false); }
private void VerifyAffixedRibbonMark(LegalityAnalysis data, IRibbonIndex m) { if (!(m is PK8 pk8)) { return; } var affix = pk8.AffixedRibbon; if (affix == -1) // None { return; } if ((byte)affix > (int)RibbonIndex.MarkSlump) { data.AddLine(GetInvalid(string.Format(LRibbonMarkingAffixedF_0, affix))); } else if (!pk8.GetRibbonIndex((RibbonIndex)affix)) { data.AddLine(GetInvalid(string.Format(LRibbonMarkingAffixedF_0, (RibbonIndex)affix))); } }
public static void SetRibbonIndex(this IRibbonIndex x, RibbonIndex r, bool value = true) => x.SetRibbon((int)r, value);
public static bool GetRibbonIndex(this IRibbonIndex x, RibbonIndex r) => x.GetRibbon((int)r);