2025-06-28 12:02:24 +02:00

19 lines
704 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Abilities;
/// <summary>
/// Protean is an ability that changes the Pokémon's type to the type of the move it is about to use.
///
/// <see href="https://bulbapedia.bulbagarden.net/wiki/Protean_(Ability)">Bulbapedia - Protean</see>
/// </summary>
[Script(ScriptCategory.Ability, "protean")]
public class Protean : Script, IScriptOnBeforeMove
{
/// <inheritdoc />
public void OnBeforeMove(IExecutingMove move)
{
if (move.User.Types.Count == 1 && move.User.Types[0] == move.UseMove.MoveType)
return;
move.Battle.EventHook.Invoke(new AbilityTriggerEvent(move.User));
move.User.SetTypes([move.UseMove.MoveType]);
}
}