Move all battle state from IPokemon to an ephemeral IBattlePokemon wrapper

This commit is contained in:
Deukhoofd committed 2026-08-28 15:22:26 +02:00
1 parent 942be8eaeb
commit 8a2733a0a9
859 files changed
+4408 -5331

No files matched your search

@@ -7,17 +7,17 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
public class HyperspaceFury : Script, IScriptFailMove, IScriptOnSecondaryEffect
{
/// <inheritdoc />
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
public void OnSecondaryEffect(IExecutingMove move, IBattlePokemon target, byte hit)
{
var protectionScripts = target.Volatile.Select(x => x.Script).OfType<ProtectionEffectScript>();
foreach (var protectionScript in protectionScripts.ToList())
{
target.Volatile.Remove(protectionScript.Name);
}
target.BattleData?.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName<CraftyShieldEffect>());
target.BattleData?.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName<MatBlockEffect>());
target.BattleData?.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName<QuickGuardEffect>());
target.BattleData?.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName<WideGuardEffect>());
target.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName<CraftyShieldEffect>());
target.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName<MatBlockEffect>());
target.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName<QuickGuardEffect>());
target.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName<WideGuardEffect>());
move.User.ChangeStatBoost(Statistic.Defense, -1, true, false);
}