Esempio n. 1
0
        public BossPawnKindDef(PawnKindDef def, float points, IEnumerable <BuffCat> strategy)
        {
            foreach (FieldInfo field in def.GetType().GetFields(BindingFlags.Public | BindingFlags.Instance))
            {
                field.SetValue(this, field.GetValue(def));
            }

            defName             = "Boss" + def.defName + points;
            labelFemale         = labelMale = label = "Boss " + def.label;
            combatPower         = CombatPowerCalculator.BuffUpToThreshold(def, points, strategy, out buffMultiple);
            canArriveManhunter  = true;
            wildSpawn_spawnWild = false;
            lifeStages          = BossFightDefOf.PawnKindLifeStages(def.lifeStages, buffMultiple[BuffCat.Size]);
            minGenerationAge    = BossFightSettings.VanillaBossMinimumAge;
            race = new BossPawnThingDef(BossFightDefOf.AllowedBossDefs.First(thingDef => thingDef.defName == def.defName), points, buffMultiple);

            ResolveReferences();
        }
Esempio n. 2
0
        private static PawnKindDef BaseSlimeKindDef(SlimeGeneratorDef slimeGenerator)
        {
            var pawnKind = new PawnKindDef();

            foreach (var fieldInfo in typeof(PawnKindDef).GetFields())
            {
                try
                {
                    var newField = pawnKind.GetType().GetField(fieldInfo.Name);
                    newField.SetValue(pawnKind, fieldInfo.GetValue(slimeGenerator.slimeTypeDef.originPawnKind));
                }
                catch { }
            }
            AssignNewVariables(ref pawnKind, slimeGenerator.slimeTypeDef.originPawnKind);
            pawnKind.defName = slimeGenerator.defName;
            pawnKind.label   = slimeGenerator.label;
            if (slimeGenerator.description?.Length > 0)
            {
                pawnKind.description = slimeGenerator.description;
            }
            else
            {
                pawnKind.description = slimeGenerator.slimeTypeDef.originThingDef.description;
            }
            foreach (var lifeStage in pawnKind.lifeStages)
            {
                if (slimeGenerator.color != null)
                {
                    lifeStage.bodyGraphicData.color = new Color(slimeGenerator.color.r, slimeGenerator.color.g, slimeGenerator.color.b, slimeGenerator.color.a);
                }
                else
                {
                    lifeStage.bodyGraphicData.color = new Color(slimeGenerator.sourceThingDef.stuffProps.color.r, slimeGenerator.sourceThingDef.stuffProps.color.g,
                                                                slimeGenerator.sourceThingDef.stuffProps.color.b, slimeGenerator.sourceThingDef.stuffProps.color.a);
                }
            }
            Utils.slimePawnKindDefs.Add(pawnKind);
            return(pawnKind);
        }