Exemplo n.º 1
0
        public AcceptanceReport CanBeTrained(PawnKindDef pawnKind, TrainableDef td, out bool visible)
        {
            if (pawnKind.RaceProps.untrainableTags != null)
            {
                for (var index = 0; index < pawnKind.RaceProps.untrainableTags.Count; ++index)
                {
                    if (td.MatchesTag(pawnKind.RaceProps.untrainableTags[index]))
                    {
                        visible = false;
                        return(false);
                    }
                }
            }

            if (pawnKind.RaceProps.trainableTags != null)
            {
                for (var index = 0; index < pawnKind.RaceProps.trainableTags.Count; ++index)
                {
                    if (td.MatchesTag(pawnKind.RaceProps.trainableTags[index]))
                    {
                        if (pawnKind.RaceProps.baseBodySize < (double)td.minBodySize)
                        {
                            visible = true;
                            return(new AcceptanceReport(
                                       "CannotTrainTooSmall".Translate((object)pawnKind.LabelCap)));
                        }

                        visible = true;
                        return(true);
                    }
                }
            }

            if (!td.defaultTrainable)
            {
                visible = false;
                return(false);
            }

            if (pawnKind.RaceProps.baseBodySize < (double)td.minBodySize)
            {
                visible = true;
                return(new AcceptanceReport(
                           "FM.Livestock.CannotTrainTooSmall".Translate((object)pawnKind.GetLabelPlural())));
            }

            if (pawnKind.RaceProps.trainability.intelligenceOrder < td.requiredTrainability.intelligenceOrder)
            {
                visible = true;
                return
                    (new AcceptanceReport("CannotTrainNotSmartEnough".Translate((object)td.requiredTrainability)));
            }

            visible = true;
            return(true);
        }
Exemplo n.º 2
0
 public AcceptanceReport CanBeTrained( PawnKindDef pawnKind, TrainableDef td, out bool visible )
 {
     if ( pawnKind.RaceProps.untrainableTags != null )
     {
         for ( int index = 0; index < pawnKind.RaceProps.untrainableTags.Count; ++index )
         {
             if ( td.MatchesTag( pawnKind.RaceProps.untrainableTags[index] ) )
             {
                 visible = false;
                 return false;
             }
         }
     }
     if ( pawnKind.RaceProps.trainableTags != null )
     {
         for ( int index = 0; index < pawnKind.RaceProps.trainableTags.Count; ++index )
         {
             if ( td.MatchesTag( pawnKind.RaceProps.trainableTags[index] ) )
             {
                 if ( pawnKind.RaceProps.baseBodySize < (double)td.minBodySize )
                 {
                     visible = true;
                     return new AcceptanceReport( "CannotTrainTooSmall".Translate( (object)pawnKind.LabelCap ) );
                 }
                 visible = true;
                 return true;
             }
         }
     }
     if ( !td.defaultTrainable )
     {
         visible = false;
         return false;
     }
     if ( pawnKind.RaceProps.baseBodySize < (double)td.minBodySize )
     {
         visible = true;
         return new AcceptanceReport( "CannotTrainTooSmall".Translate( (object)pawnKind.LabelCap ) );
     }
     if ( pawnKind.RaceProps.trainableIntelligence < td.requiredTrainableIntelligence )
     {
         visible = true;
         return
             new AcceptanceReport(
                 "CannotTrainNotSmartEnough".Translate( (object)td.requiredTrainableIntelligence ) );
     }
     visible = true;
     return true;
 }