Exemplo n.º 1
0
        public bool IsSurpassedBy(SuitBuildableMyWorldObject compareItem)
        {
            BuiltItemSearchCache();
            compareItem.BuiltItemSearchCache();

            if (compareItem.Exclude)
            {
                return(false);
            }

            // Items must be of the same armor set
            if (compareItem.ItemSetId != ItemSetId)
            {
                return(false);
            }

            // This checks to see that the compare item covers at least all the slots that the passed item does
            if (compareItem.Coverage.IsBodyArmor() && Coverage.IsBodyArmor())
            {
                if ((compareItem.Coverage & Coverage) != Coverage)
                {
                    return(false);
                }
            }
            else if ((compareItem.EquippableSlots & EquippableSlots) != EquippableSlots)
            {
                return(false);
            }

            // Find the highest level spell on this item
            Spell.CantripLevels highestCantrip = Spell.CantripLevels.None;

            foreach (Spell itemSpell in cachedSpells)
            {
                if (itemSpell.CantripLevel > highestCantrip)
                {
                    highestCantrip = itemSpell.CantripLevel;
                }
            }

            // Does this item have spells that equal or surpass this items at the highest cantrip level found?
            foreach (Spell itemSpell in cachedSpells)
            {
                if (itemSpell.CantripLevel < highestCantrip)
                {
                    continue;
                }

                foreach (Spell compareSpell in compareItem.cachedSpells)
                {
                    if (compareSpell.Surpasses(itemSpell))
                    {
                        return(true);
                    }

                    if (compareSpell.IsSameOrSurpasses(itemSpell))
                    {
                        goto next;
                    }
                }

                return(false);

                next :;
            }

            if (compareItem.CalcedStartingArmorLevel > CalcedStartingArmorLevel)
            {
                return(true);
            }

            if (compareItem.DamRating > DamRating && DamRating > 0)
            {
                return(true);
            }
            if (compareItem.DamResistRating > DamResistRating && DamResistRating > 0)
            {
                return(true);
            }
            if (compareItem.CritRating > CritRating && CritRating > 0)
            {
                return(true);
            }
            if (compareItem.CritResistRating > CritResistRating && CritResistRating > 0)
            {
                return(true);
            }
            if (compareItem.CritDamRating > CritDamRating && CritDamRating > 0)
            {
                return(true);
            }
            if (compareItem.CritDamResistRating > CritDamResistRating && CritDamResistRating > 0)
            {
                return(true);
            }
            if (compareItem.HealBoostRating > HealBoostRating && HealBoostRating > 0)
            {
                return(true);
            }
            if (compareItem.VitalityRating > VitalityRating && VitalityRating > 0)
            {
                return(true);
            }

            return(false);
        }