Пример #1
0
        static Dictionary <string, RandomEncountersForMap> LoadEncounters(string objectFile)
        {
            var parser = new ParseRgbdsObj.ObjParser(objectFile);
            var ret    = new Dictionary <string, RandomEncountersForMap>();

            foreach (var symbol in Symbols)
            {
                var data = parser.CopySymbolData(symbol, 21 * 2);
                var rme  = new RandomEncountersForMap
                {
                    Name = symbol
                };
                rme.GrassEncounters = new RandomEncounters(data);
                rme.WaterEncounters = new RandomEncounters(data.Skip(rme.GrassEncounters.EncounterRate == 0 ? 1 : 21).ToArray());
                ret[symbol]         = rme;
            }
            return(ret);
        }
Пример #2
0
        public MergedRandomEncounters(RandomEncountersForMap red, RandomEncountersForMap blue)
        {
            Debug.Assert(red.Name == blue.Name && red.GrassEncounters.EncounterRate == blue.GrassEncounters.EncounterRate && red.WaterEncounters.EncounterRate == blue.WaterEncounters.EncounterRate);
            Name = red.Name;
            EncounterRateGrass = red.GrassEncounters.EncounterRate;
            EncounterRateWater = red.WaterEncounters.EncounterRate;

            var redGrass0  = red.GrassEncounters.Encounters.ToDictionary(x => x.ToInteger());
            var blueGrass0 = blue.GrassEncounters.Encounters.ToDictionary(x => x.ToInteger());
            var redWater0  = red.WaterEncounters.Encounters.ToDictionary(x => x.ToInteger());
            var blueWater0 = blue.WaterEncounters.Encounters.ToDictionary(x => x.ToInteger());

            var mergedGrass = Merge(redGrass0, blueGrass0, red.GrassEncounters.Encounters, blue.GrassEncounters.Encounters);
            var mergedWater = Merge(redWater0, blueWater0, red.WaterEncounters.Encounters, blue.WaterEncounters.Encounters);

            RedOnlyGrassEncounters  = mergedGrass[0].Values.OrderBy(x => x.Species).ThenBy(x => x.Level).ToList();
            BlueOnlyGrassEncounters = mergedGrass[1].Values.OrderBy(x => x.Species).ThenBy(x => x.Level).ToList();
            GrassEncounters         = mergedGrass[2].Values.OrderBy(x => x.Species).ThenBy(x => x.Level).ToList();

            RedOnlyWaterEncounters  = mergedWater[0].Values.OrderBy(x => x.Species).ThenBy(x => x.Level).ToList();
            BlueOnlyWaterEncounters = mergedWater[1].Values.OrderBy(x => x.Species).ThenBy(x => x.Level).ToList();
            WaterEncounters         = mergedWater[2].Values.OrderBy(x => x.Species).ThenBy(x => x.Level).ToList();
        }