PKHeX/PKHeX.Core/Legality/RNG/Frame/LeadRequired.cs

54 lines
2.1 KiB
C#
Raw Normal View History

2017-12-02 01:27:09 +00:00
using System;
namespace PKHeX.Core
{
2021-03-14 18:28:46 +00:00
/// <summary>
/// Indicates the requirement of the player's lead Pokémon, first sent out when starting a battle.
/// </summary>
2017-12-02 01:27:09 +00:00
[Flags]
public enum LeadRequired
{
2021-03-14 18:28:46 +00:00
/// <summary> No Lead ability effect is present, or is not checked for this type of frame. </summary>
2017-12-02 01:27:09 +00:00
None = 0,
2021-03-14 18:28:46 +00:00
/// <summary> <see cref="Ability.CuteCharm"/> </summary>
2017-12-02 01:27:09 +00:00
CuteCharm = 1 << 0,
2021-03-14 18:28:46 +00:00
/// <summary> <see cref="Ability.Synchronize"/> </summary>
2017-12-02 01:27:09 +00:00
Synchronize = 1 << 1,
// Slot Modifiers
2021-03-14 18:28:46 +00:00
/// <summary> <see cref="Ability.Static"/> or <see cref="Ability.MagnetPull"/> </summary>
2017-12-02 01:27:09 +00:00
StaticMagnet = 1 << 2,
// Level Modifiers
2021-03-14 18:28:46 +00:00
/// <summary> <see cref="Ability.Intimidate"/> or <see cref="Ability.KeenEye"/> </summary>
2017-12-02 01:27:09 +00:00
IntimidateKeenEye = 1 << 3,
2021-03-14 18:28:46 +00:00
/// <summary> <see cref="Ability.Pressure"/> or <see cref="Ability.Hustle"/> or <see cref="Ability.VitalSpirit"/> </summary>
2017-12-02 01:27:09 +00:00
PressureHustleSpirit = 1 << 4,
2021-03-14 18:28:46 +00:00
/// <summary> <see cref="Ability.SuctionCups"/> </summary>
2017-12-02 01:27:09 +00:00
SuctionCups = 1 << 5,
// Compatibility Flags
UsesLevelCall = 1 << 6,
2017-12-02 01:27:09 +00:00
Fail = 1 << 7,
2021-03-14 18:28:46 +00:00
/// <summary> <inheritdoc cref="CuteCharm"/> </summary>
2017-12-02 01:27:09 +00:00
CuteCharmFail = CuteCharm | Fail,
2021-03-14 18:28:46 +00:00
/// <summary> <inheritdoc cref="Synchronize"/> </summary>
2017-12-02 01:27:09 +00:00
SynchronizeFail = Synchronize | Fail,
2021-03-14 18:28:46 +00:00
/// <summary> <inheritdoc cref="StaticMagnet"/> </summary>
2017-12-02 01:27:09 +00:00
StaticMagnetFail = StaticMagnet | Fail,
2021-03-14 18:28:46 +00:00
/// <summary> <inheritdoc cref="PressureHustleSpirit"/> </summary>
2017-12-02 01:27:09 +00:00
PressureHustleSpiritFail = PressureHustleSpirit | Fail,
AllFlags = UsesLevelCall | Fail,
2017-12-02 01:27:09 +00:00
}
public static partial class Extensions
{
2021-08-05 22:18:43 +00:00
internal static bool IsLevelOrSlotModified(this LeadRequired lead) => lead.RemoveFlags() > LeadRequired.Synchronize;
internal static LeadRequired RemoveFlags(this LeadRequired lead) => lead & ~LeadRequired.AllFlags;
internal static bool NeedsLevelCall(this LeadRequired lead) => (lead & LeadRequired.UsesLevelCall) != 0;
}
}