More usum prep

I think egg hatch location checking is wrong for traded eggs (see gen3
vs future games, origin game shouldn't change but could hatch ORAS egg
on XY at XY location?)
This commit is contained in:
Kurt
2017-09-19 21:35:30 -07:00
parent fd8143cae4
commit c23cc81212
8 changed files with 31 additions and 16 deletions

View File

@@ -456,13 +456,17 @@ public static List<ComboItem> GetLocationList(GameVersion Version, int SaveForma
case GameVersion.SN:
case GameVersion.MN:
return MetGen7.Take(3).Concat(MetGen7.Skip(3).OrderByDescending(loc => loc.Value < 200)).ToList(); // Outer Cape
case GameVersion.US:
case GameVersion.UM:
case GameVersion.GO:
case GameVersion.RD:
case GameVersion.BU:
case GameVersion.GN:
case GameVersion.YW:
return MetGen7.Take(3).Concat(MetGen7.Skip(3).OrderByDescending(loc => loc.Value < 200)).ToList(); // Secret Base
return MetGen7.Take(3).Concat(MetGen7.Skip(3).OrderByDescending(loc => loc.Value < 200)).ToList(); // Outer Cape
}
// Currently on a future game, return corresponding list for generation

View File

@@ -302,6 +302,12 @@ private void VerifyNicknameTrade()
AddLine(Severity.Valid, V194, CheckIdentifier.Nickname);
return;
}
else if (pkm.USUM)
{
// TODO
AddLine(Severity.Valid, V194, CheckIdentifier.Nickname);
return;
}
else if (pkm.Format <= 2 || pkm.VC)
{
var et = (EncounterOriginalGB ?? EncounterMatch) as EncounterTrade;
@@ -2173,13 +2179,8 @@ private bool VerifyNsPKMOTValid()
if (pkm.TID != 00002 || pkm.SID != 00000)
return false;
switch (pkm.Language)
{
case 1: // jp
return pkm.OT_Name == "N";
default:
return pkm.OT_Name == "N";
}
var OT = pkm.Language == 1 ? "N" : "N";
return OT == pkm.OT_Name;
}
private void VerifyVersionEvolution()
{
@@ -2187,20 +2188,22 @@ private void VerifyVersionEvolution()
return;
// No point using the evolution tree. Just handle certain species.
bool Sun() => pkm.Version == (int)GameVersion.SN || pkm.Version == (int)GameVersion.US;
bool Moon() => pkm.Version == (int)GameVersion.MN || pkm.Version == (int)GameVersion.UM;
switch (pkm.Species)
{
case 745: // Lycanroc
if (!pkm.WasEgg)
break;
if (pkm.AltForm == 0 && pkm.Version == 31 // Moon
|| pkm.AltForm == 1 && pkm.Version == 30) // Sun
if (pkm.AltForm == 0 && Moon()
|| pkm.AltForm == 1 && Sun())
if (pkm.IsUntraded)
AddLine(Severity.Invalid, V328, CheckIdentifier.Evolution);
break;
case 791: // Solgaleo
if (pkm.Version == 31 && pkm.IsUntraded)
if (Moon() && pkm.IsUntraded)
{
if (EncounterMatch is MysteryGift g && g.Species == pkm.Species) // Gifted via Mystery Gift
break;
@@ -2208,7 +2211,7 @@ private void VerifyVersionEvolution()
}
break;
case 792: // Lunala
if (pkm.Version == 30 && pkm.IsUntraded)
if (Sun() && pkm.IsUntraded)
{
if (EncounterMatch is MysteryGift g && g.Species == pkm.Species) // Gifted via Mystery Gift
break;
@@ -2217,8 +2220,6 @@ private void VerifyVersionEvolution()
break;
}
}
#region VerifyMoves
#endregion
public static string[] MoveStrings { internal get; set; } = Util.GetMovesList("en");
public static string[] SpeciesStrings { internal get; set; } = Util.GetSpeciesList("en");
internal static IEnumerable<string> getMoveNames(IEnumerable<int> moves) => moves.Select(m => m >= MoveStrings.Length ? V190 : MoveStrings[m]);

View File

@@ -106,6 +106,8 @@ public static int GetSuggestedEggMetLocation(PKM pkm)
case GameVersion.SN:
case GameVersion.MN:
case GameVersion.US:
case GameVersion.UM:
return 50; // Route 4
}
return -1;

View File

@@ -218,6 +218,8 @@ private static CheckResult VerifyEncounterEgg7(PKM pkm)
{
if (pkm.SM)
return VerifyEncounterEggLevelLoc(pkm, 1, Legal.ValidMet_SM);
if (pkm.USUM)
return VerifyEncounterEggLevelLoc(pkm, 1, Legal.ValidMet_USUM);
// no other games
return new CheckResult(Severity.Invalid, V51, CheckIdentifier.Encounter);

View File

@@ -515,7 +515,7 @@ public class EvolutionMethod
internal static readonly int[] TradeMethods = {5, 6, 7};
private static readonly IReadOnlyCollection<GameVersion> NoBanlist = new GameVersion[0];
internal static readonly IReadOnlyCollection<GameVersion> BanSM = new[] {GameVersion.SN, GameVersion.MN};
internal static readonly IReadOnlyCollection<GameVersion> BanSM = new[] {GameVersion.SN, GameVersion.MN, GameVersion.US, GameVersion.UM};
internal IReadOnlyCollection<GameVersion> Banlist = NoBanlist;
public bool Valid(PKM pkm, int lvl, bool skipChecks)

View File

@@ -316,6 +316,9 @@ public static partial class Legal
30016 // Poké Pelago
};
internal static readonly int[] ValidMet_USUM =
{
};
private static readonly int[] TMHM_SM =
{

View File

@@ -297,6 +297,7 @@ private byte[] Write()
public bool XY => Version == (int)GameVersion.X || Version == (int)GameVersion.Y;
public bool AO => Version == (int)GameVersion.AS || Version == (int)GameVersion.OR;
public bool SM => Version == (int)GameVersion.SN || Version == (int)GameVersion.MN;
public bool USUM => Version == (int)GameVersion.US || Version == (int)GameVersion.UM;
protected bool PtHGSS => Pt || HGSS;
public bool VC => VC1 || VC2;
public bool Gen7 => Version >= 30 && Version <= 33;

View File

@@ -10,7 +10,7 @@ public static class SaveUtil
{
public const int BEEF = 0x42454546;
public const int SIZE_G7USUM = -1;
public const int SIZE_G7USUM = 999_999_999;
public const int SIZE_G7SM = 0x6BE00;
public const int SIZE_G6XY = 0x65600;
public const int SIZE_G6ORAS = 0x76000;
@@ -545,6 +545,8 @@ private static SaveFile GetBlankSAV(GameVersion Game)
case GameVersion.SN: case GameVersion.MN: case GameVersion.SM:
return new SAV7(new byte[SIZE_G7SM]);
case GameVersion.US: case GameVersion.UM: case GameVersion.USUM:
return new SAV7(new byte[SIZE_G7USUM]);
default:
return null;