Adds setters for IVs and EVs.

This commit is contained in:
Deukhoofd 2020-08-08 18:00:36 +02:00
parent 00167ecbb4
commit a19c3bdeb4
Signed by: Deukhoofd
GPG Key ID: F63E044490819F6F
5 changed files with 98 additions and 15 deletions

View File

@ -202,19 +202,61 @@ namespace PkmnLibSharp.Battling
public uint BoostedSpecialDefense => GetBoostedStat(Statistic.SpecialDefense);
public uint BoostedSpeed => GetBoostedStat(Statistic.Speed);
public byte HpIv => GetIndividualValue(Statistic.Health);
public byte AttackIv => GetIndividualValue(Statistic.Attack);
public byte DefenseIv => GetIndividualValue(Statistic.Defense);
public byte SpecialAttackIv => GetIndividualValue(Statistic.SpecialAttack);
public byte SpecialDefenseIv => GetIndividualValue(Statistic.SpecialDefense);
public byte SpeedIv => GetIndividualValue(Statistic.Speed);
public byte HpIv
{
get => GetIndividualValue(Statistic.Health);
set => SetEffortValue(Statistic.Health, value);
}
public byte HpEv => GetEffortValue(Statistic.Health);
public byte AttackEv => GetEffortValue(Statistic.Attack);
public byte DefenseEv => GetEffortValue(Statistic.Defense);
public byte SpecialAttackEv => GetEffortValue(Statistic.SpecialAttack);
public byte SpecialDefenseEv => GetEffortValue(Statistic.SpecialDefense);
public byte SpeedEv => GetEffortValue(Statistic.Speed);
public byte AttackIv{
get => GetIndividualValue(Statistic.Attack);
set => SetEffortValue(Statistic.Attack, value);
}
public byte DefenseIv{
get => GetIndividualValue(Statistic.Defense);
set => SetEffortValue(Statistic.Defense, value);
}
public byte SpecialAttackIv{
get => GetIndividualValue(Statistic.SpecialAttack);
set => SetEffortValue(Statistic.SpecialAttack, value);
}
public byte SpecialDefenseIv{
get => GetIndividualValue(Statistic.SpecialDefense);
set => SetEffortValue(Statistic.SpecialDefense, value);
}
public byte SpeedIv{
get => GetIndividualValue(Statistic.Speed);
set => SetEffortValue(Statistic.Speed, value);
}
public byte HpEv
{
get => GetEffortValue(Statistic.Health);
set => SetEffortValue(Statistic.Health, value);
}
public byte AttackEv
{
get => GetEffortValue(Statistic.Attack);
set => SetEffortValue(Statistic.Attack, value);
}
public byte DefenseEv{
get => GetEffortValue(Statistic.Defense);
set => SetEffortValue(Statistic.Defense, value);
}
public byte SpecialAttackEv{
get => GetEffortValue(Statistic.SpecialAttack);
set => SetEffortValue(Statistic.SpecialAttack, value);
}
public byte SpecialDefenseEv {
get => GetEffortValue(Statistic.SpecialDefense);
set => SetEffortValue(Statistic.SpecialDefense, value);
}
public byte SpeedEv {
get => GetEffortValue(Statistic.Speed);
set => SetEffortValue(Statistic.Speed, value);
}
public Nature Nature
{
@ -326,10 +368,19 @@ namespace PkmnLibSharp.Battling
{
return Pkmnlib.Generated.Pokemon.GetIndividualValue(Ptr, (Pkmnlib.Statistic) stat);
}
public void SetIndividualValue(Statistic stat, byte value)
{
Pkmnlib.Generated.Pokemon.SetIndividualValue(Ptr, (Pkmnlib.Statistic) stat, value);
}
public byte GetEffortValue(Statistic stat)
{
return Pkmnlib.Generated.Pokemon.GetEffortValue(Ptr, (Pkmnlib.Statistic) stat);
}
public void SetEffortValue(Statistic stat, byte value)
{
Pkmnlib.Generated.Pokemon.SetEffortValue(Ptr, (Pkmnlib.Statistic) stat, value);
}
public void SetStatus(string name)
{

View File

@ -64,6 +64,24 @@ namespace PkmnLibSharp.Battling
return this;
}
public BasePokemonBuilder<T> WithNature(string nature)
{
Nature = nature;
return this;
}
public BasePokemonBuilder<T> WithIVs(StatisticSet<byte> ivs)
{
IVs = ivs;
return this;
}
public BasePokemonBuilder<T> WithEVs(StatisticSet<byte> evs)
{
EVs = evs;
return this;
}
public BasePokemonBuilder<T> LearnMove(string moveName, MoveLearnMethod moveLearnMethod)
{
if (LearnedMoves.Count > Library.StaticLibrary.Settings.MaximalMoves)

View File

@ -58,12 +58,26 @@ namespace Pkmnlib.Generated
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_GetIndividualValue")]
internal static extern byte GetIndividualValue(IntPtr p, Statistic stat);
/// <param name="p">Pokemon *</param>
/// <param name="stat">Statistic</param>
/// <param name="value">unsigned char</param>
/// <returns>void</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_SetIndividualValue")]
internal static extern void SetIndividualValue(IntPtr p, Statistic stat, byte value);
/// <param name="p">const Pokemon *</param>
/// <param name="stat">Statistic</param>
/// <returns>unsigned char</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_GetEffortValue")]
internal static extern byte GetEffortValue(IntPtr p, Statistic stat);
/// <param name="p">Pokemon *</param>
/// <param name="stat">Statistic</param>
/// <param name="value">unsigned char</param>
/// <returns>void</returns>
[DllImport("pkmnLib", CallingConvention = CallingConvention.Cdecl, EntryPoint= "PkmnLib_Pokemon_SetEffortValue")]
internal static extern void SetEffortValue(IntPtr p, Statistic stat, byte value);
/// <param name="p">Pokemon *</param>
/// <param name="name">const char *</param>
/// <returns>unsigned char</returns>

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

Binary file not shown.

File diff suppressed because one or more lines are too long