Example #1
0
        private void DoubleTheFun(Map map)
        {
            var result = TableOfFun.RandomElementByWeight(GetWeight);

            while (result.defName == "Cults_SpellDoubleTheFun")
            {
                result = TableOfFun.RandomElementByWeight(GetWeight);
            }

            var temp = DefDatabase <IncidentDef> .GetNamed(result.defName);

            var result2 = TableOfFun.RandomElementByWeight(GetWeight);

            while (result2.defName == "Cults_SpellDoubleTheFun")
            {
                result2 = TableOfFun.RandomElementByWeight(GetWeight);
            }

            var temp2 = DefDatabase <IncidentDef> .GetNamed(result2.defName);

            if (temp != null && temp2 != null)
            {
                map.GetComponent <MapComponent_SacrificeTracker>().wasDoubleTheFun      = true;
                map.GetComponent <MapComponent_SacrificeTracker>().lastSideEffect       = temp;
                map.GetComponent <MapComponent_SacrificeTracker>().lastDoubleSideEffect = temp2;
                CultUtility.CastSpell(temp, map);
                CultUtility.CastSpell(temp2, map);
                return;
            }

            Utility.DebugReport("Failed to utilize " + temp);
            Utility.DebugReport("Failed to utilize " + temp2);
        }
        private void DoubleTheFun(Map map)
        {
            FunSpell result = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);

            while (result.defName == "Cults_SpellDoubleTheFun")
            {
                result = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);
            }
            IncidentDef temp = DefDatabase <IncidentDef> .GetNamed(result.defName);

            FunSpell result2 = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);

            while (result2.defName == "Cults_SpellDoubleTheFun")
            {
                result2 = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);
            }
            IncidentDef temp2 = DefDatabase <IncidentDef> .GetNamed(result2.defName);

            if (temp != null && temp2 != null)
            {
                map.GetComponent <MapComponent_SacrificeTracker>().wasDoubleTheFun      = true;
                map.GetComponent <MapComponent_SacrificeTracker>().lastSideEffect       = temp;
                map.GetComponent <MapComponent_SacrificeTracker>().lastDoubleSideEffect = temp2;
                CultUtility.CastSpell(temp, map);
                CultUtility.CastSpell(temp2, map);
                return;
            }
            Cthulhu.Utility.DebugReport("Failed to utilize " + temp.ToString());
            Cthulhu.Utility.DebugReport("Failed to utilize " + temp2.ToString());
        }
        public void RollTableOfFun(Map map)
        {
            FunSpell result = GenCollection.RandomElementByWeight <FunSpell>(TableOfFun, GetWeight);

            if (result.defName == "Cults_SpellDoubleTheFun")
            {
                Cthulhu.Utility.DebugReport("Double The Fun!");
                DoubleTheFun(map);
                return;
            }
            IncidentDef temp = DefDatabase <IncidentDef> .GetNamed(result.defName);

            if (temp != null)
            {
                map.GetComponent <MapComponent_SacrificeTracker>().lastSideEffect = temp;
                CultUtility.CastSpell(temp, map);
                return;
            }
            Cthulhu.Utility.DebugReport("Failed to utilize " + temp.ToString());
        }
Example #4
0
        public void RollTableOfFun(Map map)
        {
            var result = TableOfFun.RandomElementByWeight(GetWeight);

            if (result.defName == "Cults_SpellDoubleTheFun")
            {
                Utility.DebugReport("Double The Fun!");
                DoubleTheFun(map);
                return;
            }

            var temp = DefDatabase <IncidentDef> .GetNamed(result.defName);

            if (temp != null)
            {
                map.GetComponent <MapComponent_SacrificeTracker>().lastSideEffect = temp;
                CultUtility.CastSpell(temp, map);
                return;
            }

            Utility.DebugReport("Failed to utilize " + temp);
        }