Misc tweaks

Fix ranch save load (index out of range on party stat fetch due to bad truncation)
Folder Browser: Reapply filter if active on column sort
Fix inverted VC1/2 cross-check, add missing derived type and ignore Generation==0 (empty/invalid) moves.
This commit is contained in:
Kurt 2023-12-28 22:39:42 -08:00
parent 6b1e967a74
commit 50209c4f0d
4 changed files with 8 additions and 5 deletions

View file

@ -187,7 +187,7 @@ internal static class GBRestrictions
{
foreach (var z in moves)
{
if (z.Generation == enc.Generation || z.Generation > 2)
if (z.Generation == enc.Generation || z.Generation is not (1 or 2))
continue;
if (pk is PK1 {Catch_Rate: not 0} g1 && !IsTradebackCatchRate(g1.Catch_Rate))
return BadCatchRate;
@ -198,8 +198,8 @@ internal static class GBRestrictions
{
return enc.Generation switch
{
2 when pk.VC2 => Transferred21,
1 when pk.VC1 => Transferred12,
1 when pk.VC2 => Transferred12,
2 when pk.VC1 => Transferred21,
_ => NotTransferred,
};
}
@ -231,6 +231,7 @@ internal static class GBRestrictions
private static bool IsCatchRateMatchEncounter(IEncounterTemplate enc, PK1 pk1) => enc switch
{
EncounterGift1 g when g.GetMatchRating(pk1) < EncounterMatchRating.PartialMatch => true,
EncounterStatic1 s when s.GetMatchRating(pk1) < EncounterMatchRating.PartialMatch => true,
EncounterTrade1 => true,
_ => RateMatchesEncounter(enc.Species, enc.Version, pk1.Catch_Rate),

View file

@ -25,7 +25,7 @@ public sealed class RK4 : G4PKM
private static byte[] Decrypt(byte[] data)
{
data = data[..PokeCrypto.SIZE_4STORED];
data = data[..PokeCrypto.SIZE_4RSTORED];
PokeCrypto.DecryptIfEncrypted45(ref data);
return data;
}

View file

@ -1134,4 +1134,4 @@
高档货的样子
杰作的样子
太晶形态
星晶形态
星晶形态

View file

@ -294,6 +294,8 @@ public partial class SAV_FolderList : Form
enumerator.Dispose();
});
dgData.Sorted += (_, _) => GetFilterText(dgData);
return list;
}