public static bool HasSoulTraitRequirements(ThoughtDef thdef, Pawn p)
        {
            if (p.needs.TryGetNeed <Need_Soul>() == null)

            {
                SituationalThoughtHandlerModded.CreateNewSoul(p);
            }

            PatronInfo      pinfo = p.needs.TryGetNeed <Need_Soul>().patronInfo;
            List <TraitDef> lvt   = thdef.requiredTraits;

            if (lvt == null)
            {
                Log.Message("No Required Traits");
            }
            SoulTraitDef stdef = pinfo.PatronSpecificTrait(pinfo.PatronName);
            int          tt    = 0;

            foreach (TraitDef tdef in lvt)
            {
                if (stdef.defName == tdef.defName)
                {
                    tt += 1;
                }
            }
            if (tt > 0)
            {
                return(true);
            }
            else
            {
                return(false);
            }
        }
Пример #2
0
 public SoulTrait(SoulTraitDef traitdef, int newdeg)
 {
     this.degree               = newdeg;
     this.def                  = traitdef as TraitDef;
     this.SDef                 = traitdef;
     this.CurrentSData         = traitdef.SDegreeDataAt(newdeg);
     this.NullifiedThoughtsInt = SDef.NullifiesThoughts;
 }
Пример #3
0
        public void ExposeData()
        {
            Scribe_Defs.LookDef <SoulTraitDef>(ref this.SDef, "SDef");
            Scribe_Collections.LookList <ThoughtDef>(ref this.NullifiedThoughtsInt, "NullifiedThoughtsInt", LookMode.Def, new object[0]);
            Scribe_Values.LookValue <int>(ref this.sdegree, "sdegree", 0, true);
            if (Scribe.mode == LoadSaveMode.ResolvingCrossRefs && this.SDef == null)
            {
                this.SDef = DefDatabase <SoulTraitDef> .GetRandom();

                this.sdegree = this.SDef.SDegreeDatas.RandomElementByWeight((SoulTraitDegreeData dd) => dd.Commonality).degree;
            }
        }
Пример #4
0
 public SoulTrait(SoulTraitDef traitdef, int newdeg)
 {
     this.sdegree = newdeg;
     this.SDef    = traitdef;
     this.NullifiedThoughtsInt = SDef.NullifiesThoughts;
 }