mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-26 22:10:21 +00:00
Minor tweaks
This commit is contained in:
parent
3351e0a66f
commit
6bed33f7f1
4 changed files with 37 additions and 6 deletions
|
@ -10,12 +10,24 @@ namespace PKHeX.Core
|
|||
public sealed class LegalMoveSource
|
||||
{
|
||||
public readonly bool[] IsMoveBoxOrdered = new bool[4];
|
||||
|
||||
/// <summary> Creates a shallow copy of the array reference for use in binding. </summary>
|
||||
public IReadOnlyList<ComboItem> DataSource => (ComboItem[])MoveDataAllowed.Clone();
|
||||
|
||||
/// <summary>
|
||||
/// Checks if the requested <see cref="move"/> is in the valid learnable list of moves.
|
||||
/// </summary>
|
||||
/// <param name="move">Move to check if can be learned</param>
|
||||
/// <returns>True if can learn the move</returns>
|
||||
public bool CanLearn(int move) => AllowedMoves.Contains(move);
|
||||
|
||||
private readonly HashSet<int> AllowedMoves = new();
|
||||
private ComboItem[] MoveDataAllowed = Array.Empty<ComboItem>();
|
||||
|
||||
/// <summary>
|
||||
/// Reloads the legality sources to permit the provided legal <see cref="moves"/>.
|
||||
/// </summary>
|
||||
/// <param name="moves">Legal moves to allow</param>
|
||||
public void ReloadMoves(IReadOnlyList<int> moves)
|
||||
{
|
||||
// check prior move-pool to not needlessly refresh the data set
|
||||
|
|
|
@ -23,11 +23,13 @@ namespace PKHeX.Core
|
|||
/// <summary>
|
||||
/// Pokémon Link Flag
|
||||
/// </summary>
|
||||
public byte PL_Flag {
|
||||
get => Data[0x00]; set => Data[0x00] = value;
|
||||
public byte Flags
|
||||
{
|
||||
get => Data[0x00];
|
||||
set => Data[0x00] = value;
|
||||
}
|
||||
|
||||
public bool PL_enabled { get => PL_Flag != 0; set => PL_Flag = value ? (byte)(1 << 7) : (byte)0; }
|
||||
public bool Enabled { get => (Flags & 0x80) != 0; set => Flags = value ? (byte)(1 << 7) : (byte)0; }
|
||||
|
||||
/// <summary>
|
||||
/// Name of data source
|
||||
|
@ -75,7 +77,7 @@ namespace PKHeX.Core
|
|||
/// This Template object is very similar to the <see cref="WC6"/> structure and similar objects, in that the structure offsets are ordered the same.
|
||||
/// This template object is only present in Generation 6 save files.
|
||||
/// </remarks>
|
||||
public sealed class PL6_PKM : IRibbonSetEvent3, IRibbonSetEvent4
|
||||
public sealed class PL6_PKM : IRibbonSetEvent3, IRibbonSetEvent4, IEncounterInfo
|
||||
{
|
||||
internal const int Size = 0xA0;
|
||||
|
||||
|
@ -192,5 +194,19 @@ namespace PKHeX.Core
|
|||
if (value.Count > 3) RelearnMove4 = value[3];
|
||||
}
|
||||
}
|
||||
|
||||
public int Generation => 6;
|
||||
public bool IsShiny => false;
|
||||
public bool EggEncounter => false;
|
||||
public GameVersion Version => GameVersion.Gen6;
|
||||
|
||||
public PKM ConvertToPKM(ITrainerInfo sav) => ConvertToPKM(sav, EncounterCriteria.Unrestricted);
|
||||
|
||||
public PKM ConvertToPKM(ITrainerInfo sav, EncounterCriteria criteria)
|
||||
{
|
||||
var wc6 = new WC6();
|
||||
Data.CopyTo(wc6.Data, 0x68);
|
||||
return wc6.ConvertToPKM(sav, criteria);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1695,6 +1695,9 @@ namespace PKHeX.WinForms.Controls
|
|||
{
|
||||
var s = (ComboBox) sender;
|
||||
var index = Array.IndexOf(Moves, s);
|
||||
|
||||
// Populating the combobox drop-down list is deferred until the dropdown is entered into at least once.
|
||||
// Saves some lag delays when viewing a pkm.
|
||||
if (LegalMoveSource.IsMoveBoxOrdered[index])
|
||||
return;
|
||||
SetMoveDataSource(s);
|
||||
|
|
|
@ -68,7 +68,7 @@ namespace PKHeX.WinForms
|
|||
private void LoadLinkData()
|
||||
{
|
||||
RTB_LinkSource.Text = LinkInfo.Origin;
|
||||
CHK_LinkAvailable.Checked = LinkInfo.PL_enabled;
|
||||
CHK_LinkAvailable.Checked = LinkInfo.Enabled;
|
||||
|
||||
NUD_BP.Value = LinkInfo.BattlePoints;
|
||||
NUD_Pokemiles.Value = LinkInfo.Pokemiles;
|
||||
|
|
Loading…
Reference in a new issue