Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Scrappy.cs

21 lines
872 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Scrappy is an ability that allows the Pokémon to hit Ghost-type Pokémon with Normal- and Fighting-type moves.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Scrappy_(Ability)">Bulbapedia - Scrappy</see>
/// </summary>
[Script(ScriptCategory.Ability, "scrappy")]
public class Scrappy : Script, IScriptChangeTypesForMove
{
/// <inheritdoc />
public void ChangeTypesForMove(IExecutingMove executingMove, IBattlePokemon target, byte hitIndex,
IList<TypeIdentifier> types)
{
var hitType = executingMove.GetHitData(target, hitIndex).Type;
if (hitType?.Name != TypeNames.Normal && hitType?.Name != TypeNames.Fighting)
return;
if (types.Any(x => x.Name == TypeNames.Ghost))
types.RemoveAll(x => x.Name == TypeNames.Ghost);
}
}