Discard Fairy type Arceus when reversing

https://projectpokemon.org/home/forums/topic/63635-pkhex-230709-bugs/
This commit is contained in:
Kurt
2023-07-09 20:22:01 -07:00
parent 7fb5dc2fde
commit 478413e8cd
2 changed files with 9 additions and 2 deletions

View File

@@ -18,7 +18,8 @@ public int Devolve(Span<EvoCriteria> result, PKM pk, EvolutionOrigin enc)
int present = 1;
for (int i = 1; i < result.Length; i++)
{
var prev = result[i - 1];
ref var prev = ref result[i - 1];
RevertMutatedForms(ref prev);
if (!TryDevolve(prev, pk, prev.LevelMax, enc.LevelMin, enc.SkipChecks, out var evo))
continue;
@@ -30,6 +31,12 @@ public int Devolve(Span<EvoCriteria> result, PKM pk, EvolutionOrigin enc)
return present;
}
private static void RevertMutatedForms(ref EvoCriteria evo)
{
if (evo is { Species: (ushort)Species.Arceus, Form: 17 }) // Fairy, prevent it hitting Gen5 (as Fairy does not exist yet).
evo = evo with { Form = 0 }; // Normal
}
public bool TryDevolve(ISpeciesForm head, PKM pk, byte currentMaxLevel, byte levelMin, bool skipChecks, out EvoCriteria result)
{
return Tree.Reverse.TryDevolve(head, pk, currentMaxLevel, levelMin, skipChecks, out result);

View File

@@ -413,7 +413,7 @@ private static void VerifyTrade8b(LegalityAnalysis data, EncounterTrade8b t)
data.AddLine(GetInvalid(string.Format(LOTLanguage, $"{Japanese}/{German}", $"{(LanguageID)pk.Language}"), CheckIdentifier.Language));
}
if (t.Species == (int)Species.Chatot && pk.Language == (int)French)
if (t.Species == (int)Species.Chatot && pk is { Language: (int)French, IsNicknamed: false })
{
// NgWord disallows the French nickname (Pijouk) and resets it back to default (Pijako).
// Let it be anything (Nicknamed or not) and just verify the OT.