2025-02-01 14:00:22 +00:00
|
|
|
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;
|
|
|
|
|
2025-02-03 10:40:26 +00:00
|
|
|
if (choiceQueue.FirstOrDefault(x => x is IMoveChoice moveChoice && moveChoice.User == target) is not IMoveChoice choice)
|
2025-02-01 14:00:22 +00:00
|
|
|
{
|
|
|
|
move.GetHitData(target, hit).Fail();
|
|
|
|
return;
|
|
|
|
}
|
|
|
|
|
|
|
|
choice.Volatile.Add(new ElectrifyEffect());
|
|
|
|
}
|
|
|
|
}
|