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
697 B
C#

using PkmnLib.Static.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Utils;
public static class TurnChoiceHelper
{
public static IMoveChoice CreateMoveChoice(IPokemon owner, StringKey moveName, byte targetSide, byte targetPosition)
{
var move = owner.Moves.FirstOrDefault(x => x?.MoveData.Name == moveName);
if (move == null)
{
if (!owner.Library.StaticLibrary.Moves.TryGet(moveName, out var moveData))
throw new Exception($"Move '{moveName}' not found in move library.");
move = new LearnedMoveImpl(moveData, MoveLearnMethod.Unknown);
}
return new MoveChoice(owner, move, targetSide, targetPosition);
}
}