Ejemplo n.º 1
0
        static public float DoGetBaseValueFor(StatDef stat, StatRequest request)
        // Helper function called by the transpiled StatWorker.GetBaseValueFor
        // returns the final value of the specified defaultBaseStat if
        // the StatDef is a DerivedStatDef
        {
            float result = stat.defaultBaseValue;

            if (stat is DerivedStatDef)
            {
                DerivedStatDef derivedStat = (stat as DerivedStatDef);
                if (stat != null)
                {
                    StatDef baseStat = derivedStat.defaultBaseStat;
                    if (baseStat != null)
                    {
                        Thing thing = request.Thing;
                        if (thing != null)
                        {
                            result = thing.GetStatValue(baseStat, true);
                        }
                    }
                }
            }
            return(result);
        }
Ejemplo n.º 2
0
#pragma warning restore CS0649

        public static string GetFromBaseStatString(StatDef stat)
        {
            string result = "";

            if (stat is DerivedStatDef)
            {
                DerivedStatDef derivedStat = (stat as DerivedStatDef);
                if (derivedStat != null)
                {
                    StatDef baseStat = derivedStat.defaultBaseStat;
                    if (baseStat != null)
                    {
                        result = " (from " + baseStat.LabelCap + ")";
                    }
                }
            }
            return(result);
        }