Deukhoofd 7c270a6d52
All checks were successful
Build / Build (push) Successful in 1m1s
Finish script interface refactor
2025-07-06 10:27:56 +02:00

18 lines
601 B
C#

using PkmnLib.Static.Moves;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "sucker_punch")]
public class SuckerPunch : Script, IScriptOnBeforeHit
{
/// <inheritdoc />
public void OnBeforeHit(IExecutingMove move, IPokemon target, byte hitIndex)
{
var targetChoice = move.Battle.ChoiceQueue?.Where(x => x.User == target).FirstOrDefault();
if (targetChoice is not IMoveChoice moveChoice ||
moveChoice.ChosenMove.MoveData.Category == MoveCategory.Status)
{
move.GetHitData(target, hitIndex).Fail();
}
}
}