Support for integration tests, fixes

This commit is contained in:
2024-08-23 11:15:53 +02:00
parent e7dc885afd
commit 2a0aaed4c3
13 changed files with 346 additions and 14 deletions

View File

@@ -223,7 +223,7 @@ public class BattleImpl : ScriptSource, IBattle
/// <inheritdoc />
public bool CanUse(ITurnChoice choice)
{
if (choice.User.IsUsable)
if (!choice.User.IsUsable)
return false;
if (choice is IMoveChoice moveChoice)
{

View File

@@ -1,3 +1,5 @@
using PkmnLib.Dynamic.ScriptHandling;
namespace PkmnLib.Dynamic.Models.Choices;
/// <summary>
@@ -6,4 +8,25 @@ namespace PkmnLib.Dynamic.Models.Choices;
public interface IPassChoice : ITurnChoice
{
}
public class PassChoice : TurnChoice, IPassChoice
{
public PassChoice(IPokemon user) : base(user)
{
}
/// <inheritdoc />
public override int ScriptCount => User.ScriptCount;
/// <inheritdoc />
public override void GetOwnScripts(List<IEnumerable<ScriptContainer>> scripts)
{
}
/// <inheritdoc />
public override void CollectScripts(List<IEnumerable<ScriptContainer>> scripts)
{
User.CollectScripts(scripts);
}
}

View File

@@ -271,7 +271,7 @@ public interface IPokemon : IScriptSource
/// <summary>
/// Learn a move by name.
/// </summary>
void LearnMove(string moveName, MoveLearnMethod method, byte index);
void LearnMove(StringKey moveName, MoveLearnMethod method, byte index);
/// <summary>
/// Removes the current non-volatile status from the Pokemon.
@@ -658,7 +658,7 @@ public class PokemonImpl : ScriptSource, IPokemon
/// <remarks>
/// If the index is 255, it will try to find the first empty move slot.
/// </remarks>
public void LearnMove(string moveName, MoveLearnMethod method, byte index)
public void LearnMove(StringKey moveName, MoveLearnMethod method, byte index)
{
if (index == 255)
{