More abilities
All checks were successful
Build / Build (push) Successful in 49s

This commit is contained in:
2025-06-09 15:24:37 +02:00
parent 074f92bfc0
commit 1579d46671
23 changed files with 480 additions and 41 deletions

View File

@@ -0,0 +1,21 @@
using PkmnLib.Plugin.Gen7.Scripts.Utils;
namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon;
[Script(ScriptCategory.Pokemon, "autotomize")]
public class AutotomizeEffect : Script, IBatonPassException
{
public int Stacks { get; private set; } = 1;
/// <inheritdoc />
public override void Stack()
{
Stacks++;
}
/// <inheritdoc />
public override void ModifyWeight(ref float weight)
{
weight -= 100f * Stacks;
}
}

View File

@@ -11,6 +11,18 @@ public class ProtectionEffectScript : Script
if (!executingMove.UseMove.HasFlag("protect"))
return;
var bypass = false;
var parameters = new Dictionary<StringKey, object?>
{
{ "target", target },
{ "move", executingMove },
{ "hitIndex", hitIndex },
{ "bypass", bypass },
};
executingMove.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.BypassProtection, parameters));
bypass = parameters.GetValueOrDefault("bypass", false) as bool? ?? false;
if (bypass)
return;
block = true;
}

View File

@@ -11,6 +11,19 @@ public class SubstituteEffect(uint health) : Script
if (executingMove.UseMove.HasFlag("ignore-substitute"))
return;
var bypass = false;
var parameters = new Dictionary<StringKey, object?>
{
{ "target", target },
{ "move", executingMove },
{ "hitIndex", hitIndex },
{ "bypass", bypass },
};
executingMove.User.RunScriptHook(x => x.CustomTrigger(CustomTriggers.BypassProtection, parameters));
bypass = parameters.GetValueOrDefault("bypass", false) as bool? ?? false;
if (bypass)
return;
block = true;
var damage = executingMove.GetHitData(target, hitIndex).Damage;
if (damage >= _health)