More move effects

This commit is contained in:
2025-03-02 14:03:51 +01:00
parent 9b0ac36597
commit c0bc905c46
40 changed files with 804 additions and 46 deletions

View File

@@ -240,6 +240,20 @@ public interface IPokemon : IScriptSource, IDeepCloneable
/// </summary>
[MustUseReturnValue]
IItem? RemoveHeldItem();
/// <summary>
/// Removes the held item from the Pokemon for the duration of the battle. Returns the previously held item.
/// </summary>
/// <remarks>
/// This is used for moves that remove a held item, but do not consume it. In this case, the item needs to be
/// restored after the battle.
/// </remarks>
IItem? RemoveHeldItemForBattle();
/// <summary>
/// Restores the held item of a Pokémon if it was temporarily removed.
/// </summary>
void RestoreStolenHeldItem();
/// <summary>
/// Makes the Pokemon uses its held item. Returns whether the item was consumed.
@@ -716,6 +730,21 @@ public class PokemonImpl : ScriptSource, IPokemon
HeldItem = null;
return previous;
}
private IItem? _stolenHeldItem;
/// <inheritdoc />
public IItem? RemoveHeldItemForBattle()
{
return _stolenHeldItem = RemoveHeldItem();
}
/// <inheritdoc />
public void RestoreStolenHeldItem()
{
_ = SetHeldItem(_stolenHeldItem);
_stolenHeldItem = null;
}
/// <inheritdoc />
public bool ConsumeHeldItem()