Updates to latest pkmnlib, fixes issues.
This commit is contained in:
@@ -1,4 +1,5 @@
|
||||
using System.Linq;
|
||||
using NUnit.Framework;
|
||||
using PkmnLibSharp.Battling;
|
||||
using PkmnLibSharp.Library;
|
||||
using PkmnLibSharp.Library.GrowthRates;
|
||||
@@ -10,15 +11,23 @@ namespace PkmnLibSharpTests.Battling
|
||||
public static class BattleLibraryHelper
|
||||
{
|
||||
private static BattleLibrary _cache;
|
||||
private static readonly object Lock = new object();
|
||||
|
||||
public static BattleLibrary GetLibrary()
|
||||
{
|
||||
if (_cache != null) return _cache;
|
||||
|
||||
_cache = new BattleLibrary(BuildStatic(), new StatCalculator(), new DamageLibrary(),
|
||||
new ExperienceLibrary(),
|
||||
new AngelScriptResolver(), new MiscLibrary());
|
||||
return _cache;
|
||||
lock (Lock)
|
||||
{
|
||||
if (_cache != null)
|
||||
return _cache;
|
||||
|
||||
TestContext.WriteLine("Building battle library");
|
||||
var scriptLibrary = new AngelScriptResolver();
|
||||
_cache = new BattleLibrary(BuildStatic(), new StatCalculator(), new DamageLibrary(),
|
||||
new ExperienceLibrary(),
|
||||
scriptLibrary, new MiscLibrary());
|
||||
scriptLibrary.Initialize(_cache);
|
||||
return _cache;
|
||||
}
|
||||
}
|
||||
|
||||
private static PokemonLibrary BuildStatic()
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using System.Collections.Generic;
|
||||
using PkmnLibSharp.Battling;
|
||||
using PkmnLibSharp.Library;
|
||||
@@ -15,7 +16,7 @@ namespace PkmnLibSharpTests.Battling
|
||||
|
||||
protected override Pokemon Finalize(Species species, Forme forme, Item? heldItem, IReadOnlyCollection<LearnedMove> moves, Nature nature)
|
||||
{
|
||||
var pkmn = new Pokemon(Library, species, forme!, Level, Experience, Uid, Gender, Coloring,
|
||||
var pkmn = new Pokemon(Library, species, forme, Level, Experience, Uid, Gender, Coloring,
|
||||
heldItem, Nickname, HiddenAbility, (byte) AbilityIndex, moves, IVs, EVs, nature);
|
||||
return pkmn;
|
||||
}
|
||||
|
||||
@@ -1,3 +1,4 @@
|
||||
using System;
|
||||
using NUnit.Framework;
|
||||
using PkmnLibSharp.Battling;
|
||||
using PkmnLibSharp.Library;
|
||||
|
||||
@@ -7,13 +7,13 @@
|
||||
|
||||
<Configurations>Debug</Configurations>
|
||||
|
||||
<Platforms>AnyCPU</Platforms>
|
||||
<Platforms>x64</Platforms>
|
||||
</PropertyGroup>
|
||||
|
||||
<ItemGroup>
|
||||
<PackageReference Include="nunit" Version="3.12.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.15.1" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.4.0" />
|
||||
<PackageReference Include="NUnit3TestAdapter" Version="3.17.0" />
|
||||
<PackageReference Include="Microsoft.NET.Test.Sdk" Version="16.8.3" />
|
||||
<PackageReference Include="System.Runtime.Loader" Version="4.3.0" />
|
||||
</ItemGroup>
|
||||
|
||||
|
||||
@@ -4,6 +4,7 @@ using System.Runtime.InteropServices;
|
||||
using NUnit.Framework;
|
||||
using PkmnLibSharp.Battling;
|
||||
using PkmnLibSharp.Utilities;
|
||||
using PkmnLibSharpTests.Battling;
|
||||
|
||||
namespace PkmnLibSharpTests
|
||||
{
|
||||
@@ -15,8 +16,9 @@ namespace PkmnLibSharpTests
|
||||
{
|
||||
NativeLibrary.Load("Arbutils", Assembly.GetCallingAssembly(), DllImportSearchPath.AssemblyDirectory);
|
||||
NativeLibrary.Load("CreatureLib", Assembly.GetCallingAssembly(), DllImportSearchPath.AssemblyDirectory);
|
||||
NativeLibrary.Load("libangelscript.so.2.35.0", Assembly.GetCallingAssembly(), DllImportSearchPath.AssemblyDirectory);
|
||||
NativeLibrary.Load("pkmnLib", Assembly.GetCallingAssembly(), DllImportSearchPath.AssemblyDirectory);
|
||||
|
||||
|
||||
LogHandler.RegisterListener((level, s) =>
|
||||
{
|
||||
Console.WriteLine($"[{level.ToString().ToUpperInvariant()}] {s}");
|
||||
@@ -24,5 +26,6 @@ namespace PkmnLibSharpTests
|
||||
|
||||
SignalHandler.SetSignalListener(s => throw new Exception("Encountered a catastrophic signal. \n" + s));
|
||||
}
|
||||
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user