Adds support for pokemon eggs
This commit is contained in:
parent
1153ad6034
commit
919b486f69
|
@ -18,25 +18,21 @@ namespace PkmnLibSharp.Battling
|
||||||
Library = new BattleLibrary(Creaturelib.Generated.Creature.GetLibrary(ptr));
|
Library = new BattleLibrary(Creaturelib.Generated.Creature.GetLibrary(ptr));
|
||||||
}
|
}
|
||||||
|
|
||||||
public Pokemon(BattleLibrary library, Species species, Forme forme,
|
public Pokemon(BattleLibrary library, Species species, Forme forme, byte level, uint experience, uint uid,
|
||||||
byte level, uint experience, uint uid,
|
Gender gender, byte coloring, Item? heldItem, string? nickname, bool hiddenAbility, byte abilityIndex,
|
||||||
Gender gender, byte coloring, Item? heldItem, string? nickname, bool hiddenAbility,
|
IReadOnlyCollection<LearnedMove> moves, StatisticSet<byte> ivs, StatisticSet<byte> evs, Nature nature,
|
||||||
byte abilityIndex,
|
bool allowedExperienceGain = true, bool isEgg = false) :
|
||||||
IReadOnlyCollection<LearnedMove> moves, StatisticSet<byte> ivs, StatisticSet<byte> evs,
|
base(CreatePtr(library, species, forme, level, experience, uid, gender, coloring, heldItem, nickname,
|
||||||
Nature nature)
|
hiddenAbility, abilityIndex, moves, ivs, evs, nature, allowedExperienceGain, isEgg))
|
||||||
: base(CreatePtr(library, species, forme, level, experience, uid, gender, coloring, heldItem, nickname,
|
|
||||||
hiddenAbility, abilityIndex, moves, ivs, evs, nature))
|
|
||||||
{
|
{
|
||||||
Library = library;
|
Library = library;
|
||||||
Initialize();
|
Initialize();
|
||||||
}
|
}
|
||||||
|
|
||||||
protected static IntPtr CreatePtr(BattleLibrary library, Species species, Forme forme,
|
protected static IntPtr CreatePtr(BattleLibrary library, Species species, Forme forme, byte level,
|
||||||
byte level, uint experience, uint uid,
|
uint experience, uint uid, Gender gender, byte coloring, Item? heldItem, string? nickname,
|
||||||
Gender gender, byte coloring, Item? heldItem, string? nickname, bool hiddenAbility,
|
bool hiddenAbility, byte abilityIndex, IReadOnlyCollection<LearnedMove> moves, StatisticSet<byte> ivs,
|
||||||
byte abilityIndex,
|
StatisticSet<byte> evs, Nature nature, bool allowedExperienceGain, bool isEgg)
|
||||||
IReadOnlyCollection<LearnedMove> moves, StatisticSet<byte> ivs, StatisticSet<byte> evs,
|
|
||||||
Nature nature)
|
|
||||||
{
|
{
|
||||||
var movesArr = moves.Select(x => x?.Ptr ?? IntPtr.Zero).ToArray();
|
var movesArr = moves.Select(x => x?.Ptr ?? IntPtr.Zero).ToArray();
|
||||||
|
|
||||||
|
@ -48,13 +44,11 @@ namespace PkmnLibSharp.Battling
|
||||||
var naturePtr = nature.Ptr;
|
var naturePtr = nature.Ptr;
|
||||||
|
|
||||||
var ptr = IntPtr.Zero;
|
var ptr = IntPtr.Zero;
|
||||||
Pkmnlib.Generated.Pokemon.Construct(ref ptr, libraryPtr, speciesPtr, formePtr, level, experience,
|
Pkmnlib.Generated.Pokemon.Construct(ref ptr, libraryPtr, speciesPtr, formePtr, level, experience, uid,
|
||||||
uid, (Pkmnlib.Gender) gender, coloring, heldItemPtr ?? IntPtr.Zero, nicknamePtr,
|
(Pkmnlib.Gender) gender, coloring, heldItemPtr ?? IntPtr.Zero, nicknamePtr, hiddenAbility.ToNative(),
|
||||||
hiddenAbility.ToNative(), abilityIndex,
|
abilityIndex, movesArr.ArrayPtr(), (ulong) moves.Count, ivs.HP, ivs.Attack, ivs.Defense,
|
||||||
movesArr.ArrayPtr(), (ulong) moves.Count,
|
ivs.SpecialAttack, ivs.SpecialDefense, ivs.Speed, evs.HP, evs.Attack, evs.Defense, evs.SpecialAttack,
|
||||||
ivs.HP, ivs.Attack, ivs.Defense, ivs.SpecialAttack,
|
evs.SpecialDefense, evs.Speed, naturePtr, allowedExperienceGain.ToNative(), isEgg.ToNative()).Assert();
|
||||||
ivs.SpecialDefense, ivs.Speed, evs.HP, evs.Attack, evs.Defense,
|
|
||||||
evs.SpecialAttack, evs.SpecialDefense, evs.Speed, naturePtr).Assert();
|
|
||||||
return ptr;
|
return ptr;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -122,6 +116,7 @@ namespace PkmnLibSharp.Battling
|
||||||
public bool IsShiny => Pkmnlib.Generated.Pokemon.IsShiny(Ptr) == 1;
|
public bool IsShiny => Pkmnlib.Generated.Pokemon.IsShiny(Ptr) == 1;
|
||||||
public uint CurrentHealth => Creaturelib.Generated.Creature.GetCurrentHealth(Ptr);
|
public uint CurrentHealth => Creaturelib.Generated.Creature.GetCurrentHealth(Ptr);
|
||||||
public uint MaxHealth => Creaturelib.Generated.Creature.GetMaxHealth(Ptr);
|
public uint MaxHealth => Creaturelib.Generated.Creature.GetMaxHealth(Ptr);
|
||||||
|
|
||||||
public byte Friendship
|
public byte Friendship
|
||||||
{
|
{
|
||||||
get => Pkmnlib.Generated.Pokemon.GetFriendship(Ptr);
|
get => Pkmnlib.Generated.Pokemon.GetFriendship(Ptr);
|
||||||
|
@ -140,6 +135,7 @@ namespace PkmnLibSharp.Battling
|
||||||
return ptr.PtrString();
|
return ptr.PtrString();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public Battle? Battle
|
public Battle? Battle
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -152,6 +148,7 @@ namespace PkmnLibSharp.Battling
|
||||||
return _battle;
|
return _battle;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public BattleSide? BattleSide
|
public BattleSide? BattleSide
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -164,7 +161,9 @@ namespace PkmnLibSharp.Battling
|
||||||
return _battleSide;
|
return _battleSide;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool IsOnBattleField => Creaturelib.Generated.Creature.IsOnBattleField(Ptr) == 1;
|
public bool IsOnBattleField => Creaturelib.Generated.Creature.IsOnBattleField(Ptr) == 1;
|
||||||
|
|
||||||
public Item? HeldItem
|
public Item? HeldItem
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -175,13 +174,13 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
item = Constructor.Active.ConstructItem(ptr);
|
item = Constructor.Active.ConstructItem(ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
return item;
|
return item;
|
||||||
}
|
}
|
||||||
set =>
|
set => Creaturelib.Generated.Creature.SetHeldItemFromItem(Ptr, value?.Ptr ?? IntPtr.Zero);
|
||||||
Creaturelib.Generated.Creature.SetHeldItemFromItem(Ptr,
|
|
||||||
value?.Ptr ?? IntPtr.Zero);
|
|
||||||
}
|
}
|
||||||
public string? Nickname
|
|
||||||
|
public virtual string? Nickname
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
{
|
{
|
||||||
|
@ -196,6 +195,9 @@ namespace PkmnLibSharp.Battling
|
||||||
_nickname = null;
|
_nickname = null;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public bool IsEgg => Pkmnlib.Generated.Pokemon.IsEgg(Ptr) == 1;
|
||||||
|
|
||||||
public ReadOnlyNativePtrArray<LearnedMove> Moves
|
public ReadOnlyNativePtrArray<LearnedMove> Moves
|
||||||
{
|
{
|
||||||
get
|
get
|
||||||
|
@ -220,7 +222,7 @@ namespace PkmnLibSharp.Battling
|
||||||
return managedArray;
|
return managedArray;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
public sbyte HpBoost => GetStatBoost(Statistic.Health);
|
public sbyte HpBoost => GetStatBoost(Statistic.Health);
|
||||||
public sbyte AttackBoost => GetStatBoost(Statistic.Attack);
|
public sbyte AttackBoost => GetStatBoost(Statistic.Attack);
|
||||||
public sbyte DefenseBoost => GetStatBoost(Statistic.Defense);
|
public sbyte DefenseBoost => GetStatBoost(Statistic.Defense);
|
||||||
|
@ -248,30 +250,39 @@ namespace PkmnLibSharp.Battling
|
||||||
public uint BoostedSpecialAttack => GetBoostedStat(Statistic.SpecialAttack);
|
public uint BoostedSpecialAttack => GetBoostedStat(Statistic.SpecialAttack);
|
||||||
public uint BoostedSpecialDefense => GetBoostedStat(Statistic.SpecialDefense);
|
public uint BoostedSpecialDefense => GetBoostedStat(Statistic.SpecialDefense);
|
||||||
public uint BoostedSpeed => GetBoostedStat(Statistic.Speed);
|
public uint BoostedSpeed => GetBoostedStat(Statistic.Speed);
|
||||||
|
|
||||||
public byte HpIv
|
public byte HpIv
|
||||||
{
|
{
|
||||||
get => GetIndividualValue(Statistic.Health);
|
get => GetIndividualValue(Statistic.Health);
|
||||||
set => SetEffortValue(Statistic.Health, value);
|
set => SetEffortValue(Statistic.Health, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte AttackIv{
|
public byte AttackIv
|
||||||
|
{
|
||||||
get => GetIndividualValue(Statistic.Attack);
|
get => GetIndividualValue(Statistic.Attack);
|
||||||
set => SetEffortValue(Statistic.Attack, value);
|
set => SetEffortValue(Statistic.Attack, value);
|
||||||
}
|
}
|
||||||
public byte DefenseIv{
|
|
||||||
|
public byte DefenseIv
|
||||||
|
{
|
||||||
get => GetIndividualValue(Statistic.Defense);
|
get => GetIndividualValue(Statistic.Defense);
|
||||||
set => SetEffortValue(Statistic.Defense, value);
|
set => SetEffortValue(Statistic.Defense, value);
|
||||||
}
|
}
|
||||||
public byte SpecialAttackIv{
|
|
||||||
|
public byte SpecialAttackIv
|
||||||
|
{
|
||||||
get => GetIndividualValue(Statistic.SpecialAttack);
|
get => GetIndividualValue(Statistic.SpecialAttack);
|
||||||
set => SetEffortValue(Statistic.SpecialAttack, value);
|
set => SetEffortValue(Statistic.SpecialAttack, value);
|
||||||
}
|
}
|
||||||
public byte SpecialDefenseIv{
|
|
||||||
|
public byte SpecialDefenseIv
|
||||||
|
{
|
||||||
get => GetIndividualValue(Statistic.SpecialDefense);
|
get => GetIndividualValue(Statistic.SpecialDefense);
|
||||||
set => SetEffortValue(Statistic.SpecialDefense, value);
|
set => SetEffortValue(Statistic.SpecialDefense, value);
|
||||||
}
|
}
|
||||||
public byte SpeedIv{
|
|
||||||
|
public byte SpeedIv
|
||||||
|
{
|
||||||
get => GetIndividualValue(Statistic.Speed);
|
get => GetIndividualValue(Statistic.Speed);
|
||||||
set => SetEffortValue(Statistic.Speed, value);
|
set => SetEffortValue(Statistic.Speed, value);
|
||||||
}
|
}
|
||||||
|
@ -288,19 +299,26 @@ namespace PkmnLibSharp.Battling
|
||||||
set => SetEffortValue(Statistic.Attack, value);
|
set => SetEffortValue(Statistic.Attack, value);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte DefenseEv{
|
public byte DefenseEv
|
||||||
|
{
|
||||||
get => GetEffortValue(Statistic.Defense);
|
get => GetEffortValue(Statistic.Defense);
|
||||||
set => SetEffortValue(Statistic.Defense, value);
|
set => SetEffortValue(Statistic.Defense, value);
|
||||||
}
|
}
|
||||||
public byte SpecialAttackEv{
|
|
||||||
|
public byte SpecialAttackEv
|
||||||
|
{
|
||||||
get => GetEffortValue(Statistic.SpecialAttack);
|
get => GetEffortValue(Statistic.SpecialAttack);
|
||||||
set => SetEffortValue(Statistic.SpecialAttack, value);
|
set => SetEffortValue(Statistic.SpecialAttack, value);
|
||||||
}
|
}
|
||||||
public byte SpecialDefenseEv {
|
|
||||||
|
public byte SpecialDefenseEv
|
||||||
|
{
|
||||||
get => GetEffortValue(Statistic.SpecialDefense);
|
get => GetEffortValue(Statistic.SpecialDefense);
|
||||||
set => SetEffortValue(Statistic.SpecialDefense, value);
|
set => SetEffortValue(Statistic.SpecialDefense, value);
|
||||||
}
|
}
|
||||||
public byte SpeedEv {
|
|
||||||
|
public byte SpeedEv
|
||||||
|
{
|
||||||
get => GetEffortValue(Statistic.Speed);
|
get => GetEffortValue(Statistic.Speed);
|
||||||
set => SetEffortValue(Statistic.Speed, value);
|
set => SetEffortValue(Statistic.Speed, value);
|
||||||
}
|
}
|
||||||
|
@ -330,10 +348,12 @@ namespace PkmnLibSharp.Battling
|
||||||
_forme = null;
|
_forme = null;
|
||||||
Creaturelib.Generated.Creature.ChangeVariant(Ptr, forme.Ptr);
|
Creaturelib.Generated.Creature.ChangeVariant(Ptr, forme.Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasHeldItem(string itemName)
|
public bool HasHeldItem(string itemName)
|
||||||
{
|
{
|
||||||
return Creaturelib.Generated.Creature.HasHeldItem(Ptr, itemName.ToPtr()) == 1;
|
return Creaturelib.Generated.Creature.HasHeldItem(Ptr, itemName.ToPtr()) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetHeldItem(string item)
|
public void SetHeldItem(string item)
|
||||||
{
|
{
|
||||||
if (string.IsNullOrEmpty(item))
|
if (string.IsNullOrEmpty(item))
|
||||||
|
@ -341,56 +361,68 @@ namespace PkmnLibSharp.Battling
|
||||||
else
|
else
|
||||||
Creaturelib.Generated.Creature.SetHeldItem(Ptr, item.ToPtr());
|
Creaturelib.Generated.Creature.SetHeldItem(Ptr, item.ToPtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasType(string type)
|
public bool HasType(string type)
|
||||||
{
|
{
|
||||||
var typeByte = Library.StaticLibrary.TypeLibrary.GetTypeId(type);
|
var typeByte = Library.StaticLibrary.TypeLibrary.GetTypeId(type);
|
||||||
return Creaturelib.Generated.Creature.HasType(Ptr, typeByte) == 1;
|
return Creaturelib.Generated.Creature.HasType(Ptr, typeByte) == 1;
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeLevelBy(sbyte amount)
|
public void ChangeLevelBy(sbyte amount)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.ChangeLevelBy(Ptr, amount).Assert();
|
Creaturelib.Generated.Creature.ChangeLevelBy(Ptr, amount).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddExperience(uint experience)
|
public void AddExperience(uint experience)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.AddExperience(Ptr, experience).Assert();
|
Creaturelib.Generated.Creature.AddExperience(Ptr, experience).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Damage(uint damage, DamageSource source)
|
public void Damage(uint damage, DamageSource source)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.Damage(Ptr, damage, (Creaturelib.DamageSource) source);
|
Creaturelib.Generated.Creature.Damage(Ptr, damage, (Creaturelib.DamageSource) source);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void Heal(uint amount, bool canRevive)
|
public void Heal(uint amount, bool canRevive)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.Heal(Ptr, amount, canRevive.ToNative()).Assert();
|
Creaturelib.Generated.Creature.Heal(Ptr, amount, canRevive.ToNative()).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RestoreAllPP()
|
public void RestoreAllPP()
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.RestoreAllAttackUses(Ptr);
|
Creaturelib.Generated.Creature.RestoreAllAttackUses(Ptr);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void OverrideActiveAbility(string ability)
|
public void OverrideActiveAbility(string ability)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.OverrideActiveTalent(Ptr, ability.ToPtr()).Assert();
|
Creaturelib.Generated.Creature.OverrideActiveTalent(Ptr, ability.ToPtr()).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearVolatileScripts()
|
public void ClearVolatileScripts()
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.ClearVolatileScripts(Ptr).Assert();
|
Creaturelib.Generated.Creature.ClearVolatileScripts(Ptr).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddVolatileScript(string scriptName)
|
public void AddVolatileScript(string scriptName)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.AddVolatileScriptByName(Ptr, scriptName.ToPtr()).Assert();
|
Creaturelib.Generated.Creature.AddVolatileScriptByName(Ptr, scriptName.ToPtr()).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void AddVolatileScript(Script script)
|
public void AddVolatileScript(Script script)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.AddVolatileScript(Ptr, script.Ptr).Assert();
|
Creaturelib.Generated.Creature.AddVolatileScript(Ptr, script.Ptr).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveVolatileScript(string scriptName)
|
public void RemoveVolatileScript(string scriptName)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.RemoveVolatileScriptByName(Ptr, scriptName.ToPtr()).Assert();
|
Creaturelib.Generated.Creature.RemoveVolatileScriptByName(Ptr, scriptName.ToPtr()).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void RemoveVolatileScript(Script script)
|
public void RemoveVolatileScript(Script script)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.RemoveVolatileScript(Ptr, script.Ptr).Assert();
|
Creaturelib.Generated.Creature.RemoveVolatileScript(Ptr, script.Ptr).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public bool HasVolatileScript(string scriptName)
|
public bool HasVolatileScript(string scriptName)
|
||||||
{
|
{
|
||||||
return Creaturelib.Generated.Creature.HasVolatileScript(Ptr, scriptName.ToPtr()) == 1;
|
return Creaturelib.Generated.Creature.HasVolatileScript(Ptr, scriptName.ToPtr()) == 1;
|
||||||
|
@ -405,6 +437,7 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
return Creaturelib.Generated.Creature.GetStatBoost(Ptr, (Creaturelib.Statistic) stat);
|
return Creaturelib.Generated.Creature.GetStatBoost(Ptr, (Creaturelib.Statistic) stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ChangeStatBoost(Statistic stat, sbyte amount)
|
public void ChangeStatBoost(Statistic stat, sbyte amount)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.ChangeStatBoost(Ptr, (Creaturelib.Statistic) stat, amount);
|
Creaturelib.Generated.Creature.ChangeStatBoost(Ptr, (Creaturelib.Statistic) stat, amount);
|
||||||
|
@ -414,18 +447,22 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
return Creaturelib.Generated.Creature.GetBaseStat(Ptr, (Creaturelib.Statistic) stat);
|
return Creaturelib.Generated.Creature.GetBaseStat(Ptr, (Creaturelib.Statistic) stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetFlatStat(Statistic stat)
|
public uint GetFlatStat(Statistic stat)
|
||||||
{
|
{
|
||||||
return Creaturelib.Generated.Creature.GetFlatStat(Ptr, (Creaturelib.Statistic) stat);
|
return Creaturelib.Generated.Creature.GetFlatStat(Ptr, (Creaturelib.Statistic) stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public uint GetBoostedStat(Statistic stat)
|
public uint GetBoostedStat(Statistic stat)
|
||||||
{
|
{
|
||||||
return Creaturelib.Generated.Creature.GetBoostedStat(Ptr, (Creaturelib.Statistic) stat);
|
return Creaturelib.Generated.Creature.GetBoostedStat(Ptr, (Creaturelib.Statistic) stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public byte GetIndividualValue(Statistic stat)
|
public byte GetIndividualValue(Statistic stat)
|
||||||
{
|
{
|
||||||
return Pkmnlib.Generated.Pokemon.GetIndividualValue(Ptr, (Pkmnlib.Statistic) stat);
|
return Pkmnlib.Generated.Pokemon.GetIndividualValue(Ptr, (Pkmnlib.Statistic) stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetIndividualValue(Statistic stat, byte value)
|
public void SetIndividualValue(Statistic stat, byte value)
|
||||||
{
|
{
|
||||||
Pkmnlib.Generated.Pokemon.SetIndividualValue(Ptr, (Pkmnlib.Statistic) stat, value);
|
Pkmnlib.Generated.Pokemon.SetIndividualValue(Ptr, (Pkmnlib.Statistic) stat, value);
|
||||||
|
@ -435,6 +472,7 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
return Pkmnlib.Generated.Pokemon.GetEffortValue(Ptr, (Pkmnlib.Statistic) stat);
|
return Pkmnlib.Generated.Pokemon.GetEffortValue(Ptr, (Pkmnlib.Statistic) stat);
|
||||||
}
|
}
|
||||||
|
|
||||||
public void SetEffortValue(Statistic stat, byte value)
|
public void SetEffortValue(Statistic stat, byte value)
|
||||||
{
|
{
|
||||||
Pkmnlib.Generated.Pokemon.SetEffortValue(Ptr, (Pkmnlib.Statistic) stat, value);
|
Pkmnlib.Generated.Pokemon.SetEffortValue(Ptr, (Pkmnlib.Statistic) stat, value);
|
||||||
|
@ -444,6 +482,7 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
Pkmnlib.Generated.Pokemon.SetStatus(Ptr, name.ToPtr());
|
Pkmnlib.Generated.Pokemon.SetStatus(Ptr, name.ToPtr());
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ClearStatus()
|
public void ClearStatus()
|
||||||
{
|
{
|
||||||
Pkmnlib.Generated.Pokemon.ClearStatus(Ptr);
|
Pkmnlib.Generated.Pokemon.ClearStatus(Ptr);
|
||||||
|
@ -463,6 +502,7 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.AddAttack(Ptr, move.Ptr).Assert();
|
Creaturelib.Generated.Creature.AddAttack(Ptr, move.Ptr).Assert();
|
||||||
}
|
}
|
||||||
|
|
||||||
public void ReplaceMove(byte index, LearnedMove move)
|
public void ReplaceMove(byte index, LearnedMove move)
|
||||||
{
|
{
|
||||||
Creaturelib.Generated.Creature.ReplaceAttack(Ptr, index, move.Ptr).Assert();
|
Creaturelib.Generated.Creature.ReplaceAttack(Ptr, index, move.Ptr).Assert();
|
||||||
|
@ -504,6 +544,7 @@ namespace PkmnLibSharp.Battling
|
||||||
{
|
{
|
||||||
move?.MarkAsDeleted();
|
move?.MarkAsDeleted();
|
||||||
}
|
}
|
||||||
|
|
||||||
base.MarkAsDeleted();
|
base.MarkAsDeleted();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -29,6 +29,8 @@ namespace PkmnLibSharp.Battling
|
||||||
|
|
||||||
public bool? IsForceShiny { get; private set; }
|
public bool? IsForceShiny { get; private set; }
|
||||||
public string? HeldItem { get; private set; }
|
public string? HeldItem { get; private set; }
|
||||||
|
public bool IsEgg { get; private set; }
|
||||||
|
public bool IsAllowedExperienceGain { get; private set; } = true;
|
||||||
|
|
||||||
public List<(string moveName, MoveLearnMethod learnMethod)> LearnedMoves { get; } =
|
public List<(string moveName, MoveLearnMethod learnMethod)> LearnedMoves { get; } =
|
||||||
new List<(string moveName, MoveLearnMethod learnMethod)>();
|
new List<(string moveName, MoveLearnMethod learnMethod)>();
|
||||||
|
@ -86,6 +88,18 @@ namespace PkmnLibSharp.Battling
|
||||||
EVs = evs;
|
EVs = evs;
|
||||||
return this;
|
return this;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public BasePokemonBuilder<TPokemon, TLearnedMove> MakeEgg()
|
||||||
|
{
|
||||||
|
IsEgg = true;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public BasePokemonBuilder<TPokemon, TLearnedMove> AllowedExperienceGain(bool value)
|
||||||
|
{
|
||||||
|
IsAllowedExperienceGain = value;
|
||||||
|
return this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
public BasePokemonBuilder<TPokemon, TLearnedMove> LearnMove(string moveName, MoveLearnMethod moveLearnMethod)
|
public BasePokemonBuilder<TPokemon, TLearnedMove> LearnMove(string moveName, MoveLearnMethod moveLearnMethod)
|
||||||
|
|
|
@ -34,9 +34,11 @@ namespace Pkmnlib.Generated
|
||||||
/// <param name="sDeEv">unsigned char</param>
|
/// <param name="sDeEv">unsigned char</param>
|
||||||
/// <param name="spEv">unsigned char</param>
|
/// <param name="spEv">unsigned char</param>
|
||||||
/// <param name="nature">const Nature *</param>
|
/// <param name="nature">const Nature *</param>
|
||||||
|
/// <param name="allowedExperienceGain">bool</param>
|
||||||
|
/// <param name="isEgg">bool</param>
|
||||||
/// <returns>unsigned char</returns>
|
/// <returns>unsigned char</returns>
|
||||||
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_Construct")]
|
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_Construct")]
|
||||||
internal static extern byte Construct(ref IntPtr @out, IntPtr library, IntPtr species, IntPtr forme, byte level, uint experience, uint uid, Gender gender, byte coloring, IntPtr heldItem, IntPtr nickname, byte hiddenAbility, byte abilityIndex, IntPtr moves, ulong moveCount, byte hpIv, byte attIv, byte defIv, byte sAtIv, byte sDeIv, byte spIv, byte hpEv, byte attEv, byte defEv, byte sAtEv, byte sDeEv, byte spEv, IntPtr nature);
|
internal static extern byte Construct(ref IntPtr @out, IntPtr library, IntPtr species, IntPtr forme, byte level, uint experience, uint uid, Gender gender, byte coloring, IntPtr heldItem, IntPtr nickname, byte hiddenAbility, byte abilityIndex, IntPtr moves, ulong moveCount, byte hpIv, byte attIv, byte defIv, byte sAtIv, byte sDeIv, byte spIv, byte hpEv, byte attEv, byte defEv, byte sAtEv, byte sDeEv, byte spEv, IntPtr nature, byte allowedExperienceGain, byte isEgg);
|
||||||
|
|
||||||
/// <param name="p">const Pokemon *</param>
|
/// <param name="p">const Pokemon *</param>
|
||||||
/// <returns>void</returns>
|
/// <returns>void</returns>
|
||||||
|
@ -112,6 +114,11 @@ namespace Pkmnlib.Generated
|
||||||
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_ChangeFriendship")]
|
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_ChangeFriendship")]
|
||||||
internal static extern void ChangeFriendship(IntPtr p, sbyte amount);
|
internal static extern void ChangeFriendship(IntPtr p, sbyte amount);
|
||||||
|
|
||||||
|
/// <param name="p">const Pokemon *</param>
|
||||||
|
/// <returns>bool</returns>
|
||||||
|
[DllImport("libpkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_IsEgg")]
|
||||||
|
internal static extern byte IsEgg(IntPtr p);
|
||||||
|
|
||||||
/// <param name="p">Pokemon *</param>
|
/// <param name="p">Pokemon *</param>
|
||||||
/// <param name="species">const PokemonSpecies *</param>
|
/// <param name="species">const PokemonSpecies *</param>
|
||||||
/// <param name="forme">const PokemonForme *</param>
|
/// <param name="forme">const PokemonForme *</param>
|
||||||
|
|
BIN
PkmnLibSharp/Native/Linux/libArbutils.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/Linux/libArbutils.so (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/Linux/libCreatureLib.so (Stored with Git LFS)
BIN
PkmnLibSharp/Native/Linux/libCreatureLib.so (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/Linux/libpkmnLib.so (Stored with Git LFS)
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)
BIN
PkmnLibSharp/Native/Linux/libpkmnlib_ai.so (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/Windows/libArbutils.dll (Stored with Git LFS)
BIN
PkmnLibSharp/Native/Windows/libArbutils.dll (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/Windows/libCreatureLib.dll (Stored with Git LFS)
BIN
PkmnLibSharp/Native/Windows/libCreatureLib.dll (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/Windows/libangelscript.dll (Stored with Git LFS)
BIN
PkmnLibSharp/Native/Windows/libangelscript.dll (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/Windows/libpkmnLib.dll (Stored with Git LFS)
BIN
PkmnLibSharp/Native/Windows/libpkmnLib.dll (Stored with Git LFS)
Binary file not shown.
BIN
PkmnLibSharp/Native/Windows/libpkmnlib_ai.dll (Stored with Git LFS)
BIN
PkmnLibSharp/Native/Windows/libpkmnlib_ai.dll (Stored with Git LFS)
Binary file not shown.
File diff suppressed because one or more lines are too long
|
@ -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":"ScriptCategory","values":{"0":"Attack","1":"Talent","2":"Status","3":"Creature","4":"Battle","5":"Side"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"TurnChoiceKind","values":{"0":"Pass","1":"Attack","2":"Item","3":"Switch","4":"Flee"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"EffectParameterType","values":{"0":"None","1":"Bool","2":"Int","3":"Float","4":"String"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"Statistic","values":{"0":"Health","1":"PhysicalAttack","2":"PhysicalDefense","3":"MagicalAttack","4":"MagicalDefense","5":"Speed"}}],"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":"EffectParameterType","values":{"0":"None","1":"Bool","2":"Int","3":"Float","4":"String"}},{"byteSize":1,"filename":"libpkmnlib_ai","name":"Statistic","values":{"0":"Health","1":"PhysicalAttack","2":"PhysicalDefense","3":"MagicalAttack","4":"MagicalDefense","5":"Speed"}},{"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 *"}]}
|
||||||
|
|
|
@ -1,5 +1,6 @@
|
||||||
using System;
|
using System;
|
||||||
using System.Collections.Generic;
|
using System.Collections.Generic;
|
||||||
|
using NUnit.Framework;
|
||||||
using PkmnLibSharp.Battling;
|
using PkmnLibSharp.Battling;
|
||||||
using PkmnLibSharp.Library;
|
using PkmnLibSharp.Library;
|
||||||
using PkmnLibSharp.Library.Items;
|
using PkmnLibSharp.Library.Items;
|
||||||
|
@ -16,8 +17,8 @@ namespace PkmnLibSharpTests.Battling
|
||||||
|
|
||||||
protected override Pokemon Finalize(Species species, Forme forme, Item? heldItem, IReadOnlyCollection<LearnedMove> moves, Nature nature)
|
protected override Pokemon Finalize(Species species, Forme forme, Item? heldItem, IReadOnlyCollection<LearnedMove> moves, Nature nature)
|
||||||
{
|
{
|
||||||
var pkmn = new Pokemon(Library, species, forme, Level, Experience, Uid, Gender, Coloring,
|
var pkmn = new Pokemon(Library, species, forme, Level, Experience, Uid, Gender, Coloring, heldItem,
|
||||||
heldItem, Nickname, HiddenAbility, (byte) AbilityIndex, moves, IVs, EVs, nature);
|
Nickname, HiddenAbility, (byte) AbilityIndex, moves, IVs, EVs, nature, IsAllowedExperienceGain, IsEgg);
|
||||||
return pkmn;
|
return pkmn;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue