diff --git a/PkmnLib.Dynamic/Models/Battle.cs b/PkmnLib.Dynamic/Models/Battle.cs index 469e394..7c260af 100644 --- a/PkmnLib.Dynamic/Models/Battle.cs +++ b/PkmnLib.Dynamic/Models/Battle.cs @@ -143,7 +143,7 @@ public interface IBattle : IScriptSource, IDeepCloneable, IDisposable /// /// Volatile scripts are scripts that are not permanent and can be removed by other scripts. /// - public IScriptSet Volatile { get; } + IScriptSet Volatile { get; } /// /// Gets the current weather of the battle. If no weather is present, this returns null. @@ -341,6 +341,16 @@ public class BattleImpl : ScriptSource, IBattle if (preventMove) return false; } + else if (choice is ISwitchChoice switchChoice) + { + if (!switchChoice.SwitchTo.IsUsable) + return false; + // Can't switch to a Pokémon already on the field + if (switchChoice.SwitchTo.BattleData is { IsOnBattlefield: true }) + return false; + if (switchChoice.SwitchTo == switchChoice.User) + return false; + } return true;