More move effects
This commit is contained in:
@@ -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()
|
||||
|
||||
@@ -6,7 +6,7 @@ namespace PkmnLib.Dynamic.ScriptHandling.Registry;
|
||||
/// <summary>
|
||||
/// Helper attribute to register scripts through reflection.
|
||||
/// </summary>
|
||||
[AttributeUsage(AttributeTargets.Class)]
|
||||
[AttributeUsage(AttributeTargets.Class, Inherited = false)]
|
||||
[MeansImplicitUse]
|
||||
public class ScriptAttribute : Attribute
|
||||
{
|
||||
|
||||
@@ -554,4 +554,8 @@ public abstract class Script : IDeepCloneable
|
||||
public virtual void ChangeIncomingDamage(IPokemon pokemon, DamageSource source, ref uint damage)
|
||||
{
|
||||
}
|
||||
|
||||
public virtual void ChangeAccuracy(IExecutingMove executingMove, IPokemon target, byte hitIndex, ref int modifiedAccuracy)
|
||||
{
|
||||
}
|
||||
}
|
||||
Reference in New Issue
Block a user