This commit is contained in:
33
Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/SpotlightEffect.cs
Normal file
33
Plugins/PkmnLib.Plugin.Gen7/Scripts/Side/SpotlightEffect.cs
Normal file
@@ -0,0 +1,33 @@
|
||||
using System.Collections.Generic;
|
||||
using PkmnLib.Dynamic.Models.BattleFlow;
|
||||
|
||||
namespace PkmnLib.Plugin.Gen7.Scripts.Side;
|
||||
|
||||
public class SpotlightEffect : Script
|
||||
{
|
||||
private readonly byte _position;
|
||||
private readonly IBattleSide _side;
|
||||
|
||||
public SpotlightEffect(IBattleSide side, byte position)
|
||||
{
|
||||
_side = side;
|
||||
_position = position;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public override 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 override void OnEndTurn(IBattle battle)
|
||||
{
|
||||
RemoveSelf();
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user