public static bool CanGetThought(Pawn pawn, ThoughtDef def)
 {
     try
     {
         if (!def.validWhileDespawned && !pawn.Spawned && !def.IsMemory)
         {
             return(false);
         }
         if (def.nullifyingTraits != null)
         {
             for (int i = 0; i < def.nullifyingTraits.Count; i++)
             {
                 if (pawn.story.traits.HasTrait(def.nullifyingTraits[i]))
                 {
                     return(false);
                 }
             }
         }
         if (!def.requiredTraits.NullOrEmpty <TraitDef>())
         {
             bool flag = false;
             for (int j = 0; j < def.requiredTraits.Count; j++)
             {
                 if (pawn.story.traits.HasTrait(def.requiredTraits[j]))
                 {
                     if (!def.RequiresSpecificTraitsDegree || def.requiredTraitsDegree == pawn.story.traits.DegreeOfTrait(def.requiredTraits[j]))
                     {
                         flag = true;
                         break;
                     }
                 }
             }
             if (!flag)
             {
                 return(false);
             }
         }
         if (def.nullifiedIfNotColonist && !pawn.IsColonist)
         {
             return(false);
         }
         if (ThoughtUtility.IsSituationalThoughtNullifiedByHediffs(def, pawn))
         {
             return(false);
         }
         if (ThoughtUtility.IsThoughtNullifiedByOwnTales(def, pawn))
         {
             return(false);
         }
     }
     finally
     {
     }
     return(true);
 }