Initial set up for item use

This commit is contained in:
2025-01-10 11:11:50 +01:00
parent 85ea31f7cd
commit 0518499a4c
23 changed files with 305 additions and 59 deletions

View File

@@ -1,4 +1,5 @@
using System.Collections.Immutable;
using PkmnLib.Static.Moves;
using PkmnLib.Static.Utils;
namespace PkmnLib.Static;
@@ -104,6 +105,9 @@ public interface IItem : INamedValue
/// A set of arbitrary flags that can be set on the item.
/// </summary>
ImmutableHashSet<StringKey> Flags { get; }
ISecondaryEffect? Effect { get; }
ISecondaryEffect? BattleEffect { get; }
/// <summary>
/// Checks whether the item has a specific flag.
@@ -118,12 +122,14 @@ public class ItemImpl : IItem
{
/// <inheritdoc cref="ItemImpl"/>
public ItemImpl(StringKey name, ItemCategory category, BattleItemCategory battleCategory, int price,
IEnumerable<StringKey> flags)
IEnumerable<StringKey> flags, ISecondaryEffect? effect, ISecondaryEffect? battleTriggerEffect)
{
Name = name;
Category = category;
BattleCategory = battleCategory;
Price = price;
Effect = effect;
BattleEffect = battleTriggerEffect;
Flags = [..flags];
}
@@ -142,6 +148,12 @@ public class ItemImpl : IItem
/// <inheritdoc />
public ImmutableHashSet<StringKey> Flags { get; }
/// <inheritdoc />
public ISecondaryEffect? Effect { get; }
/// <inheritdoc />
public ISecondaryEffect? BattleEffect { get; }
/// <inheritdoc />
public bool HasFlag(string key)
{