2020-11-27 19:51:02 +00:00
|
|
|
namespace PKHeX.Core
|
|
|
|
{
|
|
|
|
/// <summary>
|
|
|
|
/// Encounter Slot found in <see cref="GameVersion.SWSH"/>.
|
|
|
|
/// </summary>
|
|
|
|
/// <inheritdoc cref="EncounterSlot"/>
|
2021-02-14 18:20:35 +00:00
|
|
|
public sealed record EncounterSlot8 : EncounterSlot, IOverworldCorrelation8
|
2020-11-27 19:51:02 +00:00
|
|
|
{
|
|
|
|
public readonly AreaWeather8 Weather;
|
|
|
|
public override string LongName => Weather == AreaWeather8.All ? wild : $"{wild} - {Weather.ToString().Replace("_", string.Empty)}";
|
|
|
|
public override int Generation => 8;
|
|
|
|
|
2021-01-01 18:53:05 +00:00
|
|
|
public EncounterSlot8(EncounterArea8 area, int species, int form, int min, int max, AreaWeather8 weather) : base(area, species, form, min, max)
|
2020-11-27 19:51:02 +00:00
|
|
|
{
|
|
|
|
Weather = weather;
|
|
|
|
}
|
2021-02-14 18:20:35 +00:00
|
|
|
|
2021-02-14 20:27:14 +00:00
|
|
|
protected override void ApplyDetails(ITrainerInfo sav, EncounterCriteria criteria, PKM pk)
|
|
|
|
{
|
|
|
|
base.ApplyDetails(sav, criteria, pk);
|
|
|
|
if (!HasOverworldCorrelation)
|
|
|
|
pk.SetRandomEC();
|
|
|
|
}
|
|
|
|
|
|
|
|
protected override void SetPINGA(PKM pk, EncounterCriteria criteria)
|
|
|
|
{
|
|
|
|
// be lazy and just do the regular, and overwrite with correlation if required
|
|
|
|
base.SetPINGA(pk, criteria);
|
|
|
|
if (!HasOverworldCorrelation)
|
|
|
|
return;
|
|
|
|
Overworld8RNG.ApplyDetails(pk, criteria);
|
|
|
|
}
|
|
|
|
|
2021-02-14 18:20:35 +00:00
|
|
|
public bool HasOverworldCorrelation
|
|
|
|
{
|
|
|
|
get
|
|
|
|
{
|
|
|
|
if ((Weather & AreaWeather8.Shaking_Trees) != 0)
|
|
|
|
return false; // berry tree can have any 128bit seed from overworld
|
|
|
|
if (!((EncounterArea8) Area).PermitCrossover)
|
|
|
|
return false; // curry from hidden (not symbol) can have any 128bit seed from overworld
|
|
|
|
return true;
|
|
|
|
}
|
|
|
|
}
|
|
|
|
|
|
|
|
public bool IsOverworldCorrelationCorrect(PKM pk)
|
|
|
|
{
|
|
|
|
return Overworld8RNG.ValidateOverworldEncounter(pk);
|
|
|
|
}
|
2020-11-27 19:51:02 +00:00
|
|
|
}
|
|
|
|
}
|