Beispiel #1
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);
            }
        }
Beispiel #2
0
        internal static void ToBytes(this IPBEMoveset moveset, EndianBinaryWriter w)
        {
            byte count = (byte)moveset.Count;

            w.Write(count);
            for (int i = 0; i < count; i++)
            {
                IPBEMovesetSlot slot = moveset[i];
                w.Write(slot.Move);
                w.Write(slot.PPUps);
            }
        }
Beispiel #3
0
        public PBEReadOnlyPartyMoveset(PBESettings settings, IPBEMoveset other)
        {
            settings.ShouldBeReadOnly(nameof(settings));
            int count = other.Count;

            _list = new PBEReadOnlyPartyMovesetSlot[count];
            for (int i = 0; i < count; i++)
            {
                IPBEMovesetSlot oSlot = other[i];
                _list[i] = new PBEReadOnlyPartyMovesetSlot(settings, oSlot.Move, oSlot.PPUps);
            }
        }
Beispiel #4
0
 internal static void ToJson(this IPBEMoveset moveset, JsonTextWriter w)
 {
     w.WriteStartArray();
     for (int i = 0; i < moveset.Count; i++)
     {
         IPBEMovesetSlot slot = moveset[i];
         w.WriteStartObject();
         w.WritePropertyName(nameof(IPBEMovesetSlot.Move));
         w.WriteValue(slot.Move.ToString());
         w.WritePropertyName(nameof(IPBEMovesetSlot.PPUps));
         w.WriteValue(slot.PPUps);
         w.WriteEndObject();
     }
     w.WriteEndArray();
 }
Beispiel #5
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);
            }
        }
Beispiel #6
0
        public PBEReadOnlyPartyMoveset(PBESettings settings, IPBEMoveset other)
        {
            if (settings == null)
            {
                throw new ArgumentNullException(nameof(settings));
            }
            if (!settings.IsReadOnly)
            {
                throw new ArgumentException("Settings must be read-only.", nameof(settings));
            }
            if (other == null)
            {
                throw new ArgumentNullException(nameof(other));
            }
            int count = other.Count;

            _list = new PBEReadOnlyPartyMovesetSlot[count];
            for (int i = 0; i < count; i++)
            {
                IPBEMovesetSlot oSlot = other[i];
                _list[i] = new PBEReadOnlyPartyMovesetSlot(settings, oSlot.Move, oSlot.PPUps);
            }
        }