PkmnLibSharp/PkmnLibSharpTests/Battling/BattleLibraryHelper.cs

58 lines
2.4 KiB
C#
Raw Normal View History

2020-07-19 10:33:22 +00:00
using System.Linq;
using PkmnLibSharp.Battling;
using PkmnLibSharp.Library;
using PkmnLibSharp.Library.GrowthRates;
using PkmnLibSharp.Library.Items;
using PkmnLibSharp.Library.Moves;
namespace PkmnLibSharpTests.Battling
{
public static class BattleLibraryHelper
{
private static BattleLibrary _cache;
public static BattleLibrary GetLibrary()
{
if (_cache != null) return _cache;
_cache = new BattleLibrary(BuildStatic(), new StatCalculator(), new DamageLibrary(),
2020-07-19 10:33:22 +00:00
new ExperienceLibrary(),
new AngelScriptResolver(), new MiscLibrary());
return _cache;
}
private static PokemonLibrary BuildStatic()
{
var settings = new LibrarySettings(100, 4, 4096);
var species = new SpeciesLibrary(10);
species.Insert("testSpecies", new Species(1, "testSpecies",
new Forme("default", 10f, 10f, 100, new byte[] {0, 1}, 100,
2020-07-19 10:33:22 +00:00
100, 100, 100, 100, 100, new[] {"testAbility", "testAbility2"},
new[] {"testHiddenAbility"}, new LearnableMoves(100)), 0.5f, "growthRate",
2020-08-09 09:01:43 +00:00
20, 100, new[]{"testEggGroup"}));
2020-07-19 10:33:22 +00:00
var moves = new MoveLibrary(10);
moves.Insert("testMove", new MoveData("testMove", 0, MoveCategory.Physical, 100,
100, 20, MoveTarget.Any, 0, 0f, "",
new EffectParameter[0], new string[0]));
moves.Insert("testMove2", new MoveData("testMove2", 0, MoveCategory.Physical, 100,
100, 20, MoveTarget.Any, 0, 0f, "",
new EffectParameter[0], new string[0]));
2020-07-19 10:33:22 +00:00
var items = new ItemLibrary(10);
items.Insert("testItem", new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.None,
2020-07-19 10:33:22 +00:00
500, new string[] { }, 20));
var gr = new GrowthRateLibrary(10);
gr.AddGrowthRate("growthRate",
new LookupGrowthRate(
Enumerable.Range(1, 100).Select(x => (uint)x * 100).ToArray()));
var types = new TypeLibrary(10);
types.RegisterType("normal");
types.RegisterType("fighting");
2020-07-19 10:33:22 +00:00
var natures = new NatureLibrary(10);
natures.LoadNature("testNature", new Nature());
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
2020-07-19 10:33:22 +00:00
return lib;
}
}
}