PKHeX/PKHeX.Core/Legality/Encounters/EncounterSlot/EncounterSlot3.cs
Kurt f83a9bf833 Expose shiny potential value
Not really digging it currently as it doesn't cover multi-state like AlwaysStar-Or-Never, but that single edge case can be handled elsewhere
2022-01-07 17:48:12 -08:00

41 lines
1.4 KiB
C#

namespace PKHeX.Core
{
/// <summary>
/// Encounter Slot found in <see cref="GameVersion.Gen3"/>.
/// </summary>
/// <inheritdoc cref="EncounterSlot"/>
public record EncounterSlot3 : EncounterSlot, IMagnetStatic, INumberedSlot, ISlotRNGType
{
public sealed override int Generation => 3;
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 override Ball FixedBall => Locations.IsSafariZoneLocation3(Location) ? Ball.Safari : Ball.None;
public EncounterSlot3(EncounterArea3 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;
}
public override EncounterMatchRating GetMatchRating(PKM pkm)
{
if (IsDeferredSafari3(pkm.Ball == (int)Ball.Safari))
return EncounterMatchRating.PartialMatch;
return base.GetMatchRating(pkm);
}
private bool IsDeferredSafari3(bool IsSafariBall) => IsSafariBall != Locations.IsSafariZoneLocation3(Location);
}
}