3 using System.Collections.Immutable;
7 internal sealed
class CharacterAbilityGiveItemStatToTags: CharacterAbility
9 private readonly ItemTalentStats stat;
10 private readonly
float value;
11 private readonly ImmutableHashSet<Identifier> tags;
12 private readonly
bool stackable;
13 private readonly
bool save;
15 public CharacterAbilityGiveItemStatToTags(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
17 stat = abilityElement.GetAttributeEnum(
"stattype", ItemTalentStats.None);
18 value = abilityElement.GetAttributeFloat(
"value", 0f);
19 tags = abilityElement.GetAttributeIdentifierImmutableHashSet(
"tags", ImmutableHashSet<Identifier>.Empty);
20 stackable = abilityElement.GetAttributeBool(
"stackable",
true);
21 save = abilityElement.GetAttributeBool(
"save",
false);
24 public override void InitializeAbility(
bool addingFirstTime)
28 VerifyState(conditionsMatched:
true, timeSinceLastUpdate: 0.0f);
32 protected override void VerifyState(
bool conditionsMatched,
float timeSinceLastUpdate)
34 if (conditionsMatched)
42 if (Character is
null) {
return; }
44 foreach (Item item
in Item.ItemList)
47 if (item.HasTag(tags) || tags.Contains(item.Prefab.Identifier))
49 item.StatManager.ApplyStat(stat, stackable, save, value, CharacterTalent);
virtual void ApplyEffect(AbilityObject abilityObject)