Nature Library, Nature wrapper and tests, cleanup to ensure no duplicate enums are visible outside the library.

This commit is contained in:
Deukhoofd 2020-05-06 14:40:29 +02:00
parent 8845f33d04
commit 95a2270ca3
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
78 changed files with 366 additions and 109 deletions

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum AttackCategory : byte internal enum AttackCategory : byte
{ {
Physical = 0, Physical = 0,
Magical = 1, Magical = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum AttackLearnMethod : int internal enum AttackLearnMethod : int
{ {
Unknown = 0, Unknown = 0,
Level = 1, Level = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum AttackTarget : byte internal enum AttackTarget : byte
{ {
Adjacent = 0, Adjacent = 0,
AdjacentAlly = 1, AdjacentAlly = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum BattleItemCategory : byte internal enum BattleItemCategory : byte
{ {
None = 0, None = 0,
Healing = 1, Healing = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum DamageSource : byte internal enum DamageSource : byte
{ {
AttackDamage = 0, AttackDamage = 0,
} }

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum EffectParameterType : byte internal enum EffectParameterType : byte
{ {
None = 0, None = 0,
Bool = 1, Bool = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum EventDataKind : byte internal enum EventDataKind : byte
{ {
Damage = 0, Damage = 0,
Heal = 1, Heal = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum Gender : byte internal enum Gender : byte
{ {
Male = 0, Male = 0,
Female = 1, Female = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ItemCategory : byte internal enum ItemCategory : byte
{ {
MiscItem = 0, MiscItem = 0,
CaptureDevice = 1, CaptureDevice = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ScriptCategory : byte internal enum ScriptCategory : byte
{ {
Attack = 0, Attack = 0,
Talent = 1, Talent = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum Statistic : byte internal enum Statistic : byte
{ {
Health = 0, Health = 0,
PhysicalAttack = 1, PhysicalAttack = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum TurnChoiceKind : byte internal enum TurnChoiceKind : byte
{ {
Pass = 0, Pass = 0,
Attack = 1, Attack = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creaturelibbattling namespace Creaturelibbattling
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum memory_order : int internal enum memory_order : int
{ {
memory_order_relaxed = 0, memory_order_relaxed = 0,
memory_order_consume = 1, memory_order_consume = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creatureliblibrary namespace Creatureliblibrary
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum AttackCategory : byte internal enum AttackCategory : byte
{ {
Physical = 0, Physical = 0,
Magical = 1, Magical = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creatureliblibrary namespace Creatureliblibrary
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum AttackTarget : byte internal enum AttackTarget : byte
{ {
Adjacent = 0, Adjacent = 0,
AdjacentAlly = 1, AdjacentAlly = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creatureliblibrary namespace Creatureliblibrary
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum BattleItemCategory : byte internal enum BattleItemCategory : byte
{ {
None = 0, None = 0,
Healing = 1, Healing = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creatureliblibrary namespace Creatureliblibrary
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum EffectParameterType : byte internal enum EffectParameterType : byte
{ {
None = 0, None = 0,
Bool = 1, Bool = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creatureliblibrary namespace Creatureliblibrary
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum Gender : byte internal enum Gender : byte
{ {
Male = 0, Male = 0,
Female = 1, Female = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creatureliblibrary namespace Creatureliblibrary
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ItemCategory : byte internal enum ItemCategory : byte
{ {
MiscItem = 0, MiscItem = 0,
CaptureDevice = 1, CaptureDevice = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creatureliblibrary namespace Creatureliblibrary
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum Statistic : byte internal enum Statistic : byte
{ {
Health = 0, Health = 0,
PhysicalAttack = 1, PhysicalAttack = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Creatureliblibrary namespace Creatureliblibrary
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum memory_order : int internal enum memory_order : int
{ {
memory_order_relaxed = 0, memory_order_relaxed = 0,
memory_order_consume = 1, memory_order_consume = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum AttackCategory : byte internal enum AttackCategory : byte
{ {
Physical = 0, Physical = 0,
Magical = 1, Magical = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum AttackLearnMethod : int internal enum AttackLearnMethod : int
{ {
Unknown = 0, Unknown = 0,
Level = 1, Level = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum AttackTarget : byte internal enum AttackTarget : byte
{ {
Adjacent = 0, Adjacent = 0,
AdjacentAlly = 1, AdjacentAlly = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum BattleItemCategory : byte internal enum BattleItemCategory : byte
{ {
None = 0, None = 0,
Healing = 1, Healing = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum DamageSource : byte internal enum DamageSource : byte
{ {
AttackDamage = 0, AttackDamage = 0,
} }

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum EffectParameterType : byte internal enum EffectParameterType : byte
{ {
None = 0, None = 0,
Bool = 1, Bool = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum EventDataKind : byte internal enum EventDataKind : byte
{ {
Damage = 0, Damage = 0,
Heal = 1, Heal = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum EvolutionMethod : byte internal enum EvolutionMethod : byte
{ {
Level = 0, Level = 0,
HighFriendship = 1, HighFriendship = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum Gender : byte internal enum Gender : byte
{ {
Male = 0, Male = 0,
Female = 1, Female = 1,

View File

@ -1,15 +0,0 @@
using System;
using System.Runtime.InteropServices;
namespace Pkmnlib.Generated
{
internal static class GetLastException
{
/// <summary>
///
/// </summary>
/// <returns>const char *</returns>
[DllImport("pkmnLib")]
internal static extern string PkmnLib_GetLastException();
}
}

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ItemCategory : byte internal enum ItemCategory : byte
{ {
MiscItem = 0, MiscItem = 0,
CaptureDevice = 1, CaptureDevice = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum METADATATYPE : int internal enum METADATATYPE : int
{ {
MDT_TYPE = 1, MDT_TYPE = 1,
MDT_FUNC = 2, MDT_FUNC = 2,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum MoveCategory : byte internal enum MoveCategory : byte
{ {
Physical = 0, Physical = 0,
Special = 1, Special = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum PkmnDamageSource : byte internal enum PkmnDamageSource : byte
{ {
Struggle = 1, Struggle = 1,
} }

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum PkmnEventDataKind : byte internal enum PkmnEventDataKind : byte
{ {
WeatherChange = 4, WeatherChange = 4,
} }

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum PkmnScriptCategory : byte internal enum PkmnScriptCategory : byte
{ {
Weather = 6, Weather = 6,
} }

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum ScriptCategory : byte internal enum ScriptCategory : byte
{ {
Attack = 0, Attack = 0,
Talent = 1, Talent = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum Statistic : byte internal enum Statistic : byte
{ {
Health = 0, Health = 0,
PhysicalAttack = 1, PhysicalAttack = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum TimeOfDay : byte internal enum TimeOfDay : byte
{ {
Night = 0, Night = 0,
Morning = 1, Morning = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum TurnChoiceKind : byte internal enum TurnChoiceKind : byte
{ {
Pass = 0, Pass = 0,
Attack = 1, Attack = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asEBehaviours : int internal enum asEBehaviours : int
{ {
asBEHAVE_CONSTRUCT = 0, asBEHAVE_CONSTRUCT = 0,
asBEHAVE_LIST_CONSTRUCT = 1, asBEHAVE_LIST_CONSTRUCT = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asECallConvTypes : int internal enum asECallConvTypes : int
{ {
asCALL_CDECL = 0, asCALL_CDECL = 0,
asCALL_STDCALL = 1, asCALL_STDCALL = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asEContextState : int internal enum asEContextState : int
{ {
asEXECUTION_FINISHED = 0, asEXECUTION_FINISHED = 0,
asEXECUTION_SUSPENDED = 1, asEXECUTION_SUSPENDED = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asEEngineProp : int internal enum asEEngineProp : int
{ {
asEP_ALLOW_UNSAFE_REFERENCES = 1, asEP_ALLOW_UNSAFE_REFERENCES = 1,
asEP_REQUIRE_ENUM_SCOPE = 10, asEP_REQUIRE_ENUM_SCOPE = 10,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asEFuncType : int internal enum asEFuncType : int
{ {
asFUNC_DUMMY = -1, asFUNC_DUMMY = -1,
asFUNC_SYSTEM = 0, asFUNC_SYSTEM = 0,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asEGMFlags : int internal enum asEGMFlags : int
{ {
asGM_ONLY_IF_EXISTS = 0, asGM_ONLY_IF_EXISTS = 0,
asGM_CREATE_IF_NOT_EXISTS = 1, asGM_CREATE_IF_NOT_EXISTS = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asEMsgType : int internal enum asEMsgType : int
{ {
asMSGTYPE_ERROR = 0, asMSGTYPE_ERROR = 0,
asMSGTYPE_WARNING = 1, asMSGTYPE_WARNING = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asEObjTypeFlags : int internal enum asEObjTypeFlags : int
{ {
asOBJ_REF = 1, asOBJ_REF = 1,
asOBJ_APP_CLASS_DESTRUCTOR = 1024, asOBJ_APP_CLASS_DESTRUCTOR = 1024,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asERetCodes : int internal enum asERetCodes : int
{ {
asERROR = -1, asERROR = -1,
asINVALID_DECLARATION = -10, asINVALID_DECLARATION = -10,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asETokenClass : int internal enum asETokenClass : int
{ {
asTC_UNKNOWN = 0, asTC_UNKNOWN = 0,
asTC_KEYWORD = 1, asTC_KEYWORD = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asETypeIdFlags : int internal enum asETypeIdFlags : int
{ {
asTYPEID_VOID = 0, asTYPEID_VOID = 0,
asTYPEID_BOOL = 1, asTYPEID_BOOL = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum asETypeModifiers : int internal enum asETypeModifiers : int
{ {
asTM_NONE = 0, asTM_NONE = 0,
asTM_INREF = 1, asTM_INREF = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum error_type : int internal enum error_type : int
{ {
_S_error_collate = 0, _S_error_collate = 0,
_S_error_ctype = 1, _S_error_ctype = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum match_flag_type : int internal enum match_flag_type : int
{ {
} }
} }

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum memory_order : int internal enum memory_order : int
{ {
memory_order_relaxed = 0, memory_order_relaxed = 0,
memory_order_consume = 1, memory_order_consume = 1,

View File

@ -4,7 +4,7 @@ using System.Diagnostics.CodeAnalysis;
namespace Pkmnlib namespace Pkmnlib
{ {
[SuppressMessage("ReSharper", "InconsistentNaming")] [SuppressMessage("ReSharper", "InconsistentNaming")]
public enum syntax_option_type : int internal enum syntax_option_type : int
{ {
} }
} }

View File

@ -4,6 +4,15 @@ using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Library namespace PkmnLibSharp.Library
{ {
public enum EffectParameterType
{
None = 0,
Bool = 1,
Int = 2,
Float = 3,
String = 4,
}
public class EffectParameter : PointerWrapper public class EffectParameter : PointerWrapper
{ {
public EffectParameter(string s) : base(Creatureliblibrary.Generated.EffectParameter.FromString(s.ToPtr())) public EffectParameter(string s) : base(Creatureliblibrary.Generated.EffectParameter.FromString(s.ToPtr()))

View File

@ -40,12 +40,17 @@ namespace PkmnLibSharp.Library
} }
} }
public uint BaseHealth => SpeciesVariant.GetStatistic(Ptr, Statistic.Health); public uint BaseHealth => SpeciesVariant.GetStatistic(Ptr, (byte) Statistic.Health);
public uint BaseAttack => SpeciesVariant.GetStatistic(Ptr, Statistic.PhysicalAttack); public uint BaseAttack => SpeciesVariant.GetStatistic(Ptr, (Creatureliblibrary.Statistic) Statistic.Attack);
public uint BaseDefense => SpeciesVariant.GetStatistic(Ptr, Statistic.PhysicalDefense); public uint BaseDefense => SpeciesVariant.GetStatistic(Ptr, (Creatureliblibrary.Statistic) Statistic.Defense);
public uint BaseSpecialAttack => SpeciesVariant.GetStatistic(Ptr, Statistic.MagicalAttack);
public uint BaseSpecialDefense => SpeciesVariant.GetStatistic(Ptr, Statistic.MagicalDefense); public uint BaseSpecialAttack =>
public uint BaseSpeed => SpeciesVariant.GetStatistic(Ptr, Statistic.Speed); SpeciesVariant.GetStatistic(Ptr, (Creatureliblibrary.Statistic) Statistic.SpecialAttack);
public uint BaseSpecialDefense =>
SpeciesVariant.GetStatistic(Ptr, (Creatureliblibrary.Statistic) Statistic.SpecialDefense);
public uint BaseSpeed => SpeciesVariant.GetStatistic(Ptr, (Creatureliblibrary.Statistic) Statistic.Speed);
public ImmutableArray<string> Abilities public ImmutableArray<string> Abilities
{ {
@ -67,6 +72,7 @@ namespace PkmnLibSharp.Library
return _abilities; return _abilities;
} }
} }
public ImmutableArray<string> HiddenAbilities public ImmutableArray<string> HiddenAbilities
{ {
get get
@ -98,6 +104,7 @@ namespace PkmnLibSharp.Library
{ {
_moves = new LearnableMoves(movesPtr); _moves = new LearnableMoves(movesPtr);
} }
return _moves; return _moves;
} }
} }

View File

@ -0,0 +1,11 @@
namespace PkmnLibSharp.Library.Items
{
public enum BattleItemCategory
{
None = 0,
Healing = 1,
StatusHealing = 2,
Pokeball = 3,
MiscBattleItem = 4,
}
}

View File

@ -1,10 +1,8 @@
using System; using System;
using System.Linq; using System.Linq;
using PkmnLibSharp.Utilities; using PkmnLibSharp.Utilities;
using BattleItemCategory = Pkmnlib.BattleItemCategory;
using ItemCategory = Pkmnlib.ItemCategory;
namespace PkmnLibSharp.Library namespace PkmnLibSharp.Library.Items
{ {
public class Item : PointerWrapper public class Item : PointerWrapper
{ {
@ -12,8 +10,10 @@ namespace PkmnLibSharp.Library
public string Name => _name ??= Creatureliblibrary.Generated.Item.GetName(Ptr).PtrString(); public string Name => _name ??= Creatureliblibrary.Generated.Item.GetName(Ptr).PtrString();
public ItemCategory Category => (ItemCategory) Creatureliblibrary.Generated.Item.GetCategory(Ptr); public ItemCategory Category => (ItemCategory) Creatureliblibrary.Generated.Item.GetCategory(Ptr);
public BattleItemCategory BattleCategory => public BattleItemCategory BattleCategory =>
(BattleItemCategory) Creatureliblibrary.Generated.Item.GetBattleCategory(Ptr); (BattleItemCategory) Creatureliblibrary.Generated.Item.GetBattleCategory(Ptr);
public int Price => Creatureliblibrary.Generated.Item.GetPrice(Ptr); public int Price => Creatureliblibrary.Generated.Item.GetPrice(Ptr);
public byte FlingPower => Pkmnlib.Generated.Item.GetFlingPower(Ptr); public byte FlingPower => Pkmnlib.Generated.Item.GetFlingPower(Ptr);
@ -21,7 +21,7 @@ namespace PkmnLibSharp.Library
{ {
return Creatureliblibrary.Generated.Item.HasFlag(Ptr, s.ToPtr()) == MarshalHelper.True; return Creatureliblibrary.Generated.Item.HasFlag(Ptr, s.ToPtr()) == MarshalHelper.True;
} }
internal Item(IntPtr ptr) : base(ptr) internal Item(IntPtr ptr) : base(ptr)
{ {
} }
@ -31,8 +31,8 @@ namespace PkmnLibSharp.Library
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(), category, battleCategory, price, convertedFlags, var p = Pkmnlib.Generated.Item.Construct(name.ToPtr(), (Pkmnlib.ItemCategory) category,
(ulong) flags.Length, flingPower); (Pkmnlib.BattleItemCategory) battleCategory, price, convertedFlags, (ulong) flags.Length, flingPower);
return new Item(p); return new Item(p);
} }

View File

@ -0,0 +1,14 @@
namespace PkmnLibSharp.Library
{
public enum ItemCategory
{
MiscItem = 0,
Pokeball = 1,
Medicine = 2,
Berry = 3,
TechnicalMachine = 4,
FormeChanger = 5,
KeyItem = 6,
Mail = 7,
}
}

View File

@ -2,7 +2,7 @@ using System;
using System.Collections.Generic; using System.Collections.Generic;
using PkmnLibSharp.Utilities; using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Library namespace PkmnLibSharp.Library.Items
{ {
public class ItemLibrary : PointerWrapper public class ItemLibrary : PointerWrapper
{ {

View File

@ -1,5 +1,6 @@
using System; using System;
using Creatureliblibrary.Generated; using Creatureliblibrary.Generated;
using PkmnLibSharp.Library.Moves;
using PkmnLibSharp.Utilities; using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Library namespace PkmnLibSharp.Library

View File

@ -0,0 +1,9 @@
namespace PkmnLibSharp.Library.Moves
{
public enum MoveCategory
{
Physical = 0,
Special = 1,
Status = 2,
}
}

View File

@ -1,12 +1,11 @@
using System; using System;
using System.Linq; using System.Linq;
using System.Runtime.InteropServices;
using Creatureliblibrary.Generated; using Creatureliblibrary.Generated;
using Pkmnlib; using Pkmnlib;
using PkmnLibSharp.Utilities; using PkmnLibSharp.Utilities;
using AttackCategory = Creatureliblibrary.AttackCategory; using AttackCategory = Creatureliblibrary.AttackCategory;
namespace PkmnLibSharp.Library namespace PkmnLibSharp.Library.Moves
{ {
public class MoveData : PointerWrapper public class MoveData : PointerWrapper
{ {
@ -19,7 +18,7 @@ namespace PkmnLibSharp.Library
public byte BasePower => AttackData.GetBasePower(Ptr); public byte BasePower => AttackData.GetBasePower(Ptr);
public byte Accuracy => AttackData.GetAccuracy(Ptr); public byte Accuracy => AttackData.GetAccuracy(Ptr);
public byte BaseUsages => AttackData.GetBaseUsages(Ptr); public byte BaseUsages => AttackData.GetBaseUsages(Ptr);
public AttackTarget Target => (AttackTarget) AttackData.GetTarget(Ptr); public MoveTarget Target => (MoveTarget) AttackData.GetTarget(Ptr);
public sbyte Priority => AttackData.GetPriority(Ptr); public sbyte Priority => AttackData.GetPriority(Ptr);
public bool HasSecondaryEffect => AttackData.HasSecondaryEffect(Ptr) == 1; public bool HasSecondaryEffect => AttackData.HasSecondaryEffect(Ptr) == 1;
public float SecondaryEffectChance => AttackData.GetSecondaryEffectChance(Ptr); public float SecondaryEffectChance => AttackData.GetSecondaryEffectChance(Ptr);
@ -33,7 +32,7 @@ namespace PkmnLibSharp.Library
} }
public static MoveData Create(string name, byte type, MoveCategory category, byte power, byte accuracy, public static MoveData Create(string name, byte type, MoveCategory category, byte power, byte accuracy,
byte baseUsage, AttackTarget 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)
{ {
var ptr = IntPtr.Zero; var ptr = IntPtr.Zero;

View File

@ -3,7 +3,7 @@ using System.Collections.Generic;
using Creatureliblibrary.Generated; using Creatureliblibrary.Generated;
using PkmnLibSharp.Utilities; using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Library namespace PkmnLibSharp.Library.Moves
{ {
public class MoveLibrary : PointerWrapper public class MoveLibrary : PointerWrapper
{ {

View File

@ -0,0 +1,18 @@
namespace PkmnLibSharp.Library.Moves
{
public enum MoveTarget
{
Adjacent = 0,
AdjacentAlly = 1,
AdjacentAllySelf = 2,
AdjacentOpponent = 3,
All = 4,
AllAdjacent = 5,
AllAdjacentOpponent = 6,
AllAlly = 7,
AllOpponent = 8,
Any = 9,
RandomOpponent = 10,
Self = 11,
}
}

View File

@ -0,0 +1,36 @@
using System;
using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Library
{
public class Nature : PointerWrapper
{
internal Nature(IntPtr ptr) : base(ptr){}
public Nature(Statistic increasedStat, Statistic decreasedStat, float increasedModifier = 1.1f,
float decreasedModifier = 0.9f) : base(Pkmnlib.Generated.Nature.Construct((Pkmnlib.Statistic) increasedStat,
(Pkmnlib.Statistic) decreasedStat,
increasedModifier, decreasedModifier))
{
}
public Nature() : this(Statistic.Health, Statistic.Health, 1f, 1f)
{
}
public float IncreasedModifier => Pkmnlib.Generated.Nature.GetIncreaseModifier(Ptr);
public float DecreasedModifier => Pkmnlib.Generated.Nature.GetDecreaseModifier(Ptr);
public Statistic IncreasedStat => (Statistic) Pkmnlib.Generated.Nature.GetIncreasedStat(Ptr);
public Statistic DecreasedStat => (Statistic) Pkmnlib.Generated.Nature.GetDecreasedStat(Ptr);
public float GetStatModifier(Statistic stat)
{
return Pkmnlib.Generated.Nature.GetStatModifier(Ptr, (Pkmnlib.Statistic) stat);
}
protected override void DeletePtr()
{
Pkmnlib.Generated.Nature.Destruct(Ptr);
}
}
}

View File

@ -0,0 +1,56 @@
using System;
using System.Collections.Generic;
using PkmnLibSharp.Utilities;
namespace PkmnLibSharp.Library
{
public class NatureLibrary : PointerWrapper
{
private readonly Dictionary<string, Nature> _cache =
new Dictionary<string, Nature>(StringComparer.InvariantCultureIgnoreCase);
private readonly Dictionary<IntPtr, string> _natureNames = new Dictionary<IntPtr, string>();
public NatureLibrary(ulong initialCapacity) : base(Pkmnlib.Generated.NatureLibrary.Construct(initialCapacity))
{
}
public void LoadNature(string name, Nature nature)
{
Pkmnlib.Generated.NatureLibrary.LoadNature(Ptr, name.ToPtr(), nature.Ptr).Assert();
_cache.Add(name, nature);
_natureNames.Add(nature.Ptr, name);
}
public Nature GetNature(string name)
{
if (_cache.TryGetValue(name, out var nature))
return nature;
var ptr = IntPtr.Zero;
Pkmnlib.Generated.NatureLibrary.GetNatureByName(Ptr, name.ToPtr(), ref ptr).Assert();
if (TryResolvePointer(ptr, out nature))
{
_cache.Add(name, nature);
_natureNames.Add(ptr, name);
return nature;
}
nature = new Nature(ptr);
_cache.Add(name, nature);
_natureNames.Add(ptr, name);
return nature;
}
public string GetNatureName(Nature nature)
{
if (_natureNames.TryGetValue(nature.Ptr, out var s))
return s;
var ptr = IntPtr.Zero;
Pkmnlib.Generated.NatureLibrary.GetNatureName(Ptr, nature.Ptr, ref ptr).Assert();
return ptr.PtrString();
}
protected override void DeletePtr()
{
Pkmnlib.Generated.NatureLibrary.Destruct(Ptr);
}
}
}

View File

@ -0,0 +1,12 @@
namespace PkmnLibSharp.Library
{
public enum Statistic : byte
{
Health = 0,
Attack = 1,
Defense = 2,
SpecialAttack = 3,
SpecialDefense = 4,
Speed = 5
}
}

View File

@ -17,7 +17,7 @@ def write_enum(enum, enumNames):
f.write("using System.Diagnostics.CodeAnalysis;\n\n") f.write("using System.Diagnostics.CodeAnalysis;\n\n")
f.write("namespace {}\n{{\n".format(namespace)) f.write("namespace {}\n{{\n".format(namespace))
f.write(" [SuppressMessage(\"ReSharper\", \"InconsistentNaming\")]\n") f.write(" [SuppressMessage(\"ReSharper\", \"InconsistentNaming\")]\n")
f.write(" public enum {} : {}\n {{\n".format(enum["name"], resolve_enum_size(enum["byteSize"]) )) f.write(" internal enum {} : {}\n {{\n".format(enum["name"], resolve_enum_size(enum["byteSize"]) ))
for k, v in enum["values"].items(): for k, v in enum["values"].items():
f.write(" {} = {},\n".format(v, k)) f.write(" {} = {},\n".format(v, k))
f.write(" }\n") f.write(" }\n")

View File

@ -1,6 +1,7 @@
using NUnit.Framework; using NUnit.Framework;
using Pkmnlib; using Pkmnlib;
using PkmnLibSharp.Library; using PkmnLibSharp.Library;
using PkmnLibSharp.Library.Items;
using PkmnLibSharp.Utilities; using PkmnLibSharp.Utilities;
namespace PkmnLibSharpTests.Library namespace PkmnLibSharpTests.Library

View File

@ -1,6 +1,7 @@
using NUnit.Framework; using NUnit.Framework;
using Pkmnlib; using Pkmnlib;
using PkmnLibSharp.Library; using PkmnLibSharp.Library;
using PkmnLibSharp.Library.Items;
namespace PkmnLibSharpTests.Library namespace PkmnLibSharpTests.Library
{ {

View File

@ -1,6 +1,7 @@
using NUnit.Framework; using NUnit.Framework;
using Pkmnlib; using Pkmnlib;
using PkmnLibSharp.Library; using PkmnLibSharp.Library;
using PkmnLibSharp.Library.Moves;
namespace PkmnLibSharpTests.Library namespace PkmnLibSharpTests.Library
{ {
@ -9,7 +10,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void ConstructDestruct() public void ConstructDestruct()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +18,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetName() public void GetName()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +27,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetType() public void GetType()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +36,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetCategory() public void GetCategory()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +45,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetBasePower() public void GetBasePower()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +54,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetAccuracy() public void GetAccuracy()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +63,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetBaseUsages() public void GetBaseUsages()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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,16 +72,16 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetTarget() public void GetTarget()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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(AttackTarget.Adjacent, move.Target); Assert.AreEqual(MoveTarget.Adjacent, move.Target);
move.Dispose(); move.Dispose();
} }
[Test] [Test]
public void GetPriority() public void GetPriority()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +90,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetEffectChance() public void GetEffectChance()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +99,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void GetEffectChanceName() public void GetEffectChanceName()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 +108,11 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void HasSecondaryEffect() public void HasSecondaryEffect()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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, AttackTarget.Adjacent, 1, move = MoveData.Create("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 +122,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void HasFlag() public void HasFlag()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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"));

View File

@ -3,6 +3,7 @@ using NUnit.Framework;
using Pkmnlib; using Pkmnlib;
using PkmnLibSharp; using PkmnLibSharp;
using PkmnLibSharp.Library; using PkmnLibSharp.Library;
using PkmnLibSharp.Library.Moves;
using PkmnLibSharp.Utilities; using PkmnLibSharp.Utilities;
namespace PkmnLibSharpTests.Library namespace PkmnLibSharpTests.Library
@ -19,7 +20,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void Insert() public void Insert()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 = MoveLibrary.Create(100);
library.Insert("foobar", move); library.Insert("foobar", move);
@ -30,7 +31,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void Delete() public void Delete()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 = MoveLibrary.Create(100);
library.Insert("foobar", move); library.Insert("foobar", move);
@ -43,7 +44,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void Get() public void Get()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 = MoveLibrary.Create(100);
library.Insert("foobar", move); library.Insert("foobar", move);
@ -60,7 +61,7 @@ namespace PkmnLibSharpTests.Library
[Test] [Test]
public void TryGet() public void TryGet()
{ {
var move = MoveData.Create("foobar", 0, MoveCategory.Physical, 60, 100, 20, AttackTarget.Adjacent, 1, var move = MoveData.Create("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 = MoveLibrary.Create(100);
library.Insert("foobar", move); library.Insert("foobar", move);

View File

@ -0,0 +1,43 @@
using NUnit.Framework;
using PkmnLibSharp.Library;
namespace PkmnLibSharpTests.Library
{
public class NatureLibraryTests
{
[Test]
public void ConstructDestruct()
{
var nl = new NatureLibrary(0);
nl.Dispose();
}
[Test]
public void LoadNature()
{
var nl = new NatureLibrary(1);
nl.LoadNature("foo", new Nature());
nl.Dispose();
}
[Test]
public void GetNature()
{
var nl = new NatureLibrary(1);
nl.LoadNature("foo", new Nature(Statistic.SpecialAttack, Statistic.SpecialDefense));
Assert.AreEqual(Statistic.SpecialAttack, nl.GetNature("foo").IncreasedStat);
nl.Dispose();
}
[Test]
public void GetNatureName()
{
var nl = new NatureLibrary(1);
nl.LoadNature("foo", new Nature(Statistic.SpecialAttack, Statistic.SpecialDefense));
var nature = nl.GetNature("foo");
Assert.AreEqual("foo", nl.GetNatureName(nature));
nl.Dispose();
}
}
}

View File

@ -0,0 +1,53 @@
using NUnit.Framework;
using PkmnLibSharp.Library;
namespace PkmnLibSharpTests.Library
{
public class NatureTests
{
[Test]
public void ConstructDestruct()
{
var nature = new Nature(Statistic.Attack, Statistic.Defense);
nature.Dispose();
}
[Test]
public void GetIncreasedStat()
{
var nature = new Nature(Statistic.Attack, Statistic.Defense);
Assert.AreEqual(Statistic.Attack, nature.IncreasedStat);
nature.Dispose();
}
[Test]
public void GetIncreasedModifier()
{
var nature = new Nature(Statistic.Attack, Statistic.Defense);
Assert.AreEqual(1.1f, nature.IncreasedModifier);
nature.Dispose();
}
[Test]
public void GetDecreasedStat()
{
var nature = new Nature(Statistic.Attack, Statistic.Defense);
Assert.AreEqual(Statistic.Defense, nature.DecreasedStat);
nature.Dispose();
}
[Test]
public void GetDecreasedModifier()
{
var nature = new Nature(Statistic.Attack, Statistic.Defense);
Assert.AreEqual(0.9f, nature.DecreasedModifier);
nature.Dispose();
}
[Test]
public void GetStatModifier()
{
var nature = new Nature(Statistic.Attack, Statistic.Defense);
Assert.AreEqual(0.9f, nature.GetStatModifier(Statistic.Defense));
Assert.AreEqual(1f, nature.GetStatModifier(Statistic.SpecialAttack));
nature.Dispose();
}
}
}