Update to latest version of PkmnLib
continuous-integration/drone/push Build is failing Details
continuous-integration/drone Build is passing Details

This commit is contained in:
Deukhoofd 2022-03-12 10:32:31 +01:00
parent aaad311158
commit cb3d3c74a1
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
27 changed files with 91 additions and 88 deletions

View File

@ -35,14 +35,17 @@ namespace PkmnLibSharp.Battling
return res == 1;
}
public void OnUse()
public void OnUse(Battle? battle)
{
Creaturelib.Generated.ItemUseScript.OnUse(Ptr);
var ptr = IntPtr.Zero;
if (battle != null)
ptr = battle.Ptr;
Creaturelib.Generated.ItemUseScript.OnUse(Ptr, ptr);
}
public void OnPokemonUse(Pokemon pokemon)
public void OnPokemonUse(Pokemon pokemon, bool isBattle)
{
Creaturelib.Generated.ItemUseScript.OnCreatureUse(Ptr, pokemon.Ptr);
Creaturelib.Generated.ItemUseScript.OnCreatureUse(Ptr, pokemon.Ptr, isBattle.ToNative());
}
protected override void DeletePtr()

View File

@ -13,11 +13,14 @@ namespace Creaturelib.Generated
/// <param name="effectName">const char *</param>
/// <param name="effectParameters">EffectParameter * *</param>
/// <param name="effectParameterCount">long unsigned int</param>
/// <param name="battleTriggerEffectName">const char *</param>
/// <param name="battleTriggerEffectParameters">EffectParameter * *</param>
/// <param name="battleTriggerEffectParameterCount">long unsigned int</param>
/// <param name="flags">const char * *</param>
/// <param name="flagsCount">long unsigned int</param>
/// <returns>Item *</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Item_Construct")]
internal static extern IntPtr Construct(IntPtr name, ItemCategory category, BattleItemCategory battleCategory, int price, IntPtr effectName, IntPtr effectParameters, ulong effectParameterCount, IntPtr flags, ulong flagsCount);
internal static extern IntPtr Construct(IntPtr name, ItemCategory category, BattleItemCategory battleCategory, int price, IntPtr effectName, IntPtr effectParameters, ulong effectParameterCount, IntPtr battleTriggerEffectName, IntPtr battleTriggerEffectParameters, ulong battleTriggerEffectParameterCount, IntPtr flags, ulong flagsCount);
/// <param name="p">const Item *</param>
/// <returns>void</returns>

View File

@ -37,15 +37,17 @@ namespace Creaturelib.Generated
internal static extern byte IsHoldable(IntPtr p, ref byte @out);
/// <param name="p">ItemUseScript *</param>
/// <param name="battle">Battle *</param>
/// <returns>unsigned char</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ItemUseScript_OnUse")]
internal static extern byte OnUse(IntPtr p);
internal static extern byte OnUse(IntPtr p, IntPtr battle);
/// <param name="p">ItemUseScript *</param>
/// <param name="creature">Creature *</param>
/// <param name="isBattle">bool</param>
/// <returns>unsigned char</returns>
[DllImport("libCreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ItemUseScript_OnCreatureUse")]
internal static extern byte OnCreatureUse(IntPtr p, IntPtr creature);
internal static extern byte OnCreatureUse(IntPtr p, IntPtr creature, byte isBattle);
}
}

View File

@ -12,5 +12,6 @@ namespace Creaturelib
Creature = 3,
Battle = 4,
Side = 5,
ItemBattleTrigger = 6,
}
}

View File

@ -104,11 +104,5 @@ namespace Pkmnlib.Generated
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_AngelScriptResolver_DefineWord")]
internal static extern void DefineWord(IntPtr p, IntPtr word);
/// <param name="p">AngelScriptResolver *</param>
/// <param name="port">unsigned short</param>
/// <returns>void</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_AngelScriptResolver_AddDebugger")]
internal static extern void AddDebugger(IntPtr p, ushort port);
}
}

View File

