3 using System.Collections.Generic;
4 using System.Collections.Immutable;
8 internal sealed
class CharacterAbilityApplyStatusEffectsToApprenticeship : CharacterAbilityApplyStatusEffects
10 private readonly
bool invert;
11 private readonly ImmutableHashSet<JobPrefab> jobPrefabList = JobPrefab.Prefabs.ToImmutableHashSet();
13 public CharacterAbilityApplyStatusEffectsToApprenticeship(CharacterAbilityGroup characterAbilityGroup, ContentXElement abilityElement) : base(characterAbilityGroup, abilityElement)
15 invert = abilityElement.GetAttributeBool(
"invert",
false);
18 protected override void ApplyEffect()
21 JobPrefab? apprenticeJob = GetApprenticeJob(Character, jobPrefabList);
22 if (apprenticeJob is
null)
24 DebugConsole.ThrowError($
"{nameof(CharacterAbilityUnlockApprenticeshipTalentTree)}: Could not find apprentice job for character {Character.Name}",
29 foreach (Character character
in GameSession.GetSessionCrewCharacters(
CharacterType.Both))
31 JobPrefab? characterJob = character.Info?.Job?.Prefab;
32 if (characterJob is
null) {
continue; }
34 switch (characterJob.Identifier == apprenticeJob.Identifier)
36 case true when invert:
38 case false when !invert:
46 protected override void ApplyEffect(AbilityObject abilityObject)
51 public static JobPrefab? GetApprenticeJob(Character character, IReadOnlyCollection<JobPrefab> jobList)
53 foreach (JobPrefab prefab
in jobList)
55 if (character.Info.GetSavedStatValue(
StatTypes.Apprenticeship, prefab.Identifier) > 0)
void ApplyEffectSpecific(Character targetCharacter, Limb targetLimb=null)
CharacterTalent CharacterTalent
readonly TalentPrefab Prefab
ContentPackage? ContentPackage
StatTypes
StatTypes are used to alter several traits of a character. They are mostly used by talents.