Beispiel #1
0
        private static void BattleRoyaleByDamagetype()
        {
            PawnKindDef[] array = new PawnKindDef[2]
            {
                PawnKindDefOf.Colonist,
                PawnKindDefOf.Muffalo
            };
            IEnumerable <ToolCapacityDef> enumerable = DefDatabase <ToolCapacityDef> .AllDefsListForReading.Where((ToolCapacityDef tc) => tc != ToolCapacityDefOf.KickMaterialInEyes);

            Func <PawnKindDef, ToolCapacityDef, string> func = (PawnKindDef pkd, ToolCapacityDef dd) => $"{pkd.label}_{dd.defName}";

            if (pawnKindsForDamageTypeBattleRoyale == null)
            {
                pawnKindsForDamageTypeBattleRoyale = new List <PawnKindDef>();
                PawnKindDef[] array2 = array;
                foreach (PawnKindDef pawnKindDef in array2)
                {
                    foreach (ToolCapacityDef toolType in enumerable)
                    {
                        string   text     = func(pawnKindDef, toolType);
                        ThingDef thingDef = Gen.MemberwiseClone(pawnKindDef.race);
                        thingDef.defName = text;
                        thingDef.label   = text;
                        thingDef.tools   = new List <Tool>(pawnKindDef.race.tools.Select(delegate(Tool tool)
                        {
                            Tool tool2       = Gen.MemberwiseClone(tool);
                            tool2.capacities = new List <ToolCapacityDef>();
                            tool2.capacities.Add(toolType);
                            return(tool2);
                        }));
                        PawnKindDef pawnKindDef2 = Gen.MemberwiseClone(pawnKindDef);
                        pawnKindDef2.defName = text;
                        pawnKindDef2.label   = text;
                        pawnKindDef2.race    = thingDef;
                        pawnKindsForDamageTypeBattleRoyale.Add(pawnKindDef2);
                    }
                }
            }
            ArenaUtility.PerformBattleRoyale(pawnKindsForDamageTypeBattleRoyale);
        }