From e4e1681e1cef7eed5937a8a7a0a6f100affdb1a8 Mon Sep 17 00:00:00 2001 From: Kurt Date: Fri, 17 Jan 2020 21:09:54 -0800 Subject: [PATCH] Clamp roto rally score to 99_999 https://github.com/kwsch/PKHeX/issues/2639#issuecomment-575863541 --- PKHeX.Core/Saves/Substructures/Gen8/TrainerCard8.cs | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/PKHeX.Core/Saves/Substructures/Gen8/TrainerCard8.cs b/PKHeX.Core/Saves/Substructures/Gen8/TrainerCard8.cs index 042d58ca5..5facfcf14 100644 --- a/PKHeX.Core/Saves/Substructures/Gen8/TrainerCard8.cs +++ b/PKHeX.Core/Saves/Substructures/Gen8/TrainerCard8.cs @@ -19,11 +19,15 @@ public int TrainerID set => SAV.SetData(Data, BitConverter.GetBytes(value), 0x1C); } + public const int RotoRallyScoreMax = 99_999; + public int RotoRallyScore { get => BitConverter.ToInt32(Data, 0x28); set { + if (value > RotoRallyScoreMax) + value = RotoRallyScoreMax; var data = BitConverter.GetBytes(value); SAV.SetData(Data, data, 0x28); // set to the other block since it doesn't have an accessor