예제 #1
0
        internal static bool getIsFossil(PKM pkm)
        {
            if (pkm.Egg_Location != 0)
            {
                return(false);
            }

            switch (pkm.GenNumber)
            {
            case 6:
                if (pkm.Met_Level != 20)
                {
                    return(false);
                }
                if (pkm.XY && pkm.Met_Location == 44)
                {
                    return(Fossils.Contains(getBaseSpecies(pkm)));
                }
                if (pkm.AO && pkm.Met_Location == 190)
                {
                    return(Fossils.Contains(getBaseSpecies(pkm)));
                }
                return(false);

            case 7:
                // TBD
                return(false);
            }

            return(false);
        }
예제 #2
0
        public bool Execute(Equipment item, AffixManager affixManager)
        {
            if (item.Corrupted || item.Rarity != EquipmentRarity.Rare)
            {
                return(false);
            }

            var corruptedEssenceChance = Fossils.Max(x => x.CorruptedEssenceChance);

            bool addCorruptedEssence = false;

            if (corruptedEssenceChance == 100)
            {
                addCorruptedEssence = true;
            }
            else if (corruptedEssenceChance > 0)
            {
                var chance = Random.Next(100);
                if (chance >= corruptedEssenceChance)
                {
                    addCorruptedEssence = true;
                }
            }

            int addedAffixes = 0;

            if (addCorruptedEssence)
            {
                var essence = _corruptionOnlyEssences[Random.Next(_corruptionOnlyEssences.Count)];

                StatFactory.AddExplicit(Random, item, essence.ItemClassToMod[item.ItemBase.ItemClass]);

                addedAffixes = 1;
            }

            int fourMod = 8;
            int fiveMod = 3;
            int sixMod  = 1;

            var sum = fourMod + fiveMod + sixMod;

            var roll     = Random.Next(sum);
            int modCount = roll < fourMod ? 4 :
                           roll < fourMod + fiveMod ? 5 :
                           6;

            item.Stats.Clear();
            for (int i = addedAffixes; i < modCount; i++)
            {
                StatFactory.AddExplicit(Random, item, affixManager, Fossils);
            }

            return(true);
        }
예제 #3
0
        public override int GetHashCode()
        {
            const int seed  = 0x2D2816FE;
            const int prime = 397;

            unchecked
            {
                int tagsHash = Tags != null?Tags.Aggregate(seed, (x, y) => x ^ y.GetHashCode()) : 0;

                int fossilsHash = Fossils != null?Fossils.Aggregate(seed, (x, y) => x ^ y.GetHashCode()) : 0;

                int masterModHash = MasterMods != null?MasterMods.Aggregate(seed, (x, y) => x ^ y.GetHashCode()) : 0;

                return(tagsHash * prime + fossilsHash * prime + masterModHash);
            }
        }
예제 #4
0
        internal static bool getIsFossil(PK6 pk6)
        {
            if (pk6.Met_Level != 20)
            {
                return(false);
            }
            if (pk6.Egg_Location != 0)
            {
                return(false);
            }
            if (pk6.XY && pk6.Met_Location == 44)
            {
                return(Fossils.Contains(getBaseSpecies(pk6)));
            }
            if (pk6.AO && pk6.Met_Location == 190)
            {
                return(Fossils.Contains(getBaseSpecies(pk6)));
            }

            return(false);
        }
예제 #5
0
 protected bool Equals(PoolKey other)
 {
     return(Tags.All(x => other.Tags.Contains(x)) && Fossils.All(x => other.Fossils.Contains(x)) && MasterMods.All(x => other.MasterMods.Contains(x)));
 }