@ -13,12 +13,15 @@ namespace Pkmnlib.Generated
/// <param name="effectName">const char *</param>
/// <param name="effectParameters">EffectParameter * *</param>
/// <param name="effectParameterCount">long unsigned int</param>
/// <param name="battleTriggerEffectName">const char *</param>
/// <param name="battleTriggerEffectParameters">EffectParameter * *</param>
/// <param name="battleTriggerEffectParameterCount">long unsigned int</param>
/// <param name="flags">const char * *</param>
/// <param name="flagsCount">long unsigned int</param>
/// <param name="flingPower">unsigned char</param>
/// <returns>Item *</returns>
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Item_Construct")]
internal static extern IntPtr Construct(IntPtr name, ItemCategory category, BattleItemCategory battleCategory, int price, IntPtr effectName, IntPtr effectParameters, ulong effectParameterCount, IntPtr flags, ulong flagsCount, byte flingPower);
internal static extern IntPtr Construct(IntPtr name, ItemCategory category, BattleItemCategory battleCategory, int price, IntPtr effectName, IntPtr effectParameters, ulong effectParameterCount, IntPtr battleTriggerEffectName, IntPtr battleTriggerEffectParameters, ulong battleTriggerEffectParameterCount, IntPtr flags, ulong flagsCount, byte flingPower);
/// <param name="p">const Item *</param>
/// <returns>void</returns>

View File

@ -12,5 +12,6 @@ namespace Pkmnlib
Creature = 3,
Battle = 4,
Side = 5,
ItemBattleTrigger = 6,
}
}

View File

@ -9,13 +9,16 @@ namespace PkmnLibSharp.Library.Items
private string? _name;
public Item(string name, ItemCategory category, BattleItemCategory battleCategory, int price, string effectName,
EffectParameter[] parameters, string[] flags, byte flingPower)
EffectParameter[] parameters, string battleTriggerEffectName, EffectParameter[] battleTriggerParameters,
string[] flags, byte flingPower)
{
var convertedFlags = flags.Select(x => x.ToPtr()).ToArray().ArrayPtr();
var pars = parameters.Select(x => x.Ptr).ToArray().ArrayPtr();
var battlePars = battleTriggerParameters.Select(x => x.Ptr).ToArray().ArrayPtr();
var p = Pkmnlib.Generated.Item.Construct(name.ToPtr(), (Pkmnlib.ItemCategory)category,
(Pkmnlib.BattleItemCategory)battleCategory, price, effectName.ToPtr(), pars, (ulong)parameters.Length,
convertedFlags, (ulong) flags.Length, flingPower);
battleTriggerEffectName.ToPtr(), battlePars, (ulong)battleTriggerParameters.Length, convertedFlags,
(ulong)flags.Length, flingPower);
Initialize(p);
}

View File

@ -28,8 +28,8 @@ namespace PkmnLibSharp.Library.Items
public void Delete(string key)
{
Creaturelib.Generated.ItemLibrary.Delete(Ptr, key.ToPtr()).Assert();
_cache.Remove(key);
Creaturelib.Generated.ItemLibrary.Delete(Ptr, key.ToPtr()).Assert();
}
public bool TryGet(string key, out Item? item)

View File

@ -24,8 +24,8 @@ namespace PkmnLibSharp.Library.Moves
public void Delete(string key)
{
AttackLibrary.Delete(Ptr, key.ToPtr()).Assert();
_cache.Remove(key);
AttackLibrary.Delete(Ptr, key.ToPtr()).Assert();
}
public bool TryGet(string key, out MoveData? move)

View File

@ -20,13 +20,13 @@ namespace PkmnLibSharp.Library
public void Delete(string key)
{
Creaturelib.Generated.SpeciesLibrary.Delete(Ptr, key.ToPtr()).Assert();
if (_cache.TryGetValue(key, out var s))
{
_cache.Remove(key);
if (s != null)
_idCache.Remove(s.Id);
}
Creaturelib.Generated.SpeciesLibrary.Delete(Ptr, key.ToPtr()).Assert();
}
public bool TryGet(string key, out Species? species)

