From 9c9f0f8a94e627041da700659af7c866feff4aad Mon Sep 17 00:00:00 2001 From: Kurt Date: Mon, 14 Jun 2021 21:11:46 -0700 Subject: [PATCH] Get criteria from set details pretty much futureproof I guess --- PKHeX.WinForms/Subforms/SAV_Encounters.cs | 7 ++----- Tests/PKHeX.Core.Tests/Simulator/GeneratorTests.cs | 2 +- 2 files changed, 3 insertions(+), 6 deletions(-) diff --git a/PKHeX.WinForms/Subforms/SAV_Encounters.cs b/PKHeX.WinForms/Subforms/SAV_Encounters.cs index 46bf62364..8038febdb 100644 --- a/PKHeX.WinForms/Subforms/SAV_Encounters.cs +++ b/PKHeX.WinForms/Subforms/SAV_Encounters.cs @@ -154,11 +154,8 @@ private EncounterCriteria GetCriteria(ISpeciesForm enc, EncounterDatabaseSetting return EncounterCriteria.Unrestricted; } - return new EncounterCriteria - { - Gender = editor.Gender, - Nature = (Nature) editor.Nature, - }; + var set = new ShowdownSet(editor); + return EncounterCriteria.GetCriteria(set, editor.PersonalInfo); } private void PopulateComboBoxes() diff --git a/Tests/PKHeX.Core.Tests/Simulator/GeneratorTests.cs b/Tests/PKHeX.Core.Tests/Simulator/GeneratorTests.cs index 30fae88f5..d9c0dddd4 100644 --- a/Tests/PKHeX.Core.Tests/Simulator/GeneratorTests.cs +++ b/Tests/PKHeX.Core.Tests/Simulator/GeneratorTests.cs @@ -49,7 +49,7 @@ public void CanGenerateMG5Case() var ez = EncounterMovesetGenerator.GenerateEncounters(pk, pk.Moves, GameVersion.W2).OfType().First(); ez.Should().NotBeNull("Shiny Haxorus stationary encounter exists for B2/W2"); - var criteria = new EncounterCriteria(); + var criteria = EncounterCriteria.Unrestricted; var tr = new SimpleTrainerInfo(GameVersion.B2) { TID = 57600,