Files
PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Synchronoise.cs

16 lines
604 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "synchronoise")]
public class Synchronoise : Script, IScriptChangeTargets
{
/// <inheritdoc />
public void ChangeTargets(IMoveChoice moveChoice, ref IReadOnlyList<IBattlePokemon?> targets)
{
var battleData = moveChoice.User;
if (battleData == null)
throw new InvalidOperationException("Battle data is null.");
targets = battleData.Battle.Sides.SelectMany(x => x.Pokemon).WhereNotNull()
.Where(x => x.Types.Any(y => moveChoice.User.Types.Contains(y))).ToList();
}
}