diff --git a/.config/dotnet-tools.json b/.config/dotnet-tools.json index 29fd77f..45a755b 100644 --- a/.config/dotnet-tools.json +++ b/.config/dotnet-tools.json @@ -3,14 +3,14 @@ "isRoot": true, "tools": { "husky": { - "version": "0.7.2", + "version": "0.9.1", "commands": [ "husky" ], "rollForward": false }, "jetbrains.resharper.globaltools": { - "version": "2025.1.1", + "version": "2026.1.4", "commands": [ "jb" ], diff --git a/.gitea/workflows/build.yaml b/.gitea/workflows/build.yaml index 93cfc53..a4bb292 100644 --- a/.gitea/workflows/build.yaml +++ b/.gitea/workflows/build.yaml @@ -27,4 +27,4 @@ jobs: - name: Build run: dotnet build PkmnLib.NET.slnx -c Release --nologo --verbosity quiet -p:NoWarn=CS1591 - name: Test - run: dotnet test PkmnLib.NET.slnx -c Release --nologo --no-restore --no-build -- --disable-logo \ No newline at end of file + run: dotnet test --solution PkmnLib.NET.slnx -c Release --nologo --no-restore --no-build -- --disable-logo \ No newline at end of file diff --git a/.husky/task-runner.json b/.husky/task-runner.json index 119b9b2..365246c 100644 --- a/.husky/task-runner.json +++ b/.husky/task-runner.json @@ -7,7 +7,6 @@ "command": "dotnet", "args": [ "test", - "PkmnLib.NET.sln", "--verbosity", "minimal" ] @@ -21,7 +20,7 @@ "args": [ "jb", "cleanupcode", - "PkmnLib.NET.sln", + "PkmnLib.NET.slnx", "--profile=Built-in: Reformat & Apply Syntax Style", "--include=${args}" ], diff --git a/AI/AIRunner/Program.cs b/AI/AIRunner/Program.cs index 426ed3c..b3b4d10 100644 --- a/AI/AIRunner/Program.cs +++ b/AI/AIRunner/Program.cs @@ -1,6 +1,5 @@ using System.CommandLine; using System.CommandLine.Parsing; -using System.Reflection; using PkmnLib.Dynamic.AI; using PkmnLib.Dynamic.Libraries; using PkmnLib.Plugin.Gen7; @@ -14,7 +13,7 @@ internal static class Program { private static List? _availableAIs; - internal static LoggingLevelSwitch LogLevelSwitch { get; } = new(LogEventLevel.Information); + internal static LoggingLevelSwitch LogLevelSwitch { get; } = new(); private static Task Main(string[] args) { diff --git a/AI/AIRunner/TestCommandRunner.cs b/AI/AIRunner/TestCommandRunner.cs index a34f581..c288ffd 100644 --- a/AI/AIRunner/TestCommandRunner.cs +++ b/AI/AIRunner/TestCommandRunner.cs @@ -2,7 +2,6 @@ using System.Collections.Concurrent; using PkmnLib.Dynamic.AI; using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Models; -using PkmnLib.Plugin.Gen7; using PkmnLib.Static.Species; using PkmnLib.Static.Utils; using Serilog; @@ -184,10 +183,10 @@ public static class TestCommandRunner throw new InvalidOperationException("Both Pokémon must be non-null to proceed with the battle."); } - var taskAiOne = !battle.HasForcedTurn(pokemon1!, out var choice1) + var taskAiOne = !battle.HasForcedTurn(pokemon1, out var choice1) ? Task.Run(() => ai1.GetChoice(battle, pokemon1)) : Task.FromResult(choice1); - var taskAiTwo = !battle.HasForcedTurn(pokemon2!, out var choice2) + var taskAiTwo = !battle.HasForcedTurn(pokemon2, out var choice2) ? Task.Run(() => ai2.GetChoice(battle, pokemon2)) : Task.FromResult(choice2); await Task.WhenAll(taskAiOne, taskAiTwo); diff --git a/Directory.Build.props b/Directory.Build.props index 6030abe..7df3ec3 100644 --- a/Directory.Build.props +++ b/Directory.Build.props @@ -9,6 +9,7 @@ nullable true enable + true diff --git a/Directory.Packages.props b/Directory.Packages.props index fca5803..b322d93 100644 --- a/Directory.Packages.props +++ b/Directory.Packages.props @@ -1,24 +1,24 @@ - - true - - - - - - - - - - - - - - - - - - - - + + true + + + + + + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/PkmnLib.Dynamic/AI/AILogging.cs b/PkmnLib.Dynamic/AI/AILogging.cs index 78ff71b..bd70b80 100644 --- a/PkmnLib.Dynamic/AI/AILogging.cs +++ b/PkmnLib.Dynamic/AI/AILogging.cs @@ -2,7 +2,7 @@ namespace PkmnLib.Dynamic.AI; public static class AILogging { - public static Action LogHandler { get; set; } = message => { }; + public static Action LogHandler { get; set; } = _ => { }; public static void LogInformation(string message) => LogHandler(message); } \ No newline at end of file diff --git a/PkmnLib.Dynamic/AI/HighestDamageAI.cs b/PkmnLib.Dynamic/AI/HighestDamageAI.cs index 793dd06..4cdb753 100644 --- a/PkmnLib.Dynamic/AI/HighestDamageAI.cs +++ b/PkmnLib.Dynamic/AI/HighestDamageAI.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Models; using PkmnLib.Dynamic.Models.Choices; -using PkmnLib.Static; using PkmnLib.Static.Utils; namespace PkmnLib.Dynamic.AI; diff --git a/PkmnLib.Dynamic/Events/DisplaySpeciesChangeEvent.cs b/PkmnLib.Dynamic/Events/DisplaySpeciesChangeEvent.cs index ff53918..8e0f488 100644 --- a/PkmnLib.Dynamic/Events/DisplaySpeciesChangeEvent.cs +++ b/PkmnLib.Dynamic/Events/DisplaySpeciesChangeEvent.cs @@ -1,7 +1,7 @@ -using PkmnLib.Dynamic.Events; +using PkmnLib.Dynamic.Models; using PkmnLib.Static.Species; -namespace PkmnLib.Dynamic.Models; +namespace PkmnLib.Dynamic.Events; public class DisplaySpeciesChangeEvent : IEventData { diff --git a/PkmnLib.Dynamic/Libraries/DataLoaders/Models/SerializedSpecies.cs b/PkmnLib.Dynamic/Libraries/DataLoaders/Models/SerializedSpecies.cs index ff5c935..e4b1369 100644 --- a/PkmnLib.Dynamic/Libraries/DataLoaders/Models/SerializedSpecies.cs +++ b/PkmnLib.Dynamic/Libraries/DataLoaders/Models/SerializedSpecies.cs @@ -226,20 +226,20 @@ public class SerializedMoves /// /// The moves the Pokémon can learn by leveling up. /// - public SerializedLevelMove[]? LevelMoves { get; set; } = null!; + public SerializedLevelMove[]? LevelMoves { get; set; } /// /// The moves the Pokémon can learn by breeding. /// - public string[]? EggMoves { get; set; } = null!; + public string[]? EggMoves { get; set; } /// /// The moves the Pokémon can learn by tutoring. /// - public string[]? TutorMoves { get; set; } = null!; + public string[]? TutorMoves { get; set; } /// /// The moves the Pokémon can learn by TM. /// - public string[]? Machine { get; set; } = null!; + public string[]? Machine { get; set; } } \ No newline at end of file diff --git a/PkmnLib.Dynamic/Libraries/DynamicLibrary.cs b/PkmnLib.Dynamic/Libraries/DynamicLibrary.cs index 59eaf86..349e4a7 100644 --- a/PkmnLib.Dynamic/Libraries/DynamicLibrary.cs +++ b/PkmnLib.Dynamic/Libraries/DynamicLibrary.cs @@ -1,7 +1,6 @@ using PkmnLib.Dynamic.AI.Explicit; using PkmnLib.Dynamic.Plugins; using PkmnLib.Dynamic.ScriptHandling; -using PkmnLib.Dynamic.ScriptHandling.Registry; using PkmnLib.Static.Libraries; namespace PkmnLib.Dynamic.Libraries; diff --git a/PkmnLib.Dynamic/Models/Battle.cs b/PkmnLib.Dynamic/Models/Battle.cs index 4ea6c15..1bedfb8 100644 --- a/PkmnLib.Dynamic/Models/Battle.cs +++ b/PkmnLib.Dynamic/Models/Battle.cs @@ -136,7 +136,7 @@ public interface IBattle : IScriptSource, IDeepCloneable, IDisposable /// /// Sets the current weather for the battle. If null is passed, this clears the weather. /// A duration can be passed to set the duration of the weather in turns. This duration can be modified by - /// other scripts before the weather is set through the script hook. + /// other scripts before the weather is set through the script hook. /// bool SetWeather(StringKey? weatherName, int duration, EventBatchId batchId = default); @@ -369,18 +369,18 @@ public class BattleImpl : ScriptSource, IBattle return true; - bool IsValidForForcedTurn(ITurnChoice forcedChoice, ITurnChoice choiceToCheck) + bool IsValidForForcedTurn(ITurnChoice forcedChoiceInner, ITurnChoice choiceToCheck) { // If the forced choice is a move choice, we can only use it if the move is the same - if (forcedChoice is IMoveChoice forcedMove && choiceToCheck is IMoveChoice moveChoice) + if (forcedChoiceInner is IMoveChoice forcedMove && choiceToCheck is IMoveChoice moveChoiceInner) { - return forcedMove.ChosenMove.MoveData.Name == moveChoice.ChosenMove.MoveData.Name; + return forcedMove.ChosenMove.MoveData.Name == moveChoiceInner.ChosenMove.MoveData.Name; } - if (forcedChoice is IPassChoice && choiceToCheck is IPassChoice) + if (forcedChoiceInner is IPassChoice && choiceToCheck is IPassChoice) { return true; // Both are pass choices, so they are valid } - return forcedChoice.Equals(choiceToCheck); + return forcedChoiceInner.Equals(choiceToCheck); } } diff --git a/PkmnLib.Dynamic/Models/BattleChoiceQueue.cs b/PkmnLib.Dynamic/Models/BattleChoiceQueue.cs index 436a6f9..ffd31ce 100644 --- a/PkmnLib.Dynamic/Models/BattleChoiceQueue.cs +++ b/PkmnLib.Dynamic/Models/BattleChoiceQueue.cs @@ -25,7 +25,7 @@ public class BattleChoiceQueue : IDeepCloneable /// public BattleChoiceQueue(ITurnChoice[] choices) { - Array.Sort(choices, TurnChoiceComparer.Instance!); + Array.Sort(choices, TurnChoiceComparer.Instance); _choices = choices; } @@ -144,7 +144,7 @@ public class BattleChoiceQueue : IDeepCloneable /// public void Remove(ITurnChoice choice) { - var index = Array.FindIndex(_choices, _currentIndex, x => x == choice); + var index = Array.FindIndex(_choices, _currentIndex, x => Equals(x, choice)); if (index == -1) return; _choices[index] = null; diff --git a/PkmnLib.Dynamic/Models/Choices/FleeChoice.cs b/PkmnLib.Dynamic/Models/Choices/FleeChoice.cs index 6562ae7..4595e47 100644 --- a/PkmnLib.Dynamic/Models/Choices/FleeChoice.cs +++ b/PkmnLib.Dynamic/Models/Choices/FleeChoice.cs @@ -47,5 +47,6 @@ public class FleeTurnChoice : TurnChoice, IFleeChoice /// public override int GetHashCode() => + // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract User?.GetHashCode() ?? 0; } \ No newline at end of file diff --git a/PkmnLib.Dynamic/Models/Choices/PassChoice.cs b/PkmnLib.Dynamic/Models/Choices/PassChoice.cs index 4879e71..797cdc6 100644 --- a/PkmnLib.Dynamic/Models/Choices/PassChoice.cs +++ b/PkmnLib.Dynamic/Models/Choices/PassChoice.cs @@ -51,5 +51,6 @@ public class PassChoice : TurnChoice, IPassChoice /// public override int GetHashCode() => + // ReSharper disable once ConditionalAccessQualifierIsNonNullableAccordingToAPIContract User?.GetHashCode() ?? 0; } \ No newline at end of file diff --git a/PkmnLib.Dynamic/Models/Choices/SwitchChoice.cs b/PkmnLib.Dynamic/Models/Choices/SwitchChoice.cs index b2acd2d..b67e0f9 100644 --- a/PkmnLib.Dynamic/Models/Choices/SwitchChoice.cs +++ b/PkmnLib.Dynamic/Models/Choices/SwitchChoice.cs @@ -60,5 +60,6 @@ public class SwitchChoice : TurnChoice, ISwitchChoice /// public override int GetHashCode() => + // ReSharper disable twice ConditionalAccessQualifierIsNonNullableAccordingToAPIContract User?.GetHashCode() ?? 0 ^ SwitchTo?.GetHashCode() ?? 0; } \ No newline at end of file diff --git a/PkmnLib.Dynamic/ScriptHandling/Script.cs b/PkmnLib.Dynamic/ScriptHandling/Script.cs index aa65740..2fa8cf2 100644 --- a/PkmnLib.Dynamic/ScriptHandling/Script.cs +++ b/PkmnLib.Dynamic/ScriptHandling/Script.cs @@ -1,9 +1,5 @@ using System.Diagnostics; -using PkmnLib.Dynamic.Models; -using PkmnLib.Dynamic.Models.Choices; using PkmnLib.Dynamic.ScriptHandling.Registry; -using PkmnLib.Static; -using PkmnLib.Static.Moves; using PkmnLib.Static.Utils; namespace PkmnLib.Dynamic.ScriptHandling; diff --git a/PkmnLib.Dynamic/ScriptHandling/ScriptIterator.cs b/PkmnLib.Dynamic/ScriptHandling/ScriptIterator.cs index 96646ee..f17ec89 100644 --- a/PkmnLib.Dynamic/ScriptHandling/ScriptIterator.cs +++ b/PkmnLib.Dynamic/ScriptHandling/ScriptIterator.cs @@ -8,7 +8,7 @@ namespace PkmnLib.Dynamic.ScriptHandling; public class ScriptIterator : IEnumerable { private readonly IReadOnlyList> _scripts; - private int _currentIndex = 0; + private int _currentIndex; /// public ScriptIterator(IReadOnlyList> scripts) diff --git a/PkmnLib.NET.sln b/PkmnLib.NET.sln deleted file mode 100644 index 9743ca2..0000000 --- a/PkmnLib.NET.sln +++ /dev/null @@ -1,51 +0,0 @@ - -Microsoft Visual Studio Solution File, Format Version 12.00 -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PkmnLib.Static", "PkmnLib.Static\PkmnLib.Static.csproj", "{312782DA-1066-4490-BD0E-DF4DF8713B4A}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PkmnLib.Tests", "PkmnLib.Tests\PkmnLib.Tests.csproj", "{42DE3095-0468-4827-AF5C-691C94BA7F92}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PkmnLib.Dynamic", "PkmnLib.Dynamic\PkmnLib.Dynamic.csproj", "{D0CBA9A9-7288-41B4-B76B-CB4F20036AB2}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PkmnLib.Plugin.Gen7", "Plugins\PkmnLib.Plugin.Gen7\PkmnLib.Plugin.Gen7.csproj", "{FA5380F0-28CC-4AEC-8963-814B347A89BA}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "Plugins", "Plugins", "{63C1B450-DC26-444A-AEBD-15979F3EEE53}" -EndProject -Project("{FAE04EC0-301F-11D3-BF4B-00C04F79EFBC}") = "PkmnLib.Plugin.Gen7.Tests", "Plugins\PkmnLib.Plugin.Gen7.Tests\PkmnLib.Plugin.Gen7.Tests.csproj", "{FBB53861-081F-4DAC-B006-79EE238D0DFC}" -EndProject -Project("{2150E333-8FDC-42A3-9474-1A3956D46DE8}") = "SolutionFiles", "SolutionFiles", "{2B99ADF8-10E2-4A3D-906F-27DC8E312A79}" - ProjectSection(SolutionItems) = preProject - .editorconfig = .editorconfig - EndProjectSection -EndProject -Global - GlobalSection(SolutionConfigurationPlatforms) = preSolution - Debug|Any CPU = Debug|Any CPU - Release|Any CPU = Release|Any CPU - EndGlobalSection - GlobalSection(ProjectConfigurationPlatforms) = postSolution - {312782DA-1066-4490-BD0E-DF4DF8713B4A}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {312782DA-1066-4490-BD0E-DF4DF8713B4A}.Debug|Any CPU.Build.0 = Debug|Any CPU - {312782DA-1066-4490-BD0E-DF4DF8713B4A}.Release|Any CPU.ActiveCfg = Release|Any CPU - {312782DA-1066-4490-BD0E-DF4DF8713B4A}.Release|Any CPU.Build.0 = Release|Any CPU - {42DE3095-0468-4827-AF5C-691C94BA7F92}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {42DE3095-0468-4827-AF5C-691C94BA7F92}.Debug|Any CPU.Build.0 = Debug|Any CPU - {42DE3095-0468-4827-AF5C-691C94BA7F92}.Release|Any CPU.ActiveCfg = Release|Any CPU - {42DE3095-0468-4827-AF5C-691C94BA7F92}.Release|Any CPU.Build.0 = Release|Any CPU - {D0CBA9A9-7288-41B4-B76B-CB4F20036AB2}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {D0CBA9A9-7288-41B4-B76B-CB4F20036AB2}.Debug|Any CPU.Build.0 = Debug|Any CPU - {D0CBA9A9-7288-41B4-B76B-CB4F20036AB2}.Release|Any CPU.ActiveCfg = Release|Any CPU - {D0CBA9A9-7288-41B4-B76B-CB4F20036AB2}.Release|Any CPU.Build.0 = Release|Any CPU - {FA5380F0-28CC-4AEC-8963-814B347A89BA}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FA5380F0-28CC-4AEC-8963-814B347A89BA}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FA5380F0-28CC-4AEC-8963-814B347A89BA}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FA5380F0-28CC-4AEC-8963-814B347A89BA}.Release|Any CPU.Build.0 = Release|Any CPU - {FBB53861-081F-4DAC-B006-79EE238D0DFC}.Debug|Any CPU.ActiveCfg = Debug|Any CPU - {FBB53861-081F-4DAC-B006-79EE238D0DFC}.Debug|Any CPU.Build.0 = Debug|Any CPU - {FBB53861-081F-4DAC-B006-79EE238D0DFC}.Release|Any CPU.ActiveCfg = Release|Any CPU - {FBB53861-081F-4DAC-B006-79EE238D0DFC}.Release|Any CPU.Build.0 = Release|Any CPU - EndGlobalSection - GlobalSection(NestedProjects) = preSolution - {FA5380F0-28CC-4AEC-8963-814B347A89BA} = {63C1B450-DC26-444A-AEBD-15979F3EEE53} - {FBB53861-081F-4DAC-B006-79EE238D0DFC} = {63C1B450-DC26-444A-AEBD-15979F3EEE53} - EndGlobalSection -EndGlobal diff --git a/PkmnLib.Tests/Dataloader/AbilityDataLoaderTests.cs b/PkmnLib.Tests/Dataloader/AbilityDataLoaderTests.cs index 0560d5d..2fc5412 100644 --- a/PkmnLib.Tests/Dataloader/AbilityDataLoaderTests.cs +++ b/PkmnLib.Tests/Dataloader/AbilityDataLoaderTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Libraries.DataLoaders; using PkmnLib.Dynamic.Plugins; -using PkmnLib.Dynamic.ScriptHandling.Registry; namespace PkmnLib.Tests.Dataloader; diff --git a/PkmnLib.Tests/Dataloader/GrowthRateDataLoaderTests.cs b/PkmnLib.Tests/Dataloader/GrowthRateDataLoaderTests.cs index ec64af4..375f06d 100644 --- a/PkmnLib.Tests/Dataloader/GrowthRateDataLoaderTests.cs +++ b/PkmnLib.Tests/Dataloader/GrowthRateDataLoaderTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Libraries.DataLoaders; using PkmnLib.Dynamic.Plugins; -using PkmnLib.Dynamic.ScriptHandling.Registry; namespace PkmnLib.Tests.Dataloader; diff --git a/PkmnLib.Tests/Dataloader/ItemDataLoaderTests.cs b/PkmnLib.Tests/Dataloader/ItemDataLoaderTests.cs index 0178184..6bdf728 100644 --- a/PkmnLib.Tests/Dataloader/ItemDataLoaderTests.cs +++ b/PkmnLib.Tests/Dataloader/ItemDataLoaderTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Libraries.DataLoaders; using PkmnLib.Dynamic.Plugins; -using PkmnLib.Dynamic.ScriptHandling.Registry; namespace PkmnLib.Tests.Dataloader; diff --git a/PkmnLib.Tests/Dataloader/MoveDataLoaderTests.cs b/PkmnLib.Tests/Dataloader/MoveDataLoaderTests.cs index 33fc731..dd98ebe 100644 --- a/PkmnLib.Tests/Dataloader/MoveDataLoaderTests.cs +++ b/PkmnLib.Tests/Dataloader/MoveDataLoaderTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Libraries.DataLoaders; using PkmnLib.Dynamic.Plugins; -using PkmnLib.Dynamic.ScriptHandling.Registry; using PkmnLib.Static.Libraries; namespace PkmnLib.Tests.Dataloader; diff --git a/PkmnLib.Tests/Dataloader/NatureDataloaderTests.cs b/PkmnLib.Tests/Dataloader/NatureDataloaderTests.cs index 02c3bdf..de5f53b 100644 --- a/PkmnLib.Tests/Dataloader/NatureDataloaderTests.cs +++ b/PkmnLib.Tests/Dataloader/NatureDataloaderTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Libraries.DataLoaders; using PkmnLib.Dynamic.Plugins; -using PkmnLib.Dynamic.ScriptHandling.Registry; namespace PkmnLib.Tests.Dataloader; diff --git a/PkmnLib.Tests/Dataloader/SpeciesDataloaderTests.cs b/PkmnLib.Tests/Dataloader/SpeciesDataloaderTests.cs index dd0ef52..371f247 100644 --- a/PkmnLib.Tests/Dataloader/SpeciesDataloaderTests.cs +++ b/PkmnLib.Tests/Dataloader/SpeciesDataloaderTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Libraries.DataLoaders; using PkmnLib.Dynamic.Plugins; -using PkmnLib.Dynamic.ScriptHandling.Registry; using PkmnLib.Static.Libraries; namespace PkmnLib.Tests.Dataloader; @@ -70,9 +69,9 @@ public class SpeciesDataloaderTests await Assert.That(species).IsNotNull(); await Assert.That(species!.TryGetForm("arceus_fighting", out var form)).IsTrue(); await Assert.That(form).IsNotNull(); - await Assert.That(form!.Types).HasCount().EqualTo(1); - await Assert.That(form.Types[0].Name).IsEqualTo("fighting"); - await Assert.That(form.Flags).IsEqualTo(species.GetDefaultForm().Flags); + await Assert.That(form!.Types).Count().IsEqualTo(1); + await Assert.That(form.Types[0].Name.ToString()).IsEqualTo("fighting"); + await Assert.That(form.Flags).IsEquivalentTo(species.GetDefaultForm().Flags); await Assert.That(form.BaseStats).IsEqualTo(species.GetDefaultForm().BaseStats); } } \ No newline at end of file diff --git a/PkmnLib.Tests/Dataloader/TypeDataloaderTests.cs b/PkmnLib.Tests/Dataloader/TypeDataloaderTests.cs index a3acb20..2c39833 100644 --- a/PkmnLib.Tests/Dataloader/TypeDataloaderTests.cs +++ b/PkmnLib.Tests/Dataloader/TypeDataloaderTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Libraries.DataLoaders; using PkmnLib.Dynamic.Plugins; -using PkmnLib.Dynamic.ScriptHandling.Registry; namespace PkmnLib.Tests.Dataloader; diff --git a/PkmnLib.Tests/Dynamic/ChoiceQueueTests.cs b/PkmnLib.Tests/Dynamic/ChoiceQueueTests.cs index 6631622..a11f5b4 100644 --- a/PkmnLib.Tests/Dynamic/ChoiceQueueTests.cs +++ b/PkmnLib.Tests/Dynamic/ChoiceQueueTests.cs @@ -21,8 +21,8 @@ public class ChoiceQueueTests choice2.Speed.Returns((uint)50); var queue = new BattleChoiceQueue([choice1, choice2]); - await Assert.That(queue.Dequeue()).IsEqualTo(choice1); - await Assert.That(queue.Dequeue()).IsEqualTo(choice2); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice1); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice2); } [Test] @@ -41,8 +41,8 @@ public class ChoiceQueueTests choice2.Speed.Returns((uint)50); var queue = new BattleChoiceQueue([choice1, choice2]); - await Assert.That(queue.Dequeue()).IsEqualTo(choice2); - await Assert.That(queue.Dequeue()).IsEqualTo(choice1); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice2); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice1); } [Test] @@ -69,7 +69,7 @@ public class ChoiceQueueTests var queue = new BattleChoiceQueue([choice1, choice2, choice3, choice4]); var result = queue.MovePokemonChoiceNext(pokemon3); await Assert.That(result).IsTrue(); - await Assert.That(queue.Dequeue()).IsEqualTo(choice3); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice3); } [Test] @@ -97,7 +97,7 @@ public class ChoiceQueueTests queue.Dequeue(); var result = queue.MovePokemonChoiceNext(pokemon1); await Assert.That(result).IsFalse(); - await Assert.That(queue.Dequeue()).IsEqualTo(choice2); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice2); } [Test] @@ -124,10 +124,10 @@ public class ChoiceQueueTests var queue = new BattleChoiceQueue([choice1, choice2, choice3, choice4]); var result = queue.MovePokemonChoiceLast(pokemon2); await Assert.That(result).IsTrue(); - await Assert.That(queue.Dequeue()).IsEqualTo(choice1); - await Assert.That(queue.Dequeue()).IsEqualTo(choice3); - await Assert.That(queue.Dequeue()).IsEqualTo(choice4); - await Assert.That(queue.Dequeue()).IsEqualTo(choice2); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice1); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice3); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice4); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice2); } [Test] @@ -155,8 +155,8 @@ public class ChoiceQueueTests queue.Dequeue(); var result = queue.MovePokemonChoiceLast(pokemon1); await Assert.That(result).IsFalse(); - await Assert.That(queue.Dequeue()).IsEqualTo(choice2); - await Assert.That(queue.Dequeue()).IsEqualTo(choice3); - await Assert.That(queue.Dequeue()).IsEqualTo(choice4); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice2); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice3); + await Assert.That((IMoveChoice)queue.Dequeue()!).IsEqualTo(choice4); } } \ No newline at end of file diff --git a/PkmnLib.Tests/Dynamic/PokemonStatBoostTests.cs b/PkmnLib.Tests/Dynamic/PokemonStatBoostTests.cs index dd0a664..911d89a 100644 --- a/PkmnLib.Tests/Dynamic/PokemonStatBoostTests.cs +++ b/PkmnLib.Tests/Dynamic/PokemonStatBoostTests.cs @@ -1,4 +1,3 @@ -using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Models; using PkmnLib.Static; using PkmnLib.Static.Species; @@ -13,7 +12,7 @@ public class PokemonStatBoostTests var library = LibraryHelpers.LoadLibrary(); if (!library.StaticLibrary.Species.TryGet("bulbasaur", out var species)) throw new InvalidOperationException("Failed to load bulbasaur species."); - return new PokemonImpl(library, species!, species!.GetDefaultForm(), new AbilityIndex + return new PokemonImpl(library, species, species.GetDefaultForm(), new AbilityIndex { Index = 0, IsHidden = false, diff --git a/PkmnLib.Tests/Dynamic/SerializationTests.cs b/PkmnLib.Tests/Dynamic/SerializationTests.cs index 306da32..8e4977c 100644 --- a/PkmnLib.Tests/Dynamic/SerializationTests.cs +++ b/PkmnLib.Tests/Dynamic/SerializationTests.cs @@ -32,10 +32,10 @@ public class SerializationTests await Assert.That(data.Gender).IsEqualTo(Gender.Male); await Assert.That(data.Coloring).IsEqualTo((byte)0); await Assert.That(data.HeldItem).IsNull(); - await Assert.That(data.CurrentHealth).IsEqualTo((ushort)29); + await Assert.That(data.CurrentHealth).IsEqualTo((uint)29); await Assert.That(data.Happiness).IsEqualTo((byte)70); - await Assert.That(data.Moves).HasCount().EqualTo(4); + await Assert.That(data.Moves).Count().IsEqualTo(4); await Assert.That(data.Moves[0]).IsNotNull(); await Assert.That(data.Moves[0]!.MoveName).IsEqualTo("tackle"); await Assert.That(data.Moves[0]!.LearnMethod).IsEqualTo(MoveLearnMethod.LevelUp); @@ -93,7 +93,7 @@ public class SerializationTests await Assert.That(pokemon.EffortValues).IsEqualTo(new EffortValueStatisticSet(0, 0, 0, 0, 0, 0)); await Assert.That(pokemon.Nature.Name.ToString()).IsEqualTo("hardy"); await Assert.That(pokemon.Nickname).IsEqualTo("foo"); - await Assert.That(pokemon.Moves).HasCount().EqualTo(4); + await Assert.That(pokemon.Moves).Count().IsEqualTo(4); await Assert.That(pokemon.Moves[0]).IsNotNull(); await Assert.That(pokemon.Moves[0]!.MoveData.Name.ToString()).IsEqualTo("tackle"); await Assert.That(pokemon.Moves[0]!.LearnMethod).IsEqualTo(MoveLearnMethod.LevelUp); @@ -153,7 +153,7 @@ public class SerializationTests await Assert.That(deserialized.Nature).IsEqualTo("hardy"); await Assert.That(deserialized.Nickname).IsEqualTo("foo"); - await Assert.That(deserialized.Moves).HasCount().EqualTo(4); + await Assert.That(deserialized.Moves).Count().IsEqualTo(4); await Assert.That(deserialized.Moves[0]).IsNotNull(); await Assert.That(deserialized.Moves[0]!.MoveName).IsEqualTo("tackle"); await Assert.That(deserialized.Moves[0]!.LearnMethod).IsEqualTo(MoveLearnMethod.LevelUp); diff --git a/PkmnLib.Tests/Integration/IntegrationTestRunner.cs b/PkmnLib.Tests/Integration/IntegrationTestRunner.cs index fd2679f..914a9dd 100644 --- a/PkmnLib.Tests/Integration/IntegrationTestRunner.cs +++ b/PkmnLib.Tests/Integration/IntegrationTestRunner.cs @@ -58,7 +58,7 @@ public class IntegrationTestRunner } await TestContext.Current!.OutputWriter.WriteLineAsync("File: " + $"file://{test.FileName}"); - TestContext.Current.AddArtifact(new Artifact + TestContext.Current.Output.AttachArtifact(new Artifact { File = new FileInfo(test.FileName), DisplayName = test.Name, diff --git a/PkmnLib.Tests/Static/DeepCloneTests.cs b/PkmnLib.Tests/Static/DeepCloneTests.cs index b0ce4ff..c1d158c 100644 --- a/PkmnLib.Tests/Static/DeepCloneTests.cs +++ b/PkmnLib.Tests/Static/DeepCloneTests.cs @@ -2,7 +2,6 @@ using System.Diagnostics.CodeAnalysis; using System.Reflection; using Pcg; using PkmnLib.Dynamic.Models; -using PkmnLib.Plugin.Gen7.Scripts.Moves; using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Static; using PkmnLib.Static.Species; @@ -60,7 +59,7 @@ public class DeepCloneTests var clonePrivateValue = clone.GetType().GetProperty("PrivateValue", BindingFlags.NonPublic | BindingFlags.Instance)! .GetValue(clone); - await Assert.That(clonePrivateValue).IsEqualTo(1); + await Assert.That((int)clonePrivateValue!).IsEqualTo(1); } [Test] @@ -72,7 +71,7 @@ public class DeepCloneTests await Assert.That(clone).IsNotEqualTo(obj); var clonePrivateField = clone.GetType().GetField("_privateField", BindingFlags.NonPublic | BindingFlags.Instance)!.GetValue(clone); - await Assert.That(clonePrivateField).IsEqualTo(1); + await Assert.That((int)clonePrivateField!).IsEqualTo(1); } [Test] @@ -119,8 +118,8 @@ public class DeepCloneTests var clone = battle.DeepClone(); await Assert.That(clone).IsNotEqualTo(battle); - await Assert.That(clone.Sides[0].Pokemon[0]).IsNotEqualTo(battle.Sides[0].Pokemon[0]); - await Assert.That(clone.Sides[1].Pokemon[0]).IsNotEqualTo(battle.Sides[1].Pokemon[0]); + await Assert.That(clone.Sides[0].Pokemon[0]).IsNotEqualTo(battle.Sides[0].Pokemon[0]!); + await Assert.That(clone.Sides[1].Pokemon[0]).IsNotEqualTo(battle.Sides[1].Pokemon[0]!); await Assert.That(clone.Sides[0].Pokemon[0]!.Species).IsEqualTo(battle.Sides[0].Pokemon[0]!.Species); await Assert.That(clone.Sides[1].Pokemon[0]!.Species).IsEqualTo(battle.Sides[1].Pokemon[0]!.Species); @@ -129,21 +128,21 @@ public class DeepCloneTests var pokemon = clone.Sides[0].Pokemon[0]!; await Assert.That(pokemon).IsNotNull(); - await Assert.That(pokemon).IsNotEqualTo(battle.Sides[0].Pokemon[0]); + await Assert.That(pokemon).IsNotEqualTo(battle.Sides[0].Pokemon[0]!); await Assert.That(pokemon.BattleData).IsNotNull(); - await Assert.That(pokemon.BattleData).IsNotEqualTo(battle.Sides[0].Pokemon[0]!.BattleData); - await Assert.That(pokemon.BattleData!.Battle).IsEqualTo(clone); + await Assert.That(pokemon.BattleData).IsNotEqualTo(battle.Sides[0].Pokemon[0]!.BattleData!); + await Assert.That(pokemon.BattleData!.Battle).IsEqualTo((IBattle)clone); await Assert.That(pokemon.BattleData!.SeenOpponents).Contains(clone.Sides[1].Pokemon[0]!); await Assert.That(pokemon.BattleData!.SeenOpponents).DoesNotContain(battle.Sides[1].Pokemon[0]!); await Assert.That(pokemon.StatBoost.Defense).IsEqualTo((sbyte)2); await Assert.That(pokemon.Volatile.Get()).IsNotNull(); await Assert.That(pokemon.Volatile.Get()).IsNotEqualTo( - battle.Sides[0].Pokemon[0]!.Volatile.Get()); + battle.Sides[0].Pokemon[0]!.Volatile.Get()!); var ownerGetter = typeof(ChargeBounceEffect).GetField("_owner", BindingFlags.NonPublic | BindingFlags.Instance)!; var owner = ownerGetter.GetValue(pokemon.Volatile.Get()!); - await Assert.That(owner).IsEqualTo(pokemon); + await Assert.That((IPokemon)owner!).IsEqualTo(pokemon); pokemon.Volatile.Remove(); await Assert.That(pokemon.Volatile.Get()).IsNull(); diff --git a/PkmnLib.Tests/Static/GrowthRateTests.cs b/PkmnLib.Tests/Static/GrowthRateTests.cs index 1501a07..90be24d 100644 --- a/PkmnLib.Tests/Static/GrowthRateTests.cs +++ b/PkmnLib.Tests/Static/GrowthRateTests.cs @@ -1,5 +1,4 @@ using PkmnLib.Static; -using TUnit.Assertions.AssertConditions.Throws; namespace PkmnLib.Tests.Static; diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/DataTests/MoveDataTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/DataTests/MoveDataTests.cs index 3f1eb4f..088c74f 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/DataTests/MoveDataTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/DataTests/MoveDataTests.cs @@ -3,7 +3,6 @@ using System.Text.Json; using PkmnLib.Dynamic.Libraries; using PkmnLib.Dynamic.Plugins; using PkmnLib.Dynamic.ScriptHandling; -using PkmnLib.Dynamic.ScriptHandling.Registry; using PkmnLib.Plugin.Gen7.Common; using PkmnLib.Static.Moves; using PkmnLib.Static.Utils; diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Abilities/AftermathTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Abilities/AftermathTests.cs index e6f54fe..43c47b7 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Abilities/AftermathTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Abilities/AftermathTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.Events; using PkmnLib.Dynamic.Models; -using PkmnLib.Dynamic.ScriptHandling; using PkmnLib.Plugin.Gen7.Scripts.Abilities; using PkmnLib.Static.Species; using PkmnLib.Static.Utils; @@ -333,7 +332,7 @@ public class AftermathTests aftermath.OnFaint(target, DamageSource.MoveDamage); // Assert - await Assert.That(GetDamageSource(user)).IsEqualTo(DamageSource.Misc); + await Assert.That(GetDamageSource(user)!.Value).IsEqualTo(DamageSource.Misc); } /// diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/GenericScriptTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/GenericScriptTests.cs index bb6fbde..7938a48 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/GenericScriptTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/GenericScriptTests.cs @@ -1,6 +1,5 @@ using PkmnLib.Dynamic.ScriptHandling; using PkmnLib.Dynamic.ScriptHandling.Registry; -using Assembly = System.Reflection.Assembly; namespace PkmnLib.Plugin.Gen7.Tests.Scripts; diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/AcrobaticsTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/AcrobaticsTests.cs index 66fe2aa..001ca84 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/AcrobaticsTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/AcrobaticsTests.cs @@ -22,7 +22,7 @@ public class AcrobaticsTests acrobatics.ChangeBasePower(move, target, 0, ref basePower); // Assert - await Assert.That(basePower).IsEqualTo((byte)20); + await Assert.That(basePower).IsEqualTo((ushort)20); } [Test] @@ -41,7 +41,7 @@ public class AcrobaticsTests acrobatics.ChangeBasePower(move, target, 0, ref basePower); // Assert - await Assert.That(basePower).IsEqualTo((byte)10); + await Assert.That(basePower).IsEqualTo((ushort)10); } [Test] diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BatonPassTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BatonPassTests.cs index a186828..960f557 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BatonPassTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BatonPassTests.cs @@ -77,7 +77,7 @@ public class BatonPassTests script.OnSecondaryEffect(move, user, 0); // Assert - side.Received(1).SwapPokemon((byte)1, toSwitch); + side.Received(1).SwapPokemon(1, toSwitch); } /// diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BeakBlastTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BeakBlastTests.cs index df2b54d..a0c70cb 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BeakBlastTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BeakBlastTests.cs @@ -85,7 +85,7 @@ public class BeakBlastTests // Assert await Assert.That(capturedEvent).IsNotNull(); await Assert.That(capturedEvent!.Message).IsEqualTo("beak_blast_charge"); - await Assert.That(capturedEvent.Parameters!["user"]).IsEqualTo(user); + await Assert.That((IPokemon)capturedEvent.Parameters!["user"]).IsEqualTo(user); } /// diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BellyDrumTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BellyDrumTests.cs index e5b66fa..fe07173 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BellyDrumTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BellyDrumTests.cs @@ -70,7 +70,7 @@ public class BellyDrumTests script.OnSecondaryEffect(move, user, 0); // Assert - await Assert.That(GetDamageCall(user)).IsEqualTo((expectedDeduction, DamageSource.Misc, true)); + await Assert.That(GetDamageCall(user)!.Value).IsEqualTo((expectedDeduction, DamageSource.Misc, true)); } /// diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BestowTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BestowTests.cs index 1c8b3bb..569987d 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BestowTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BestowTests.cs @@ -45,7 +45,7 @@ public class BestowTests script.OnSecondaryEffect(move, target, 0); // Assert - target.Received(1).ForceSetHeldItem(userItem); + _ = target.Received(1).ForceSetHeldItem(userItem); } /// @@ -115,7 +115,7 @@ public class BestowTests script.OnSecondaryEffect(move, target, 0); // Assert - target.DidNotReceive().ForceSetHeldItem(Arg.Any()); + _ = target.DidNotReceive().ForceSetHeldItem(Arg.Any()); } /// diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BideTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BideTests.cs index 9170a2a..5c932ec 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BideTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BideTests.cs @@ -135,7 +135,7 @@ public class BideTests script.OnSecondaryEffect(move, target, 0); // Assert - await Assert.That(GetDamageAmount(attacker)).IsEqualTo(expectedDamage); + await Assert.That(GetDamageAmount(attacker)!.Value).IsEqualTo(expectedDamage); } /// @@ -154,7 +154,7 @@ public class BideTests script.OnSecondaryEffect(move, target, 0); // Assert - await Assert.That(GetDamageSource(attacker)).IsEqualTo(DamageSource.MoveDamage); + await Assert.That(GetDamageSource(attacker)!.Value).IsEqualTo(DamageSource.MoveDamage); } /// diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BindTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BindTests.cs index a6089fb..927a185 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BindTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BindTests.cs @@ -126,7 +126,7 @@ public class BindTests effect!.OnEndTurn(target, Substitute.For()); // Assert - await Assert.That(GetDamageAmount(target)).IsEqualTo(expectedDamage); + await Assert.That(GetDamageAmount(target)!.Value).IsEqualTo(expectedDamage); } /// @@ -193,7 +193,7 @@ public class BindTests effect!.OnEndTurn(target, Substitute.For()); // Assert - await Assert.That(GetDamageAmount(target)).IsEqualTo(expectedDamage); + await Assert.That(GetDamageAmount(target)!.Value).IsEqualTo(expectedDamage); } /// diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BrickBreakTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BrickBreakTests.cs index 6390690..2991028 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BrickBreakTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/BrickBreakTests.cs @@ -3,7 +3,6 @@ using PkmnLib.Dynamic.ScriptHandling; using PkmnLib.Plugin.Gen7.Scripts.Moves; using PkmnLib.Plugin.Gen7.Scripts.Side; using PkmnLib.Static.Utils; -using TUnit.Assertions.AssertConditions.Throws; namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves; diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/ChangeTargetSpecialDefenseTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/ChangeTargetSpecialDefenseTests.cs index cc421fc..444a4d8 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/ChangeTargetSpecialDefenseTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/ChangeTargetSpecialDefenseTests.cs @@ -2,7 +2,6 @@ using PkmnLib.Dynamic.Models; using PkmnLib.Plugin.Gen7.Scripts.Moves; using PkmnLib.Static; using PkmnLib.Static.Utils; -using TUnit.Assertions.AssertConditions.Throws; namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves; diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/DrainTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/DrainTests.cs index 44e7e66..add1f3f 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/DrainTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/DrainTests.cs @@ -80,7 +80,7 @@ public class DrainTests drain.OnSecondaryEffect(move, target, 0); // Assert - await Assert.That(GetHealAmount(user)).IsEqualTo(50u); + await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(50u); } /// @@ -97,7 +97,7 @@ public class DrainTests drain.OnSecondaryEffect(move, target, 0); // Assert - await Assert.That(GetHealAmount(user)).IsEqualTo(expectedHeal); + await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(expectedHeal); } /// @@ -115,7 +115,7 @@ public class DrainTests drain.OnSecondaryEffect(move, target, 0); // Assert - await Assert.That(GetHealAmount(user)).IsEqualTo(1u); + await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(1u); } /// @@ -132,7 +132,7 @@ public class DrainTests drain.OnSecondaryEffect(move, target, 0); // Assert - 65% of 100 damage - await Assert.That(GetHealAmount(user)).IsEqualTo(65u); + await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(65u); } /// @@ -149,7 +149,7 @@ public class DrainTests drain.OnSecondaryEffect(move, target, 0); // Assert - user takes the 50 HP it would have gained, and is not healed - await Assert.That(GetDamageAmount(user)).IsEqualTo(50u); + await Assert.That(GetDamageAmount(user)!.Value).IsEqualTo(50u); await Assert.That(user.ReceivedCalls().Any(c => c.GetMethodInfo().Name == "Heal")).IsFalse(); } @@ -167,7 +167,7 @@ public class DrainTests drain.OnSecondaryEffect(move, target, 0); // Assert - await Assert.That(GetDamageSource(user)).IsEqualTo(DamageSource.Misc); + await Assert.That(GetDamageSource(user)!.Value).IsEqualTo(DamageSource.Misc); } /// @@ -184,7 +184,7 @@ public class DrainTests drain.OnSecondaryEffect(move, target, 0); // Assert - await Assert.That(GetDamageAmount(user)).IsEqualTo(65u); + await Assert.That(GetDamageAmount(user)!.Value).IsEqualTo(65u); } /// @@ -238,6 +238,6 @@ public class DrainTests drain.OnSecondaryEffect(move, target, 0); // Assert - await Assert.That(GetHealAmount(user)).IsEqualTo(50u); + await Assert.That(GetHealAmount(user)!.Value).IsEqualTo(50u); } } \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/HiddenPowerTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/HiddenPowerTests.cs index 05d11d4..d18e7db 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/HiddenPowerTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/HiddenPowerTests.cs @@ -9,7 +9,7 @@ namespace PkmnLib.Plugin.Gen7.Tests.Scripts.Moves; public class HiddenPowerTests { - public record TestCaseData(IndividualValueStatisticSet Ivs, StringKey ExpectedType, byte ExpectedPower) + public record TestCaseData(IndividualValueStatisticSet Ivs, StringKey ExpectedType, ushort ExpectedPower) { /// public override string ToString() => diff --git a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/MultiAttackTests.cs b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/MultiAttackTests.cs index cefd80e..fcce9b2 100644 --- a/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/MultiAttackTests.cs +++ b/Plugins/PkmnLib.Plugin.Gen7.Tests/Scripts/Moves/MultiAttackTests.cs @@ -86,6 +86,6 @@ public class MultiAttackTests multiAttack.ChangeMoveType(move, target, 0, ref typeIdentifier); // Assert - await Assert.That(typeIdentifier!.Value.Name).IsEqualTo(test.ExpectedTypeName); + await Assert.That(typeIdentifier!.Value.Name.ToString()).IsEqualTo(test.ExpectedTypeName); } } \ No newline at end of file diff --git a/Plugins/PkmnLib.Plugin.Gen7/AI/AISwitchFunctions.cs b/Plugins/PkmnLib.Plugin.Gen7/AI/AISwitchFunctions.cs index bd71d0f..11a5616 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/AI/AISwitchFunctions.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/AI/AISwitchFunctions.cs @@ -1,5 +1,4 @@ using PkmnLib.Dynamic.AI.Explicit; -using PkmnLib.Plugin.Gen7.Scripts.Moves; using PkmnLib.Plugin.Gen7.Scripts.Pokemon; using PkmnLib.Plugin.Gen7.Scripts.Side; using PkmnLib.Plugin.Gen7.Scripts.Status; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Bulletproof.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Bulletproof.cs index 2753c5f..0113191 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Bulletproof.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/Bulletproof.cs @@ -1,5 +1,3 @@ -using PkmnLib.Plugin.Gen7.Common; - namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/RKSSystem.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/RKSSystem.cs index e109488..1087480 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/RKSSystem.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/RKSSystem.cs @@ -6,7 +6,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// Bulbapedia - RKS System /// [Script(ScriptCategory.Ability, "rks_system")] -public class RKSSystem : Script, IScriptOnAfterHeldItemChange +public class RksSystem : Script, IScriptOnAfterHeldItemChange { /// public void OnAfterHeldItemChange(IPokemon pokemon, IItem? previous, IItem? item) diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs index 3172707..480012f 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Abilities/StrongJaw.cs @@ -1,5 +1,3 @@ -using PkmnLib.Plugin.Gen7.Common; - namespace PkmnLib.Plugin.Gen7.Scripts.Abilities; /// diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/KnockOff.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/KnockOff.cs index 30645ba..b4c7776 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/KnockOff.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/KnockOff.cs @@ -6,7 +6,7 @@ public class KnockOff : Script, IScriptOnSecondaryEffect /// public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) { - if (!target.TryStealHeldItem(out var item)) + if (!target.TryStealHeldItem(out _)) { move.GetHitData(target, hit).Fail(); } diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MagmaStorm.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MagmaStorm.cs index b82b48a..8505cfa 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MagmaStorm.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/MagmaStorm.cs @@ -3,7 +3,7 @@ using PkmnLib.Plugin.Gen7.Scripts.Pokemon; namespace PkmnLib.Plugin.Gen7.Scripts.Moves; [Script(ScriptCategory.Move, "magma_storm")] -public class MagmaStorm : MultiHitMove +public class MagmaStorm : MultiHitMove, IScriptOnSecondaryEffect { /// public void OnSecondaryEffect(IExecutingMove move, IPokemon target, byte hit) diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/NaturePower.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/NaturePower.cs index 4a8fef8..cdc51d6 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/NaturePower.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Moves/NaturePower.cs @@ -1,5 +1,4 @@ using PkmnLib.Plugin.Gen7.Scripts.Utils; -using PkmnLib.Static.Moves; namespace PkmnLib.Plugin.Gen7.Scripts.Moves; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ProtectionEffectScript.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ProtectionEffectScript.cs index c7d81b7..970c11c 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ProtectionEffectScript.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/ProtectionEffectScript.cs @@ -1,5 +1,3 @@ -using PkmnLib.Plugin.Gen7.Common; - namespace PkmnLib.Plugin.Gen7.Scripts.Pokemon; [Script(ScriptCategory.Pokemon, "protect")] diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/PursuitEffect.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/PursuitEffect.cs index 5469f13..ed7bf66 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/PursuitEffect.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Pokemon/PursuitEffect.cs @@ -30,7 +30,7 @@ public class PursuitEffect : Script, IScriptOnSwitchOut var choiceQueue = battleData.Battle.ChoiceQueue; - var choice = choiceQueue?.FirstOrDefault(x => x == _choice); + var choice = choiceQueue?.FirstOrDefault(x => Equals(x, _choice)); if (choice == null) return; choiceQueue!.Remove(choice); diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Frozen.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Frozen.cs index 1deaf9e..ccc4321 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Frozen.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Status/Frozen.cs @@ -1,5 +1,3 @@ -using PkmnLib.Plugin.Gen7.Common; - namespace PkmnLib.Plugin.Gen7.Scripts.Status; [Script(ScriptCategory.Status, "frozen")] diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/DesolateLands.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/DesolateLands.cs index 4c7119b..9bd279a 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/DesolateLands.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/DesolateLands.cs @@ -1,8 +1,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Weather; [Script(ScriptCategory.Weather, "desolate_lands")] -public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut, - IScriptPreventWeatherChange +public class DesolateLands : HarshSunlight, IScriptFailMove, IScriptOnSwitchOut, IScriptPreventWeatherChange { private readonly HashSet _placers = []; diff --git a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/PrimordialSea.cs b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/PrimordialSea.cs index d435045..b33b369 100644 --- a/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/PrimordialSea.cs +++ b/Plugins/PkmnLib.Plugin.Gen7/Scripts/Weather/PrimordialSea.cs @@ -1,7 +1,7 @@ namespace PkmnLib.Plugin.Gen7.Scripts.Weather; [Script(ScriptCategory.Weather, "primordial_sea")] -public class PrimordialSea : Rain, IScriptFailMove, IScriptOnEndTurn, IScriptOnSwitchOut, IScriptPreventWeatherChange +public class PrimordialSea : Rain, IScriptFailMove, IScriptOnSwitchOut, IScriptPreventWeatherChange { private HashSet _placers = new(); diff --git a/global.json b/global.json new file mode 100644 index 0000000..3140116 --- /dev/null +++ b/global.json @@ -0,0 +1,5 @@ +{ + "test": { + "runner": "Microsoft.Testing.Platform" + } +}