24 lines
832 B
C#
24 lines
832 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, IScriptPreventOpponentRunAway, IScriptPreventOpponentSwitch
|
|
{
|
|
/// <inheritdoc />
|
|
public void PreventOpponentRunAway(IFleeChoice choice, ref bool prevent)
|
|
{
|
|
if (choice.User.Types.Any(x => x.Name == "steel"))
|
|
prevent = true;
|
|
}
|
|
|
|
/// <inheritdoc />
|
|
public void PreventOpponentSwitch(ISwitchChoice choice, ref bool prevent)
|
|
{
|
|
if (choice.User.Types.Any(x => x.Name == "steel"))
|
|
prevent = true;
|
|
}
|
|
} |