public PBEReadOnlyPartyMoveset(IPBEPartyMoveset other) { int count = other.Count; _list = new PBEReadOnlyPartyMovesetSlot[count]; for (int i = 0; i < count; i++) { IPBEPartyMovesetSlot oSlot = other[i]; _list[i] = new PBEReadOnlyPartyMovesetSlot(oSlot.Move, oSlot.PP, oSlot.PPUps); } }
internal static void ToBytes(this IPBEPartyMoveset moveset, EndianBinaryWriter w) { byte count = (byte)moveset.Count; w.Write(count); for (int i = 0; i < count; i++) { IPBEPartyMovesetSlot slot = moveset[i]; w.Write(slot.Move); w.Write(slot.PP); w.Write(slot.PPUps); } }
internal static void ToJson(this IPBEPartyMoveset moveset, JsonTextWriter w) { w.WriteStartArray(); for (int i = 0; i < moveset.Count; i++) { IPBEPartyMovesetSlot slot = moveset[i]; w.WriteStartObject(); w.WritePropertyName(nameof(IPBEPartyMovesetSlot.Move)); w.WriteValue(slot.Move.ToString()); w.WritePropertyName(nameof(IPBEPartyMovesetSlot.PPUps)); w.WriteValue(slot.PP); w.WritePropertyName(nameof(IPBEPartyMovesetSlot.PPUps)); w.WriteValue(slot.PPUps); w.WriteEndObject(); } w.WriteEndArray(); }