mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-05-05 21:17:14 -05:00
Misc updates
Closes #860 by adding in prompt for Gen1 saves to determine if the save originated from VC. Will disable Gen2 legality sources when checking pk1 files. -- Fixes froslass/gallade evolution tree pruning movesets. For whatever reason, the level argument of the Evolution is not 0 when using the item; I manually edited the evos_sm.pkl binary to set the 2 evolutions from [XX] -> 00. Fixes gen1 ingame trades slipping through the getEncounter12 preference. Gen2 has set TIDs, so check if TID is set. Loosens checks for Gen7 trades (including prior transfers) as trading between games clears the memory. Add 3 more g7 trainer stat records too. Thanks Holla! -- Add getMoves(100) optimization as gen7 learnsets can grab 1->100, better than looping over the range every time it's checked.
This commit is contained in:
parent
afd2c58aa2
commit
fe66a65464
|
|
@ -204,7 +204,6 @@ public Main()
|
|||
}
|
||||
catch (Exception ex)
|
||||
{
|
||||
// Todo: translate this
|
||||
ErrorWindow.ShowErrorDialog("An error occurred while attempting to auto-load your save file.", ex, true);
|
||||
}
|
||||
|
||||
|
|
@ -894,7 +893,17 @@ private void openSAV(SaveFile sav, string path)
|
|||
}
|
||||
}
|
||||
// Finish setting up the save file.
|
||||
if (sav.Generation == 3 && (sav.IndeterminateGame || ModifierKeys == Keys.Control))
|
||||
if (sav.Generation == 1)
|
||||
{
|
||||
// Ask the user if it is a VC save file or if it is from a physical cartridge.
|
||||
// Necessary for legality checking possibilities that are only obtainable on GSC (non VC) or event distributions.
|
||||
var drVC = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel, $"{sav.Version} Save File detected. Is this a Virtual Console Save File?",
|
||||
"Yes: Virtual Console" + Environment.NewLine + "No: Physical Cartridge");
|
||||
if (drVC == DialogResult.Cancel)
|
||||
return;
|
||||
Legal.AllowGBCartEra = drVC == DialogResult.No; // physical cart selected
|
||||
}
|
||||
else if (sav.Generation == 3 && (sav.IndeterminateGame || ModifierKeys == Keys.Control))
|
||||
{
|
||||
// Hacky cheats invalidated the Game Code value.
|
||||
var drGame = WinFormsUtil.Prompt(MessageBoxButtons.YesNoCancel,
|
||||
|
|
@ -1670,7 +1679,7 @@ private void setMarkings()
|
|||
}
|
||||
}
|
||||
// Clicked Label Shortcuts //
|
||||
private bool QR6Notified = false;
|
||||
private bool QR6Notified;
|
||||
private void clickQR(object sender, EventArgs e)
|
||||
{
|
||||
if (ModifierKeys == Keys.Alt)
|
||||
|
|
|
|||
|
|
@ -423,7 +423,10 @@ private void B_GenTID_Click(object sender, EventArgs e)
|
|||
{011, "Link Trades"},
|
||||
{012, "Link Battles"},
|
||||
{013, "Link Battle Wins"},
|
||||
{014, "Link Battle Losses"},
|
||||
{015, "Battle Spot Battles"},
|
||||
{016, "Battle Spot Wins"},
|
||||
{017, "Battle Spot Losses"},
|
||||
{018, "Mart Stack Purchases"},
|
||||
{019, "Money Spent"},
|
||||
{020, "Pokémon deposited at Nursery"},
|
||||
|
|
|
|||
|
|
@ -209,7 +209,7 @@ private void verifyNickname()
|
|||
var et = EncounterOriginal as EncounterTrade;
|
||||
if (et?.TID == 0) // Gen1 Trade
|
||||
{
|
||||
if (!Legal.getEncounterTrade1Valid(pkm, et))
|
||||
if (!Legal.getEncounterTrade1Valid(pkm))
|
||||
AddLine(Severity.Invalid, "Incorrect OT name for RBY in-game trade.", CheckIdentifier.Trainer);
|
||||
}
|
||||
else // Gen2
|
||||
|
|
@ -567,7 +567,7 @@ private CheckResult verifyEncounterTrade()
|
|||
}
|
||||
private CheckResult verifyEncounterG12()
|
||||
{
|
||||
var obj = Legal.getEncounter12(pkm, pkm.Format < 3);
|
||||
var obj = Legal.getEncounter12(pkm, Legal.AllowGBCartEra && pkm.Format < 3);
|
||||
if (obj == null)
|
||||
return new CheckResult(Severity.Invalid, "Unknown encounter.", CheckIdentifier.Encounter);
|
||||
|
||||
|
|
@ -1619,11 +1619,18 @@ private void verifyHTMemory()
|
|||
if (!History.Valid)
|
||||
return;
|
||||
|
||||
if (pkm.GenNumber == 7 || pkm.GenNumber == 1)
|
||||
if (pkm.Format >= 7)
|
||||
{
|
||||
bool check = pkm.VC1 || pkm.HT_Memory != 0;
|
||||
if (!check)
|
||||
/*
|
||||
* Bank Transfer adds in the Link Trade Memory.
|
||||
* Trading 7<->7 between games (not Bank) clears this data.
|
||||
*/
|
||||
if (pkm.HT_Memory == 0)
|
||||
{
|
||||
if (pkm.HT_TextVar != 0 || pkm.HT_Intensity != 0 || pkm.HT_Feeling != 0)
|
||||
AddLine(Severity.Invalid, "HT memory not cleared properly.", CheckIdentifier.Memory);
|
||||
return;
|
||||
}
|
||||
|
||||
if (pkm.HT_Memory != 4)
|
||||
AddLine(Severity.Invalid, "Should have a Link Trade HT Memory.", CheckIdentifier.Memory);
|
||||
|
|
|
|||
|
|
@ -7,8 +7,11 @@ namespace PKHeX.Core
|
|||
{
|
||||
public static partial class Legal
|
||||
{
|
||||
// Event Database(s)
|
||||
public static MysteryGift[] MGDB_G6, MGDB_G7 = new MysteryGift[0];
|
||||
/// <summary>Event Database for a given Generation</summary>
|
||||
public static MysteryGift[] MGDB_G4, MGDB_G5, MGDB_G6, MGDB_G7 = new MysteryGift[0];
|
||||
|
||||
/// <summary>Setting to specify if an analysis should permit data sourced from the physical cartridge era of GameBoy games.</summary>
|
||||
public static bool AllowGBCartEra = false;
|
||||
|
||||
// Gen 1
|
||||
private static readonly Learnset[] LevelUpRB = Learnset1.getArray(Resources.lvlmove_rb, MaxSpeciesID_1);
|
||||
|
|
@ -505,7 +508,7 @@ private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, E
|
|||
return new Tuple<object, int, byte>(s, s.Level, 20); // special move
|
||||
if (game == GameVersion.GSC)
|
||||
{
|
||||
if (t != null)
|
||||
if (t != null && t.TID != 0)
|
||||
return new Tuple<object, int, byte>(t, t.Level, 10); // gen2 trade
|
||||
if (WasEgg && new[] { sm, em, tm }.Min(a => a) >= 5)
|
||||
return new Tuple<object, int, byte>(true, 5, 9); // gen2 egg
|
||||
|
|
@ -527,7 +530,7 @@ private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, E
|
|||
return g1 ?? g2;
|
||||
|
||||
var t = g1.Item1 as EncounterTrade;
|
||||
if (t != null && getEncounterTrade1Valid(pkm, t))
|
||||
if (t != null && getEncounterTrade1Valid(pkm))
|
||||
return g1;
|
||||
|
||||
// Both generations can provide an encounter. Return highest preference
|
||||
|
|
@ -538,7 +541,7 @@ private static EncounterTrade getValidEncounterTradeVC1(PKM pkm, DexLevel[] p, E
|
|||
// Return lowest level encounter
|
||||
return g1.Item2 < g2.Item2 ? g1 : g2;
|
||||
}
|
||||
internal static bool getEncounterTrade1Valid(PKM pkm, EncounterTrade t)
|
||||
internal static bool getEncounterTrade1Valid(PKM pkm)
|
||||
{
|
||||
string ot = pkm.OT_Name;
|
||||
string tr = pkm.Format <= 2 ? "TRAINER" : "Trainer"; // decaps on transfer
|
||||
|
|
|
|||
|
|
@ -12,6 +12,8 @@ public abstract class Learnset
|
|||
|
||||
public int[] getMoves(int level)
|
||||
{
|
||||
if (level >= 100)
|
||||
return Moves;
|
||||
for (int i = 0; i < Levels.Length; i++)
|
||||
if (Levels[i] > level)
|
||||
return Moves.Take(i).ToArray();
|
||||
|
|
|
|||
Binary file not shown.
Loading…
Reference in New Issue
Block a user