Loosen restriction on party set (quantity)

Empty array being set is a legitimate write; properly clears the party data.
This commit is contained in:
Kurt
2024-09-23 00:48:57 -05:00
parent 1c7bc9d455
commit 128fcdff7a

View File

@@ -197,12 +197,9 @@ public IList<PKM> PartyData
}
set
{
if (value.Count is 0 or > MaxPartyCount)
throw new ArgumentOutOfRangeException(nameof(value), $"Expected 1-6, got {value.Count}");
#if DEBUG
if (value[0].Species == 0)
System.Diagnostics.Debug.WriteLine($"Empty first slot, received {value.Count}.");
#endif
if (value.Count > MaxPartyCount)
throw new ArgumentOutOfRangeException(nameof(value), $"Expected 0-6, got {value.Count}");
int ctr = 0;
foreach (var exist in value.Where(pk => pk.Species != 0))
SetPartySlotAtIndex(exist, ctr++);