Initial outline of battle class.
This commit is contained in:
parent
e2ecec8e7a
commit
d29aa60010
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling
|
||||||
|
{
|
||||||
|
public class AngelscriptScript : Script
|
||||||
|
{
|
||||||
|
internal AngelscriptScript(IntPtr ptr) : base(ptr)
|
||||||
|
{
|
||||||
|
|
||||||
|
}
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Pkmnlib.Generated.AngelScriptResolver.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,203 @@
|
||||||
|
using System;
|
||||||
|
using System.Linq;
|
||||||
|
using PkmnLibSharp.Battling.ChoiceTurn;
|
||||||
|
using PkmnLibSharp.Battling.Events;
|
||||||
|
using PkmnLibSharp.Utilities;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling
|
||||||
|
{
|
||||||
|
public class Battle : PointerWrapper
|
||||||
|
{
|
||||||
|
public Battle(BattleLibrary library, BattleParty[] parties, bool canFlee, byte numberOfSides, byte creaturesPerSide,
|
||||||
|
ulong randomSeed)
|
||||||
|
{
|
||||||
|
var ptr = IntPtr.Zero;
|
||||||
|
var arr = parties.Select(x => x.Ptr).ToArray();
|
||||||
|
Pkmnlib.Generated.Battle.Construct(ref ptr, library.Ptr, arr.ArrayPtr(), (ulong) arr.Length,
|
||||||
|
canFlee.ToNative(), numberOfSides, creaturesPerSide, randomSeed);
|
||||||
|
}
|
||||||
|
|
||||||
|
public BattleLibrary Library
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_library != null) return _library;
|
||||||
|
var ptr = Creaturelibbattling.Generated.Battle.GetLibrary(Ptr);
|
||||||
|
if (TryResolvePointer(ptr, out _library))
|
||||||
|
{
|
||||||
|
return _library;
|
||||||
|
}
|
||||||
|
_library = new BattleLibrary(ptr);
|
||||||
|
return _library;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public BattleRandom Random
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_random != null) return _random;
|
||||||
|
var ptr = Creaturelibbattling.Generated.Battle.GetRandom(Ptr);
|
||||||
|
if (TryResolvePointer(ptr, out _random))
|
||||||
|
{
|
||||||
|
return _random;
|
||||||
|
}
|
||||||
|
_random = new BattleRandom(ptr);
|
||||||
|
return _random;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanFlee => Creaturelibbattling.Generated.Battle.CanFlee(Ptr) == 1;
|
||||||
|
public bool HasEnded => Creaturelibbattling.Generated.Battle.HasEnded(Ptr) == 1;
|
||||||
|
public bool HasConclusiveResult => Creaturelibbattling.Generated.Battle.HasConclusiveResult(Ptr) == 1;
|
||||||
|
public byte WinningSide => Creaturelibbattling.Generated.Battle.GetWinningSide(Ptr);
|
||||||
|
public ulong SidesCount => Creaturelibbattling.Generated.Battle.GetSidesCount(Ptr);
|
||||||
|
public ulong PartiesCount => Creaturelibbattling.Generated.Battle.GetPartiesCount(Ptr);
|
||||||
|
|
||||||
|
public ReadOnlyNativePtrArray<BattleSide> Sides
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_sides != null) return _sides;
|
||||||
|
var ptr = Creaturelibbattling.Generated.Battle.GetSides(Ptr);
|
||||||
|
_sides = new ReadOnlyNativePtrArray<BattleSide>(ptr, (int) SidesCount);
|
||||||
|
return _sides;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public ReadOnlyNativePtrArray<BattleParty> Parties
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_parties != null) return _parties;
|
||||||
|
var ptr = Creaturelibbattling.Generated.Battle.GetParties(Ptr);
|
||||||
|
_parties = new ReadOnlyNativePtrArray<BattleParty>(ptr, (int) PartiesCount);
|
||||||
|
return _parties;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public string WeatherName => Pkmnlib.Generated.Battle.GetWeatherName(Ptr).PtrString();
|
||||||
|
|
||||||
|
|
||||||
|
public bool CanUse(BaseTurnChoice turnChoice)
|
||||||
|
{
|
||||||
|
byte b = 0;
|
||||||
|
Creaturelibbattling.Generated.Battle.CanUse(ref b, Ptr, turnChoice.Ptr).Assert();
|
||||||
|
return b == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool TrySetChoice(BaseTurnChoice turnChoice)
|
||||||
|
{
|
||||||
|
byte b = 0;
|
||||||
|
Creaturelibbattling.Generated.Battle.TrySetChoice(ref b, Ptr, turnChoice.Ptr).Assert();
|
||||||
|
return b == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void CheckChoicesSetAndRun()
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.CheckChoicesSetAndRun(Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool IsPokemonInField(Pokemon pokemon)
|
||||||
|
{
|
||||||
|
byte b = 0;
|
||||||
|
Creaturelibbattling.Generated.Battle.CreatureInField(ref b, Ptr, pokemon.Ptr).Assert();
|
||||||
|
return b == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public Pokemon GetPokemonInField(byte side, byte index)
|
||||||
|
{
|
||||||
|
var ptr = IntPtr.Zero;
|
||||||
|
Creaturelibbattling.Generated.Battle.GetCreature(ref ptr, Ptr, side, index).Assert();
|
||||||
|
return TryResolvePointer(ptr, out Pokemon pokemon) ? pokemon : new Pokemon(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ForceRecall(byte side, byte index)
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.ForceRecall(Ptr, side, index).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SwitchPokemon(byte side, byte index, Pokemon newPokemon)
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.SwitchCreature(Ptr, side, index, newPokemon.Ptr).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool CanSlotBeFilled(byte side, byte index)
|
||||||
|
{
|
||||||
|
byte b = 0;
|
||||||
|
Creaturelibbattling.Generated.Battle.CanSlotBeFilled(ref b, Ptr, side, index).Assert();
|
||||||
|
return b == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ValidateBattleState()
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.ValidateBattleState(Ptr).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public Script GetVolatileScript(string key)
|
||||||
|
{
|
||||||
|
var ptr = Creaturelibbattling.Generated.Battle.GetVolatileScript(Ptr, key.ToPtr());
|
||||||
|
if (TryResolvePointer(ptr, out Script script))
|
||||||
|
{
|
||||||
|
return script;
|
||||||
|
}
|
||||||
|
// TODO: Handle with different script providers.
|
||||||
|
return new AngelscriptScript(ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddVolatileScript(string key)
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.AddVolatileScriptByName(Ptr, key.ToPtr()).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void AddVolatileScript(Script script)
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.AddVolatileScript(Ptr, script.Ptr).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveVolatileScript(string key)
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.RemoveVolatileScript(Ptr, key.ToPtr()).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RemoveVolatileScript(Script script)
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.RemoveVolatileScriptWithScript(Ptr, script.Ptr).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public bool HasVolatileScript(string key)
|
||||||
|
{
|
||||||
|
return Creaturelibbattling.Generated.Battle.HasVolatileScript(Ptr, key.ToPtr()) == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public void RegisterEventListener(BattleEventListener listener)
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.RegisterEventListener(Ptr, listener.FunctionPtr).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void TriggerEventListener(BattleEvent evt)
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.Battle.TriggerEventListener(Ptr, evt.Ptr).Assert();
|
||||||
|
}
|
||||||
|
|
||||||
|
public void SetWeather(string weatherName)
|
||||||
|
{
|
||||||
|
Pkmnlib.Generated.Battle.SetWeather(Ptr, weatherName.ToPtr());
|
||||||
|
}
|
||||||
|
|
||||||
|
public void ClearWeather()
|
||||||
|
{
|
||||||
|
Pkmnlib.Generated.Battle.ClearWeather(Ptr);
|
||||||
|
}
|
||||||
|
|
||||||
|
private BattleLibrary _library;
|
||||||
|
private BattleRandom _random;
|
||||||
|
private ReadOnlyNativePtrArray<BattleSide> _sides;
|
||||||
|
private ReadOnlyNativePtrArray<BattleParty> _parties;
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Pkmnlib.Generated.Battle.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -5,6 +5,8 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
public class BattleParty : PointerWrapper
|
public class BattleParty : PointerWrapper
|
||||||
{
|
{
|
||||||
|
public BattleParty(){}
|
||||||
|
|
||||||
public BattleParty(PokemonParty party, byte[] responsibleIndices)
|
public BattleParty(PokemonParty party, byte[] responsibleIndices)
|
||||||
{
|
{
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
|
@ -0,0 +1,42 @@
|
||||||
|
using System;
|
||||||
|
using PkmnLibSharp.Utilities;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling
|
||||||
|
{
|
||||||
|
public class BattleRandom : PointerWrapper
|
||||||
|
{
|
||||||
|
public BattleRandom() : base(Creaturelibbattling.Generated.BattleRandom.Construct())
|
||||||
|
{}
|
||||||
|
public BattleRandom(ulong seed) : base(Creaturelibbattling.Generated.BattleRandom.ConstructWithSeed(seed))
|
||||||
|
{}
|
||||||
|
|
||||||
|
internal BattleRandom(IntPtr ptr) : base(ptr){}
|
||||||
|
|
||||||
|
public ulong Seed => Creaturelibbattling.Generated.BattleRandom.GetSeed(Ptr);
|
||||||
|
|
||||||
|
public bool EffectChance(float chance, ExecutingMove move,Pokemon target)
|
||||||
|
{
|
||||||
|
byte b = 0;
|
||||||
|
Creaturelibbattling.Generated.BattleRandom.EffectChance(ref b, Ptr, chance, move.Ptr, target.Ptr);
|
||||||
|
return b == 1;
|
||||||
|
}
|
||||||
|
|
||||||
|
public int Get()
|
||||||
|
{
|
||||||
|
return Creaturelibbattling.Generated.BattleRandom.Get(Ptr);
|
||||||
|
}
|
||||||
|
public int Get(int max)
|
||||||
|
{
|
||||||
|
return Creaturelibbattling.Generated.BattleRandom.GetMax(Ptr, max);
|
||||||
|
}
|
||||||
|
public int Get(int min, int max)
|
||||||
|
{
|
||||||
|
return Creaturelibbattling.Generated.BattleRandom.GetMinMax(Ptr, min, max);
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.BattleRandom.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,14 @@
|
||||||
|
using PkmnLibSharp.Utilities;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling
|
||||||
|
{
|
||||||
|
public class BattleSide : PointerWrapper
|
||||||
|
{
|
||||||
|
public BattleSide(){}
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,12 @@
|
||||||
|
using PkmnLibSharp.Utilities;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling
|
||||||
|
{
|
||||||
|
public class ExecutingMove : PointerWrapper
|
||||||
|
{
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
throw new System.NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,27 @@
|
||||||
|
using System;
|
||||||
|
using PkmnLibSharp.Utilities;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.ChoiceTurn
|
||||||
|
{
|
||||||
|
public abstract class BaseTurnChoice : PointerWrapper
|
||||||
|
{
|
||||||
|
protected BaseTurnChoice(IntPtr ptr) : base(ptr){}
|
||||||
|
|
||||||
|
public TurnChoiceKind Kind => (TurnChoiceKind) Creaturelibbattling.Generated.BaseTurnChoice.GetKind(Ptr);
|
||||||
|
|
||||||
|
public Pokemon User
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_user != null) return _user;
|
||||||
|
var ptr = Creaturelibbattling.Generated.BaseTurnChoice.GetUser(Ptr);
|
||||||
|
if (TryResolvePointer(ptr, out _user))
|
||||||
|
return _user;
|
||||||
|
_user = new Pokemon(ptr);
|
||||||
|
return _user;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
private Pokemon _user;
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.ChoiceTurn
|
||||||
|
{
|
||||||
|
public class FleeTurnChoice : BaseTurnChoice
|
||||||
|
{
|
||||||
|
public FleeTurnChoice(Pokemon user) : base(Creaturelibbattling.Generated.FleeTurnChoice.Construct(user.Ptr))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.FleeTurnChoice.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
using PkmnLibSharp.Utilities;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.ChoiceTurn
|
||||||
|
{
|
||||||
|
public class MoveTurnChoice : BaseTurnChoice
|
||||||
|
{
|
||||||
|
public MoveTurnChoice(Pokemon user, LearnedMove move, byte side, byte index)
|
||||||
|
: base(Creaturelibbattling.Generated.AttackTurnChoice.Construct(user.Ptr, move.Ptr, side, index))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public LearnedMove Move
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
if (_move != null) return _move;
|
||||||
|
var ptr = Creaturelibbattling.Generated.AttackTurnChoice.GetAttack(Ptr);
|
||||||
|
if (TryResolvePointer(ptr, out _move))
|
||||||
|
return _move;
|
||||||
|
_move = new LearnedMove(ptr);
|
||||||
|
return _move;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public sbyte Priority
|
||||||
|
{
|
||||||
|
get
|
||||||
|
{
|
||||||
|
sbyte b = 0;
|
||||||
|
Creaturelibbattling.Generated.AttackTurnChoice.GetPriority(ref b, Ptr).Assert();
|
||||||
|
return b;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
public byte TargetSide => Creaturelibbattling.Generated.AttackTurnChoice.GetTargetSideIndex(Ptr);
|
||||||
|
public byte TargetIndex => Creaturelibbattling.Generated.AttackTurnChoice.GetTargetCreatureIndex(Ptr);
|
||||||
|
|
||||||
|
// TODO: Move Script getter
|
||||||
|
|
||||||
|
private LearnedMove _move;
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.AttackTurnChoice.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,17 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.ChoiceTurn
|
||||||
|
{
|
||||||
|
public class SwitchTurnChoice : BaseTurnChoice
|
||||||
|
{
|
||||||
|
public SwitchTurnChoice(Pokemon user, Pokemon newPokemon) : base(
|
||||||
|
Creaturelibbattling.Generated.SwitchTurnChoice.Construct(user.Ptr, newPokemon.Ptr))
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
Creaturelibbattling.Generated.SwitchTurnChoice.Destruct(Ptr);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
namespace PkmnLibSharp.Battling.ChoiceTurn
|
||||||
|
{
|
||||||
|
public enum TurnChoiceKind
|
||||||
|
{
|
||||||
|
Pass = 0,
|
||||||
|
Attack = 1,
|
||||||
|
Item = 2,
|
||||||
|
Switch = 3,
|
||||||
|
Flee = 4,
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,11 @@
|
||||||
|
using System;
|
||||||
|
using PkmnLibSharp.Utilities;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.Events
|
||||||
|
{
|
||||||
|
public abstract class BattleEvent : PointerWrapper
|
||||||
|
{
|
||||||
|
protected internal BattleEvent(IntPtr ptr) : base(ptr)
|
||||||
|
{}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,47 @@
|
||||||
|
using System;
|
||||||
|
using System.Runtime.InteropServices;
|
||||||
|
using Creaturelibbattling;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.Events
|
||||||
|
{
|
||||||
|
public class BattleEventListener
|
||||||
|
{
|
||||||
|
public delegate void BattleEventDelegate(BattleEvent evt);
|
||||||
|
private delegate void BattleEventPtrDelegate(IntPtr ptr);
|
||||||
|
|
||||||
|
private readonly BattleEventDelegate _del;
|
||||||
|
// ReSharper disable once PrivateFieldCanBeConvertedToLocalVariable
|
||||||
|
private readonly BattleEventPtrDelegate _innerDel;
|
||||||
|
internal readonly IntPtr FunctionPtr;
|
||||||
|
|
||||||
|
public BattleEventListener(BattleEventDelegate del)
|
||||||
|
{
|
||||||
|
_del = del;
|
||||||
|
_innerDel = OnEventPtr;
|
||||||
|
FunctionPtr = Marshal.GetFunctionPointerForDelegate(_innerDel);
|
||||||
|
}
|
||||||
|
|
||||||
|
private void OnEventPtr(IntPtr ptr)
|
||||||
|
{
|
||||||
|
var wrapped = WrapEventPtr(ptr);
|
||||||
|
_del.Invoke(wrapped);
|
||||||
|
}
|
||||||
|
|
||||||
|
private static BattleEvent WrapEventPtr(IntPtr ptr)
|
||||||
|
{
|
||||||
|
var evtType = Creaturelibbattling.Generated.EventData.GetKind(ptr);
|
||||||
|
switch (evtType)
|
||||||
|
{
|
||||||
|
case EventDataKind.Damage:
|
||||||
|
return new DamageEvent(ptr);
|
||||||
|
case EventDataKind.Heal:
|
||||||
|
break;
|
||||||
|
case EventDataKind.Faint:
|
||||||
|
break;
|
||||||
|
case EventDataKind.DisplayText:
|
||||||
|
break;
|
||||||
|
}
|
||||||
|
throw new NotImplementedException($"Unhandled battle event: '{evtType}'");
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -0,0 +1,16 @@
|
||||||
|
using System;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling.Events
|
||||||
|
{
|
||||||
|
public class DamageEvent : BattleEvent
|
||||||
|
{
|
||||||
|
internal DamageEvent(IntPtr ptr) : base(ptr)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
protected override void DeletePtr()
|
||||||
|
{
|
||||||
|
throw new NotImplementedException();
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
|
@ -257,19 +257,17 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
Creaturelibbattling.Generated.Creature.AddVolatileScriptByName(Ptr, scriptName.ToPtr()).Assert();
|
Creaturelibbattling.Generated.Creature.AddVolatileScriptByName(Ptr, scriptName.ToPtr()).Assert();
|
||||||
}
|
}
|
||||||
//TODO: Change to wrapper
|
public void AddVolatileScript(Script script)
|
||||||
public void AddVolatileScript(IntPtr script)
|
|
||||||
{
|
{
|
||||||
Creaturelibbattling.Generated.Creature.AddVolatileScript(Ptr, script).Assert();
|
Creaturelibbattling.Generated.Creature.AddVolatileScript(Ptr, script.Ptr).Assert();
|
||||||
}
|
}
|
||||||
public void RemoveVolatileScript(string scriptName)
|
public void RemoveVolatileScript(string scriptName)
|
||||||
{
|
{
|
||||||
Creaturelibbattling.Generated.Creature.RemoveVolatileScriptByName(Ptr, scriptName.ToPtr()).Assert();
|
Creaturelibbattling.Generated.Creature.RemoveVolatileScriptByName(Ptr, scriptName.ToPtr()).Assert();
|
||||||
}
|
}
|
||||||
//TODO: Change to wrapper
|
public void RemoveVolatileScript(Script script)
|
||||||
public void RemoveVolatileScript(IntPtr script)
|
|
||||||
{
|
{
|
||||||
Creaturelibbattling.Generated.Creature.RemoveVolatileScript(Ptr, script).Assert();
|
Creaturelibbattling.Generated.Creature.RemoveVolatileScript(Ptr, script.Ptr).Assert();
|
||||||
}
|
}
|
||||||
public bool HasVolatileScript(string scriptName)
|
public bool HasVolatileScript(string scriptName)
|
||||||
{
|
{
|
||||||
|
|
|
@ -0,0 +1,10 @@
|
||||||
|
using System;
|
||||||
|
using PkmnLibSharp.Utilities;
|
||||||
|
|
||||||
|
namespace PkmnLibSharp.Battling
|
||||||
|
{
|
||||||
|
public abstract class Script : PointerWrapper
|
||||||
|
{
|
||||||
|
protected Script(IntPtr ptr) : base(ptr){}
|
||||||
|
}
|
||||||
|
}
|
|
@ -14,6 +14,11 @@ namespace Creaturelibbattling.Generated
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_Construct")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_Construct")]
|
||||||
internal static extern IntPtr Construct(IntPtr user, IntPtr attack, byte sideIndex, byte targetIndex);
|
internal static extern IntPtr Construct(IntPtr user, IntPtr attack, byte sideIndex, byte targetIndex);
|
||||||
|
|
||||||
|
/// <param name="p">AttackTurnChoice *</param>
|
||||||
|
/// <returns>void</returns>
|
||||||
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_Destruct")]
|
||||||
|
internal static extern void Destruct(IntPtr p);
|
||||||
|
|
||||||
/// <param name="p">const AttackTurnChoice *</param>
|
/// <param name="p">const AttackTurnChoice *</param>
|
||||||
/// <returns>LearnedAttack *</returns>
|
/// <returns>LearnedAttack *</returns>
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetAttack")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetAttack")]
|
||||||
|
@ -24,10 +29,26 @@ namespace Creaturelibbattling.Generated
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetKind")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetKind")]
|
||||||
internal static extern TurnChoiceKind GetKind(IntPtr p);
|
internal static extern TurnChoiceKind GetKind(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="out">signed char &</param>
|
||||||
|
/// <param name="p">AttackTurnChoice *</param>
|
||||||
|
/// <returns>unsigned char</returns>
|
||||||
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetPriority")]
|
||||||
|
internal static extern byte GetPriority(ref sbyte @out, IntPtr p);
|
||||||
|
|
||||||
/// <param name="p">const AttackTurnChoice *</param>
|
/// <param name="p">const AttackTurnChoice *</param>
|
||||||
/// <returns>Script *</returns>
|
/// <returns>Script *</returns>
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetAttackScript")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetAttackScript")]
|
||||||
internal static extern IntPtr GetAttackScript(IntPtr p);
|
internal static extern IntPtr GetAttackScript(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">const AttackTurnChoice *</param>
|
||||||
|
/// <returns>unsigned char</returns>
|
||||||
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetTargetSideIndex")]
|
||||||
|
internal static extern byte GetTargetSideIndex(IntPtr p);
|
||||||
|
|
||||||
|
/// <param name="p">const AttackTurnChoice *</param>
|
||||||
|
/// <returns>unsigned char</returns>
|
||||||
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_AttackTurnChoice_GetTargetCreatureIndex")]
|
||||||
|
internal static extern byte GetTargetCreatureIndex(IntPtr p);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -6,11 +6,6 @@ namespace Creaturelibbattling.Generated
|
||||||
{
|
{
|
||||||
internal static class BaseTurnChoice
|
internal static class BaseTurnChoice
|
||||||
{
|
{
|
||||||
/// <param name="p">const BaseTurnChoice *</param>
|
|
||||||
/// <returns>void</returns>
|
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BaseTurnChoice_Destruct")]
|
|
||||||
internal static extern void Destruct(IntPtr p);
|
|
||||||
|
|
||||||
/// <param name="p">const BaseTurnChoice *</param>
|
/// <param name="p">const BaseTurnChoice *</param>
|
||||||
/// <returns>TurnChoiceKind</returns>
|
/// <returns>TurnChoiceKind</returns>
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BaseTurnChoice_GetKind")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BaseTurnChoice_GetKind")]
|
||||||
|
@ -21,21 +16,5 @@ namespace Creaturelibbattling.Generated
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BaseTurnChoice_GetUser")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BaseTurnChoice_GetUser")]
|
||||||
internal static extern IntPtr GetUser(IntPtr p);
|
internal static extern IntPtr GetUser(IntPtr p);
|
||||||
|
|
||||||
/// <param name="out">signed char &</param>
|
|
||||||
/// <param name="p">AttackTurnChoice *</param>
|
|
||||||
/// <returns>unsigned char</returns>
|
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BaseTurnChoice_GetPriority")]
|
|
||||||
internal static extern byte GetPriority(ref sbyte @out, IntPtr p);
|
|
||||||
|
|
||||||
/// <param name="p">const AttackTurnChoice *</param>
|
|
||||||
/// <returns>unsigned char</returns>
|
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BaseTurnChoice_GetTargetSideIndex")]
|
|
||||||
internal static extern byte GetTargetSideIndex(IntPtr p);
|
|
||||||
|
|
||||||
/// <param name="p">const AttackTurnChoice *</param>
|
|
||||||
/// <returns>unsigned char</returns>
|
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_BaseTurnChoice_GetTargetCreatureIndex")]
|
|
||||||
internal static extern byte GetTargetCreatureIndex(IntPtr p);
|
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -13,9 +13,10 @@ namespace Creaturelibbattling.Generated
|
||||||
/// <param name="canFlee">bool</param>
|
/// <param name="canFlee">bool</param>
|
||||||
/// <param name="numberOfSides">unsigned char</param>
|
/// <param name="numberOfSides">unsigned char</param>
|
||||||
/// <param name="creaturesPerSide">unsigned char</param>
|
/// <param name="creaturesPerSide">unsigned char</param>
|
||||||
|
/// <param name="randomSeed">long unsigned int</param>
|
||||||
/// <returns>unsigned char</returns>
|
/// <returns>unsigned char</returns>
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Battle_Construct")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_Battle_Construct")]
|
||||||
internal static extern byte Construct(ref IntPtr @out, IntPtr library, IntPtr partyArr, ulong numberOfParties, byte canFlee, byte numberOfSides, byte creaturesPerSide);
|
internal static extern byte Construct(ref IntPtr @out, IntPtr library, IntPtr partyArr, ulong numberOfParties, byte canFlee, byte numberOfSides, byte creaturesPerSide, ulong randomSeed);
|
||||||
|
|
||||||
/// <param name="p">const Battle *</param>
|
/// <param name="p">const Battle *</param>
|
||||||
/// <returns>void</returns>
|
/// <returns>void</returns>
|
||||||
|
|
|
@ -11,5 +11,10 @@ namespace Creaturelibbattling.Generated
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_FleeTurnChoice_Construct")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_FleeTurnChoice_Construct")]
|
||||||
internal static extern IntPtr Construct(IntPtr user);
|
internal static extern IntPtr Construct(IntPtr user);
|
||||||
|
|
||||||
|
/// <param name="p">AttackTurnChoice *</param>
|
||||||
|
/// <returns>void</returns>
|
||||||
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_FleeTurnChoice_Destruct")]
|
||||||
|
internal static extern void Destruct(IntPtr p);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -11,5 +11,10 @@ namespace Creaturelibbattling.Generated
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_PassTurnChoice_Construct")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_PassTurnChoice_Construct")]
|
||||||
internal static extern IntPtr Construct(IntPtr user);
|
internal static extern IntPtr Construct(IntPtr user);
|
||||||
|
|
||||||
|
/// <param name="p">AttackTurnChoice *</param>
|
||||||
|
/// <returns>void</returns>
|
||||||
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_PassTurnChoice_Destruct")]
|
||||||
|
internal static extern void Destruct(IntPtr p);
|
||||||
|
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -12,6 +12,11 @@ namespace Creaturelibbattling.Generated
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchTurnChoice_Construct")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchTurnChoice_Construct")]
|
||||||
internal static extern IntPtr Construct(IntPtr user, IntPtr newCreature);
|
internal static extern IntPtr Construct(IntPtr user, IntPtr newCreature);
|
||||||
|
|
||||||
|
/// <param name="p">AttackTurnChoice *</param>
|
||||||
|
/// <returns>void</returns>
|
||||||
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchTurnChoice_Destruct")]
|
||||||
|
internal static extern void Destruct(IntPtr p);
|
||||||
|
|
||||||
/// <param name="p">const SwitchTurnChoice *</param>
|
/// <param name="p">const SwitchTurnChoice *</param>
|
||||||
/// <returns>Creature *</returns>
|
/// <returns>Creature *</returns>
|
||||||
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchTurnChoice_GetNewCreature")]
|
[DllImport("CreatureLibBattling", CallingConvention = CallingConvention.Cdecl, EntryPoint= "CreatureLib_SwitchTurnChoice_GetNewCreature")]
|
||||||
|
|
|
@ -13,9 +13,10 @@ namespace Pkmnlib.Generated
|
||||||
/// <param name="canFlee">bool</param>
|
/// <param name="canFlee">bool</param>
|
||||||
/// <param name="numberOfSides">unsigned char</param>
|
/// <param name="numberOfSides">unsigned char</param>
|
||||||
/// <param name="creaturesPerSide">unsigned char</param>
|
/// <param name="creaturesPerSide">unsigned char</param>
|
||||||
|
/// <param name="randomSeed">long unsigned int</param>
|
||||||
/// <returns>unsigned char</returns>
|
/// <returns>unsigned char</returns>
|
||||||
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Battle_Construct")]
|
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Battle_Construct")]
|
||||||
internal static extern byte Construct(ref IntPtr @out, IntPtr library, IntPtr parties, ulong partiesCount, byte canFlee, byte numberOfSides, byte creaturesPerSide);
|
internal static extern byte Construct(ref IntPtr @out, IntPtr library, IntPtr parties, ulong partiesCount, byte canFlee, byte numberOfSides, byte creaturesPerSide, ulong randomSeed);
|
||||||
|
|
||||||
/// <param name="p">Battle *</param>
|
/// <param name="p">Battle *</param>
|
||||||
/// <returns>void</returns>
|
/// <returns>void</returns>
|
||||||
|
|
BIN
PkmnLibSharp/Native/libCreatureLibBattling.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/libCreatureLibBattling.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.
|
@ -0,0 +1,4 @@
|
||||||
|
<wpf:ResourceDictionary xml:space="preserve" xmlns:x="http://schemas.microsoft.com/winfx/2006/xaml" xmlns:s="clr-namespace:System;assembly=mscorlib" xmlns:ss="urn:shemas-jetbrains-com:settings-storage-xaml" xmlns:wpf="http://schemas.microsoft.com/winfx/2006/xaml/presentation">
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=battling_005Cbattle/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=battling_005Cchoiceturn/@EntryIndexedValue">True</s:Boolean>
|
||||||
|
<s:Boolean x:Key="/Default/CodeInspection/NamespaceProvider/NamespaceFoldersToSkip/=battling_005Clibrary/@EntryIndexedValue">True</s:Boolean></wpf:ResourceDictionary>
|
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