public static float InitiatePrisonBreakMtbDays(Pawn pawn)
        {
            float result;

            if (!pawn.Awake())
            {
                result = -1f;
            }
            else if (!PrisonBreakUtility.CanParticipateInPrisonBreak(pawn))
            {
                result = -1f;
            }
            else
            {
                Room room = pawn.GetRoom(RegionType.Set_Passable);
                if (room == null || !room.isPrisonCell)
                {
                    result = -1f;
                }
                else
                {
                    float num = 45f;
                    num /= Mathf.Clamp(pawn.health.capacities.GetLevel(PawnCapacityDefOf.Moving), 0.01f, 1f);
                    if (pawn.guest.everParticipatedInPrisonBreak)
                    {
                        float x = (float)(Find.TickManager.TicksGame - pawn.guest.lastPrisonBreakTicks) / 60000f;
                        num *= PrisonBreakUtility.PrisonBreakMTBFactorForDaysSincePrisonBreak.Evaluate(x);
                    }
                    result = num;
                }
            }
            return(result);
        }
 private static void AddPrisonersFrom(Room room, List <Pawn> outEscapingPrisoners)
 {
     foreach (Thing thing in room.ContainedAndAdjacentThings)
     {
         Pawn pawn = thing as Pawn;
         if (pawn != null && PrisonBreakUtility.CanParticipateInPrisonBreak(pawn))
         {
             outEscapingPrisoners.Add(pawn);
         }
     }
 }
 public override void Interacted(Pawn initiator, Pawn recipient, List <RulePackDef> extraSentencePacks)
 {
     if (recipient.IsPrisoner && recipient.guest.PrisonerIsSecure && PrisonBreakUtility.CanParticipateInPrisonBreak(recipient))
     {
         PrisonBreakUtility.StartPrisonBreak(recipient);
         MentalState_Jailbreaker mentalState_Jailbreaker = initiator.MentalState as MentalState_Jailbreaker;
         if (mentalState_Jailbreaker != null)
         {
             mentalState_Jailbreaker.Notify_InducedPrisonerToEscape();
         }
     }
 }
Esempio n. 4
0
 public override void Interacted(Pawn initiator, Pawn recipient, List <RulePackDef> extraSentencePacks, out string letterText, out string letterLabel, out LetterDef letterDef)
 {
     if (!recipient.IsPrisoner || !recipient.guest.PrisonerIsSecure || !PrisonBreakUtility.CanParticipateInPrisonBreak(recipient))
     {
         letterText  = null;
         letterLabel = null;
         letterDef   = null;
     }
     else
     {
         PrisonBreakUtility.StartPrisonBreak(recipient, out letterText, out letterLabel, out letterDef);
         (initiator.MentalState as MentalState_Jailbreaker)?.Notify_InducedPrisonerToEscape();
     }
 }