Esempio n. 1
0
        internal PBEReadOnlyMoveset(EndianBinaryReader r)
        {
            int count = r.ReadByte();

            _list = new PBEReadOnlyMovesetSlot[count];
            for (int i = 0; i < count; i++)
            {
                _list[i] = new PBEReadOnlyMovesetSlot(r.ReadEnum <PBEMove>(), r.ReadByte());
            }
        }
Esempio n. 2
0
        public PBEReadOnlyMoveset(IPBEMoveset other)
        {
            int count = other.Count;

            _list = new PBEReadOnlyMovesetSlot[count];
            for (int i = 0; i < count; i++)
            {
                IPBEMovesetSlot oSlot = other[i];
                _list[i] = new PBEReadOnlyMovesetSlot(oSlot.Move, oSlot.PPUps);
            }
        }
Esempio n. 3
0
        internal PBEReadOnlyMoveset(JArray jArray)
        {
            int count = jArray.Count;

            _list = new PBEReadOnlyMovesetSlot[count];
            for (int i = 0; i < count; i++)
            {
                JToken  jToken = jArray[i];
                PBEMove move   = PBELocalizedString.GetMoveByName(jToken[nameof(IPBEMovesetSlot.Move)].Value <string>()).Value;
                byte    ppUps  = jToken[nameof(IPBEMovesetSlot.PPUps)].Value <byte>();
                _list[i] = new PBEReadOnlyMovesetSlot(move, ppUps);
            }
        }
Esempio n. 4
0
        public PBEReadOnlyMoveset(IPBEMoveset other)
        {
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }
            int count = other.Count;

            _list = new PBEReadOnlyMovesetSlot[count];
            for (int i = 0; i < count; i++)
            {
                IPBEMovesetSlot oSlot = other[i];
                _list[i] = new PBEReadOnlyMovesetSlot(oSlot.Move, oSlot.PPUps);
            }
        }
Esempio n. 5
0
        internal PBEReadOnlyMoveset(JArray jArray)
        {
            int count = jArray.Count;

            _list = new PBEReadOnlyMovesetSlot[count];
            for (int i = 0; i < count; i++)
            {
                JToken jToken = jArray[i];
                if (!PBEDataProvider.Instance.GetMoveByName(jToken.GetSafeString(nameof(IPBEMovesetSlot.Move)), out PBEMove? move))
                {
                    throw new InvalidDataException("Invalid move");
                }
                byte ppUps = jToken.GetSafe(nameof(IPBEMovesetSlot.PPUps)).Value <byte>();
                _list[i] = new PBEReadOnlyMovesetSlot(move.Value, ppUps);
            }
        }