mirror of
https://github.com/kwsch/PKHeX
synced 2024-11-24 04:53:08 +00:00
6b2ea0894e
https://projectpokemon.org/home/forums/topic/57375-pkhex-new-update-legality-errors-contribution-page/?do=findComment&comment=271406 https://discord.com/channels/401014193211441153/679178558597496872/908489378043686944
54 lines
2.1 KiB
C#
54 lines
2.1 KiB
C#
namespace PKHeX.Core
|
|
{
|
|
/// <summary>
|
|
/// Encounter Slot found in <see cref="GameVersion.Gen4"/>.
|
|
/// </summary>
|
|
/// <inheritdoc cref="EncounterSlot"/>
|
|
public sealed record EncounterSlot4 : EncounterSlot, IMagnetStatic, INumberedSlot, IGroundTypeTile, ISlotRNGType
|
|
{
|
|
public override int Generation => 4;
|
|
public GroundTilePermission GroundTile => ((EncounterArea4)Area).GroundTile;
|
|
|
|
public int StaticIndex { get; }
|
|
public int MagnetPullIndex { get; }
|
|
public int StaticCount { get; }
|
|
public int MagnetPullCount { get; }
|
|
public SlotType Type => Area.Type;
|
|
|
|
public int SlotNumber { get; }
|
|
public bool CanUseRadar => !GameVersion.HGSS.Contains(Version) && GroundTile.HasFlag(GroundTilePermission.Grass);
|
|
|
|
public EncounterSlot4(EncounterArea4 area, int species, int form, int min, int max, int slot, int mpi, int mpc, int sti, int stc) : base(area, species, form, min, max)
|
|
{
|
|
SlotNumber = slot;
|
|
|
|
MagnetPullIndex = mpi;
|
|
MagnetPullCount = mpc;
|
|
|
|
StaticIndex = sti;
|
|
StaticCount = stc;
|
|
}
|
|
|
|
protected override void SetFormatSpecificData(PKM pk) => ((PK4)pk).GroundTile = GroundTile.GetIndex();
|
|
|
|
public override EncounterMatchRating GetMatchRating(PKM pkm)
|
|
{
|
|
if ((pkm.Ball == (int)Ball.Safari) != Locations.IsSafariZoneLocation4(Location))
|
|
return EncounterMatchRating.PartialMatch;
|
|
if ((pkm.Ball == (int)Ball.Sport) != (Type == SlotType.BugContest))
|
|
{
|
|
// Nincada => Shedinja can wipe the ball back to Poke
|
|
if (pkm.Species != (int)Core.Species.Shedinja || pkm.Ball != (int)Ball.Poke)
|
|
return EncounterMatchRating.PartialMatch;
|
|
}
|
|
return base.GetMatchRating(pkm);
|
|
}
|
|
|
|
public override Ball GetRequiredBallValue()
|
|
{
|
|
if (Type is SlotType.BugContest)
|
|
return Ball.Sport;
|
|
return Locations.IsSafariZoneLocation4(Location) ? Ball.Safari : Ball.None;
|
|
}
|
|
}
|
|
}
|