コード例 #1
0
ファイル: DeityUtility.cs プロジェクト: Ogliss/AdMechArmoury
        private static void FillDeity(IdeoFoundation_Deity __instance, IdeoFoundation_Deity.Deity deity)
        {
            /*
             * Gender supremeGender = __instance.ideo.SupremeGender;
             * if (supremeGender != Gender.None)
             * {
             *      deity.gender = supremeGender;
             * }
             * else
             * {
             *      deity.gender = Gen.RandomEnumValue<Gender>(true);
             * }
             */
            MemeDef relatedMeme;
            MemeDef relatedMeme2;

            if (deity.relatedMeme == null)
            {
                if ((from x in __instance.ideo.memes
                     where !__instance.deities.Any((IdeoFoundation_Deity.Deity y) => y.relatedMeme == x)
                     select x).TryRandomElement(out relatedMeme))
                {
                    deity.relatedMeme = relatedMeme;
                }
                else if (__instance.ideo.memes.TryRandomElement(out relatedMeme2))
                {
                    deity.relatedMeme = relatedMeme2;
                }
            }
        }
コード例 #2
0
ファイル: DeityUtility.cs プロジェクト: Ogliss/AdMechArmoury
        private static IEnumerable <string> AllExistingDeities(IdeoFoundation_Deity __instance)
        {
            int num;

            for (int i = 0; i < __instance.deities.Count; i = num + 1)
            {
                yield return(__instance.deities[i].name);

                num = i;
            }
            if (Find.World != null)
            {
                List <Ideo> ideos = Find.IdeoManager.IdeosListForReading;
                for (int i = 0; i < ideos.Count; i = num + 1)
                {
                    IdeoFoundation_Deity deityFoundation;
                    if ((deityFoundation = (ideos[i].foundation as IdeoFoundation_Deity)) != null)
                    {
                        for (int j = 0; j < deityFoundation.deities.Count; j = num + 1)
                        {
                            yield return(deityFoundation.deities[j].name);

                            num = j;
                        }
                    }
                    deityFoundation = null;
                    num             = i;
                }
                ideos = null;
            }
            yield break;
        }
 public static bool Prefix(IdeoFoundation_Deity __instance)
 {
     if (__instance.ideo.culture.defName.StartsWith("OG_"))
     {
         DeityUtility.GenerateSpecificDeities(__instance);
         return(false);
     }
     return(true);
 }
コード例 #4
0
ファイル: DeityUtility.cs プロジェクト: Ogliss/AdMechArmoury
        public static void GenerateSpecificDeities(IdeoFoundation_Deity __instance)
        {
            __instance.deities.Clear();

            if (__instance.ideo.culture.defName.StartsWith("OG_"))
            {
                if (__instance.ideo.culture.defName.Contains("Mechanicus"))
                {
                    IdeoFoundation_Deity.Deity omnissiah = DeityUtility.Omnissiah.cloneDeity();
                    FillDeity(__instance, omnissiah);
                    __instance.deities.Add(omnissiah);
                    return;
                }
                if (__instance.ideo.culture.defName.Contains("Imperial"))
                {
                    IdeoFoundation_Deity.Deity emperor = DeityUtility.Emperor.cloneDeity();
                    FillDeity(__instance, emperor);
                    __instance.deities.Add(emperor);
                    return;
                }
                if (__instance.ideo.culture.defName.Contains("Greenskin") || __instance.ideo.culture.defName.Contains("Orkoid"))
                {
                    IdeoFoundation_Deity.Deity gork = DeityUtility.Gork.cloneDeity();
                    IdeoFoundation_Deity.Deity mork = DeityUtility.Mork.cloneDeity();
                    FillDeity(__instance, gork);
                    __instance.deities.Add(gork);
                    FillDeity(__instance, mork);
                    __instance.deities.Add(mork);
                    return;
                }
                if (__instance.ideo.culture.defName.Contains("Kroot"))
                {
                    IdeoFoundation_Deity.Deity vawk  = DeityUtility.Vawk.cloneDeity();
                    IdeoFoundation_Deity.Deity gmork = DeityUtility.Gmork.cloneDeity();
                    FillDeity(__instance, vawk);
                    __instance.deities.Add(vawk);
                    FillDeity(__instance, gmork);
                    __instance.deities.Add(gmork);
                    return;
                }
                if (__instance.ideo.culture.defName.Contains("Aeldari"))
                {
                    IdeoFoundation_Deity.Deity khaine   = DeityUtility.Khaine.cloneDeity();
                    IdeoFoundation_Deity.Deity ynnead   = DeityUtility.Ynnead.cloneDeity();
                    IdeoFoundation_Deity.Deity cegorach = DeityUtility.Cegorach.cloneDeity();
                    FillDeity(__instance, khaine);
                    __instance.deities.Add(khaine);
                    FillDeity(__instance, ynnead);
                    __instance.deities.Add(ynnead);
                    FillDeity(__instance, Cegorach);
                    __instance.deities.Add(cegorach);
                    return;
                }
            }
        }