internal PBEReadOnlyPartyMoveset(EndianBinaryReader r) { int count = r.ReadByte(); _list = new PBEReadOnlyPartyMovesetSlot[count]; for (int i = 0; i < count; i++) { _list[i] = new PBEReadOnlyPartyMovesetSlot(r.ReadEnum <PBEMove>(), r.ReadInt32(), r.ReadByte()); } }
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); } }
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); } }
internal PBEReadOnlyPartyMoveset(JArray jArray) { int count = jArray.Count; _list = new PBEReadOnlyPartyMovesetSlot[count]; for (int i = 0; i < count; i++) { JToken jToken = jArray[i]; PBEMove move = PBELocalizedString.GetMoveByName(jToken[nameof(IPBEPartyMovesetSlot.Move)].Value <string>()).Value; int pp = jToken[nameof(IPBEPartyMovesetSlot.PP)].Value <int>(); byte ppUps = jToken[nameof(IPBEPartyMovesetSlot.PPUps)].Value <byte>(); _list[i] = new PBEReadOnlyPartyMovesetSlot(move, pp, ppUps); } }
internal PBEReadOnlyPartyMoveset(JArray jArray) { int count = jArray.Count; _list = new PBEReadOnlyPartyMovesetSlot[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"); } int pp = jToken.GetSafe(nameof(IPBEPartyMovesetSlot.PP)).Value <int>(); byte ppUps = jToken.GetSafe(nameof(IPBEPartyMovesetSlot.PPUps)).Value <byte>(); _list[i] = new PBEReadOnlyPartyMovesetSlot(move.Value, pp, ppUps); } }
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); } }