Rework constructors to remove the Create pattern.
This commit is contained in:
parent
1b025ea3cf
commit
e0f4a38309
|
@ -11,11 +11,11 @@ namespace PkmnLibSharp.Battling
|
||||||
public LearnedMove(){}
|
public LearnedMove(){}
|
||||||
internal LearnedMove(IntPtr ptr) : base(ptr){}
|
internal LearnedMove(IntPtr ptr) : base(ptr){}
|
||||||
|
|
||||||
public static LearnedMove Create(MoveData move, byte maxUses, MoveLearnMethod learnMethod)
|
public LearnedMove(MoveData move, byte maxUses, MoveLearnMethod learnMethod)
|
||||||
{
|
{
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
||||||
LearnedAttack.Construct(ref ptr, move.Ptr, maxUses, (AttackLearnMethod) learnMethod).Assert();
|
LearnedAttack.Construct(ref ptr, move.Ptr, maxUses, (AttackLearnMethod) learnMethod).Assert();
|
||||||
return new LearnedMove(ptr);
|
Initialize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public MoveData Move
|
public MoveData Move
|
||||||
|
|
|
@ -81,14 +81,14 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static BattleLibrary Create(PokemonLibrary staticLibrary, StatCalculator statCalculator,
|
public BattleLibrary(PokemonLibrary staticLibrary, StatCalculator statCalculator,
|
||||||
DamageLibrary damageLibrary, ExperienceLibrary experienceLibrary, ScriptResolver scriptResolver,
|
DamageLibrary damageLibrary, ExperienceLibrary experienceLibrary, ScriptResolver scriptResolver,
|
||||||
MiscLibrary miscLibrary)
|
MiscLibrary miscLibrary)
|
||||||
{
|
{
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
||||||
Pkmnlib.Generated.BattleLibrary.Construct(ref ptr, staticLibrary.Ptr, statCalculator.Ptr, damageLibrary.Ptr,
|
Pkmnlib.Generated.BattleLibrary.Construct(ref ptr, staticLibrary.Ptr, statCalculator.Ptr, damageLibrary.Ptr,
|
||||||
experienceLibrary.Ptr, scriptResolver.Ptr, miscLibrary.Ptr).Assert();
|
experienceLibrary.Ptr, scriptResolver.Ptr, miscLibrary.Ptr).Assert();
|
||||||
return new BattleLibrary(ptr);
|
Initialize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DeletePtr()
|
protected override void DeletePtr()
|
||||||
|
|
|
@ -143,7 +143,7 @@ namespace PkmnLibSharp.Battling
|
||||||
throw new Exception($"Move '{LearnedMoves[i].moveName}' was not found.");
|
throw new Exception($"Move '{LearnedMoves[i].moveName}' was not found.");
|
||||||
}
|
}
|
||||||
|
|
||||||
moves[i] = LearnedMove.Create(move, move.BaseUsages, LearnedMoves[i].learnMethod);
|
moves[i] = new LearnedMove(move, move.BaseUsages, LearnedMoves[i].learnMethod);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (string.IsNullOrEmpty(Nature))
|
if (string.IsNullOrEmpty(Nature))
|
||||||
|
|
|
@ -112,7 +112,7 @@ namespace PkmnLibSharp.Library
|
||||||
return Types[index];
|
return Types[index];
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Forme Create(string name, float height, float weight, uint baseExperience, byte[] types,
|
public Forme(string name, float height, float weight, uint baseExperience, byte[] types,
|
||||||
ushort baseHealth, ushort baseAttack, ushort baseDefense, ushort baseSpecialAttack,
|
ushort baseHealth, ushort baseAttack, ushort baseDefense, ushort baseSpecialAttack,
|
||||||
ushort baseSpecialDefense, ushort baseSpeed, string[] abilities, string[] hiddenAbilities,
|
ushort baseSpecialDefense, ushort baseSpeed, string[] abilities, string[] hiddenAbilities,
|
||||||
LearnableMoves moves)
|
LearnableMoves moves)
|
||||||
|
@ -130,7 +130,7 @@ namespace PkmnLibSharp.Library
|
||||||
Marshal.FreeHGlobal(intPtr);
|
Marshal.FreeHGlobal(intPtr);
|
||||||
foreach (var intPtr in hiddenAbilitiesConverted)
|
foreach (var intPtr in hiddenAbilitiesConverted)
|
||||||
Marshal.FreeHGlobal(intPtr);
|
Marshal.FreeHGlobal(intPtr);
|
||||||
return f;
|
Initialize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte GetRandomAbility(Random rand)
|
public byte GetRandomAbility(Random rand)
|
||||||
|
|
|
@ -13,7 +13,7 @@ namespace PkmnLibSharp.Library.GrowthRates
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static ExternGrowthRate Create(CalculateLevelDelegate levelFunc,
|
public ExternGrowthRate(CalculateLevelDelegate levelFunc,
|
||||||
CalculateExperienceDelegate experienceFunc)
|
CalculateExperienceDelegate experienceFunc)
|
||||||
{
|
{
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
||||||
|
@ -21,7 +21,7 @@ namespace PkmnLibSharp.Library.GrowthRates
|
||||||
Marshal.GetFunctionPointerForDelegate(levelFunc),
|
Marshal.GetFunctionPointerForDelegate(levelFunc),
|
||||||
Marshal.GetFunctionPointerForDelegate(experienceFunc)
|
Marshal.GetFunctionPointerForDelegate(experienceFunc)
|
||||||
);
|
);
|
||||||
return new ExternGrowthRate(ptr);
|
Initialize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DeletePtr()
|
protected override void DeletePtr()
|
||||||
|
|
|
@ -8,6 +8,8 @@ namespace PkmnLibSharp.Library.GrowthRates
|
||||||
internal GrowthRate(IntPtr ptr) : base(ptr)
|
internal GrowthRate(IntPtr ptr) : base(ptr)
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected GrowthRate(){}
|
||||||
|
|
||||||
public byte CalculateLevel(uint experience)
|
public byte CalculateLevel(uint experience)
|
||||||
{
|
{
|
||||||
|
|
|
@ -26,14 +26,14 @@ namespace PkmnLibSharp.Library.Items
|
||||||
return Creaturelib.Generated.Item.HasFlag(Ptr, s.ToPtr()) == MarshalHelper.True;
|
return Creaturelib.Generated.Item.HasFlag(Ptr, s.ToPtr()) == MarshalHelper.True;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Item Create(string name, ItemCategory category, BattleItemCategory battleCategory,
|
public Item (string name, ItemCategory category, BattleItemCategory battleCategory,
|
||||||
int price,
|
int price,
|
||||||
string[] flags, byte flingPower)
|
string[] flags, byte flingPower)
|
||||||
{
|
{
|
||||||
var convertedFlags = flags.Select(x => x.ToPtr()).ToArray().ArrayPtr();
|
var convertedFlags = flags.Select(x => x.ToPtr()).ToArray().ArrayPtr();
|
||||||
var p = Pkmnlib.Generated.Item.Construct(name.ToPtr(), (Pkmnlib.ItemCategory) category,
|
var p = Pkmnlib.Generated.Item.Construct(name.ToPtr(), (Pkmnlib.ItemCategory) category,
|
||||||
(Pkmnlib.BattleItemCategory) battleCategory, price, convertedFlags, (ulong) flags.Length, flingPower);
|
(Pkmnlib.BattleItemCategory) battleCategory, price, convertedFlags, (ulong) flags.Length, flingPower);
|
||||||
return new Item(p);
|
Initialize(p);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DeletePtr()
|
protected override void DeletePtr()
|
||||||
|
|
|
@ -11,11 +11,11 @@ namespace PkmnLibSharp.Library
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static LearnableMoves Create(byte maxLevel)
|
public LearnableMoves(byte maxLevel)
|
||||||
{
|
{
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
||||||
LearnableAttacks.Construct(ref ptr, maxLevel);
|
LearnableAttacks.Construct(ref ptr, maxLevel);
|
||||||
return new LearnableMoves(ptr);
|
Initialize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddLevelAttack(byte level, MoveData move)
|
public void AddLevelAttack(byte level, MoveData move)
|
||||||
|
|
|
@ -34,7 +34,7 @@ namespace PkmnLibSharp.Library.Moves
|
||||||
return AttackData.HasFlag(Ptr, s.ToPtr()) == 1;
|
return AttackData.HasFlag(Ptr, s.ToPtr()) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MoveData Create(string name, byte type, MoveCategory category, byte power, byte accuracy,
|
public MoveData(string name, byte type, MoveCategory category, byte power, byte accuracy,
|
||||||
byte baseUsage, MoveTarget target, sbyte priority, float effectChance, string effectName,
|
byte baseUsage, MoveTarget target, sbyte priority, float effectChance, string effectName,
|
||||||
EffectParameter[] parameters, string[] flags)
|
EffectParameter[] parameters, string[] flags)
|
||||||
{
|
{
|
||||||
|
@ -45,7 +45,7 @@ namespace PkmnLibSharp.Library.Moves
|
||||||
AttackData.Construct(ref ptr, name.ToPtr(), type, (AttackCategory) category, power, accuracy, baseUsage,
|
AttackData.Construct(ref ptr, name.ToPtr(), type, (AttackCategory) category, power, accuracy, baseUsage,
|
||||||
(AttackTarget) target, priority, effectChance, effectName.ToPtr(), pars,
|
(AttackTarget) target, priority, effectChance, effectName.ToPtr(), pars,
|
||||||
(ulong) parameters.Length, f, (ulong) flags.Length).Assert();
|
(ulong) parameters.Length, f, (ulong) flags.Length).Assert();
|
||||||
return new MoveData(ptr);
|
Initialize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DeletePtr()
|
protected override void DeletePtr()
|
||||||
|
|
|
@ -63,11 +63,11 @@ namespace PkmnLibSharp.Library.Moves
|
||||||
return move;
|
return move;
|
||||||
}
|
}
|
||||||
|
|
||||||
public static MoveLibrary Create(ulong defaultCapacity)
|
public MoveLibrary(ulong defaultCapacity)
|
||||||
{
|
{
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
||||||
AttackLibrary.Construct(ref ptr, defaultCapacity).Assert();
|
AttackLibrary.Construct(ref ptr, defaultCapacity).Assert();
|
||||||
return new MoveLibrary(ptr);
|
Initialize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal override void MarkAsDeleted()
|
protected internal override void MarkAsDeleted()
|
||||||
|
|
|
@ -119,14 +119,14 @@ namespace PkmnLibSharp.Library
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static PokemonLibrary Create(LibrarySettings settings, SpeciesLibrary species, MoveLibrary moves,
|
public PokemonLibrary(LibrarySettings settings, SpeciesLibrary species, MoveLibrary moves,
|
||||||
ItemLibrary items,
|
ItemLibrary items,
|
||||||
GrowthRateLibrary growthRates, TypeLibrary types, NatureLibrary natures)
|
GrowthRateLibrary growthRates, TypeLibrary types, NatureLibrary natures)
|
||||||
{
|
{
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
||||||
Pkmnlib.Generated.PokemonLibrary.Construct(ref ptr, settings.Ptr, species.Ptr, moves.Ptr, items.Ptr,
|
Pkmnlib.Generated.PokemonLibrary.Construct(ref ptr, settings.Ptr, species.Ptr, moves.Ptr, items.Ptr,
|
||||||
growthRates.Ptr, types.Ptr, natures.Ptr).Assert();
|
growthRates.Ptr, types.Ptr, natures.Ptr).Assert();
|
||||||
return new PokemonLibrary(ptr);
|
Initialize(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
protected override void DeletePtr()
|
protected override void DeletePtr()
|
||||||
|
|
|
@ -81,15 +81,14 @@ namespace PkmnLibSharp.Library
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
||||||
public static Species Create(ushort id, string name, Forme defaultForme, float genderRatio, string growthRate,
|
public Species(ushort id, string name, Forme defaultForme, float genderRatio, string growthRate,
|
||||||
byte captureRate, byte baseHappiness)
|
byte captureRate, byte baseHappiness)
|
||||||
{
|
{
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
||||||
PokemonSpecies.Construct(ref ptr, id, name.ToPtr(), defaultForme.Ptr, genderRatio,
|
PokemonSpecies.Construct(ref ptr, id, name.ToPtr(), defaultForme.Ptr, genderRatio,
|
||||||
growthRate.ToPtr(), captureRate, baseHappiness).Assert();
|
growthRate.ToPtr(), captureRate, baseHappiness).Assert();
|
||||||
var s = new Species(ptr);
|
_formes.Add("default", defaultForme);
|
||||||
s._formes.Add("default", defaultForme);
|
Initialize(ptr);
|
||||||
return s;
|
|
||||||
}
|
}
|
||||||
|
|
||||||
protected internal override void MarkAsDeleted()
|
protected internal override void MarkAsDeleted()
|
||||||
|
|
|
@ -16,7 +16,7 @@ namespace PkmnLibSharpTests.Battling
|
||||||
{
|
{
|
||||||
if (_cache != null) return _cache;
|
if (_cache != null) return _cache;
|
||||||
|
|
||||||
_cache = BattleLibrary.Create(BuildStatic(), new StatCalculator(), new DamageLibrary(),
|
_cache = new BattleLibrary(BuildStatic(), new StatCalculator(), new DamageLibrary(),
|
||||||
new ExperienceLibrary(),
|
new ExperienceLibrary(),
|
||||||
new AngelScriptResolver(), new MiscLibrary());
|
new AngelScriptResolver(), new MiscLibrary());
|
||||||
return _cache;
|
return _cache;
|
||||||
|
@ -26,22 +26,22 @@ namespace PkmnLibSharpTests.Battling
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
species.Insert("testSpecies", Species.Create(1, "testSpecies",
|
species.Insert("testSpecies", new Species(1, "testSpecies",
|
||||||
Forme.Create("default", 10f, 10f, 100, new byte[] {0, 1}, 100,
|
new Forme("default", 10f, 10f, 100, new byte[] {0, 1}, 100,
|
||||||
100, 100, 100, 100, 100, new[] {"testAbility", "testAbility2"},
|
100, 100, 100, 100, 100, new[] {"testAbility", "testAbility2"},
|
||||||
new[] {"testHiddenAbility"}, LearnableMoves.Create(100)), 0.5f, "growthRate",
|
new[] {"testHiddenAbility"}, new LearnableMoves(100)), 0.5f, "growthRate",
|
||||||
20, 100));
|
20, 100));
|
||||||
|
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
moves.Insert("testMove", MoveData.Create("testMove", 0, MoveCategory.Physical, 100,
|
moves.Insert("testMove", new MoveData("testMove", 0, MoveCategory.Physical, 100,
|
||||||
100, 20, MoveTarget.Any, 0, 0f, "",
|
100, 20, MoveTarget.Any, 0, 0f, "",
|
||||||
new EffectParameter[0], new string[0]));
|
new EffectParameter[0], new string[0]));
|
||||||
moves.Insert("testMove2", MoveData.Create("testMove2", 0, MoveCategory.Physical, 100,
|
moves.Insert("testMove2", new MoveData("testMove2", 0, MoveCategory.Physical, 100,
|
||||||
100, 20, MoveTarget.Any, 0, 0f, "",
|
100, 20, MoveTarget.Any, 0, 0f, "",
|
||||||
new EffectParameter[0], new string[0]));
|
new EffectParameter[0], new string[0]));
|
||||||
|
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
items.Insert("testItem", Item.Create("testItem", ItemCategory.MiscItem, BattleItemCategory.None,
|
items.Insert("testItem", new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.None,
|
||||||
500, new string[] { }, 20));
|
500, new string[] { }, 20));
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
gr.AddGrowthRate("growthRate",
|
gr.AddGrowthRate("growthRate",
|
||||||
|
@ -52,7 +52,7 @@ namespace PkmnLibSharpTests.Battling
|
||||||
types.RegisterType("fighting");
|
types.RegisterType("fighting");
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
natures.LoadNature("testNature", new Nature());
|
natures.LoadNature("testNature", new Nature());
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
return lib;
|
return lib;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -8,16 +8,16 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void ConstructDestruct()
|
public void ConstructDestruct()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetName()
|
public void GetName()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual("foo", forme.Name);
|
Assert.AreEqual("foo", forme.Name);
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -25,8 +25,8 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetHeight()
|
public void GetHeight()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual(1f, forme.Height);
|
Assert.AreEqual(1f, forme.Height);
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -34,8 +34,8 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetWeight()
|
public void GetWeight()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual(2f, forme.Weight);
|
Assert.AreEqual(2f, forme.Weight);
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -43,8 +43,8 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetBaseExperience()
|
public void GetBaseExperience()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual(100, forme.BaseExperience);
|
Assert.AreEqual(100, forme.BaseExperience);
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -52,13 +52,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetTypes()
|
public void GetTypes()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual(0, forme.GetPkmnType(0));
|
Assert.AreEqual(0, forme.GetPkmnType(0));
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
|
|
||||||
forme = Forme.Create("foo", 1, 2, 100, new byte[] {0, 1}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
forme = new Forme("foo", 1, 2, 100, new byte[] {0, 1}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual(0, forme.GetPkmnType(0));
|
Assert.AreEqual(0, forme.GetPkmnType(0));
|
||||||
Assert.AreEqual(1, forme.GetPkmnType(1));
|
Assert.AreEqual(1, forme.GetPkmnType(1));
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
|
@ -67,8 +67,8 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetStats()
|
public void GetStats()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 20, 30, 40, 50, 60, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 20, 30, 40, 50, 60, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual(10, forme.BaseHealth);
|
Assert.AreEqual(10, forme.BaseHealth);
|
||||||
Assert.AreEqual(20, forme.BaseAttack);
|
Assert.AreEqual(20, forme.BaseAttack);
|
||||||
Assert.AreEqual(30, forme.BaseDefense);
|
Assert.AreEqual(30, forme.BaseDefense);
|
||||||
|
@ -81,8 +81,8 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetAbilities()
|
public void GetAbilities()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual("foo", forme.Abilities[0]);
|
Assert.AreEqual("foo", forme.Abilities[0]);
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -90,8 +90,8 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetHiddenAbilities()
|
public void GetHiddenAbilities()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
Assert.AreEqual("bar", forme.HiddenAbilities[0]);
|
Assert.AreEqual("bar", forme.HiddenAbilities[0]);
|
||||||
forme.Dispose();
|
forme.Dispose();
|
||||||
}
|
}
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void ExternGrowthRate()
|
public void ExternGrowthRate()
|
||||||
{
|
{
|
||||||
var gr = PkmnLibSharp.Library.GrowthRates.ExternGrowthRate.Create(experience => (byte) (experience / 100),
|
var gr = new ExternGrowthRate(experience => (byte) (experience / 100),
|
||||||
level => (uint) (level * 100));
|
level => (uint) (level * 100));
|
||||||
Assert.AreEqual(500, gr.CalculateExperience(5));
|
Assert.AreEqual(500, gr.CalculateExperience(5));
|
||||||
Assert.AreEqual(7, gr.CalculateLevel(750));
|
Assert.AreEqual(7, gr.CalculateLevel(750));
|
||||||
|
|
|
@ -17,7 +17,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void Insert()
|
public void Insert()
|
||||||
{
|
{
|
||||||
var item = Item.Create("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
var library = new ItemLibrary(100);
|
var library = new ItemLibrary(100);
|
||||||
library.Insert("foobar", item);
|
library.Insert("foobar", item);
|
||||||
|
@ -28,7 +28,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void Delete()
|
public void Delete()
|
||||||
{
|
{
|
||||||
var item = Item.Create("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
var library = new ItemLibrary(100);
|
var library = new ItemLibrary(100);
|
||||||
library.Insert("foobar", item);
|
library.Insert("foobar", item);
|
||||||
|
@ -41,7 +41,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void Get()
|
public void Get()
|
||||||
{
|
{
|
||||||
var item = Item.Create("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
var library = new ItemLibrary(100);
|
var library = new ItemLibrary(100);
|
||||||
library.Insert("foobar", item);
|
library.Insert("foobar", item);
|
||||||
|
@ -58,7 +58,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void TryGet()
|
public void TryGet()
|
||||||
{
|
{
|
||||||
var item = Item.Create("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
var library = new ItemLibrary(100);
|
var library = new ItemLibrary(100);
|
||||||
library.Insert("foobar", item);
|
library.Insert("foobar", item);
|
||||||
|
|
|
@ -9,14 +9,14 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void ConstructDestruct()
|
public void ConstructDestruct()
|
||||||
{
|
{
|
||||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
item.Dispose();
|
item.Dispose();
|
||||||
}
|
}
|
||||||
[Test]
|
[Test]
|
||||||
public void GetName()
|
public void GetName()
|
||||||
{
|
{
|
||||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
Assert.AreEqual("foobar", item.Name);
|
Assert.AreEqual("foobar", item.Name);
|
||||||
item.Dispose();
|
item.Dispose();
|
||||||
|
@ -24,7 +24,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetCategory()
|
public void GetCategory()
|
||||||
{
|
{
|
||||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
Assert.AreEqual(ItemCategory.MiscItem, item.Category);
|
Assert.AreEqual(ItemCategory.MiscItem, item.Category);
|
||||||
item.Dispose();
|
item.Dispose();
|
||||||
|
@ -32,7 +32,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetBattleCategory()
|
public void GetBattleCategory()
|
||||||
{
|
{
|
||||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
Assert.AreEqual(BattleItemCategory.Healing, item.BattleCategory);
|
Assert.AreEqual(BattleItemCategory.Healing, item.BattleCategory);
|
||||||
item.Dispose();
|
item.Dispose();
|
||||||
|
@ -40,7 +40,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetPrice()
|
public void GetPrice()
|
||||||
{
|
{
|
||||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
Assert.AreEqual(1000, item.Price);
|
Assert.AreEqual(1000, item.Price);
|
||||||
item.Dispose();
|
item.Dispose();
|
||||||
|
@ -48,7 +48,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void HasFlag()
|
public void HasFlag()
|
||||||
{
|
{
|
||||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
Assert.True(item.HasFlag("testFlag"));
|
Assert.True(item.HasFlag("testFlag"));
|
||||||
Assert.False(item.HasFlag("non-existing"));
|
Assert.False(item.HasFlag("non-existing"));
|
||||||
|
@ -57,7 +57,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetFlingPower()
|
public void GetFlingPower()
|
||||||
{
|
{
|
||||||
var item = Item.Create("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
|
||||||
new[] {"testFlag"}, 50);
|
new[] {"testFlag"}, 50);
|
||||||
Assert.AreEqual(50, item.FlingPower);
|
Assert.AreEqual(50, item.FlingPower);
|
||||||
item.Dispose();
|
item.Dispose();
|
||||||
|
|
|
@ -9,7 +9,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void ConstructDestruct()
|
public void ConstructDestruct()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
}
|
}
|
||||||
|
@ -17,7 +17,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetName()
|
public void GetName()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual("foobar", move.Name);
|
Assert.AreEqual("foobar", move.Name);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -26,7 +26,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetTypeProp()
|
public void GetTypeProp()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual(0, move.Type);
|
Assert.AreEqual(0, move.Type);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -35,7 +35,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetCategory()
|
public void GetCategory()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual(MoveCategory.Physical, move.Category);
|
Assert.AreEqual(MoveCategory.Physical, move.Category);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -44,7 +44,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetBasePower()
|
public void GetBasePower()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual(60, move.BasePower);
|
Assert.AreEqual(60, move.BasePower);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -53,7 +53,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetAccuracy()
|
public void GetAccuracy()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual(100, move.Accuracy);
|
Assert.AreEqual(100, move.Accuracy);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -62,7 +62,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetBaseUsages()
|
public void GetBaseUsages()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual(20, move.BaseUsages);
|
Assert.AreEqual(20, move.BaseUsages);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -71,7 +71,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetTarget()
|
public void GetTarget()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual(MoveTarget.Adjacent, move.Target);
|
Assert.AreEqual(MoveTarget.Adjacent, move.Target);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -80,7 +80,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetPriority()
|
public void GetPriority()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0, "", new EffectParameter[0], new string[0]);
|
0, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual(1, move.Priority);
|
Assert.AreEqual(1, move.Priority);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -89,7 +89,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetEffectChance()
|
public void GetEffectChance()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "", new EffectParameter[0], new string[0]);
|
0.5f, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual(0.5f, move.SecondaryEffectChance);
|
Assert.AreEqual(0.5f, move.SecondaryEffectChance);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -98,7 +98,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetEffectChanceName()
|
public void GetEffectChanceName()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||||
Assert.AreEqual("test", move.SecondaryEffectName);
|
Assert.AreEqual("test", move.SecondaryEffectName);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -107,11 +107,11 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void HasSecondaryEffect()
|
public void HasSecondaryEffect()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||||
Assert.True(move.HasSecondaryEffect);
|
Assert.True(move.HasSecondaryEffect);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "", new EffectParameter[0], new string[0]);
|
0.5f, "", new EffectParameter[0], new string[0]);
|
||||||
Assert.False(move.HasSecondaryEffect);
|
Assert.False(move.HasSecondaryEffect);
|
||||||
move.Dispose();
|
move.Dispose();
|
||||||
|
@ -121,7 +121,7 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void HasFlag()
|
public void HasFlag()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "test", new EffectParameter[0], new []{"flag1"});
|
0.5f, "test", new EffectParameter[0], new []{"flag1"});
|
||||||
Assert.True(move.HasFlag("flag1"));
|
Assert.True(move.HasFlag("flag1"));
|
||||||
Assert.False(move.HasFlag("flag2"));
|
Assert.False(move.HasFlag("flag2"));
|
||||||
|
|
|
@ -10,16 +10,16 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void ConstructDestruct()
|
public void ConstructDestruct()
|
||||||
{
|
{
|
||||||
var item = MoveLibrary.Create(100);
|
var item = new MoveLibrary(100);
|
||||||
item.Dispose();
|
item.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void Insert()
|
public void Insert()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||||
var library = MoveLibrary.Create(100);
|
var library = new MoveLibrary(100);
|
||||||
library.Insert("foobar", move);
|
library.Insert("foobar", move);
|
||||||
Assert.AreEqual(1, library.Count);
|
Assert.AreEqual(1, library.Count);
|
||||||
library.Dispose();
|
library.Dispose();
|
||||||
|
@ -28,9 +28,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void Delete()
|
public void Delete()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||||
var library = MoveLibrary.Create(100);
|
var library = new MoveLibrary(100);
|
||||||
library.Insert("foobar", move);
|
library.Insert("foobar", move);
|
||||||
Assert.AreEqual(1, library.Count);
|
Assert.AreEqual(1, library.Count);
|
||||||
library.Delete("foobar");
|
library.Delete("foobar");
|
||||||
|
@ -41,9 +41,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void Get()
|
public void Get()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||||
var library = MoveLibrary.Create(100);
|
var library = new MoveLibrary(100);
|
||||||
library.Insert("foobar", move);
|
library.Insert("foobar", move);
|
||||||
Assert.AreEqual(1, library.Count);
|
Assert.AreEqual(1, library.Count);
|
||||||
var m = library.Get("foobar");
|
var m = library.Get("foobar");
|
||||||
|
@ -58,9 +58,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void TryGet()
|
public void TryGet()
|
||||||
{
|
{
|
||||||
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
var move = new MoveData("foobar", 0, MoveCategory.Physical, 60, 100, 20, MoveTarget.Adjacent, 1,
|
||||||
0.5f, "test", new EffectParameter[0], new string[0]);
|
0.5f, "test", new EffectParameter[0], new string[0]);
|
||||||
var library = MoveLibrary.Create(100);
|
var library = new MoveLibrary(100);
|
||||||
library.Insert("foobar", move);
|
library.Insert("foobar", move);
|
||||||
Assert.AreEqual(1, library.Count);
|
Assert.AreEqual(1, library.Count);
|
||||||
Assert.True(library.TryGet("foobar", out move));
|
Assert.True(library.TryGet("foobar", out move));
|
||||||
|
|
|
@ -13,13 +13,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
var types = new TypeLibrary(10);
|
var types = new TypeLibrary(10);
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
|
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
lib.Dispose();
|
lib.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -28,13 +28,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
var types = new TypeLibrary(10);
|
var types = new TypeLibrary(10);
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
|
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
var s = lib.SpeciesLibrary;
|
var s = lib.SpeciesLibrary;
|
||||||
Assert.AreEqual(species, s);
|
Assert.AreEqual(species, s);
|
||||||
lib.Dispose();
|
lib.Dispose();
|
||||||
|
@ -45,13 +45,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
var types = new TypeLibrary(10);
|
var types = new TypeLibrary(10);
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
|
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
var s = lib.Settings;
|
var s = lib.Settings;
|
||||||
Assert.AreEqual(settings, s);
|
Assert.AreEqual(settings, s);
|
||||||
lib.Dispose();
|
lib.Dispose();
|
||||||
|
@ -62,13 +62,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
var types = new TypeLibrary(10);
|
var types = new TypeLibrary(10);
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
|
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
var m = lib.MoveLibrary;
|
var m = lib.MoveLibrary;
|
||||||
Assert.AreEqual(moves, m);
|
Assert.AreEqual(moves, m);
|
||||||
lib.Dispose();
|
lib.Dispose();
|
||||||
|
@ -79,13 +79,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
var types = new TypeLibrary(10);
|
var types = new TypeLibrary(10);
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
|
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
var i = lib.ItemLibrary;
|
var i = lib.ItemLibrary;
|
||||||
Assert.AreEqual(items, i);
|
Assert.AreEqual(items, i);
|
||||||
lib.Dispose();
|
lib.Dispose();
|
||||||
|
@ -96,13 +96,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
var types = new TypeLibrary(10);
|
var types = new TypeLibrary(10);
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
|
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
var g = lib.GrowthRateLibrary;
|
var g = lib.GrowthRateLibrary;
|
||||||
Assert.AreEqual(gr, g);
|
Assert.AreEqual(gr, g);
|
||||||
lib.Dispose();
|
lib.Dispose();
|
||||||
|
@ -113,13 +113,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
var types = new TypeLibrary(10);
|
var types = new TypeLibrary(10);
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
|
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
var t = lib.TypeLibrary;
|
var t = lib.TypeLibrary;
|
||||||
Assert.AreEqual(types, t);
|
Assert.AreEqual(types, t);
|
||||||
lib.Dispose();
|
lib.Dispose();
|
||||||
|
@ -130,13 +130,13 @@ namespace PkmnLibSharpTests.Library
|
||||||
{
|
{
|
||||||
var settings = new LibrarySettings(100, 4, 4096);
|
var settings = new LibrarySettings(100, 4, 4096);
|
||||||
var species = new SpeciesLibrary(10);
|
var species = new SpeciesLibrary(10);
|
||||||
var moves = MoveLibrary.Create(10);
|
var moves = new MoveLibrary(10);
|
||||||
var items = new ItemLibrary(10);
|
var items = new ItemLibrary(10);
|
||||||
var gr = new GrowthRateLibrary(10);
|
var gr = new GrowthRateLibrary(10);
|
||||||
var types = new TypeLibrary(10);
|
var types = new TypeLibrary(10);
|
||||||
var natures = new NatureLibrary(10);
|
var natures = new NatureLibrary(10);
|
||||||
|
|
||||||
var lib = PokemonLibrary.Create(settings, species, moves, items, gr, types, natures);
|
var lib = new PokemonLibrary(settings, species, moves, items, gr, types, natures);
|
||||||
var n = lib.NatureLibrary;
|
var n = lib.NatureLibrary;
|
||||||
Assert.AreEqual(natures, n);
|
Assert.AreEqual(natures, n);
|
||||||
lib.Dispose();
|
lib.Dispose();
|
||||||
|
|
|
@ -16,9 +16,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void Insert()
|
public void Insert()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
var library = new SpeciesLibrary(100);
|
var library = new SpeciesLibrary(100);
|
||||||
library.Insert("foobar", species);
|
library.Insert("foobar", species);
|
||||||
Assert.AreEqual(1, library.Count);
|
Assert.AreEqual(1, library.Count);
|
||||||
|
@ -28,9 +28,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void Delete()
|
public void Delete()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
var library = new SpeciesLibrary(100);
|
var library = new SpeciesLibrary(100);
|
||||||
library.Insert("foobar", species);
|
library.Insert("foobar", species);
|
||||||
Assert.AreEqual(1, library.Count);
|
Assert.AreEqual(1, library.Count);
|
||||||
|
@ -42,9 +42,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void Get()
|
public void Get()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
var library = new SpeciesLibrary(100);
|
var library = new SpeciesLibrary(100);
|
||||||
library.Insert("foobar", species);
|
library.Insert("foobar", species);
|
||||||
Assert.AreEqual(1, library.Count);
|
Assert.AreEqual(1, library.Count);
|
||||||
|
@ -60,9 +60,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void TryGet()
|
public void TryGet()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
var library = new SpeciesLibrary(100);
|
var library = new SpeciesLibrary(100);
|
||||||
library.Insert("foobar", species);
|
library.Insert("foobar", species);
|
||||||
Assert.AreEqual(1, library.Count);
|
Assert.AreEqual(1, library.Count);
|
||||||
|
|
|
@ -9,75 +9,75 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void ConstructDestruct()
|
public void ConstructDestruct()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(0, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
species.Dispose();
|
species.Dispose();
|
||||||
}
|
}
|
||||||
|
|
||||||
[Test]
|
[Test]
|
||||||
public void GetId()
|
public void GetId()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
Assert.AreEqual(10, species.Id);
|
Assert.AreEqual(10, species.Id);
|
||||||
species.Dispose();
|
species.Dispose();
|
||||||
}
|
}
|
||||||
[Test]
|
[Test]
|
||||||
public void GetGenderRate()
|
public void GetGenderRate()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
Assert.AreEqual(0.5f, species.GenderRate);
|
Assert.AreEqual(0.5f, species.GenderRate);
|
||||||
species.Dispose();
|
species.Dispose();
|
||||||
}
|
}
|
||||||
[Test]
|
[Test]
|
||||||
public void GetCaptureRate()
|
public void GetCaptureRate()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
Assert.AreEqual(100, species.CaptureRate);
|
Assert.AreEqual(100, species.CaptureRate);
|
||||||
species.Dispose();
|
species.Dispose();
|
||||||
}
|
}
|
||||||
[Test]
|
[Test]
|
||||||
public void GetName()
|
public void GetName()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
Assert.AreEqual("testSpecies", species.Name);
|
Assert.AreEqual("testSpecies", species.Name);
|
||||||
species.Dispose();
|
species.Dispose();
|
||||||
}
|
}
|
||||||
[Test]
|
[Test]
|
||||||
public void GetGrowthRate()
|
public void GetGrowthRate()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
Assert.AreEqual("exponential", species.GrowthRate);
|
Assert.AreEqual("exponential", species.GrowthRate);
|
||||||
species.Dispose();
|
species.Dispose();
|
||||||
}
|
}
|
||||||
[Test]
|
[Test]
|
||||||
public void HasForme()
|
public void HasForme()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
Assert.True(species.HasForme("default"));
|
Assert.True(species.HasForme("default"));
|
||||||
species.Dispose();
|
species.Dispose();
|
||||||
}
|
}
|
||||||
[Test]
|
[Test]
|
||||||
public void SetForme()
|
public void SetForme()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
Assert.True(species.HasForme("default"));
|
Assert.True(species.HasForme("default"));
|
||||||
forme = Forme.Create("bar", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
forme = new Forme("bar", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
species.SetForme("bar", forme);
|
species.SetForme("bar", forme);
|
||||||
Assert.True(species.HasForme("bar"));
|
Assert.True(species.HasForme("bar"));
|
||||||
species.Dispose();
|
species.Dispose();
|
||||||
|
@ -85,9 +85,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void GetForme()
|
public void GetForme()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
var f = species.GetForme("default");
|
var f = species.GetForme("default");
|
||||||
Assert.AreEqual(forme, f);
|
Assert.AreEqual(forme, f);
|
||||||
Assert.Throws<NativeException>(() =>
|
Assert.Throws<NativeException>(() =>
|
||||||
|
@ -99,9 +99,9 @@ namespace PkmnLibSharpTests.Library
|
||||||
[Test]
|
[Test]
|
||||||
public void TrGetForme()
|
public void TrGetForme()
|
||||||
{
|
{
|
||||||
var forme = Forme.Create("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
var forme = new Forme("foo", 1, 2, 100, new byte[] {0}, 10, 10, 10, 10, 10, 10, new[] {"foo"},
|
||||||
new[] {"bar"}, LearnableMoves.Create(100));
|
new[] {"bar"}, new LearnableMoves(100));
|
||||||
var species = Species.Create(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
var species = new Species(10, "testSpecies", forme, 0.5f, "exponential", 100, 80);
|
||||||
Assert.True(species.TryGetForme("default", out var f));
|
Assert.True(species.TryGetForme("default", out var f));
|
||||||
Assert.AreEqual(forme, f);
|
Assert.AreEqual(forme, f);
|
||||||
Assert.False(species.TryGetForme("non-existing", out f));
|
Assert.False(species.TryGetForme("non-existing", out f));
|
||||||
|
|
Loading…
Reference in New Issue