Adds several convenience features

This commit is contained in:
2024-09-30 14:20:45 +02:00
parent 257c04c98b
commit a39c77745d
9 changed files with 72 additions and 13 deletions

View File

@@ -107,6 +107,11 @@ public interface IPokemon : IScriptSource
/// The stats of the Pokemon including the stat boosts
/// </summary>
StatisticSet<uint> BoostedStats { get; }
/// <summary>
/// The maximum health of the Pokemon.
/// </summary>
uint MaxHealth { get; }
/// <summary>
/// The individual values of the Pokemon.
@@ -268,6 +273,11 @@ public interface IPokemon : IScriptSource
/// heal if the Pokemon has 0 health. If the amount healed is 0, this will return false.
/// </summary>
bool Heal(uint heal, bool allowRevive);
/// <summary>
/// Restores all PP of the Pokemon.
/// </summary>
void RestoreAllPP();
/// <summary>
/// Learn a move by name.
@@ -489,6 +499,9 @@ public class PokemonImpl : ScriptSource, IPokemon
/// <inheritdoc />
public StatisticSet<uint> BoostedStats { get; } = new();
/// <inheritdoc />
public uint MaxHealth => BoostedStats.Hp;
/// <inheritdoc />
public IndividualValueStatisticSet IndividualValues { get; } = new();
@@ -780,6 +793,15 @@ public class PokemonImpl : ScriptSource, IPokemon
return true;
}
/// <inheritdoc />
public void RestoreAllPP()
{
foreach (var move in Moves)
{
move?.RestoreAllUses();
}
}
/// <inheritdoc />
/// <remarks>
/// If the index is 255, it will try to find the first empty move slot.