Deukhoofd eea5697109
All checks were successful
Build / Build (push) Successful in 49s
Fixes all warnings
2025-05-19 11:50:51 +02:00

19 lines
537 B
C#

using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "conversion")]
public class Conversion : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var moveType = move.User.Moves.WhereNotNull().FirstOrDefault()?.MoveData.MoveType;
if (moveType == null)
{
move.GetHitData(target, hit).Fail();
return;
}
move.User.SetTypes([moveType.Value]);
}
}