BIN
PkmnLibSharp/Native/Linux/libArbutils.so (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

BIN
PkmnLibSharp/Native/Linux/libpkmnLib.so (Stored with Git LFS)

Binary file not shown.

BIN
PkmnLibSharp/Native/Linux/libpkmnlib_ai.so (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

Binary file not shown.

Binary file not shown.

BIN
PkmnLibSharp/Native/Windows/libpkmnLib.dll (Stored with Git LFS)

Binary file not shown.

Binary file not shown.

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

File diff suppressed because one or more lines are too long

View File

@ -1 +1 @@
{"enums":[{"byteSize":4,"filename":"libpkmnlib_ai","name":"memory_order","values":{"0":"relaxed","1":"consume","2":"acquire","3":"release","4":"acq_rel","5":"seq_cst"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"float_denorm_style","values":{"-1":"denorm_indeterminate","0":"denorm_absent","1":"denorm_present"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"float_round_style","values":{"-1":"round_indeterminate","0":"round_toward_zero","1":"round_to_nearest","2":"round_toward_infinity","3":"round_toward_neg_infinity"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"launch","values":{"1":"async","2":"deferred"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"errc","values":{"1":"operation_not_permitted","10":"no_child_process","100":"network_down","101":"network_unreachable","102":"network_reset","103":"connection_aborted","104":"connection_reset","105":"no_buffer_space","106":"already_connected","107":"not_connected","11":"operation_would_block","110":"timed_out","111":"connection_refused","113":"host_unreachable","114":"connection_already_in_progress","115":"operation_in_progress","12":"not_enough_memory","125":"operation_canceled","13":"permission_denied","130":"owner_dead","131":"state_not_recoverable","14":"bad_address","16":"device_or_resource_busy","17":"file_exists","18":"cross_device_link","19":"no_such_device","2":"no_such_file_or_directory","20":"not_a_directory","21":"is_a_directory","22":"invalid_argument","23":"too_many_files_open_in_system","24":"too_many_files_open","25":"inappropriate_io_control_operation","26":"text_file_busy","27":"file_too_large","28":"no_space_on_device","29":"invalid_seek","3":"no_such_process","30":"read_only_file_system","31":"too_many_links","32":"broken_pipe","33":"argument_out_of_domain","34":"result_out_of_range","35":"resource_deadlock_would_occur","36":"filename_too_long","37":"no_lock_available","38":"function_not_supported","39":"directory_not_empty","4":"interrupted","40":"too_many_symbolic_link_levels","42":"no_message","43":"identifier_removed","5":"io_error","6":"no_such_device_or_address","60":"not_a_stream","61":"no_message_available","62":"stream_timeout","63":"no_stream_resources","67":"no_link","7":"argument_list_too_long","71":"protocol_error","74":"bad_message","75":"value_too_large","8":"executable_format_error","84":"illegal_byte_sequence","88":"not_a_socket","89":"destination_address_required","9":"bad_file_descriptor","90":"message_size","91":"wrong_protocol_type","92":"no_protocol_option","93":"protocol_not_supported","95":"not_supported","97":"address_family_not_supported","98":"address_in_use","99":"address_not_available"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"future_errc","values":{"1":"future_already_retrieved","2":"promise_already_satisfied","3":"no_state","4":"broken_promise"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"AttackTarget","values":{"0":"Adjacent","1":"AdjacentAlly","10":"RandomOpponent","11":"Self","2":"AdjacentAllySelf","3":"AdjacentOpponent","4":"All","5":"AllAdjacent","6":"AllAdjacentOpponent","7":"AllAlly","8":"AllOpponent","9":"Any"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"TurnChoiceKind","values":{"0":"Pass","1":"Attack","2":"Item","3":"Switch","4":"Flee"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"ScriptCategory","values":{"0":"Attack","1":"Talent","2":"Status","3":"Creature","4":"Battle","5":"Side"}}],"functions":[{"filename":"libpkmnlib_ai","name":"pkmnlibai_C_GetLastException","parameters":[],"returns":"const char *"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_C_GetLastExceptionStacktrace","parameters":[],"returns":"const char *"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_PokemonAI_Delete","parameters":[{"name":"p","type":"PokemonAI *"}],"returns":"void"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_PokemonAI_GetChoice","parameters":[{"name":"out","type":"BaseTurnChoice * &"},{"name":"p","type":"PokemonAI *"},{"name":"battle","type":"Battle *"},{"name":"user","type":"Pokemon *"}],"returns":"unsigned char"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_RandomAI_Create","parameters":[],"returns":"RandomAI *"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_NaiveAI_Create","parameters":[],"returns":"NaiveAI *"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_DepthSearchAI_Create","parameters":[],"returns":"DepthSearchAI *"}]}
{"enums":[{"byteSize":4,"filename":"libpkmnlib_ai","name":"memory_order","values":{"0":"relaxed","1":"consume","2":"acquire","3":"release","4":"acq_rel","5":"seq_cst"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"float_denorm_style","values":{"-1":"denorm_indeterminate","0":"denorm_absent","1":"denorm_present"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"float_round_style","values":{"-1":"round_indeterminate","0":"round_toward_zero","1":"round_to_nearest","2":"round_toward_infinity","3":"round_toward_neg_infinity"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"launch","values":{"1":"async","2":"deferred"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"errc","values":{"1":"operation_not_permitted","10":"no_child_process","100":"network_down","101":"network_unreachable","102":"network_reset","103":"connection_aborted","104":"connection_reset","105":"no_buffer_space","106":"already_connected","107":"not_connected","11":"operation_would_block","110":"timed_out","111":"connection_refused","113":"host_unreachable","114":"connection_already_in_progress","115":"operation_in_progress","12":"not_enough_memory","125":"operation_canceled","13":"permission_denied","130":"owner_dead","131":"state_not_recoverable","14":"bad_address","16":"device_or_resource_busy","17":"file_exists","18":"cross_device_link","19":"no_such_device","2":"no_such_file_or_directory","20":"not_a_directory","21":"is_a_directory","22":"invalid_argument","23":"too_many_files_open_in_system","24":"too_many_files_open","25":"inappropriate_io_control_operation","26":"text_file_busy","27":"file_too_large","28":"no_space_on_device","29":"invalid_seek","3":"no_such_process","30":"read_only_file_system","31":"too_many_links","32":"broken_pipe","33":"argument_out_of_domain","34":"result_out_of_range","35":"resource_deadlock_would_occur","36":"filename_too_long","37":"no_lock_available","38":"function_not_supported","39":"directory_not_empty","4":"interrupted","40":"too_many_symbolic_link_levels","42":"no_message","43":"identifier_removed","5":"io_error","6":"no_such_device_or_address","60":"not_a_stream","61":"no_message_available","62":"stream_timeout","63":"no_stream_resources","67":"no_link","7":"argument_list_too_long","71":"protocol_error","74":"bad_message","75":"value_too_large","8":"executable_format_error","84":"illegal_byte_sequence","88":"not_a_socket","89":"destination_address_required","9":"bad_file_descriptor","90":"message_size","91":"wrong_protocol_type","92":"no_protocol_option","93":"protocol_not_supported","95":"not_supported","97":"address_family_not_supported","98":"address_in_use","99":"address_not_available"}},{"byteSize":4,"filename":"libpkmnlib_ai","name":"future_errc","values":{"1":"future_already_retrieved","2":"promise_already_satisfied","3":"no_state","4":"broken_promise"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"AttackTarget","values":{"0":"Adjacent","1":"AdjacentAlly","10":"RandomOpponent","11":"Self","2":"AdjacentAllySelf","3":"AdjacentOpponent","4":"All","5":"AllAdjacent","6":"AllAdjacentOpponent","7":"AllAlly","8":"AllOpponent","9":"Any"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"TurnChoiceKind","values":{"0":"Pass","1":"Attack","2":"Item","3":"Switch","4":"Flee"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"ScriptCategory","values":{"0":"Attack","1":"Talent","2":"Status","3":"Creature","4":"Battle","5":"Side","6":"ItemBattleTrigger"}}],"functions":[{"filename":"libpkmnlib_ai","name":"pkmnlibai_C_GetLastException","parameters":[],"returns":"const char *"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_C_GetLastExceptionStacktrace","parameters":[],"returns":"const char *"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_PokemonAI_Delete","parameters":[{"name":"p","type":"PokemonAI *"}],"returns":"void"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_PokemonAI_GetChoice","parameters":[{"name":"out","type":"BaseTurnChoice * &"},{"name":"p","type":"PokemonAI *"},{"name":"battle","type":"Battle *"},{"name":"user","type":"Pokemon *"}],"returns":"unsigned char"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_RandomAI_Create","parameters":[],"returns":"RandomAI *"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_NaiveAI_Create","parameters":[],"returns":"NaiveAI *"},{"filename":"libpkmnlib_ai","name":"pkmnlibai_DepthSearchAI_Create","parameters":[],"returns":"DepthSearchAI *"}]}

View File

@ -63,8 +63,8 @@ namespace PkmnLibSharpTests.Battling
var items = new ItemLibrary(10);
items.Insert("testItem",
new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.None, 500, "", new EffectParameter[0],
new string[] { }, 20));
new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.None, 500, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), Array.Empty<string>(), 20));
var gr = new GrowthRateLibrary(10);
gr.AddGrowthRate("growthRate",
new LookupGrowthRate(Enumerable.Range(1, 100).Select(x => (uint)x * 100).ToArray()));

View File

@ -1,3 +1,4 @@
using System;
using NUnit.Framework;
using PkmnLibSharp.Library;
using PkmnLibSharp.Library.Items;
@ -17,9 +18,8 @@ namespace PkmnLibSharpTests.Library
[Test]
public void Insert()
{
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
var library = new ItemLibrary(100);
library.Insert("foobar", item);
Assert.AreEqual(1, library.Count);
@ -29,9 +29,8 @@ namespace PkmnLibSharpTests.Library
[Test]
public void Delete()
{
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
var library = new ItemLibrary(100);
library.Insert("foobar", item);
Assert.AreEqual(1, library.Count);
@ -43,27 +42,22 @@ namespace PkmnLibSharpTests.Library
[Test]
public void Get()
{
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
var library = new ItemLibrary(100);
library.Insert("foobar", item);
Assert.AreEqual(1, library.Count);
var m = library.Get("foobar");
Assert.AreEqual(m.Name, "testItem");
Assert.Throws<NativeException>(() =>
{
library.Get("barfoo");
});
Assert.Throws<NativeException>(() => { library.Get("barfoo"); });
library.Dispose();
}
[Test]
public void TryGet()
{
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("testItem", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
var library = new ItemLibrary(100);
library.Insert("foobar", item);
Assert.AreEqual(1, library.Count);
@ -72,6 +66,5 @@ namespace PkmnLibSharpTests.Library
Assert.False(library.TryGet("barfoo", out item));
library.Dispose();
}
}
}

View File

@ -1,3 +1,4 @@
using System;
using NUnit.Framework;
using PkmnLibSharp.Library;
using PkmnLibSharp.Library.Items;
@ -9,63 +10,62 @@ namespace PkmnLibSharpTests.Library
[Test]
public void ConstructDestruct()
{
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
item.Dispose();
}
[Test]
public void GetName()
{
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
Assert.AreEqual("foobar", item.Name);
item.Dispose();
}
[Test]
public void GetCategory()
{
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
Assert.AreEqual(ItemCategory.MiscItem, item.Category);
item.Dispose();
}
[Test]
public void GetBattleCategory()
{
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
Assert.AreEqual(BattleItemCategory.Healing, item.BattleCategory);
item.Dispose();
}
[Test]
public void GetPrice()
{
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
Assert.AreEqual(1000, item.Price);
item.Dispose();
}
[Test]
public void HasFlag()
{
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
Assert.True(item.HasFlag("testFlag"));
Assert.False(item.HasFlag("non-existing"));
item.Dispose();
}
[Test]
public void GetFlingPower()
{
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000,
"", new EffectParameter[0],
new[] {"testFlag"}, 50);
var item = new Item("foobar", ItemCategory.MiscItem, BattleItemCategory.Healing, 1000, "",
Array.Empty<EffectParameter>(), "", Array.Empty<EffectParameter>(), new[] { "testFlag" }, 50);
Assert.AreEqual(50, item.FlingPower);
item.Dispose();
}