public static AbilityData GetDivineAbility(this Pawn target, DivineAbilityDef def)
        {
            if (target.GetJobsComp() is DivineJobsComp comp)
            {
                return(comp.abilities.FirstOrDefault(ability => ability.def == def));
            }

            return(null);
        }
        public static AbilityData MakeAbilityInstance(DivineAbilityDef def, Pawn owner = null, DivineJobsComp comp = null)
        {
            AbilityData instance = (AbilityData)Activator.CreateInstance(def.abilityClass);

            instance.def      = def;
            instance.owner    = owner;
            instance.jobsComp = comp;
            instance.PostMake();
            return(instance);
        }
Esempio n. 3
0
        public bool TryGetAbility(DivineAbilityDef def, out AbilityData abilityData)
        {
            if (abilities.FirstOrDefault(ability => ability.def == def) is AbilityData foundData)
            {
                abilityData = foundData;
                return(true);
            }

            abilityData = null;
            return(false);
        }