41 lines
1.3 KiB
C#
41 lines
1.3 KiB
C#
using PkmnLibSharp.FFI;
|
|
using PkmnLibSharp.Utils;
|
|
using Interface = PkmnLibSharp.FFI.DynamicData.Libraries.DamageLibrary;
|
|
|
|
namespace PkmnLibSharp.DynamicData.Libraries
|
|
{
|
|
/// <summary>
|
|
/// A damage library holds the functions related to the calculation of damage.
|
|
/// </summary>
|
|
public abstract class DamageLibrary : HandleType
|
|
{
|
|
/// <inheritdoc cref="DamageLibrary"/>
|
|
protected DamageLibrary(FFIHandle ptr) : base(ptr)
|
|
{
|
|
}
|
|
}
|
|
|
|
/// <summary>
|
|
/// The implementation of a Damage Library for generation 7.
|
|
/// </summary>
|
|
public class Gen7DamageLibrary : DamageLibrary
|
|
{
|
|
/// <inheritdoc cref="Gen7DamageLibrary"/>
|
|
public Gen7DamageLibrary(FFIHandle ptr) : base(ptr)
|
|
{
|
|
}
|
|
|
|
/// <summary>
|
|
/// Creates a new generation 7 damage library
|
|
/// </summary>
|
|
/// <param name="hasRandomness">
|
|
/// Whether or not a random damage modifier (0.85x - 1.00x) is applied to the calculated damage
|
|
/// </param>
|
|
/// <returns></returns>
|
|
public static Gen7DamageLibrary Create(bool hasRandomness)
|
|
{
|
|
var handle = Interface.gen_7_damage_library_new((byte)(hasRandomness ? 1 : 0));
|
|
return (Gen7DamageLibrary)Resolver.Instance.ResolveDamageLibrary(handle.Resolve());
|
|
}
|
|
}
|
|
} |