Deukhoofd c795f20e54
All checks were successful
Build / Build (push) Successful in 51s
Implement highest damage AI, further work on AI runner, random fixes
2025-07-05 14:56:25 +02:00

33 lines
943 B
C#

using PkmnLib.Dynamic.BattleFlow;
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
[Script(ScriptCategory.Side, "spotlight")]
public class SpotlightEffect : Script, IScriptChangeIncomingTargets, IScriptOnEndTurn
{
private readonly byte _position;
private readonly IBattleSide _side;
public SpotlightEffect(IBattleSide side, byte position)
{
_side = side;
_position = position;
}
/// <inheritdoc />
public void ChangeIncomingTargets(IMoveChoice moveChoice, ref IReadOnlyList<IPokemon?> targets)
{
if (!TargetResolver.IsValidTarget(_side.Index, _position, moveChoice.ChosenMove.MoveData.Target,
moveChoice.User))
return;
if (_side.Pokemon[_position] == null)
return;
targets = [_side.Pokemon[_position]!];
}
/// <inheritdoc />
public void OnEndTurn(IScriptSource owner, IBattle battle)
{
RemoveSelf();
}
}