public bool MyAddHediffs(Pawn pawn) { // Sanity test; if our pawn doesn't exist, don't even bother. if (pawn == null) { return(false); } // Special case; if we're not told to apply to anything in particular, apply to the Whole Body. if (Props.partsToAffect.NullOrEmpty() && Props.groupsToAffect.NullOrEmpty()) { return(HediffGiverUtility.TryApply(pawn, Props.hediffDef, null, false, 1, addedHediffs)); } IEnumerable <BodyPartRecord> source = pawn.health.hediffSet.GetNotMissingParts(); List <BodyPartDef> partsToAffect = new List <BodyPartDef>(); int countToAffect; if (!Props.partsToAffect.NullOrEmpty()) { partsToAffect.AddRange(from p in source where Props.partsToAffect.Contains(p.def) select p.def); } if (!Props.groupsToAffect.NullOrEmpty()) { partsToAffect.AddRange(from p in source where Props.groupsToAffect.Intersect(p.groups).Any() select p.def); } countToAffect = partsToAffect.Count(); partsToAffect.RemoveDuplicates(); return(HediffGiverUtility.TryApply(pawn, Props.hediffDef, partsToAffect, false, countToAffect, addedHediffs)); }
private void GiveHeddifs() { foreach (var effect in ConstellationsDef.Effects) { foreach (var map in AffectedMaps) { foreach (var pawn in map.mapPawns.AllPawnsSpawned) { if (pawn.RaceProps.Animal) { continue; } if ((pawn.gender == Gender.Male && ConstellationsDef.AllowMale) || (pawn.gender == Gender.Female && ConstellationsDef.AllowFemale)) { Hediff firstHediffOfDef = pawn.health.hediffSet.GetFirstHediffOfDef(effect, false); if (firstHediffOfDef == null) { HediffGiverUtility.TryApply(pawn, effect, parts); } } } } } }
public void GiveHediff(Pawn pawn) { //If the random number is not within the chance range, exit. if (!(chance >= Rand.Range(0.0f, 100.0f))) { return; } //If the gender is male, check the male commonality chance, and if it fails, exit. if (pawn.gender == Gender.Male && !(maleCommonality >= Rand.Range(0.0f, 100.0f))) { return; } if (pawn.gender == Gender.Female && !(femaleCommonality >= Rand.Range(0.0f, 100.0f))) { return; } if (!allowedPawnkinds.NullOrEmpty() && !allowedPawnkinds.Contains(pawn.kindDef)) { return; } if (!disallowedPawnkinds.NullOrEmpty() && disallowedPawnkinds.Contains(pawn.kindDef)) { return; } if (pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null).Any((BodyPartRecord bpr) => partsToAffect.Contains(bpr.def))) { for (int i = 0; i < this.countToAffect; i++) { HediffGiverUtility.TryApply(pawn, hediff, partsToAffect); } } }
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) { base.Apply(target, dest); Pawn pawn = target.Pawn; Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(CultsDefOf.Cults_Hediff_FoulBile); IEnumerable <BodyPartRecord> liver = pawn.RaceProps.body.GetPartsWithDef(BodyPartDefOf.Liver); if (!liver.Any()) { Messages.Message(parent.def.LabelCap + ": failed. Target does not have a liver", new LookTargets(pawn), MessageTypeDefOf.RejectInput, historical: false); return; } if (hediff != null) { hediff.Severity += hediff.def.initialSeverity; Job job = JobMaker.MakeJob(CultsDefOf.Cults_Job_VomitBile); pawn.jobs.StartJob(job, JobCondition.InterruptForced, null, resumeCurJobAfterwards: true); } else { HediffGiverUtility.TryApply(pawn, CultsDefOf.Cults_Hediff_FoulBile, new List <BodyPartDef>() { BodyPartDefOf.Liver }, true, 1, null); Job job = JobMaker.MakeJob(CultsDefOf.Cults_Job_VomitBile); pawn.jobs.StartJob(job, JobCondition.InterruptForced, null, resumeCurJobAfterwards: true); } }
private void ApplyEffect(Pawn pawn) { Hediff hediff = pawn.health?.hediffSet?.GetFirstHediffOfDef(CultsDefOf.Cults_Hediff_MiasmaSickness); if (hediff != null) { hediff.Severity += 0.01f; } else { HediffGiverUtility.TryApply(pawn, CultsDefOf.Cults_Hediff_MiasmaSickness, null, false, 1, null); } }
public override void Effect(Pawn target) { if (JecsTools.GrappleUtility.TryGrapple(CasterPawn, target)) { base.Effect(target); int boolSel = Rand.Range(0, 2); BodyPartTagDef tagOne = null; BodyPartTagDef tagTwo = null; HediffDef hediffDefOne = null; HediffDef hediffDefTwo = null; switch (boolSel) { case 0: tagOne = BodyPartTagDefOf.MovingLimbCore; tagTwo = BodyPartTagDefOf.SightSource; hediffDefOne = VampDefOf.ROMV_CorruptFormHediff_Legs; hediffDefTwo = VampDefOf.ROMV_CorruptFormHediff_Sight; break; case 1: tagOne = BodyPartTagDefOf.ManipulationLimbCore; tagTwo = BodyPartTagDefOf.SightSource; hediffDefOne = VampDefOf.ROMV_CorruptFormHediff_Arms; hediffDefTwo = VampDefOf.ROMV_CorruptFormHediff_Sight; break; case 2: tagOne = BodyPartTagDefOf.ManipulationLimbCore; tagTwo = BodyPartTagDefOf.MovingLimbCore; hediffDefOne = VampDefOf.ROMV_CorruptFormHediff_Arms; hediffDefTwo = VampDefOf.ROMV_CorruptFormHediff_Legs; break; } IEnumerable <BodyPartRecord> recs = target.health.hediffSet.GetNotMissingParts(); if (recs.FirstOrDefault(x => x.def.tags.Contains(tagOne)) is BodyPartRecord bp) { HediffGiverUtility.TryApply(target, hediffDefOne, new List <BodyPartDef> { bp.def }); } if (recs.FirstOrDefault(x => x.def.tags.Contains(tagTwo)) is BodyPartRecord bpII) { HediffGiverUtility.TryApply(target, hediffDefTwo, new List <BodyPartDef> { bpII.def }); } } }
public override void Notify_QuestSignalReceived(Signal signal) { base.Notify_QuestSignalReceived(signal); if (!(signal.tag == inSignal)) { return; } for (int i = 0; i < pawns.Count; i++) { if (!pawns[i].DestroyedOrNull() && (!checkDiseaseContractChance || Rand.Chance(pawns[i].health.immunity.DiseaseContractChanceFactor(hediffDef)))) { HediffGiverUtility.TryApply(pawns[i], hediffDef, partsToAffect); } } }
public List <Pawn> ApplyToPawns(IEnumerable <Pawn> pawns, out string blockedInfo) { List <Pawn> list = new List <Pawn>(); Dictionary <HediffDef, List <Pawn> > dictionary = new Dictionary <HediffDef, List <Pawn> >(); foreach (Pawn current in pawns) { HediffDef hediffDef = null; if (Rand.Chance(current.health.immunity.DiseaseContractChanceFactor(this.def.diseaseIncident, out hediffDef, null))) { HediffGiverUtility.TryApply(current, this.def.diseaseIncident, this.def.diseasePartsToAffect, false, 1, null); TaleRecorder.RecordTale(TaleDefOf.IllnessRevealed, new object[] { current, this.def.diseaseIncident }); list.Add(current); } else if (hediffDef != null) { if (!dictionary.ContainsKey(hediffDef)) { dictionary[hediffDef] = new List <Pawn>(); } dictionary[hediffDef].Add(current); } } blockedInfo = string.Empty; foreach (KeyValuePair <HediffDef, List <Pawn> > current2 in dictionary) { if (current2.Key != this.def.diseaseIncident) { if (blockedInfo.Length != 0) { blockedInfo += "\n\n"; } string arg_19F_0 = blockedInfo; string arg_19A_0 = "LetterDisease_Blocked"; object[] expr_146 = new object[3]; expr_146[0] = current2.Key.LabelCap; expr_146[1] = this.def.diseaseIncident.label; expr_146[2] = (from victim in current2.Value select victim.LabelShort).ToCommaList(true); blockedInfo = arg_19F_0 + arg_19A_0.Translate(expr_146); } } return(list); }
public bool MyAddHediffs(Pawn pawn) { // Sanity test; if our pawn doesn't exist, don't even bother. if (pawn == null) { return(false); } // Special case; if we're not told to apply to anything in particular, apply to the Whole Body. if (Props.partsToAffect.NullOrEmpty() && Props.groupsToAffect.NullOrEmpty()) { return(HediffGiverUtility.TryApply(pawn, Props.hediffDef, null)); } IEnumerable <BodyPartRecord> source = pawn.health.hediffSet.GetNotMissingParts(); List <BodyPartDef> partsToAffect = new List <BodyPartDef>(); int countToAffect; // Add the specified parts, if they exist, to our list of parts to affect. if (!Props.partsToAffect.NullOrEmpty()) { partsToAffect.AddRange(from p in source where Props.partsToAffect.Contains(p.def) select p.def); } // Now do it for all the parts in the specified groups. if (!Props.groupsToAffect.NullOrEmpty()) { foreach (var item in source) { if (Props.groupsToAffect.Count == 1 && item.groups.Any(x => x == Props.groupsToAffect[0])) { // Log.Message(string.Format("{0}", item.customLabel)); GetWielder.health.AddHediff(Props.hediffDef, item); partsToAffect.AddRange(from p in source where Props.groupsToAffect.Intersect(p.groups).Any() select p.def); return(true); } } } // We need to count of parts to affect ahead of time because we are removing duplicates for performance reasons. countToAffect = partsToAffect.Count(); partsToAffect.RemoveDuplicates(); // Apply our hediffs! return(false); // return HediffGiverUtility.TryApply(pawn, Props.hediffDef, partsToAffect, false, countToAffect); }
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) { base.Apply(target, dest); Log.Message("Casted spell: " + parent.def.label); Pawn pawn = target.Pawn; // List<BodyPartRecord> parts = pawn.RaceProps.body.AllParts; Hediff hediff = pawn?.health?.hediffSet?.GetFirstHediffOfDef(CultsDefOf.Cults_Hediff_FoulBile); if (hediff == null) { HediffGiverUtility.TryApply(pawn, CultsDefOf.Cults_Hediff_FoulBile, null, false, 1, null); } else { Messages.Message("Target already has an infection", new LookTargets(pawn), MessageTypeDefOf.RejectInput, historical: false); } }
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) { base.Apply(target, dest); List <BodyPartDef> breathing_sources = target.Pawn.RaceProps.body.GetPartsWithTag(BodyPartTagDefOf.BreathingSource).Select(part => part.def).ToList(); Hediff hediff = target.Pawn.health.hediffSet.GetFirstHediffOfDef(CultsDefOf.Cults_Hediff_WateryLungs); if (hediff != null) { hediff.Severity += hediff.def.initialSeverity; } else { HediffGiverUtility.TryApply(target.Pawn, CultsDefOf.Cults_Hediff_WateryLungs, breathing_sources, true, 2, null); Job job = JobMaker.MakeJob(CultsDefOf.Cults_Job_VomitWater); target.Pawn.jobs.StartJob(job, JobCondition.InterruptForced, null, resumeCurJobAfterwards: true); } // target.Pawn.jobs.TryTakeOrderedJob(job); }
public void GiveHediff(Pawn pawn) { //If the random number is not within the chance range, exit. if (!(chance >= Rand.Range(0.0f, 100.0f))) { return; } //If the gender is male, check the male commonality chance, and if it fails, exit. if (pawn.gender == Gender.Male && !(maleCommonality >= Rand.Range(0.0f, 100.0f))) { return; } //If the gender is female, check the female commonality chance, and if it fails, exit. if (pawn.gender == Gender.Female && !(femaleCommonality >= Rand.Range(0.0f, 100.0f))) { return; } HediffGiverUtility.TryApply(pawn, hediff, partsToAffect); }
protected override bool TryExecuteWorker(IncidentParms parms) { int num = this.PotentialVictimCandidates(parms.target).Count <Pawn>(); IntRange intRange = new IntRange(Mathf.RoundToInt((float)num * this.def.diseaseVictimFractionRange.min), Mathf.RoundToInt((float)num * this.def.diseaseVictimFractionRange.max)); int num2 = intRange.RandomInRange; num2 = Mathf.Clamp(num2, 1, this.def.diseaseMaxVictims); for (int i = 0; i < num2; i++) { if (!this.PotentialVictims(parms.target).TryRandomElementByWeight((Pawn x) => x.health.immunity.DiseaseContractChanceFactor(this.def.diseaseIncident, null), out Pawn pawn)) { break; } CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>(); if (comp.IsMagicUser) { HediffGiverUtility.TryApply(pawn, this.def.diseaseIncident, this.def.diseasePartsToAffect, false, 1, null); } } return(true); }
public List <Pawn> ApplyToPawns(IEnumerable <Pawn> pawns, out string blockedInfo) { List <Pawn> list = new List <Pawn>(); Dictionary <HediffDef, List <Pawn> > dictionary = new Dictionary <HediffDef, List <Pawn> >(); foreach (Pawn pawn in pawns) { HediffDef immunityCause = null; if (Rand.Chance(pawn.health.immunity.DiseaseContractChanceFactor(def.diseaseIncident, out immunityCause))) { HediffGiverUtility.TryApply(pawn, def.diseaseIncident, def.diseasePartsToAffect); TaleRecorder.RecordTale(TaleDefOf.IllnessRevealed, pawn, def.diseaseIncident); list.Add(pawn); } else if (immunityCause != null) { if (!dictionary.ContainsKey(immunityCause)) { dictionary[immunityCause] = new List <Pawn>(); } dictionary[immunityCause].Add(pawn); } } blockedInfo = string.Empty; foreach (KeyValuePair <HediffDef, List <Pawn> > item in dictionary) { if (item.Key != def.diseaseIncident) { if (blockedInfo.Length != 0) { blockedInfo += "\n\n"; } blockedInfo += "LetterDisease_Blocked".Translate(item.Key.LabelCap, def.diseaseIncident.label, (from victim in item.Value select victim.LabelShort).ToCommaList(useAnd: true)); } } return(list); }
public override void Apply(LocalTargetInfo target, LocalTargetInfo dest) { base.Apply(target, dest); if (Props.hediffDef == null) { return; } Hediff hediff = target.Pawn.health.hediffSet.GetFirstHediffOfDef(Props.hediffDef); if (hediff != null) { hediff.Severity += hediff.def.initialSeverity; } else { HediffGiverUtility.TryApply(target.Pawn, Props.hediffDef, Props.partsToAffect, Props.affectRandomPart, Props.partsCount, null); if (Props.jobToStart != null) { Job job = JobMaker.MakeJob(Props.jobToStart); target.Pawn.jobs.StartJob(job, JobCondition.InterruptForced, null, resumeCurJobAfterwards: true); } } }
public override void WorldComponentTick() { maps = Find.Maps; foreach (Map map in maps) { List <Pawn> pawns = map.mapPawns.AllPawnsSpawned; foreach (Pawn pawn in pawns) { //Log.Error("this runs"); for (int i = 0; i < GBKT_TraitDef.Length; i++) { bool?hasTrait = pawn.story?.traits?.HasTrait(GBKT_TraitDef[i]); if (hasTrait == true) { //SKY GAZER if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_SkyGazer) { bool IsPawnRoofed = pawn.Position.Roofed(pawn.Map); string whatIsTheWeather = pawn.Map.weatherManager.curWeather.ToString(); string PawnsCurrentJob = pawn.CurJobDef.ToString(); if (PawnsCurrentJob == "Skygaze" || PawnsCurrentJob == "UseTelescope") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_SkyGazerSeesSky, GBKT_BodyPartDef); } } //CARE GIVER foreach (Pawn VisitedPAwn in pawns) { string PawnsCurrentJob = pawn.CurJobDef.ToString(); if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_CareGiver) { if (PawnsCurrentJob == "VisitSickPawn" || PawnsCurrentJob == "TendPatient" || PawnsCurrentJob == "FeedPatient") { if (pawn.CurJob.targetA == VisitedPAwn) { bool tryThisHediff = HediffGiverUtility.TryApply(VisitedPAwn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_CareGiverVisited, GBKT_BodyPartDef); VisitedPAwn.needs.joy.GainJoy(0.00001f, GBTK_DefinitionTypes.GBTK_DefinitionTypes_JoyDeff.Social); } } } if (PawnsCurrentJob == "TendPatient") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_CareGiverTendedAPatient, GBKT_BodyPartDef); } } //AQUAPHILE if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Aquaphile) { bool DoesTileExtinguishFire = pawn.Position.GetTerrain(pawn.Map).extinguishesFire; if (DoesTileExtinguishFire == true) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_Aquaphile_On_Water_Tile, GBKT_BodyPartDef); } if (DoesTileExtinguishFire == true) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_Aquaphile_Is_Wet, GBKT_BodyPartDef); } if (pawn.Map.weatherManager.curWeather.exposedThought != null) { string DoesCurrentWeatherMakePawnWet = pawn.Map.weatherManager.curWeather.exposedThought.ToString(); if (DoesCurrentWeatherMakePawnWet == "SoakingWet") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_Aquaphile_In_The_Rain, GBKT_BodyPartDef); } } if (pawn.Map.weatherManager.curWeather.exposedThought != null) { string DoesCurrentWeatherMakePawnWet = pawn.Map.weatherManager.curWeather.exposedThought.ToString(); if (DoesCurrentWeatherMakePawnWet == "SoakingWet") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_Aquaphile_Is_Wet, GBKT_BodyPartDef); } } } //ENERGETIC if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Energetic) { string PawnsCurrentJob = pawn.CurJobDef.ToString(); if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Energetic) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_BaseEnergetic, GBKT_BodyPartDef); } if (PawnsCurrentJob == "GBKT_RunBackAndForth") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_EnergizedEnergetic, GBKT_BodyPartDef); } } //EXPLORER if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Explorer) { bool IsThePawnInThePlayerFaction = pawn.Faction.IsPlayer; bool IsThePawnInThePlayerHome = pawn.Map.IsPlayerHome; if (IsThePawnInThePlayerFaction == true && IsThePawnInThePlayerHome == true) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_ExplorerAtHome, GBKT_BodyPartDef); } if (IsThePawnInThePlayerFaction == false && IsThePawnInThePlayerHome == false) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_ExplorerAtHome, GBKT_BodyPartDef); } if (IsThePawnInThePlayerFaction == true && IsThePawnInThePlayerHome == false) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_ExplorerNotAtHome, GBKT_BodyPartDef); } if (IsThePawnInThePlayerFaction == false && IsThePawnInThePlayerHome == true) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_ExplorerNotAtHome, GBKT_BodyPartDef); } } //HOMEBODY if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Homebody) { bool IsThePawnInThePlayerFaction = pawn.Faction.IsPlayer; bool IsThePawnInThePlayerHome = pawn.Map.IsPlayerHome; string PawnsCurrentJob = pawn.CurJobDef.ToString(); float GBKT_JoyLevel = pawn.needs.joy.CurLevelPercentage; if (IsThePawnInThePlayerHome == true && IsThePawnInThePlayerFaction == true) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_Homebody_AtHome, GBKT_BodyPartDef); } if (IsThePawnInThePlayerFaction == false && IsThePawnInThePlayerHome == false) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_Homebody_AtHome, GBKT_BodyPartDef); } if (PawnsCurrentJob == "Clean" && GBKT_JoyLevel < 74.00f) { pawn.needs.joy.GainJoy(0.00001f, GBTK_DefinitionTypes.GBTK_DefinitionTypes_JoyDeff.Meditative); } } //DIRT LOVER if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_DirtLover) { bool IsPawnRoofed = pawn.Position.Roofed(pawn.Map); string WhatFilthDoesTileMake = "Null"; if (pawn.Position.GetTerrain(pawn.Map).generatedFilth != null) { WhatFilthDoesTileMake = pawn.Position.GetTerrain(pawn.Map).generatedFilth.ToString(); } string PawnsCurrentJob = pawn.CurJobDef.ToString(); Random random = new Random(); int randomNumber = random.Next(0, 5); if (randomNumber == 5) { if (WhatFilthDoesTileMake == "Filth_Dirt") { pawn.filth.GainFilth(GBTK_DefinitionTypes.GBTK_DefinitionTypes_ThingDeff.Filth_Dirt); } if (WhatFilthDoesTileMake == "Filth_Sand") { pawn.filth.GainFilth(GBTK_DefinitionTypes.GBTK_DefinitionTypes_ThingDeff.Filth_Sand); } } if (PawnsCurrentJob == "GBKT_EatDirt") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_AteSomeDirt, GBKT_BodyPartDef); } if (PawnsCurrentJob == "GBKT_PlaceDirt" && IsPawnRoofed == true) { pawn.needs.joy.GainJoy(10f, GBTK_DefinitionTypes.GBTK_DefinitionTypes_JoyDeff.Meditative); pawn.ClearAllReservations(true); pawn.filth.GainFilth(GBTK_DefinitionTypes.GBTK_DefinitionTypes_ThingDeff.Filth_Dirt); pawn.filth.GainFilth(GBTK_DefinitionTypes.GBTK_DefinitionTypes_ThingDeff.Filth_Sand); pawn.filth.GainFilth(GBTK_DefinitionTypes.GBTK_DefinitionTypes_ThingDeff.Filth_Dirt); pawn.filth.GainFilth(GBTK_DefinitionTypes.GBTK_DefinitionTypes_ThingDeff.Filth_Sand); pawn.filth.GetType().GetMethod("TryDropFilth", BindingFlags.Instance | BindingFlags.NonPublic).Invoke(pawn.filth, null); } } //DREAMER if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Dreamer) { string PawnsCurrentJob = pawn.CurJobDef.ToString(); float PawnsCurrentJoyLevel = pawn.needs.joy.CurLevelPercentage; bool IsPawnInBed = pawn.InBed(); //LayDown if (IsPawnInBed == true || PawnsCurrentJob == "LayDown") { pawn.needs.joy.GainJoy(0.00001f, GBTK_DefinitionTypes.GBTK_DefinitionTypes_JoyDeff.Meditative); } if (PawnsCurrentJoyLevel <= 0.80f && PawnsCurrentJoyLevel > 0.60f) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_DreamerUnhappyI, GBKT_BodyPartDef); } if (PawnsCurrentJoyLevel <= 0.60f && PawnsCurrentJoyLevel > 0.40f) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_DreamerUnhappyII, GBKT_BodyPartDef); } if (PawnsCurrentJoyLevel <= 0.40f && PawnsCurrentJoyLevel > 0.20f) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_DreamerUnhappyIII, GBKT_BodyPartDef); } if (PawnsCurrentJoyLevel <= 0.20f && PawnsCurrentJoyLevel >= 0.0f) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_DreamerUnhappyIV, GBKT_BodyPartDef); } } //GAMER if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Gamer) { string PawnsCurrentJoyKind = "Null"; if (pawn.CurJobDef.joyKind != null) { PawnsCurrentJoyKind = pawn.CurJobDef.joyKind.ToString(); } if (PawnsCurrentJoyKind != "Null") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_GamerPlayingGames, GBKT_BodyPartDef); } } //MEDITATIVE if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Meditative) { string PawnsCurrentJoyKind = "Null"; if (pawn.CurJobDef.joyKind != null) { PawnsCurrentJoyKind = pawn.CurJobDef.joyKind.ToString(); } if (PawnsCurrentJoyKind == "Meditative") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_RecentlyMeditatied, GBKT_BodyPartDef); } } //Socialite if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Socialite) { string PawnsCurrentJoyKind = "Null"; if (pawn.CurJobDef.joyKind != null) { PawnsCurrentJoyKind = pawn.CurJobDef.joyKind.ToString(); } if (PawnsCurrentJoyKind == "Social") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_RecentlySocialed, GBKT_BodyPartDef); } if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Socialite) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_SocailiteBase, GBKT_BodyPartDef); } } //COUCH POTATO if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_CouchPotato) { string PawnsCurrentJob = pawn.CurJobDef.ToString(); if (pawn.CurJobDef.joyKind != null) { PawnsCurrentJob = pawn.CurJobDef.ToString(); } if (PawnsCurrentJob == "ViewArt" || PawnsCurrentJob == "WatchTelevision") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_CouchPotatoViewing, GBKT_BodyPartDef); } } //FOODIE if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_Foodie) { string PawnsCurrentJob = pawn.CurJobDef.ToString(); string PawnsCurrentJoyKind = "Null"; if (pawn.CurJobDef.joyKind != null) { PawnsCurrentJoyKind = pawn.CurJobDef.joyKind.ToString(); } if (PawnsCurrentJoyKind == "Gluttonous") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_FoodieAteFood, GBKT_BodyPartDef); } if (PawnsCurrentJob == "Ingest") { pawn.needs.joy.GainJoy(0.00001f, GBTK_DefinitionTypes.GBTK_DefinitionTypes_JoyDeff.Gluttonous); } } // GBKT_BattleThrill if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_BattleThrill) { string PawnsCurrentJob = pawn.CurJobDef.ToString(); if (PawnsCurrentJob == "AttackStatic" || PawnsCurrentJob == "AttackMelee" || PawnsCurrentJob == "SocialFight") { pawn.needs.joy.GainJoy(0.00001f, GBTK_DefinitionTypes.GBTK_DefinitionTypes_JoyDeff.Meditative); bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_BattleThrillBattling, GBKT_BodyPartDef); } string PawnsCurrentJoyKind = "Null"; if (pawn.CurJobDef.joyKind != null) { PawnsCurrentJoyKind = pawn.CurJobDef.joyKind.ToString(); } if (PawnsCurrentJoyKind != "Null") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_BattleThrillBattling, GBKT_BodyPartDef); } } // SUN BATHER if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_SunBather) { string PawnsCurrentJob = pawn.CurJobDef.ToString(); if (PawnsCurrentJob == "GBKT_SunBathe") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_SunBather_SoakedUpRays, GBKT_BodyPartDef); } }// //SNOW BUNNY if (GBKT_TraitDef[i] == GBTK_DefinitionTypes.GBTK_DefinitionTypes_Traits.GBKT_SnowBunny) { float HowMuchSnowIsThere = 0; if (pawn.Map.weatherManager.curWeather.snowRate > 0.0f) { HowMuchSnowIsThere = pawn.Map.weatherManager.curWeather.snowRate; if (HowMuchSnowIsThere > 0.0f) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBTK_DefinitionTypes.GBTK_DefinitionTypes_Hediff.GBKT_SnowBunny_In_The_Snow, GBKT_BodyPartDef); } } } } } } } }
public override void WorldComponentTick() { maps = Find.Maps; foreach (Map map in maps) { List <Pawn> pawns = map.mapPawns.AllPawnsSpawned; foreach (Pawn pawn in pawns) { //Log.Error("this runs"); for (int i = 0; i < GBKT_TraitDef.Length; i++) { bool?hasTrait = pawn.story?.traits?.HasTrait(GBKT_TraitDef[i]); if (hasTrait == true) { if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Gibbering) { if (pawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Talking) > 0f) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_GibberingBase, GBKT_BodyPartDef); } } if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_CreativePlanner) { int randomNumber; randomNumber = UnityEngine.Random.Range(1, 1000); if (randomNumber == 1 && !pawn.Awake()) { pawn.Awake(); } } if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Sterilizer) { string PawnsCurrentJob = pawn.CurJobDef.ToString(); Room room = pawn.GetRoom(RegionType.Set_Passable); if (PawnsCurrentJob == "Clean" && room.Role != RoomRoleDefOf.Hospital) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_SterilizerCleaning, GBKT_BodyPartDef); } if (PawnsCurrentJob == "Clean" && room.Role == RoomRoleDefOf.Hospital) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_SterilizerCleaning2, GBKT_BodyPartDef); } } foreach (Pawn possibleFacPawn in pawns) { //ALLIED COLONISTS RANGE 25 if (possibleFacPawn.Position.DistanceTo(pawn.Position) < 26 && !pawn.InMentalState && !possibleFacPawn.InMentalState && possibleFacPawn.Awake() && pawn.Awake() && pawn.Faction == possibleFacPawn.Faction && !possibleFacPawn.RaceProps.Animal) { //CREATIVE PLANNER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_CreativePlanner) { if (possibleFacPawn != pawn) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_CreativePlannerNear, GBKT_BodyPartDef); } } //Fire Brigadier if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_FireBrigadier) { string PawnsCurrentJob = "Null"; if (possibleFacPawn.CurJobDef != null) { PawnsCurrentJob = possibleFacPawn.CurJobDef.ToString(); } if (PawnsCurrentJob == "TriggerFirefoamPopper" || PawnsCurrentJob == "BeatFire" || PawnsCurrentJob == "ExtinguishSelf") { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_FireBrigadierNear, GBKT_BodyPartDef); } string PawnsCurrentJob2 = "Null"; if (pawn.CurJobDef != null) { PawnsCurrentJob2 = possibleFacPawn.CurJobDef.ToString(); } if (PawnsCurrentJob2 == "TriggerFirefoamPopper" || PawnsCurrentJob2 == "BeatFire" || PawnsCurrentJob2 == "ExtinguishSelf") { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_FireBrigadierNear, GBKT_BodyPartDef); } } } //ALLIED COLONISTS RANGE 25 damsel if (possibleFacPawn.Position.DistanceTo(pawn.Position) < 26 && !pawn.InMentalState && !possibleFacPawn.InMentalState && possibleFacPawn.Awake() && pawn.Faction == possibleFacPawn.Faction) { //DAMSEL if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Damsel && pawn.Downed) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_DamselInTrouble, GBKT_BodyPartDef); } if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Damsel) { string PawnsCurrentJob = "Null"; if (possibleFacPawn.CurJobDef != null) { PawnsCurrentJob = possibleFacPawn.CurJobDef.ToString(); } if (PawnsCurrentJob == "TendPatient" && possibleFacPawn.CurJob.targetA == pawn) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_DamselBeingTended, GBKT_BodyPartDef); } } } //ALLIED COLONISTS RANGE 10 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 11 && pawn.Faction == possibleFacPawn.Faction && !possibleFacPawn.RaceProps.Animal && !pawn.InMentalState && possibleFacPawn.Awake() && !possibleFacPawn.InMentalState && pawn.Awake()) { //TASKMASTER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Taskmaster) { if (pawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Talking) > 0f && possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Hearing) > 0f) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_TaskmasterNear, GBKT_BodyPartDef); } } //MELEE COMMANDER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_MeleeCommander) { if (possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Sight) > 0f || possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Hearing) > 0f) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_MeleeCommanderNear, GBKT_BodyPartDef); } } //CHEER LEADER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_CheerLeader) { if (pawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Talking) > 0f && possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Hearing) > 0f) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_CheerLeaderNear, GBKT_BodyPartDef); } } //PLAY LEADER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_PlayLeader) { string PawnsCurrentJoyKind = "Null"; if (possibleFacPawn.CurJobDef.joyKind != null) { PawnsCurrentJoyKind = possibleFacPawn.CurJobDef.joyKind.ToString(); } if (PawnsCurrentJoyKind != "Null") { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_PlayLeaderNear, GBKT_BodyPartDef); } } } //ALLIED COLONISTS RANGE 5 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 6 && !pawn.InMentalState && !possibleFacPawn.InMentalState && possibleFacPawn.Awake() && pawn.Awake() && pawn.Faction == possibleFacPawn.Faction && !possibleFacPawn.RaceProps.Animal) { //TEACHER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Teacher) { if (possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Sight) == 0f) { continue; } if (possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Hearing) == 0f) { continue; } if (possibleFacPawn.story.adulthood != null) { HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_TeacherNear, GBKT_BodyPartDef); } else { HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_TeacherNear2, GBKT_BodyPartDef); } } //RESEARCH ASSISTANT if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_ResearchAssistant) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_ResearchAssistantNear, GBKT_BodyPartDef); } //Sterilizer if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Sterilizer) { string PawnsCurrentJob = possibleFacPawn.CurJobDef.ToString();; string PawnsCurrentJob2 = pawn.CurJobDef.ToString(); Room room = pawn.GetRoom(RegionType.Set_Passable); if (possibleFacPawn.CurJobDef != null) { PawnsCurrentJob = possibleFacPawn.CurJobDef.ToString(); } if (!pawn.Downed && !pawn.InBed() && PawnsCurrentJob == "TendPatient") { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_SterilizerNearby, GBKT_BodyPartDef); } if (!pawn.Downed && !pawn.InBed() && possibleFacPawn.InBed() && room.Role == RoomRoleDefOf.Hospital) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_SterilizerNearby2, GBKT_BodyPartDef); } } } //ALL PAWNS RANGE 2 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 3 && possibleFacPawn.Awake() && pawn.Awake()) { //GIBBERING if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_SpasticFool) { if (pawn.Drafted) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_SpasticFoolNear, GBKT_BodyPartDef); } } } //ALL PAWNS RANGE 10 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 11 && !possibleFacPawn.RaceProps.Animal && possibleFacPawn.Awake() && pawn.Awake()) { //GIBBERING if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Gibbering) { if (pawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Talking) > 0f && possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Hearing) > 0f) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_GibberingNear, GBKT_BodyPartDef); } } } //ALL PAWNS RANGE 100 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 100 && !possibleFacPawn.RaceProps.Animal && possibleFacPawn.Awake() && pawn.Awake()) { //GIBBERING if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Blabbermouth) { if (pawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Talking) > 0f && possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Hearing) > 0f) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_BlabbermouthNear, GBKT_BodyPartDef); } } } //ALLIED ANIMALS RANGE 10 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 11 && pawn.Faction == possibleFacPawn.Faction && possibleFacPawn.RaceProps.Animal && !pawn.InMentalState && possibleFacPawn.Awake() && !possibleFacPawn.InMentalState && pawn.Awake()) { //CALVARY MASTER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Outrider) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_OutriderNear, GBKT_BodyPartDef); } } //ALLIED ANIMALS RANGE 1 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 1 && pawn.Faction == possibleFacPawn.Faction && possibleFacPawn.RaceProps.Animal && !pawn.InMentalState && possibleFacPawn.Awake() && !possibleFacPawn.InMentalState && pawn.Awake()) { //CALVARY MASTER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Outrider) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_OutriderAdjacent, GBKT_BodyPartDef); } } //ALLIED ANIMALS RANGE 100 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 100 && possibleFacPawn.RaceProps.Animal && pawn.Faction == possibleFacPawn.Faction) { //BEAST MASTER if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_BeastMaster) { List <DirectPawnRelation> directRelations = possibleFacPawn.relations.DirectRelations; for (int u = 0; u < directRelations.Count; u++) { DirectPawnRelation directPawnRelation = directRelations[u]; Pawn otherPawn = directPawnRelation.otherPawn; if (directPawnRelation.def == PawnRelationDefOf.Bond) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_BeastMasterNear, GBKT_BodyPartDef); } if (directPawnRelation.def == PawnRelationDefOf.Bond && pawn.CurJob.targetA.Equals(possibleFacPawn)) { bool tryThisHediff = HediffGiverUtility.TryApply(pawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_BeastMasterWorkingWithBondeds, GBKT_BodyPartDef); } } } } //ALLIED PAWNS RANGE 1 if (possibleFacPawn != pawn && possibleFacPawn.Position.DistanceTo(pawn.Position) < 2 && !pawn.InMentalState && !possibleFacPawn.InMentalState && possibleFacPawn.Awake() && pawn.Awake() && !possibleFacPawn.HostileTo(pawn)) { //BODYGUARD if (GBKT_TraitDef[i] == GBKT_DefinitionTypes.GBKT_DefinitionTypes_Traits.GBKT_Bodyguard) { if (pawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Talking) > 0f && possibleFacPawn.health.capacities.GetLevel(GBKT_DefinitionTypes.GBTK_DefinitionTypes_CapacityDeff.Hearing) > 0f) { bool tryThisHediff = HediffGiverUtility.TryApply(possibleFacPawn, GBKT_DefinitionTypes.GBKT_DefinitionTypes_Hediff.GBKT_BodyguardNear, GBKT_BodyPartDef); } } } } } } } } }