more usum prep

species added requires the 'latest personal table' reference to be
USUM's; the other referencs for .SM are fine as there's no possibility
to have a species ID high enough for it to matter.
This commit is contained in:
Kurt
2017-09-18 22:36:06 -07:00
parent 298dc344cf
commit 6611e874c3
8 changed files with 10 additions and 9 deletions

View File

@@ -1373,7 +1373,7 @@ private CheckResult VerifyHistory()
}
else if (EncounterMatch is WC7 wc7 && wc7.OT.Length > 0)
{
if (pkm.OT_Friendship != PersonalTable.SM[EncounterMatch.Species].BaseFriendship)
if (pkm.OT_Friendship != PersonalTable.USUM[EncounterMatch.Species].BaseFriendship)
return new CheckResult(Severity.Invalid, V132, CheckIdentifier.History);
if (pkm.OT_Affection != 0)
return new CheckResult(Severity.Invalid, V133, CheckIdentifier.History);

View File

@@ -305,7 +305,7 @@ public override PKM ConvertToPKM(SaveFile SAV)
int currentLevel = Level > 0 ? Level : (int)(Util.Rand32()%100 + 1);
int metLevel = MetLevel > 0 ? MetLevel : currentLevel;
var pi = PersonalTable.SM.GetFormeEntry(Species, Form);
var pi = PersonalTable.USUM.GetFormeEntry(Species, Form);
PK7 pk = new PK7
{
Species = Species,

View File

@@ -14,7 +14,7 @@ public class PK7 : PKM, IRibbonSetEvent3, IRibbonSetEvent4, IRibbonSetCommon3, I
public sealed override int SIZE_PARTY => PKX.SIZE_6PARTY;
public override int SIZE_STORED => PKX.SIZE_6STORED;
public override int Format => 7;
public override PersonalInfo PersonalInfo => PersonalTable.SM.GetFormeEntry(Species, AltForm);
public override PersonalInfo PersonalInfo => PersonalTable.USUM.GetFormeEntry(Species, AltForm);
public PK7(byte[] decryptedData = null, string ident = null)
{

View File

@@ -9,7 +9,7 @@ namespace PKHeX.Core
/// </summary>
public static class PKX
{
private static readonly PersonalTable Personal = PersonalTable.SM;
private static readonly PersonalTable Personal = PersonalTable.USUM;
private const int Generation = 7;
internal const int SIZE_1ULIST = 69;

View File

@@ -28,7 +28,7 @@ public SAV7(byte[] data = null)
GetSAVOffsets();
HeldItems = Legal.HeldItems_SM;
Personal = PersonalTable.SM;
Personal = USUM ? PersonalTable.USUM : PersonalTable.SM;
if (!Exportable)
ClearBoxes();

View File

@@ -65,6 +65,7 @@ protected virtual byte[] Write(bool DSV)
public abstract int Generation { get; }
public PersonalTable Personal { get; set; }
public bool USUM => Data.Length == SaveUtil.SIZE_G7USUM;
public bool SM => Data.Length == SaveUtil.SIZE_G7SM;
public bool ORASDEMO => Data.Length == SaveUtil.SIZE_G6ORASDEMO;
public bool ORAS => Data.Length == SaveUtil.SIZE_G6ORAS;

View File

@@ -35,8 +35,8 @@ private static byte[] GetRawQR(int species, int formnum, bool shiny, int gender)
BitConverter.GetBytes((ushort)species).CopyTo(basedata, 0x28);
basedata[0x2A] = (byte)formnum;
basedata[0x2C] = (byte)(shiny ? 1 : 0);
var forme_index = PersonalTable.SM[species].FormeIndex(species, formnum);
var raw_gender = PersonalTable.SM[forme_index].Gender;
var forme_index = PersonalTable.USUM[species].FormeIndex(species, formnum);
var raw_gender = PersonalTable.USUM[forme_index].Gender;
switch (raw_gender)
{
case 0:

View File

@@ -54,8 +54,8 @@ public void PIDIVMatchingTest3Misc()
var gk3 = new PK3();
PIDGenerator.SetValuesFromSeed(gk3, PIDType.CXD, ak3.OriginSeed);
Assert.AreEqual(pk3.PID, gk3.PID, "Unable to match generated PID to Channel spread");
Assert.IsTrue(pk3.IVs.SequenceEqual(gk3.IVs), "Unable to match generated IVs to Channel spread");
Assert.AreEqual(pk3.PID, gk3.PID, "Unable to match generated PID to CXD spread");
Assert.IsTrue(pk3.IVs.SequenceEqual(gk3.IVs), "Unable to match generated IVs to CXD spread");
// Channel Jirachi
var pkC = new PK3 {PID = 0x264750D9, IVs = new[] {06, 31, 14, 27, 05, 27}, SID = 45819, OT_Gender = 1, Version = (int)GameVersion.R};