예제 #1
0
    //Calculates Critter's restrictions after replacing equippedEvo with testEvo.
    private List<Adaptation.restriction> CalculateNewRestrictions(Critter critter, Adaptation testEvo, Adaptation equippedEvo)
    {
        List<Adaptation.restriction> activeRestrictions = new List<Adaptation.restriction>(critter.GetRestrictionList());

        activeRestrictions = critter.GetRestrictionList();

        if (equippedEvo != null)
        {
            Adaptation.restriction[] equippedRestrictions = new Adaptation.restriction[equippedEvo.restrictions.Count];
            equippedEvo.restrictions.CopyTo(equippedRestrictions);

            foreach (Adaptation.restriction item in equippedRestrictions)
            {
                if (activeRestrictions.Contains(item))
                {
                    activeRestrictions.Remove(item);
                }
            }
        }

        if (testEvo != null)
        {
            Adaptation.restriction[] newEvoRestrictions = new Adaptation.restriction[testEvo.restrictions.Count];
            testEvo.restrictions.CopyTo(newEvoRestrictions);

            foreach (Adaptation.restriction item in newEvoRestrictions)
            {
                activeRestrictions.Add(item);
            }
        }

        return activeRestrictions;
    }