示例#1
0
        public override string GetTipString()
        {
            string text  = base.GetTipString();
            string text2 = tolerances.TolerancesString();

            if (!string.IsNullOrEmpty(text2))
            {
                text = text + "\n\n" + text2;
            }
            if (pawn.MapHeld != null)
            {
                ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(pawn);
                text += "\n\n" + "CurrentExpectationsAndRecreation".Translate(expectationDef.label, expectationDef.joyToleranceDropPerDay.ToStringPercent(), expectationDef.joyKindsNeeded);
                text  = text + "\n\n" + JoyUtility.JoyKindsOnMapString(pawn.MapHeld);
            }
            else
            {
                Caravan caravan = pawn.GetCaravan();
                if (caravan != null)
                {
                    float num = caravan.needs.GetCurrentJoyGainPerTick(pawn) * 2500f;
                    if (num > 0f)
                    {
                        text += "\n\n" + "GainingJoyBecauseCaravanNotMoving".Translate() + ": +" + num.ToStringPercent() + "/" + "LetterHour".Translate();
                    }
                }
            }
            return(text);
        }
示例#2
0
        protected override ThoughtState CurrentStateInternal(Pawn p)
        {
            ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(p);

            if (expectationDef == null)
            {
                return(ThoughtState.Inactive);
            }
            return(ThoughtState.ActiveAtStage(expectationDef.thoughtStage));
        }
        public override string GetExplanation()
        {
            Map            map            = this.BadMap();
            int            value          = JoyUtility.JoyKindsOnMapCount(map);
            string         label          = map.info.parent.Label;
            ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(map);
            int            joyKindsNeeded = expectationDef.joyKindsNeeded;
            string         value2         = "AvailableRecreationTypes".Translate() + ":\n\n" + JoyUtility.JoyKindsOnMapString(map);
            string         value3         = "MissingRecreationTypes".Translate() + ":\n\n" + JoyUtility.JoyKindsNotOnMapString(map);

            return("NeedJoySourceDesc".Translate(value, label, expectationDef.label, joyKindsNeeded, value2, value3));
        }
        private bool NeedJoySource(Map map)
        {
            if (!map.IsPlayerHome)
            {
                return(false);
            }
            if (!map.mapPawns.AnyColonistSpawned)
            {
                return(false);
            }
            int num            = JoyUtility.JoyKindsOnMapCount(map);
            int joyKindsNeeded = ExpectationsUtility.CurrentExpectationFor(map).joyKindsNeeded;

            return(num < joyKindsNeeded);
        }
 public static ExpectationDef CurrentExpectationFor(Pawn p)
 {
     if (Current.ProgramState != ProgramState.Playing)
     {
         return(null);
     }
     if (p.Faction != Faction.OfPlayer && !p.IsPrisonerOfColony)
     {
         return(ExpectationDefOf.ExtremelyLow);
     }
     if (p.MapHeld != null)
     {
         return(ExpectationsUtility.CurrentExpectationFor(p.MapHeld));
     }
     return(ExpectationDefOf.VeryLow);
 }
        public override string GetTipString()
        {
            string text  = base.GetTipString();
            string text2 = this.tolerances.TolerancesString();

            if (!string.IsNullOrEmpty(text2))
            {
                text = text + "\n\n" + text2;
            }
            Map mapHeld = this.pawn.MapHeld;

            if (mapHeld != null)
            {
                ExpectationDef expectationDef = ExpectationsUtility.CurrentExpectationFor(this.pawn);
                text = text + "\n\n" + "CurrentExpectationsAndRecreation".Translate(new object[]
                {
                    expectationDef.label,
                    expectationDef.joyToleranceDropPerDay.ToStringPercent(),
                    expectationDef.joyKindsNeeded
                });
                text = text + "\n\n" + JoyUtility.JoyKindsOnMapString(this.pawn.MapHeld);
            }
            else
            {
                Caravan caravan = this.pawn.GetCaravan();
                if (caravan != null)
                {
                    float num = caravan.needs.GetCurrentJoyGainPerTick(this.pawn) * 2500f;
                    if (num > 0f)
                    {
                        string text3 = text;
                        text = string.Concat(new string[]
                        {
                            text3,
                            "\n\n",
                            "GainingJoyBecauseCaravanNotMoving".Translate(),
                            ": +",
                            num.ToStringPercent(),
                            "/",
                            "LetterHour".Translate()
                        });
                    }
                }
            }
            return(text);
        }
示例#7
0
        public void NeedInterval(Pawn pawn)
        {
            float num = ExpectationsUtility.CurrentExpectationFor(pawn).joyToleranceDropPerDay * 150f / 60000f;

            for (int i = 0; i < tolerances.Count; i++)
            {
                float num2 = tolerances[i];
                num2 -= num;
                if (num2 < 0f)
                {
                    num2 = 0f;
                }
                tolerances[i] = num2;
                if (bored[i] && num2 < 0.3f)
                {
                    bored[i] = false;
                }
            }
        }
示例#8
0
        public static ExpectationDef CurrentExpectationFor(Pawn p)
        {
            ExpectationDef result;

            if (Current.ProgramState != ProgramState.Playing)
            {
                result = null;
            }
            else if (p.Faction != Faction.OfPlayer)
            {
                result = ExpectationDefOf.ExtremelyLow;
            }
            else if (p.MapHeld != null)
            {
                result = ExpectationsUtility.CurrentExpectationFor(p.MapHeld);
            }
            else
            {
                result = ExpectationDefOf.VeryLow;
            }
            return(result);
        }