using System;
using System.Runtime.InteropServices;
using PkmnLibSharp.DynamicData;
using PkmnLibSharp.FFI.StaticData;
using PkmnLibSharp.StaticData;
namespace PkmnLibSharp.FFI.DynamicData
{
internal static class Pokemon
{
///
/// Instantiates a new Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_new(IntPtr dynamicLibrary, IntPtr species, IntPtr form,
byte hiddenAbility, byte abilityIndex, LevelInt level, uint uniqueIdentifier, Gender gender, byte coloring,
IntPtr natureName);
///
/// Drops an Arc reference held by the FFI.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_drop(IntPtr pokemon);
///
/// The library data of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_library(IntPtr pokemon);
///
/// The species of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_species(IntPtr pokemon);
///
/// The form of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_form(IntPtr pokemon);
///
/// The species that should be displayed to the user. This handles stuff like the Illusion ability.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_display_species(IntPtr pokemon);
///
/// The form that should be displayed to the user. This handles stuff like the Illusion ability.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_display_form(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern LevelInt pokemon_level(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern uint pokemon_experience(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern uint pokemon_unique_identifier(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern Gender pokemon_gender(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_coloring(IntPtr pokemon);
///
/// Gets the held item of a Pokemon
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_held_item(IntPtr pokemon);
///
/// Checks whether the Pokemon is holding a specific item.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_has_held_item(IntPtr pokemon, IntPtr itemName);
///
/// Changes the held item of the Pokemon. Returns the previously held item.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_set_held_item(IntPtr pokemon, IntPtr item);
///
/// Removes the held item from the Pokemon. Returns the previously held item.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_remove_held_item(IntPtr pokemon);
///
/// Makes the Pokemon uses its held item.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_consume_held_item(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern uint pokemon_current_health(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern uint pokemon_max_health(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern float pokemon_weight(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern float pokemon_height(IntPtr pokemon);
///
/// An optional nickname of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IntPtr pokemon_nickname(IntPtr pokemon);
///
/// Whether the actual ability on the form is a hidden ability.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_real_ability_is_hidden(IntPtr pokemon);
///
/// The index of the actual ability on the form.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_real_ability_index(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern ulong pokemon_types_length(IntPtr pokemon);
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern TypeIdentifier pokemon_types_get(IntPtr pokemon, ulong index);
///
/// Gets a learned move of the Pokemon. Index should generally be below [`MAX_MOVES`], you will get
/// a null pointer otherwise.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_learned_move_get(IntPtr pokemon, ulong index);
///
/// The stats of the Pokemon when disregarding any stat boosts.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_flat_stats(IntPtr pokemon);
///
/// The stats of the Pokemon including the stat boosts.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_boosted_stats(IntPtr pokemon);
///
/// Get the stat boosts for a specific stat.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern sbyte pokemon_get_stat_boost(IntPtr pokemon, Statistic statistic);
///
/// Change a boosted stat by a certain amount.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern sbyte pokemon_change_stat_boost(IntPtr pokemon, Statistic statistic, sbyte diffAmount,
byte selfInflicted);
///
/// Gets a individual value of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_get_individual_value(IntPtr pokemon, Statistic statistic);
///
/// Modifies a individual value of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_set_individual_value(IntPtr pokemon, Statistic statistic, byte value);
///
/// Gets a effort value of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_get_effort_value(IntPtr pokemon, Statistic statistic);
///
/// Modifies a effort value of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_set_effort_value(IntPtr pokemon, Statistic statistic, byte value);
///
/// Gets the data for the battle the Pokemon is currently in. If the Pokemon is not in a battle, this
/// returns null.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_get_battle(IntPtr pokemon);
///
/// Get the index of the side of the battle the Pokemon is in. If the Pokemon
/// is not on the battlefield, this always returns 0.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_get_battle_side_index(IntPtr pokemon);
///
/// Get the index of the slot on the side of the battle the Pokemon is in. If the Pokemon
/// is not on the battlefield, this always returns 0.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_get_battle_index(IntPtr pokemon);
///
/// Returns whether something overrides the ability.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_is_ability_overriden(IntPtr pokemon);
///
/// Returns the currently active ability.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_active_ability(IntPtr pokemon);
///
/// Whether or not the Pokemon is allowed to gain experience.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_allowed_experience_gain(IntPtr pokemon);
///
/// The nature of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern IdentifiablePointer pokemon_nature(IntPtr pokemon);
///
/// Calculates the flat stats on the Pokemon. This should be called when for example the base
/// stats, level, nature, IV, or EV changes. This has a side effect of recalculating the boosted
/// stats, as those depend on the flat stats.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_recalculate_flat_stats(IntPtr pokemon);
///
/// Calculates the boosted stats on the Pokemon. This should be called when a stat boost changes.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_recalculate_boosted_stats(IntPtr pokemon);
///
/// Change the species of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_change_species(IntPtr pokemon, IntPtr species, IntPtr form);
///
/// Change the form of the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_change_form(IntPtr pokemon, IntPtr form);
///
/// Whether or not the Pokemon is usable in a battle.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_is_usable(IntPtr pokemon);
///
/// Returns whether the Pokemon is fainted.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_is_fainted(IntPtr pokemon);
///
/// Whether or not the Pokemon is on the battlefield.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_is_on_battlefield(IntPtr pokemon);
///
/// Damages the Pokemon by a certain amount of damage, from a damage source.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_damage(IntPtr pokemon, uint damage, DamageSource damageSource);
///
/// Heals the Pokemon by a specific amount. Unless allowRevive is set to 1, this will not
/// heal if the Pokemon has 0 health. If the amount healed is 0, this will return false.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern byte pokemon_heal(IntPtr pokemon, uint damage, byte allowRevive);
///
/// Learn a move.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_learn_move(IntPtr pokemon, IntPtr moveName, MoveLearnMethod learnMethod);
///
/// Removes the current non-volatile status from the Pokemon.
///
[DllImport(Data.DllName, CallingConvention = CallingConvention.Cdecl, CharSet = CharSet.Ansi)]
internal static extern void pokemon_clear_status(IntPtr pokemon);
}
}