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());
        }
Пример #3
0
 private static float GetWeight(FunSpell spell)
 {
     return(spell.weight);
 }