More abilities
This commit is contained in:
@@ -235,7 +235,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
||||
/// Changes the held item of the Pokemon. Returns the previously held item.
|
||||
/// </summary>
|
||||
[MustUseReturnValue]
|
||||
IItem? SetHeldItem(IItem? item);
|
||||
IItem? ForceSetHeldItem(IItem? item);
|
||||
|
||||
/// <summary>
|
||||
/// Removes the held item from the Pokemon. Returns the previously held item.
|
||||
@@ -243,6 +243,8 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
||||
[MustUseReturnValue]
|
||||
IItem? RemoveHeldItem();
|
||||
|
||||
bool HasItemBeenRemovedForBattle { get; }
|
||||
|
||||
/// <summary>
|
||||
/// Removes the held item from the Pokemon for the duration of the battle. Returns the previously held item.
|
||||
/// </summary>
|
||||
@@ -261,7 +263,7 @@ public interface IPokemon : IScriptSource, IDeepCloneable
|
||||
/// <summary>
|
||||
/// Restores the held item of a Pokémon if it was temporarily removed.
|
||||
/// </summary>
|
||||
void RestoreStolenHeldItem();
|
||||
void RestoreRemovedHeldItem();
|
||||
|
||||
/// <summary>
|
||||
/// Makes the Pokemon uses its held item. Returns whether the item was consumed.
|
||||
@@ -788,7 +790,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
public bool HasHeldItem(StringKey itemName) => HeldItem?.Name == itemName;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IItem? SetHeldItem(IItem? item)
|
||||
public IItem? ForceSetHeldItem(IItem? item)
|
||||
{
|
||||
var previous = HeldItem;
|
||||
HeldItem = item;
|
||||
@@ -812,12 +814,15 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
return previous;
|
||||
}
|
||||
|
||||
private IItem? _stolenHeldItem;
|
||||
/// <inheritdoc />
|
||||
public bool HasItemBeenRemovedForBattle => _removedHeldItem is not null;
|
||||
|
||||
private IItem? _removedHeldItem;
|
||||
|
||||
/// <inheritdoc />
|
||||
public IItem? RemoveHeldItemForBattle()
|
||||
{
|
||||
return _stolenHeldItem = RemoveHeldItem();
|
||||
return _removedHeldItem = RemoveHeldItem();
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -840,10 +845,10 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
public void RestoreStolenHeldItem()
|
||||
public void RestoreRemovedHeldItem()
|
||||
{
|
||||
_ = SetHeldItem(_stolenHeldItem);
|
||||
_stolenHeldItem = null;
|
||||
_ = ForceSetHeldItem(_removedHeldItem);
|
||||
_removedHeldItem = null;
|
||||
}
|
||||
|
||||
/// <inheritdoc />
|
||||
@@ -863,7 +868,7 @@ public class PokemonImpl : ScriptSource, IPokemon
|
||||
BattleData.MarkItemAsConsumed(HeldItem);
|
||||
}
|
||||
|
||||
UseItem(SetHeldItem(null)!);
|
||||
UseItem(ForceSetHeldItem(null)!);
|
||||
return true;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user