Implements new events
This commit is contained in:
parent
b0dea8b6e7
commit
90d5c2a16c
|
@ -34,13 +34,21 @@ namespace PkmnLibSharp.Battling.Events
|
||||||
case EventDataKind.Damage:
|
case EventDataKind.Damage:
|
||||||
return new DamageEvent(evtType, ptr);
|
return new DamageEvent(evtType, ptr);
|
||||||
case EventDataKind.Heal:
|
case EventDataKind.Heal:
|
||||||
break;
|
return new HealEvent(evtType, ptr);
|
||||||
case EventDataKind.Faint:
|
case EventDataKind.Faint:
|
||||||
break;
|
return new FaintEvent(evtType, ptr);
|
||||||
|
case EventDataKind.Switch:
|
||||||
|
return new SwitchEvent(evtType, ptr);
|
||||||
|
case EventDataKind.TurnStart:
|
||||||
|
return new TurnStartEvent(evtType, ptr);
|
||||||
|
case EventDataKind.TurnEnd:
|
||||||
|
return new TurnEndEvent(evtType, ptr);
|
||||||
|
case EventDataKind.ExperienceGain:
|
||||||
|
return new ExperienceGainEvent(evtType, ptr);
|
||||||
case EventDataKind.DisplayText:
|
case EventDataKind.DisplayText:
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
break;
|
throw new ArgumentOutOfRangeException();
|
||||||
}
|
}
|
||||||
Creaturelib.Generated.EventData.Destruct(ptr);
|
Creaturelib.Generated.EventData.Destruct(ptr);
|
||||||
throw new NotImplementedException($"Unhandled battle event: '{evtType}'");
|
throw new NotImplementedException($"Unhandled battle event: '{evtType}'");
|
||||||
|
|
|
@ -5,6 +5,10 @@ namespace PkmnLibSharp.Battling.Events
|
||||||
Damage = 0,
|
Damage = 0,
|
||||||
Heal = 1,
|
Heal = 1,
|
||||||
Faint = 2,
|
Faint = 2,
|
||||||
DisplayText = 3,
|
Switch = 3,
|
||||||
|
TurnStart = 4,
|
||||||
|
TurnEnd = 5,
|
||||||
|
ExperienceGain = 6,
|
||||||
|
DisplayText = 7,
|
||||||
}
|
}
|
||||||
}
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.Events
|
||||||
|
{
|
||||||
|
public class ExperienceGainEvent : EventData
|
||||||
|
{
|
||||||
|
internal ExperienceGainEvent(EventDataKind kind, IntPtr ptr) : base(kind, ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pokemon Pokemon
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_pokemon != null) return _pokemon;
|
||||||
|
var ptr = Creaturelib.Generated.ExperienceGainEvent.GetCreature(Ptr);
|
||||||
|
if (TryResolvePointer(ptr, out _pokemon))
|
||||||
|
return _pokemon;
|
||||||
|
_pokemon = new Pokemon(ptr);
|
||||||
|
return _pokemon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private uint PreviousExperience => Creaturelib.Generated.ExperienceGainEvent.GetPreviousExperience(Ptr);
|
||||||
|
private uint NewExperience => Creaturelib.Generated.ExperienceGainEvent.GetNewExperience(Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
private Pokemon _pokemon;
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Creaturelib.Generated.ExperienceGainEvent.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,35 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.Events
|
||||||
|
{
|
||||||
|
public class SwitchEvent : EventData
|
||||||
|
{
|
||||||
|
internal SwitchEvent(EventDataKind kind, IntPtr ptr) : base(kind, ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pokemon NewPokemon
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_newPokemon != null) return _newPokemon;
|
||||||
|
var ptr = Creaturelib.Generated.SwitchEvent.GetNewCreature(Ptr);
|
||||||
|
if (TryResolvePointer(ptr, out _newPokemon))
|
||||||
|
return _newPokemon;
|
||||||
|
_newPokemon = new Pokemon(ptr);
|
||||||
|
return _newPokemon;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte Side => Creaturelib.Generated.SwitchEvent.GetSide(Ptr);
|
||||||
|
public byte Index => Creaturelib.Generated.SwitchEvent.GetIndex(Ptr);
|
||||||
|
|
||||||
|
|
||||||
|
private Pokemon _newPokemon;
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Creaturelib.Generated.SwitchEvent.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.Events
|
||||||
|
{
|
||||||
|
public class TurnEndEvent : EventData
|
||||||
|
{
|
||||||
|
internal TurnEndEvent(EventDataKind kind, IntPtr ptr) : base(kind, ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Creaturelib.Generated.TurnEndEvent.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.Events
|
||||||
|
{
|
||||||
|
public class TurnStartEvent : EventData
|
||||||
|
{
|
||||||
|
internal TurnStartEvent(EventDataKind kind, IntPtr ptr) : base(kind, ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Creaturelib.Generated.TurnStartEvent.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,10 @@ namespace Creaturelib
|
||||||
Damage = 0,
|
Damage = 0,
|
||||||
Heal = 1,
|
Heal = 1,
|
||||||
Faint = 2,
|
Faint = 2,
|
||||||
DisplayText = 3,
|
Switch = 3,
|
||||||
|
TurnStart = 4,
|
||||||
|
TurnEnd = 5,
|
||||||
|
ExperienceGain = 6,
|
||||||
|
DisplayText = 7,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
// AUTOMATICALLY GENERATED, DO NOT EDIT
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Creaturelib.Generated
|
||||||
|
{
|
||||||
|
internal static class ExperienceGainEvent
|
||||||
|
{
|
||||||
|
/// <param name="p">const ExperienceGainEvent *</param>
|
||||||
|
/// <returns>Creature *</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ExperienceGainEvent_GetCreature")]
|
||||||
|
internal static extern IntPtr GetCreature(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">const ExperienceGainEvent *</param>
|
||||||
|
/// <returns>unsigned int</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ExperienceGainEvent_GetPreviousExperience")]
|
||||||
|
internal static extern uint GetPreviousExperience(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">const ExperienceGainEvent *</param>
|
||||||
|
/// <returns>unsigned int</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ExperienceGainEvent_GetNewExperience")]
|
||||||
|
internal static extern uint GetNewExperience(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">const ExperienceGainEvent *</param>
|
||||||
|
/// <returns>void</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_ExperienceGainEvent_Destruct")]
|
||||||
|
internal static extern void Destruct(IntPtr p);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -34,10 +34,10 @@ namespace Creaturelib.Generated
|
||||||
|
|
||||||
/// <param name="p">Script *</param>
|
/// <param name="p">Script *</param>
|
||||||
/// <param name="choice">AttackTurnChoice *</param>
|
/// <param name="choice">AttackTurnChoice *</param>
|
||||||
/// <param name="outAttack">StringView *</param>
|
/// <param name="outAttack">const char * &</param>
|
||||||
/// <returns>unsigned char</returns>
|
/// <returns>unsigned char</returns>
|
||||||
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Script_ChangeAttack")]
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Script_ChangeAttack")]
|
||||||
internal static extern byte ChangeAttack(IntPtr p, IntPtr choice, IntPtr outAttack);
|
internal static extern byte ChangeAttack(IntPtr p, IntPtr choice, ref IntPtr outAttack);
|
||||||
|
|
||||||
/// <param name="p">Script *</param>
|
/// <param name="p">Script *</param>
|
||||||
/// <param name="attack">ExecutingAttack *</param>
|
/// <param name="attack">ExecutingAttack *</param>
|
||||||
|
|
|
@ -0,0 +1,30 @@
|
||||||
|
// AUTOMATICALLY GENERATED, DO NOT EDIT
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Creaturelib.Generated
|
||||||
|
{
|
||||||
|
internal static class SwitchEvent
|
||||||
|
{
|
||||||
|
/// <param name="p">const SwitchEvent *</param>
|
||||||
|
/// <returns>Creature *</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchEvent_GetNewCreature")]
|
||||||
|
internal static extern IntPtr GetNewCreature(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">const SwitchEvent *</param>
|
||||||
|
/// <returns>unsigned char</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchEvent_GetSide")]
|
||||||
|
internal static extern byte GetSide(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">const SwitchEvent *</param>
|
||||||
|
/// <returns>unsigned char</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchEvent_GetIndex")]
|
||||||
|
internal static extern byte GetIndex(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">const SwitchEvent *</param>
|
||||||
|
/// <returns>void</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchEvent_Destruct")]
|
||||||
|
internal static extern void Destruct(IntPtr p);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
// AUTOMATICALLY GENERATED, DO NOT EDIT
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Creaturelib.Generated
|
||||||
|
{
|
||||||
|
internal static class TurnEndEvent
|
||||||
|
{
|
||||||
|
/// <param name="p">const TurnEndEvent *</param>
|
||||||
|
/// <returns>void</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_TurnEndEvent_Destruct")]
|
||||||
|
internal static extern void Destruct(IntPtr p);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
// AUTOMATICALLY GENERATED, DO NOT EDIT
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Creaturelib.Generated
|
||||||
|
{
|
||||||
|
internal static class TurnStartEvent
|
||||||
|
{
|
||||||
|
/// <param name="p">const TurnStartEvent *</param>
|
||||||
|
/// <returns>void</returns>
|
||||||
|
[DllImport("CreatureLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_TurnStartEvent_Destruct")]
|
||||||
|
internal static extern void Destruct(IntPtr p);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,15 @@
|
||||||
|
// AUTOMATICALLY GENERATED, DO NOT EDIT
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
|
||||||
|
namespace Pkmnlib.Generated
|
||||||
|
{
|
||||||
|
internal static class AngelscriptScript
|
||||||
|
{
|
||||||
|
/// <param name="p">AngelScriptScript *</param>
|
||||||
|
/// <returns>unsigned char</returns>
|
||||||
|
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_AngelscriptScript_Destruct")]
|
||||||
|
internal static extern byte Destruct(IntPtr p);
|
||||||
|
|
||||||
|
}
|
||||||
|
}
|
|
@ -9,6 +9,10 @@ namespace Pkmnlib
|
||||||
Damage = 0,
|
Damage = 0,
|
||||||
Heal = 1,
|
Heal = 1,
|
||||||
Faint = 2,
|
Faint = 2,
|
||||||
DisplayText = 3,
|
Switch = 3,
|
||||||
|
TurnStart = 4,
|
||||||
|
TurnEnd = 5,
|
||||||
|
ExperienceGain = 6,
|
||||||
|
DisplayText = 7,
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
BIN
PkmnLibSharp/Native/libArbutils.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/libArbutils.so (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/libCreatureLib.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/libCreatureLib.so (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/libpkmnLib.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/libpkmnLib.so (Stored with Git LFS)
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
Loading…
Reference in New Issue