Ejemplo n.º 1
0
        public override int[] getSpecies(int ver, bool IsNight)
        {
            bool IsMoon  = ver == 6 || ver == 8;
            bool IsUltra = ver > 6;

            int[] table = (int[])Species.Clone();
            for (int i = 0; i < table.Length; i++)
            {
                if (IsNight)
                {
                    table[i] = Day2Night.TryGetValue(table[i], out int specform) ? specform : table[i];
                }
                if (IsNight && IsUltra)
                {
                    table[i] = UltraDay2Night.TryGetValue(table[i], out int specform) ? specform : table[i];
                }
                if (IsMoon)
                {
                    table[i] = Sun2Moon.TryGetValue(table[i], out int specform) ? specform : table[i];
                }
                if (Pokemon.AlolanForms.Contains(table[i]))
                {
                    table[i] += 2048;
                }
            }
            return(table);
        }
Ejemplo n.º 2
0
 private int[] getSpecies(bool IsY)
 {
     int[] table = (int[])Species.Clone();
     if (IsY && VersionDifference)  // Replace ORAS species
     {
         for (int i = 0; i < 3; i++)
         {
             int idx = Array.IndexOf(XList, table[i]);
             if (idx > -1)
             {
                 table[i] = YList[idx];
             }
         }
     }
     return(table);
 }
Ejemplo n.º 3
0
 public override int[] getSpecies(int ver, bool IsNight)
 {
     int[] table = (int[])Species.Clone();
     if (VersionDifference && ver == 1)  // Replace XY species; ORAS don't have version difference?
     {
         for (int i = 0; i < 3; i++)
         {
             int idx = Array.IndexOf(XList, table[i]);
             if (idx > -1)
             {
                 table[i] = YList[idx];
             }
         }
     }
     return(table);
 }
Ejemplo n.º 4
0
 private int[] getSpecies(bool IsMoon, bool IsNight)
 {
     IsNight ^= Reverse;
     IsMoon  ^= Reverse;
     int[] table = (int[])Species.Clone();
     if (IsNight && DayNightDifference) // Replace Day/Night species
     {
         for (int i = 1; i < table.Length; i++)
         {
             int idx = Array.IndexOf(DayList, table[i]);
             if (idx > -1)
             {
                 table[i] = NightList[idx];
             }
         }
     }
     if (IsMoon && VersionDifference)  // Replace Sun/Moon species
     {
         for (int i = 1; i < table.Length; i++)
         {
             int idx = Array.IndexOf(SunList, table[i]);
             if (idx > -1)
             {
                 table[i] = MoonList[idx];
             }
         }
     }
     if (table.Any(i => AlolanForms.Contains(i))) // Replace with alolan form
     {
         for (int i = 1; i < table.Length; i++)
         {
             if (AlolanForms.Contains(table[i]))
             {
                 table[i] += 2048;
             }
         }
     }
     return(table);
 }
Ejemplo n.º 5
0
 protected virtual int[] getSpecies(bool IsMoon, bool IsNight)
 {
     IsNight ^= Reverse;
     IsMoon  ^= Reverse;
     int[] table = (int[])Species.Clone();
     for (int i = 1; i < table.Length; i++)
     {
         if (IsNight)
         {
             table[i] = Day2Night.TryGetValue(table[i], out int specform) ? specform : table[i];
         }
         if (IsMoon)
         {
             table[i] = Sun2Moon.TryGetValue(table[i], out int specform) ? specform : table[i];
         }
         if (Pokemon.AlolanForms.Contains(table[i]))
         {
             table[i] += 2048;
         }
     }
     return(table);
 }
Ejemplo n.º 6
0
        private MicrobeSpecies TryBiodiversitySplit(Species splitFrom, bool inCurrentPatch)
        {
            var config = new SimulationConfiguration(configuration, map, Constants.AUTO_EVO_VARIANT_SIMULATION_STEPS);

            var split = (MicrobeSpecies)splitFrom.Clone();

            if (configuration.BiodiversitySplitIsMutated)
            {
                mutations.CreateMutatedSpecies((MicrobeSpecies)splitFrom, split);
            }

            // Set the starting population in the patch
            split.Population = configuration.NewBiodiversityIncreasingSpeciesPopulation;

            config.ExtraSpecies.Add(split);
            config.PatchesToRun.Add(patch);

            if (inCurrentPatch)
            {
                // TODO: should we apply the population reduction to splitFrom?
            }

            PopulationSimulation.Simulate(config);

            var population = config.Results.GetPopulationInPatch(split, patch);

            if (population < configuration.NewBiodiversityIncreasingSpeciesPopulation)
            {
                return(null);
            }

            // TODO: could compare the original species population here to determine if this change is beneficial to
            // it as well (in which case a non-force species split could be done)

            // Successfully found a species to create in order to increase biodiversity
            return(split);
        }