public override float GetPriority(Pawn pawn)
        {
            if (pawn.needs.joy == null)
            {
                return(0f);
            }
            if (Find.TickManager.TicksGame < 5000)
            {
                return(0f);
            }
            if (JoyUtility.LordPreventsGettingJoy(pawn))
            {
                return(0f);
            }
            float             curLevel          = pawn.needs.joy.CurLevel;
            TimeAssignmentDef timeAssignmentDef = (pawn.timetable == null) ? TimeAssignmentDefOf.Anything : pawn.timetable.CurrentAssignment;

            if (!timeAssignmentDef.allowJoy)
            {
                return(0f);
            }
            if (timeAssignmentDef == TimeAssignmentDefOf.Anything)
            {
                if (curLevel < 0.35f)
                {
                    return(6f);
                }
                return(0f);
            }
            if (timeAssignmentDef == TimeAssignmentDefOf.Joy)
            {
                if (curLevel < 0.95f)
                {
                    return(7f);
                }
                return(0f);
            }
            if (timeAssignmentDef == TimeAssignmentDefOf.Sleep)
            {
                if (curLevel < 0.95f)
                {
                    return(2f);
                }
                return(0f);
            }
            if (timeAssignmentDef == TimeAssignmentDefOf.Meditate)
            {
                return(0f);
            }
            throw new NotImplementedException();
        }
Ejemplo n.º 2
0
 protected override Job TryGiveJob(Pawn pawn)
 {
     if (pawn.needs.joy == null)
     {
         return(null);
     }
     if (Find.TickManager.TicksGame < 60000)
     {
         return(null);
     }
     if (JoyUtility.LordPreventsGettingJoy(pawn) || JoyUtility.TimetablePreventsGettingJoy(pawn))
     {
         return(null);
     }
     return(base.TryGiveJob(pawn));
 }
Ejemplo n.º 3
0
        protected override Job TryGiveJob(Pawn pawn)
        {
            Job result;

            if (pawn.needs.joy == null)
            {
                result = null;
            }
            else if (Find.TickManager.TicksGame < 60000)
            {
                result = null;
            }
            else if (JoyUtility.LordPreventsGettingJoy(pawn) || JoyUtility.TimetablePreventsGettingJoy(pawn))
            {
                result = null;
            }
            else
            {
                result = base.TryGiveJob(pawn);
            }
            return(result);
        }
        public override float GetPriority(Pawn pawn)
        {
            float result;

            if (pawn.needs.joy == null)
            {
                result = 0f;
            }
            else if (Find.TickManager.TicksGame < 5000)
            {
                result = 0f;
            }
            else if (JoyUtility.LordPreventsGettingJoy(pawn))
            {
                result = 0f;
            }
            else
            {
                float             curLevel          = pawn.needs.joy.CurLevel;
                TimeAssignmentDef timeAssignmentDef = (pawn.timetable != null) ? pawn.timetable.CurrentAssignment : TimeAssignmentDefOf.Anything;
                if (!timeAssignmentDef.allowJoy)
                {
                    result = 0f;
                }
                else if (timeAssignmentDef == TimeAssignmentDefOf.Anything)
                {
                    if (curLevel < 0.35f)
                    {
                        result = 6f;
                    }
                    else
                    {
                        result = 0f;
                    }
                }
                else if (timeAssignmentDef == TimeAssignmentDefOf.Joy)
                {
                    if (curLevel < 0.95f)
                    {
                        result = 7f;
                    }
                    else
                    {
                        result = 0f;
                    }
                }
                else
                {
                    if (timeAssignmentDef != TimeAssignmentDefOf.Sleep)
                    {
                        throw new NotImplementedException();
                    }
                    if (curLevel < 0.95f)
                    {
                        result = 2f;
                    }
                    else
                    {
                        result = 0f;
                    }
                }
            }
            return(result);
        }