Consider the "SkipFormCheck" for gen7 scatterbug static

Rework to match the encounter slot form-ambiguous checks
This commit is contained in:
Kurt 2021-08-02 20:45:52 -07:00
parent c784a0d992
commit 66f1b23dc6
4 changed files with 10 additions and 8 deletions

View file

@ -197,7 +197,7 @@ namespace PKHeX.Core
new(USUM) { Species = 007, Level = 12, Location = 042, Relearn = new[] {453,110,055,033}, }, // Squirtle @ Seaward Cave
new(USUM) { Species = 095, Level = 14, Location = 034, Relearn = new[] {563,099,317,088}, }, // Onix @ Ten Carat Hill
new(USUM) { Species = 116, Level = 18, Location = 014, Relearn = new[] {352,239,055,043}, }, // Horsea @ Kala'e Bay
new(USUM) { Species = 664, Level = 09, Location = 020, Relearn = new[] {476,081,078,033}, SkipFormCheck = true, }, // Scatterbug @ Hau'oli City
new(USUM) { Species = 664, Level = 09, Location = 020, Relearn = new[] {476,081,078,033}, Form = EncounterStatic.FormVivillon, }, // Scatterbug @ Hau'oli City
new(USUM) { Species = 001, Level = 10, Location = 012, Relearn = new[] {580,022,045,033}, }, // Bulbasaur @ Route 2
new(USUM) { Species = 607, Level = 09, Location = 038, Relearn = new[] {203,052,083,123}, }, // Litwick @ Hau'oli Cemetery

View file

@ -36,7 +36,6 @@ namespace PKHeX.Core
public int EggCycles { get; init; }
public bool Fateful { get; init; }
public bool SkipFormCheck { get; init; }
public bool EggEncounter => EggLocation > 0;
private const string _name = "Static Encounter";
@ -44,6 +43,11 @@ namespace PKHeX.Core
public string LongName => Version == GameVersion.Any ? _name : $"{_name} ({Version})";
public bool IsShiny => Shiny.IsShiny();
public bool IsRandomUnspecificForm => Form >= FormDynamic;
private const int FormDynamic = FormVivillon;
internal const int FormVivillon = 30;
//protected const int FormRandom = 31;
protected EncounterStatic(GameVersion game) => Version = game;
protected virtual PKM GetBlank(ITrainerInfo tr) => PKMConverter.GetBlank(Generation, Version);
@ -246,7 +250,7 @@ namespace PKHeX.Core
protected virtual bool IsMatchForm(PKM pkm, DexLevel evo)
{
if (SkipFormCheck)
if (IsRandomUnspecificForm)
return true;
return Form == evo.Form || FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format);
}

View file

@ -42,16 +42,12 @@ namespace PKHeX.Core
protected override bool IsMatchForm(PKM pkm, DexLevel evo)
{
if (SkipFormCheck)
return true;
if (IsTotem)
{
var expectForm = pkm.Format == 7 ? Form : FormInfo.GetTotemBaseForm(Species, Form);
return expectForm == evo.Form;
}
return Form == evo.Form || FormInfo.IsFormChangeable(Species, Form, pkm.Form, pkm.Format);
return base.IsMatchForm(pkm, evo);
}
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)

View file

@ -407,6 +407,8 @@ namespace PKHeX.Core
return true;
if (enc is EncounterSlot {IsRandomUnspecificForm: true})
return true;
if (enc is EncounterStatic {IsRandomUnspecificForm: true})
return true;
if (enc is EncounterStatic7 {IsTotem: true} && evo.Form == 0 && format > 7) // totems get form wiped
return true;
break;