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()); } }
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); } }
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); } }
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); } }
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); } }