Further work on the script interface rework

This commit is contained in:
2025-07-05 11:30:18 +02:00
parent 1feb27e826
commit 4499927551
100 changed files with 418 additions and 352 deletions

View File

@@ -1,18 +1,18 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "fairy_lock")]
public class FairyLockEffect : Script, IScriptOnEndTurn
public class FairyLockEffect : Script, IScriptOnEndTurn, IScriptPreventSelfRunAway, IScriptPreventSelfSwitch
{
private int _turns = 1;
/// <inheritdoc />
public override void PreventSelfRunAway(IFleeChoice choice, ref bool prevent)
public void PreventSelfRunAway(IFleeChoice choice, ref bool prevent)
{
prevent = true;
}
/// <inheritdoc />
public override void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent)
public void PreventSelfSwitch(ISwitchChoice choice, ref bool prevent)
{
prevent = true;
}

View File

@@ -1,12 +1,12 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "magic_room")]
public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnEndTurn
public class MagicRoomEffect : Script, IScriptOnBeforeAnyHookInvoked, IScriptOnEndTurn, IScriptPreventHeldItemConsume
{
private int _turnsLeft = 5;
/// <inheritdoc />
public override void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
public void PreventHeldItemConsume(IPokemon pokemon, IItem heldItem, ref bool prevented)
{
prevented = true;
}

View File

@@ -1,7 +1,7 @@
namespace PkmnLib.Plugin.Gen7.Scripts.Battle;
[Script(ScriptCategory.Battle, "water_sport")]
public class WaterSportEffect : Script, IScriptChangeMoveDamage
public class WaterSportEffect : Script, IScriptChangeMoveDamage, IScriptOnSwitchOut
{
public readonly HashSet<IPokemon> Placers = new();
@@ -15,7 +15,7 @@ public class WaterSportEffect : Script, IScriptChangeMoveDamage
}
/// <inheritdoc />
public override void OnSwitchOut(IPokemon oldPokemon, byte position)
public void OnSwitchOut(IPokemon oldPokemon, byte position)
{
if (!Placers.Contains(oldPokemon))
return;