Update 22.08.31

This commit is contained in:
Kurt 2022-08-30 22:49:54 -07:00
parent d350bb7fee
commit 71e08222cf
8 changed files with 38 additions and 16 deletions

View file

@ -100,7 +100,7 @@ public static partial class Legal
/// <param name="pk">Entity to check</param>
internal static bool IsOriginalMovesetDeleted(this PKM pk)
{
if (pk.Format == 8 && pk.Generation == 8)
if (pk.Format == 8)
return IsSideGameTransferDeletedMoveset(pk);
return pk is IBattleVersion { BattleVersion: not 0 };
}

View file

@ -224,17 +224,17 @@ public sealed class FormVerifier : Verifier
return ++form; // ??? type Form shifts everything by 1
}
public static int GetSilvallyFormFromHeldItem(int item)
public static byte GetSilvallyFormFromHeldItem(int item)
{
if (item is >= 904 and <= 920)
return item - 903;
return (byte)(item - 903);
return 0;
}
public static int GetGenesectFormFromHeldItem(int item)
public static byte GetGenesectFormFromHeldItem(int item)
{
if (item is >= 116 and <= 119)
return item - 115;
return (byte)(item - 115);
return 0;
}

View file

@ -91,13 +91,22 @@ public static class RibbonVerifierCommon6
private static void GetInvalidRibbons6Memory(IRibbonSetMemory6 r, RibbonVerifierArguments args, ref RibbonResultList list)
{
(int contest, int battle) = RibbonRules.GetMaxMemoryCounts(args.History, args.Entity, args.Encounter);
if (r.RibbonCountMemoryContest > contest || r.HasContestMemoryRibbon != (r.RibbonCountMemoryContest != 0))
var format = args.Entity.Format;
(byte contest, byte battle) = RibbonRules.GetMaxMemoryCounts(args.History, args.Entity, args.Encounter);
if (!IsCountFlagValid(r.RibbonCountMemoryContest, r.HasContestMemoryRibbon, format, contest))
list.Add(CountMemoryContest);
if (r.RibbonCountMemoryBattle > battle || r.HasBattleMemoryRibbon != (r.RibbonCountMemoryBattle != 0))
if (!IsCountFlagValid(r.RibbonCountMemoryBattle, r.HasBattleMemoryRibbon, format, battle))
list.Add(CountMemoryBattle);
}
private static bool IsCountFlagValid(byte count, bool state, int format, byte max)
{
if (count > max)
return false;
bool expect = format >= 8 && count != 0; // Gen8+ use flag, Gen6/7 do not set it.
return state == expect;
}
private static void FlagContestAffection(IRibbonSetCommon6 r, ref RibbonResultList list, int current)
{
int expect = 0;

View file

@ -202,8 +202,8 @@ public sealed class PK6 : G6PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetC
public bool RibbonMasterToughness { get => (RIB5 & (1 << 5)) == 1 << 5; set => RIB5 = (byte)((RIB5 & ~(1 << 5)) | (value ? 1 << 5 : 0)); }
public bool RIB5_6 { get => (RIB5 & (1 << 6)) == 1 << 6; set => RIB5 = (byte)((RIB5 & ~(1 << 6)) | (value ? 1 << 6 : 0)); } // Unused
public bool RIB5_7 { get => (RIB5 & (1 << 7)) == 1 << 7; set => RIB5 = (byte)((RIB5 & ~(1 << 7)) | (value ? 1 << 7 : 0)); } // Unused
public byte RibbonCountMemoryContest { get => Data[0x38]; set => HasContestMemoryRibbon = (Data[0x38] = value) != 0; }
public byte RibbonCountMemoryBattle { get => Data[0x39]; set => HasBattleMemoryRibbon = (Data[0x39] = value) != 0; }
public byte RibbonCountMemoryContest { get => Data[0x38]; set => Data[0x38] = value; }
public byte RibbonCountMemoryBattle { get => Data[0x39]; set => Data[0x39] = value; }
private ushort DistByte { get => ReadUInt16LittleEndian(Data.AsSpan(0x3A)); set => WriteUInt16LittleEndian(Data.AsSpan(0x3A), value); }
public bool DistSuperTrain1 { get => (DistByte & (1 << 0)) == 1 << 0; set => DistByte = (byte)((DistByte & ~(1 << 0)) | (value ? 1 << 0 : 0)); }
public bool DistSuperTrain2 { get => (DistByte & (1 << 1)) == 1 << 1; set => DistByte = (byte)((DistByte & ~(1 << 1)) | (value ? 1 << 1 : 0)); }

View file

@ -212,8 +212,8 @@ public sealed class PK7 : G6PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetC
public bool RIB6_5 { get => (RIB6 & (1 << 5)) == 1 << 5; set => RIB6 = (byte)((RIB6 & ~(1 << 5)) | (value ? 1 << 5 : 0)); } // Unused
public bool RIB6_6 { get => (RIB6 & (1 << 6)) == 1 << 6; set => RIB6 = (byte)((RIB6 & ~(1 << 6)) | (value ? 1 << 6 : 0)); } // Unused
public bool RIB6_7 { get => (RIB6 & (1 << 7)) == 1 << 7; set => RIB6 = (byte)((RIB6 & ~(1 << 7)) | (value ? 1 << 7 : 0)); } // Unused
public byte RibbonCountMemoryContest { get => Data[0x38]; set => HasContestMemoryRibbon = (Data[0x38] = value) != 0; }
public byte RibbonCountMemoryBattle { get => Data[0x39]; set => HasBattleMemoryRibbon = (Data[0x39] = value) != 0; }
public byte RibbonCountMemoryContest { get => Data[0x38]; set => Data[0x38] = value; }
public byte RibbonCountMemoryBattle { get => Data[0x39]; set => Data[0x39] = value; }
private ushort DistByte { get => ReadUInt16LittleEndian(Data.AsSpan(0x3A)); set => WriteUInt16LittleEndian(Data.AsSpan(0x3A), value); }
public bool DistSuperTrain1 { get => (DistByte & (1 << 0)) == 1 << 0; set => DistByte = (byte)((DistByte & ~(1 << 0)) | (value ? 1 << 0 : 0)); }
public bool DistSuperTrain2 { get => (DistByte & (1 << 1)) == 1 << 1; set => DistByte = (byte)((DistByte & ~(1 << 1)) | (value ? 1 << 1 : 0)); }

View file

@ -12,9 +12,9 @@ internal static partial class RibbonExtensions
{
internal static void CopyRibbonSetMemory6(this IRibbonSetMemory6 set, IRibbonSetMemory6 dest)
{
dest.RibbonCountMemoryContest = set.RibbonCountMemoryContest;
dest.RibbonCountMemoryBattle = set.RibbonCountMemoryBattle;
dest.HasContestMemoryRibbon = set.HasContestMemoryRibbon;
dest.HasBattleMemoryRibbon = set.HasBattleMemoryRibbon;
dest.RibbonCountMemoryContest = set.RibbonCountMemoryContest;
dest.RibbonCountMemoryBattle = set.RibbonCountMemoryBattle;
}
}

View file

@ -13,7 +13,7 @@
<ApplicationIcon>Resources\icon.ico</ApplicationIcon>
<StartupObject>PKHeX.WinForms.Program</StartupObject>
<AssemblyName>PKHeX</AssemblyName>
<Version>22.06.26</Version>
<Version>22.08.31</Version>
<LangVersion>10</LangVersion>
<Nullable>enable</Nullable>
</PropertyGroup>

View file

@ -1,7 +1,20 @@
PKHeX - By Kaphotics
http://projectpokemon.org/pkhex/
22/06/26 - New Update:
22/08/31 - New Update:
- Legality:
- - Refactored move validation and evolution branching to better handle sidegame alterations.
- - Refactored some data structures for faster program performance.
- - Refactored some validators for faster performance (ex. Ribbons).
- Added: More event flag/constant names. Thanks @tastymeatball and @CanoeHope !
- Added: Advanced tab of PKM/MGDB/Encounter Database now shows a batch editor command builder.
- Added: Can now copy a folder path prior to importing/exporting individual box data entities. Thanks @berichan !
- Changed: PKM Editor ball selection window is now sorted by legality. Setting available to revert to ordered by ball ID.
- Fixed: Event Flag editor custom work value now clamped to correct maximum. Thanks @PKMWM1 !
- Fixed: Colosseum/XD playtime values now read & write correctly. Thanks @trigger-segfault !
- Fixed: Colosseum format entities now read/write friendship correctly.
22/06/26 - New Update: (224234) [5220293]
- Legality:
- - Added: Current Handler legality for the save file is now checked. Having incorrect Handling Trainer data will be flagged.
- - Added: Marking legality now flags illegal marking values that can cause crashes in all Gen8 games (not yet patched).