2 using System.Collections.Immutable;
6 internal sealed
class AbilityConditionHoldingItem : AbilityConditionDataless
8 private readonly ImmutableHashSet<Identifier> tags;
10 public AbilityConditionHoldingItem(CharacterTalent characterTalent, ContentXElement conditionElement) : base(characterTalent, conditionElement)
12 tags = conditionElement.GetAttributeIdentifierImmutableHashSet(
"tags", ImmutableHashSet<Identifier>.Empty);
15 protected override bool MatchesConditionSpecific()
19 return HasItemInHand(character, Identifier.Empty);
22 foreach (Identifier tag
in tags)
24 if (HasItemInHand(character, tag)) {
return true; }
29 static bool HasItemInHand(Character character, Identifier tagOrIdentifier) =>
30 character.GetEquippedItem(tagOrIdentifier,
InvSlotType.RightHand) is not
null ||
31 character.GetEquippedItem(tagOrIdentifier,
InvSlotType.LeftHand) is not
null;