Add SimpleTrainerInfo constructor

zeroes out console region data if not present in game
This commit is contained in:
Kurt
2019-11-26 16:55:28 -08:00
parent 65e2457762
commit 08e293dadc
4 changed files with 17 additions and 10 deletions

View File

@@ -12,7 +12,14 @@ public sealed class SimpleTrainerInfo : ITrainerInfo
public int SubRegion { get; set; } = 7; // California
public int Country { get; set; } = 49; // USA
public int Game { get; set; } = (int)GameVersion.UM;
public int Game { get; }
public int Generation { get; set; } = PKX.Generation;
public SimpleTrainerInfo(GameVersion game = GameVersion.SW)
{
Game = (int) game;
if (GameVersion.GG.Contains(game) || game.GetGeneration() >= 8)
ConsoleRegion = SubRegion = Country = 0;
}
}
}

View File

@@ -2,7 +2,7 @@
{
public static class ParseSettings
{
internal static ITrainerInfo ActiveTrainer { get; set; } = new SimpleTrainerInfo { OT = string.Empty, Game = (int)GameVersion.Any, Language = -1 };
internal static ITrainerInfo ActiveTrainer { get; set; } = new SimpleTrainerInfo(GameVersion.Any) { OT = string.Empty, Language = -1 };
/// <summary>
/// Toggles whether or not the word filter should be used when checking the data.

View File

@@ -27,7 +27,7 @@ public static IEnumerable<object[]> PokemonGenerationTestData()
public void PokemonGenerationReturnsLegalPokemon(int species)
{
int count = 0;
var tr = new SimpleTrainerInfo();
var tr = new SimpleTrainerInfo(GameVersion.SN);
var pk = new PK7 { Species = species };
pk.Gender = pk.GetSaneGender();
@@ -50,7 +50,7 @@ public void CanGenerateMG5Case()
ez.Should().NotBeNull("Shiny Haxorus stationary encounter exists for B2/W2");
var criteria = new EncounterCriteria();
var tr = new SimpleTrainerInfo
var tr = new SimpleTrainerInfo(GameVersion.B2)
{
TID = 57600,
SID = 62446,

View File

@@ -37,7 +37,7 @@ public void SimulatorGetEncounters()
Assert.NotNull(first);
var egg = (EncounterEgg)first;
var info = new SimpleTrainerInfo();
var info = new SimpleTrainerInfo(GameVersion.SN);
var pk = egg.ConvertToPKM(info);
Assert.True(pk.Species != set.Species);
@@ -64,7 +64,7 @@ public void SimulatorGetWC3()
Assert.NotNull(first);
var wc3 = (WC3)first;
var info = new SimpleTrainerInfo();
var info = new SimpleTrainerInfo(GameVersion.R);
var pk = wc3.ConvertToPKM(info);
var la = new LegalityAnalysis(pk);
@@ -83,7 +83,7 @@ public void SimulatorGetCelebi()
Assert.NotNull(first);
var enc = first;
var info = new SimpleTrainerInfo();
var info = new SimpleTrainerInfo(GameVersion.SN);
var pk = enc.ConvertToPKM(info);
var la = new LegalityAnalysis(pk);
@@ -99,7 +99,7 @@ public void SimulatorGetSplitBreed()
Assert.True(encs.Count > 0);
Assert.True(encs.All(z => z.Species > 150));
var info = new SimpleTrainerInfo();
var info = new SimpleTrainerInfo(GameVersion.SN);
var enc = encs[0];
var pk = enc.ConvertToPKM(info);
@@ -115,7 +115,7 @@ public void SimulatorGetVCEgg1()
var encs = EncounterMovesetGenerator.GenerateEncounters(pk7, set.Moves, GameVersion.GD).ToList();
Assert.True(encs.Count > 0);
var info = new SimpleTrainerInfo();
var info = new SimpleTrainerInfo(GameVersion.SN);
var enc = encs[0];
var pk = enc.ConvertToPKM(info);
@@ -135,7 +135,7 @@ public void SimulatorGetSmeargle()
Assert.NotNull(first);
var enc = first;
var info = new SimpleTrainerInfo();
var info = new SimpleTrainerInfo(GameVersion.SN);
var pk = enc.ConvertToPKM(info);
var la = new LegalityAnalysis(pk);