Esempio n. 1
0
        private EncounterSlot4[] ReadRegularSlots(byte[] data)
        {
            const int size  = 10;
            int       count = (data.Length - 6) / size;
            var       slots = new EncounterSlot4[count];

            for (int i = 0; i < slots.Length; i++)
            {
                int offset = 6 + (size * i);

                int species = BitConverter.ToUInt16(data, offset + 0);
                int form    = data[offset + 2];
                int slotNum = data[offset + 3];
                int min     = data[offset + 4];
                int max     = data[offset + 5];

                int mpi = data[offset + 6];
                int mpc = data[offset + 7];
                int sti = data[offset + 8];
                int stc = data[offset + 9];
                slots[i] = new EncounterSlot4(this, species, form, min, max, slotNum, mpi, mpc, sti, stc);
            }

            return(slots);
        }
Esempio n. 2
0
 // Utility
 private static bool IsEncounterTypeMatch(IEncounterable e, int type)
 {
     return(e switch
     {
         EncounterStaticTyped t => t.TypeEncounter.Contains(type),
         EncounterSlot4 w => w.TypeEncounter.Contains(type),
         _ => (type == 0)
     });
Esempio n. 3
0
        private static EncounterType GetEncounterTypeValue(PKM pkm, IEncounterable enc)
        {
            // Encounter type data is only stored for gen 4 encounters
            // All eggs have encounter type none, even if they are from static encounters
            if (enc.Generation != 4 || pkm.Egg_Location != 0)
            {
                return(EncounterType.None);
            }

            return(enc switch
            {
                EncounterSlot4 w => w.TypeEncounter,
                EncounterStaticTyped s => s.TypeEncounter,
                _ => EncounterType.None
            });