FormRandom SV Vivillon

This commit is contained in:
Kurt 2023-03-04 14:07:55 -08:00
parent 5246d67284
commit 94d5ca491f
3 changed files with 17 additions and 5 deletions

View file

@ -60,7 +60,7 @@ public sealed record EncounterArea9 : EncounterArea
{
if (slot.Species != evo.Species)
continue;
if (slot.Form != evo.Form && !IsFormOkayWild(slot.Species, evo.Form))
if (slot.Form != evo.Form && !slot.IsRandomUnspecificForm && !IsFormOkayWild(slot.Species, evo.Form))
break;
if (slot.Gender != -1 && pk.Gender != slot.Gender)
break;
@ -83,10 +83,9 @@ public sealed record EncounterArea9 : EncounterArea
private static bool IsFormOkayWild(ushort species, byte form) => species switch
{
(int)Species.Rotom => true,
(int)Species.Deerling or (int)Species.Sawsbuck => true,
(int)Species.Scatterbug or (int)Species.Spewpa or (int)Species.Vivillon => form < Vivillon3DS.FancyFormID, // GO Postcard
(int)Species.Oricorio => true,
(int)Species.Rotom => form <= 5,
(int)Species.Deerling or (int)Species.Sawsbuck => form < 4,
(int)Species.Oricorio => form < 4,
_ => false,
};
}

View file

@ -1,3 +1,4 @@
using System;
using System.Linq;
using FluentAssertions;
using Xunit;
@ -53,6 +54,18 @@ public class ShowdownSetTests
}
}
[Fact]
public void SimGetVivillonPostcardSV()
{
var pk9 = new PK9 { Species = (int)Species.Vivillon, Form = 1 };
var encounters = EncounterMovesetGenerator.GenerateEncounters(pk9, Array.Empty<ushort>(), GameVersion.SL);
encounters.OfType<EncounterSlot9>().Should().NotBeEmpty();
pk9 = new PK9 { Species = (int)Species.Vivillon, Form = Vivillon3DS.FancyFormID };
encounters = EncounterMovesetGenerator.GenerateEncounters(pk9, Array.Empty<ushort>(), GameVersion.SL);
encounters.OfType<EncounterSlot9>().Should().NotBeEmpty();
}
[Fact]
public void SimulatorGetWC3()
{