2025-01-26 10:55:13 +00:00
|
|
|
using System;
|
|
|
|
using System.Linq;
|
2025-02-03 10:40:26 +00:00
|
|
|
using PkmnLib.Static.Utils;
|
2025-01-26 10:55:13 +00:00
|
|
|
|
|
|
|
namespace PkmnLib.Plugin.Gen7.Scripts.Utils;
|
|
|
|
|
|
|
|
public static class TurnChoiceHelper
|
|
|
|
{
|
2025-02-03 10:40:26 +00:00
|
|
|
public static IMoveChoice CreateMoveChoice(IPokemon owner, StringKey moveName, byte targetSide, byte targetPosition)
|
2025-01-26 10:55:13 +00:00
|
|
|
{
|
|
|
|
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);
|
|
|
|
}
|
|
|
|
}
|