PkmnLib.NET/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/Electrify.cs

23 lines
680 B
C#

using PkmnLib.Plugin.Gen7.Scripts.MoveVolatile;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "electrify")]
public class Electrify : Script
{
/// <inheritdoc />
public override void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var choiceQueue = target.BattleData?.Battle.ChoiceQueue;
if (choiceQueue == null)
return;
if (choiceQueue.Where(x => x is IMoveChoice moveChoice && moveChoice.User == target) is not IMoveChoice choice)
{
move.GetHitData(target, hit).Fail();
return;
}
choice.Volatile.Add(new ElectrifyEffect());
}
}