Exemplo n.º 1
0
    private static void InvertDeadlockContest(IRibbonSetCommon6 c6, LegalityAnalysis la, bool desiredState)
    {
        // RibbonContestStar depends on having all contest ribbons, and having RibbonContestStar requires all.
        // Since the above logic sets individual ribbons, we must try setting this deadlock pair manually.
        if (c6.RibbonMasterToughness == desiredState || c6.RibbonContestStar == desiredState)
        {
            return;
        }

        la.ResetParse();
        c6.RibbonMasterToughness = c6.RibbonContestStar = desiredState;
        bool result = UpdateIsValid(la);

        if (!result)
        {
            c6.RibbonMasterToughness = c6.RibbonContestStar = !desiredState;
        }
    }
Exemplo n.º 2
0
    private static int TryRemoveAllRibbons(PKM pk, LegalityAnalysis la, IList <string> allRibbons, ICollection <string> valid)
    {
        int removed = 0;

        for (int i = 0; i < allRibbons.Count;)
        {
            la.ResetParse();
            var rib     = allRibbons[i];
            var success = TryRemoveRibbon(pk, la, rib);
            if (success)
            {
                ++removed;
                allRibbons.RemoveAt(i);
                valid.Add(rib);
            }
            else
            {
                SetRibbonValue(pk, rib, 1);
                ++i;
            }
        }

        return(removed);
    }