Deukhoofd 6d71de375e
All checks were successful
Build / Build (push) Successful in 48s
More abilities, refactor custom triggers to be typed.
2025-06-13 11:15:48 +02:00

24 lines
789 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Magnet Pull is an ability that prevents Steel-type Pokémon from fleeing or switching out.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Magnet_Pull_(Ability)">Bulbapedia - Magnet Pull</see>
/// </summary>
[Script(ScriptCategory.Ability, "magnet_pull")]
public class MagnetPull : Script
{
/// <inheritdoc />
public override void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
{
if (choice.User.Types.Any(x => x.Name == "steel"))
prevent = true;
}
/// <inheritdoc />
public override void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
{
if (choice.User.Types.Any(x => x.Name == "steel"))
prevent = true;
}
}