using PkmnLib.Plugin.Gen7.Scripts.Pokemon;
using PkmnLib.Plugin.Gen7.Scripts.Side;
namespace PkmnLib.Plugin.Gen7.Scripts.Moves;
[Script(ScriptCategory.Move, "hyperspace_fury")]
public class HyperspaceFury : Script, IScriptFailMove, IScriptOnSecondaryEffect
{
///
public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit)
{
var protectionScripts = target.Volatile.Select(x => x.Script).OfType();
foreach (var protectionScript in protectionScripts.ToList())
{
target.Volatile.Remove(protectionScript.Name);
}
target.BattleData?.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName());
target.BattleData?.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName());
target.BattleData?.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName());
target.BattleData?.BattleSide.VolatileScripts.Remove(ScriptUtils.ResolveName());
move.User.ChangeStatBoost(Statistic.Defense, -1, true, false);
}
private static StringKey HoopaName = "hoopa";
private static StringKey UnboundName = "unbound";
public void FailMove(IExecutingMove move, ref bool fail)
{
if (move.User.Species.Name != HoopaName || move.User.Form.Name != UnboundName)
{
fail = true;
}
}
}