5 internal sealed
class CharacterAbilitySetMetadataInt : CharacterAbility
7 private readonly Identifier identifier;
8 private readonly
int value;
10 public CharacterAbilitySetMetadataInt(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
12 identifier = abilityElement.GetAttributeIdentifier(
"identifier", Identifier.Empty);
13 value = abilityElement.GetAttributeInt(
"value", 0);
14 if (identifier.IsEmpty)
16 DebugConsole.ThrowError($
"Error in talent {CharacterTalent.DebugIdentifier}, {nameof(CharacterAbilitySetMetadataInt)} - identifier is empty.",
17 contentPackage: abilityElement.ContentPackage);
21 public override void InitializeAbility(
bool addingFirstTime)
26 protected override void ApplyEffect()
28 if (identifier == Identifier.Empty) {
return; }
29 if (GameMain.GameSession?.Campaign?.CampaignMetadata is not { } metadata) {
return; }
31 metadata.SetValue(identifier, value);
34 protected override void ApplyEffect(AbilityObject abilityObject)