Example #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);
            }
        }
Example #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);
            }
        }
Example #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);
            }
        }
Example #4
0
        public static int CountMoves(this IPBEMoveset moves)
        {
            int num = 0;

            for (int i = 0; i < moves.Count; i++)
            {
                if (moves[i].Move != PBEMove.None)
                {
                    num++;
                }
            }
            return(num);
        }
Example #5
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();
 }
Example #6
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);
            }
        }
Example #7
0
 internal PBEReadOnlyPokemon(EndianBinaryReader r)
 {
     Species          = r.ReadEnum <PBESpecies>();
     Form             = r.ReadEnum <PBEForm>();
     Nickname         = r.ReadStringNullTerminated();
     Level            = r.ReadByte();
     Friendship       = r.ReadByte();
     Shiny            = r.ReadBoolean();
     Ability          = r.ReadEnum <PBEAbility>();
     Nature           = r.ReadEnum <PBENature>();
     Gender           = r.ReadEnum <PBEGender>();
     Item             = r.ReadEnum <PBEItem>();
     EffortValues     = new PBEStatCollection(r);
     IndividualValues = new PBEReadOnlyStatCollection(r);
     Moveset          = new PBEReadOnlyMoveset(r);
 }
Example #8
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);
            }
        }