Exemple #1
0
            public static bool Prefix(ref GeoUnitDescriptor __result, GeoFaction faction, TacCharacterDef template, BaseStatSheetDef ___BaseStatsSheet, DefRepository ____defRepo, List <TacticalAbilityDef> ____personalAbilityPool)
            {
                try
                {
                    if (template == null)
                    {
                        throw new Exception("Missing template for character");
                    }

                    GeoUnitDescriptor geoUnitDescriptor = new GeoUnitDescriptor(faction, new GeoUnitDescriptor.UnitTypeDescriptor(template));
                    GeoUnitDescriptor.ProgressionDescriptor progressionDescriptor = null;

                    foreach (ClassTagDef classTag in template.ClassTags)
                    {
                        SpecializationDef specializationByClassTag = Support.GetSpecializationByClassTag(classTag, ____defRepo.GetAllDefs <SpecializationDef>().ToList());

                        if (specializationByClassTag != null)
                        {
                            if (progressionDescriptor == null)
                            {
                                Dictionary <int, TacticalAbilityDef> personalAbilitiesByLevel = AbilityGen.GeneratePersonalTraits(___BaseStatsSheet.PersonalAbilitiesCount, template.Data.LevelProgression.Def, specializationByClassTag, ____defRepo, ____personalAbilityPool);
                                progressionDescriptor = new GeoUnitDescriptor.ProgressionDescriptor(specializationByClassTag, personalAbilitiesByLevel);
                            }
                            else
                            {
                                progressionDescriptor.SecondarySpecDef = specializationByClassTag;
                            }
                        }
                    }
                    if (progressionDescriptor != null && template.Data.LevelProgression.IsValid)
                    {
                        progressionDescriptor.Level = template.Data.LevelProgression.Level;
                        progressionDescriptor.ExtraAbilities.AddRange(template.Data.Abilites);
                    }
                    if (progressionDescriptor != null)
                    {
                        geoUnitDescriptor.Progression = progressionDescriptor;
                    }
                    geoUnitDescriptor.BonusStats = template.Data.BonusStats;
                    geoUnitDescriptor.ArmorItems.AddRange(template.Data.BodypartItems.OfType <TacticalItemDef>());
                    geoUnitDescriptor.Equipment.AddRange(template.Data.EquipmentItems.OfType <TacticalItemDef>());
                    geoUnitDescriptor.Inventory.AddRange(template.Data.InventoryItems.OfType <TacticalItemDef>());
                    __result = geoUnitDescriptor;

                    return(false);
                }
                catch (Exception e)
                {
                    Logger.Error(e);
                    return(true);
                }
            }
 private static string GetClassName(GeoUnitDescriptor recruit) => recruit.Progression.MainSpecDef.ViewElementDef.DisplayName1.Localize();
Exemple #3
0
 internal EquipmentInfo(GeoUnitDescriptor recruit) : base(recruit)
 {
 }
Exemple #4
0
 internal AugInfo(GeoUnitDescriptor recruit) : base(recruit)
 {
 }
Exemple #5
0
 internal PersonalSkillInfo(GeoUnitDescriptor recruit) : base(recruit)
 {
 }
Exemple #6
0
 protected RecruitInfo(GeoUnitDescriptor recruit)
 {
     this.recruit = recruit;
     NameTags     = new string[] { Prefix(Config.Name), Postfix(Config.Name) };
 }