Beispiel #1
0
        public static bool FindRandomSickPawn(ref Pawn __result, Pawn pawn, JoyCategory maxPatientJoy)
        {
            List <Pawn> pawnList = pawn.Map.mapPawns.FreeColonistsSpawned;
            List <Pawn> source   = new List <Pawn>();

            for (int i = 0; i < pawnList.Count; i++)
            {
                Pawn pawn2;
                try
                {
                    pawn2 = pawnList[i];
                } catch (ArgumentOutOfRangeException)
                {
                    break;
                }
                if (pawn2 != null && SickPawnVisitUtility.CanVisit(pawn, pawn2, maxPatientJoy))
                {
                    source.Add(pawn2);
                }
            }
            Func <Pawn, float> weightSelector = (Pawn x) => VisitChanceScore(pawn, x);
            bool result2 = GenCollection_Patch.TryRandomElementByWeight_Pawn(source, weightSelector, out Pawn result);

            if (!result2)
            {
                __result = null;
                return(false);
            }

            __result = result;
            return(false);
        }
 public static void Listener(Pawn pawn, Pawn sick, JoyCategory maxPatientJoy, ref bool __result)
 {
     if (sick.IsBasicAndroidTier())
     {
         __result = false;
     }
 }
Beispiel #3
0
 public static bool CanVisit(Pawn pawn, Pawn sick, JoyCategory maxPatientJoy)
 {
     if (sick.IsColonist && !sick.Dead && pawn != sick && sick.InBed() && sick.Awake() && !sick.IsForbidden(pawn) && sick.needs.joy != null && (int)sick.needs.joy.CurCategory <= (int)maxPatientJoy && InteractionUtility.CanReceiveInteraction(sick) && !sick.needs.food.Starving && sick.needs.rest.CurLevel > 0.33f && pawn.CanReserveAndReach(sick, PathEndMode.InteractionCell, Danger.None))
     {
         return(!AboutToRecover(sick));
     }
     return(false);
 }
Beispiel #4
0
 public static Pawn FindRandomSickPawn(Pawn pawn, JoyCategory maxPatientJoy)
 {
     if (!pawn.Map.mapPawns.FreeColonistsSpawned.Where((Pawn x) => CanVisit(pawn, x, maxPatientJoy)).TryRandomElementByWeight((Pawn x) => VisitChanceScore(pawn, x), out Pawn result))
     {
         return(null);
     }
     return(result);
 }
Beispiel #5
0
 public static bool ThoughtsFromIngestingPostPrefix(Pawn pawn, Pawn sick, JoyCategory maxPatientJoy, bool __result)
 {
     if (sick.def == USCMDefOf.RRY_Synth)
     {
         __result = false;
         return(__result);
     }
     return(true);
 }
Beispiel #6
0
        public static Pawn FindRandomSickPawn(Pawn pawn, JoyCategory maxPatientJoy)
        {
            IEnumerable <Pawn> source = from x in pawn.Map.mapPawns.FreeColonistsSpawned
                                        where CanVisit(pawn, x, maxPatientJoy)
                                        select x;

            if (!source.TryRandomElementByWeight((Pawn x) => VisitChanceScore(pawn, x), out Pawn result))
            {
                return(null);
            }
            return(result);
        }
        public static Pawn FindRandomSickPawn(Pawn pawn, JoyCategory maxPatientJoy)
        {
            IEnumerable <Pawn> source = from x in pawn.Map.mapPawns.FreeColonistsSpawned
                                        where SickPawnVisitUtility.CanVisit(pawn, x, maxPatientJoy)
                                        select x;
            Pawn result = default(Pawn);

            if (!source.TryRandomElementByWeight <Pawn>((Func <Pawn, float>)((Pawn x) => SickPawnVisitUtility.VisitChanceScore(pawn, x)), out result))
            {
                return(null);
            }
            return(result);
        }
        static bool Prefix(Pawn pawn, Pawn sick, JoyCategory maxPatientJoy, ref bool __result)
        {
            if (sick.needs.rest != null)
            {
                return(true);
            }

            __result = sick.IsColonist && !sick.Dead && pawn != sick && sick.InBed() &&
                       sick.Awake() && !sick.IsForbidden(pawn) && sick.needs.joy != null &&
                       sick.needs.joy.CurCategory <= maxPatientJoy &&
                       InteractionUtility.CanReceiveInteraction(sick) && !sick.needs.food.Starving &&
                       pawn.CanReserveAndReach(sick, PathEndMode.InteractionCell, Danger.None, 1, -1, null, false);
            return(false);
        }
        // RimWorld.SickPawnVisitUtility
        public static bool Vamp_CanVisit(ref bool __result, Pawn pawn, Pawn sick, JoyCategory maxPatientJoy)
        {
            if (sick.IsVampire())
            {
                __result = sick.IsColonist && !sick.Dead && pawn != sick && sick.InBed() && sick.Awake() &&
                           !sick.IsForbidden(pawn) && sick.needs.joy != null &&
                           sick.needs.joy.CurCategory <= maxPatientJoy &&
                           InteractionUtility.CanReceiveInteraction(sick) &&
                           pawn.CanReserveAndReach(sick, PathEndMode.InteractionCell, Danger.None) &&
                           !AboutToRecover(sick);
                return(false);
            }

            return(true);
        }