Add setting to retain met date on 4->5 transfer

This commit is contained in:
Kurt 2024-04-24 02:11:14 -05:00
parent 093264bc24
commit 9ff94455b9
4 changed files with 13 additions and 3 deletions

View file

@ -316,9 +316,9 @@ public sealed class PK4 : G4PKM
{
JunkByte = 0,
OriginalTrainerFriendship = 70,
// Apply new met date
MetDate = EncounterDate.GetDateNDS(),
};
if (!EntityConverter.RetainMetDateTransfer45)
EncounterDate.GetDateNDS(); // Apply new met date
pk5.HeldMail.Clear();
// Arceus Type Changing -- Plate forcibly removed.
@ -327,7 +327,7 @@ public sealed class PK4 : G4PKM
pk5.Form = 0;
pk5.HeldItem = 0;
}
else if (Array.IndexOf(Legal.HeldItems_BW, (ushort)HeldItem) == -1)
else if (!Legal.HeldItems_BW.AsSpan().Contains((ushort)HeldItem))
{
pk5.HeldItem = 0; // if valid, it's already copied
}

View file

@ -51,6 +51,12 @@ public static class EntityConverter
set => _vc2 = (value is GD or SI or C) ? value : SI;
}
/// <summary>
/// Retain the Met Date when transferring from Gen4 to Gen5.
/// </summary>
/// <remarks>Default behavior is to update it with a new date based on the time of transfer.</remarks>
public static bool RetainMetDateTransfer45 { get; set; }
/// <summary>
/// Checks if the input <see cref="PKM"/> file is capable of being converted to the desired format.
/// </summary>

View file

@ -433,6 +433,7 @@ public partial class Main : Form
EntityConverter.RejuvenateHOME = converter.AllowGuessRejuvenateHOME;
EntityConverter.VirtualConsoleSourceGen1 = converter.VirtualConsoleSourceGen1;
EntityConverter.VirtualConsoleSourceGen2 = converter.VirtualConsoleSourceGen2;
EntityConverter.RetainMetDateTransfer45 = converter.RetainMetDateTransfer45;
SpriteBuilder.LoadSettings(settings.Sprite);
}

View file

@ -259,6 +259,9 @@ public sealed class EntityConverterSettings
[LocalizedDescription("Default version to set when transferring from Generation 2 3DS Virtual Console to Generation 7.")]
public GameVersion VirtualConsoleSourceGen2 { get; set; } = GameVersion.SI;
[LocalizedDescription("Retain the Met Date when transferring from Generation 4 to Generation 5.")]
public bool RetainMetDateTransfer45 { get; set; }
}
public sealed class AdvancedSettings