コード例 #1
0
ファイル: EncounterArea6XY.cs プロジェクト: jan2705/PKHeX
        public EncounterArea6XY(ICollection <int> species) : base(GameVersion.XY)
        {
            Location = 148;
            Type     = SlotType.FriendSafari;

            var slots = new EncounterSlot6XY[species.Count];
            int ctr   = 0;

            foreach (var s in species)
            {
                slots[ctr++] = new EncounterSlot6XY(this, s, 0, 30, 30);
            }
            Slots = slots;
        }
コード例 #2
0
        private EncounterSlot6XY[] ReadSlots(byte[] data)
        {
            const int size  = 4;
            int       count = (data.Length - 4) / size;
            var       slots = new EncounterSlot6XY[count];

            for (int i = 0; i < slots.Length; i++)
            {
                int    offset   = 4 + (size * i);
                ushort SpecForm = BitConverter.ToUInt16(data, offset);
                int    species  = SpecForm & 0x3FF;
                int    form     = SpecForm >> 11;
                int    min      = data[offset + 2];
                int    max      = data[offset + 3];
                slots[i] = new EncounterSlot6XY(this, species, form, min, max);
            }

            return(slots);
        }
コード例 #3
0
        public EncounterArea6XY(ICollection <int> species) : base(GameVersion.XY)
        {
            Location = 148;
            Type     = SlotType.FriendSafari;

            var slots = new EncounterSlot6XY[species.Count];
            int ctr   = 0;

            foreach (var s in species)
            {
                slots[ctr++] = new EncounterSlot6XY(this, s, 0, 30, 30);
            }

            // Find Vivillon and replace form to be region-random
            var idx = Array.FindIndex(slots, z => z.Species == (int)Species.Vivillon);

            slots[idx] = new EncounterSlot6XY(this, (int)Species.Vivillon, 30, 30, 30);
            Slots      = slots;
        }