Deukhoofd 6d71de375e
All checks were successful
Build / Build (push) Successful in 48s
More abilities, refactor custom triggers to be typed.
2025-06-13 11:15:48 +02:00

21 lines
701 B
C#

namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "protect")]
public class ProtectionEffectScript : Script
{
/// <inheritdoc />
public override void BlockIncomingHit(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref bool block)
{
if (target.BattleData == null)
return;
if (!executingMove.UseMove.HasFlag("protect"))
return;
var args = new CustomTriggers.BypassProtectionArgs(executingMove, target, hitIndex, false);
executingMove.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.BypassProtection, args));
if (args.Bypass)
return;
block = true;
}
}