mirror of
https://github.com/kwsch/PKHeX.git
synced 2026-09-29 19:53:56 -05:00
Add Gen4 HG/SS ball check
GUI would display the selected ball, but internally it was forced back to Poke. Currently, the setter sanitizes both values, but if manually modified via external code, technically it could be in an invalid state. - Add check if ball is disassociated from what is expected (modified outside of the GUI) - GUI updates to the final (sanity checked) value regardless of what was selected. https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/page/35/#findComment-298902
This commit is contained in:
@@ -96,6 +96,16 @@ public override void Verify(LegalityAnalysis data)
|
||||
|
||||
private void VerifyMisc4(LegalityAnalysis data, G4PKM pk)
|
||||
{
|
||||
// Verify misc values that were introduced in HG/SS
|
||||
|
||||
// Version is a true match. If not from HG/SS, should not have HG/SS ball value set.
|
||||
if (pk.BallHGSS != 0 || pk.BallDPPt != pk.Ball)
|
||||
{
|
||||
// Only set the HG/SS value if it originated in HG/SS and was not an event.
|
||||
if (!pk.HGSS || pk.FatefulEncounter)
|
||||
data.AddLine(GetInvalid(CheckIdentifier.Ball, BallEncMismatch));
|
||||
}
|
||||
|
||||
// Mood:
|
||||
// Range is [-127, 127]. Deduplicated unique adjustments are +8, +10, and -20.
|
||||
// Increment adjustments of -2 (-20 +8 +10) and +2 (+8*4 +10 -20) are possible.
|
||||
|
||||
@@ -709,8 +709,13 @@ private void ClickBall(object sender, EventArgs e)
|
||||
using var frm = new BallBrowser();
|
||||
frm.LoadBalls(Entity);
|
||||
frm.ShowDialog();
|
||||
if (frm.WasBallChosen)
|
||||
CB_Ball.SelectedValue = (int)frm.BallChoice;
|
||||
if (!frm.WasBallChosen)
|
||||
return;
|
||||
|
||||
// Set to the entity, then check the updated value.
|
||||
// Gen4 has split fields for HG/SS and D/P/Pt segregation. If the value refused to update, show the refused value.
|
||||
Entity.Ball = frm.BallChoice;
|
||||
CB_Ball.SelectedValue = (int)Entity.Ball;
|
||||
}
|
||||
|
||||
private void ClickMetLocation(object sender, EventArgs e)
|
||||
|
||||
Reference in New Issue
Block a user