/// <summary>Gets the random selection weight.</summary> /// <param name="initiator">The initiator.</param> /// <param name="recipient">The recipient.</param> /// <returns></returns> public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { float weight = 0f; Dictionary <string, float> dicc = new Dictionary <string, float>() { { "EtherWing", 0.5f }, { "EtherTailfeathers", 1f }, { "EtherEggLayer", 2f }, { "EtherWingTip", 1f }, { "EtherAvianFoot", 0.5f }, { "EtherFeatheredLimb", 0.5f }, }; HediffSet hs = initiator.health.hediffSet; if (initiator.health.hediffSet.HasHediff(HediffDef.Named("EtherBeak"))) { foreach (KeyValuePair <string, float> pair in dicc) { if (hs.HasHediff(HediffDef.Named(pair.Key))) { weight += pair.Value; } } if (hs.HasHediff(HediffDef.Named("EtherEggLayer"))) { weight += hs.hediffs.Find(x => x.def.defName == "EtherEggLayer").Severity * 3; } return(weight); } else { return(0f); } }
/* * public void BodyCheck(HediffSet hediffSet) * { * //var list = hediffSet.hediffs.FindAll(x => x.Part != null && x.Part.IsInGroup(racomp.torsoDef.linkedBodyGroup)); * var list = hediffSet.hediffs.FindAll(x => x.Part == null && racomp.torsoDef.linkedBodyGroup == null || x.Part != null && x.Part.IsInGroup(racomp.torsoDef.linkedBodyGroup)); * if (racomp.torsoDef.bodyPath.customs.FindAll(x => list.Any(y => y.def == x.hediffDef)) is var list2 && list2.Count > 0) * { * list2.Sort((x, y) => y.priority - x.priority); * if (list2[0].hediffDef != lastBodyHediffDef) * { * ResolveAllGraphics.RenewalBodyGraphic(pawn.Drawer.renderer.graphics, list2[0].path, racomp.torsoDef.shaderType.Shader, racomp, (pawn.def as RaceAddonThingDef).raceAddonSettings.graphicSetting.rottingColor); * lastBodyHediffDef = list2[0].hediffDef; * } * } * } * * public void HeadCheck(HediffSet hediffSet) * { * //var list = hediffSet.hediffs.FindAll(x => x.Part != null && x.Part.IsInGroup(racomp.torsoDef.linkedHeadGroup)); * var list = hediffSet.hediffs.FindAll(x => x.Part == null && racomp.torsoDef.linkedHeadGroup == null || x.Part != null && x.Part.IsInGroup(racomp.torsoDef.linkedHeadGroup)); * if (racomp.torsoDef.headPath.customs.FindAll(x => list.Any(y => y.def == x.hediffDef)) is var list2 && list2.Count > 0) * { * list2.Sort((x, y) => y.priority - x.priority); * if (list2[0].hediffDef != lastHeadHediffDef) * { * ResolveAllGraphics.RenewalHeadGraphic(pawn.Drawer.renderer.graphics, list2[0].path, racomp.torsoDef.shaderType.Shader, racomp, (pawn.def as RaceAddonThingDef).raceAddonSettings.graphicSetting.rottingColor); * lastHeadHediffDef = list2[0].hediffDef; * } * } * } */ public void TorsoCheck(HediffSet hediffSet) { if (racomp.torsoDef.headPath.customs.FindAll(x => hediffSet.HasHediff(x.hediffDef, null)) is var headList && headList.Count > 0) { headList.Sort((x, y) => y.priority - x.priority); if (headList[0].hediffDef != lastHeadHediffDef) { ResolveAllGraphics.RenewalHeadGraphic(pawn.Drawer.renderer.graphics, headList[0].path, racomp.torsoDef.shaderType.Shader, racomp, (pawn.def as RaceAddonThingDef).raceAddonSettings.graphicSetting.rottingColor); lastHeadHediffDef = headList[0].hediffDef; } } if (racomp.torsoDef.bodyPath.customs.FindAll(x => hediffSet.HasHediff(x.hediffDef, null)) is var bodyList && bodyList.Count > 0) { bodyList.Sort((x, y) => y.priority - x.priority); if (bodyList[0].hediffDef != lastBodyHediffDef) { ResolveAllGraphics.RenewalHeadGraphic(pawn.Drawer.renderer.graphics, bodyList[0].path, racomp.torsoDef.shaderType.Shader, racomp, (pawn.def as RaceAddonThingDef).raceAddonSettings.graphicSetting.rottingColor); lastBodyHediffDef = bodyList[0].hediffDef; } } var injuredParts = hediffSet.GetInjuredParts(); bodyDamaged = injuredParts.Any(x => x.IsInGroup(racomp.torsoDef.linkedBodyGroup)); headDamaged = injuredParts.Any(x => x.IsInGroup(racomp.torsoDef.linkedHeadGroup)); }
private static void AddHackedPawnGizmos(Pawn __instance, ref List <Gizmo> gizmoList, ExtendedDataStorage store) { ExtendedPawnData pawnData = store.GetExtendedDataFor(__instance); gizmoList.Add(CreateGizmo_SearchAndDestroy(__instance, pawnData)); gizmoList.Add(CreateGizmo_AutoRecharge(__instance, pawnData)); HediffSet hediffSet = __instance.health.hediffSet; if (!__instance.IsColonistPlayerControlled) { if (__instance.apparel != null) { foreach (Gizmo apparelGizmo in __instance.apparel.GetGizmos()) { gizmoList.Add(apparelGizmo); } } } if (hediffSet.HasHediff(WTH_DefOf.WTH_SelfDestruct)) { gizmoList.Add(CreateGizmo_SelfDestruct(__instance, pawnData)); } if (hediffSet.HasHediff(WTH_DefOf.WTH_RepairModule)) { gizmoList.Add(CreateGizmo_SelfRepair(__instance, pawnData)); } if (hediffSet.HasHediff(WTH_DefOf.WTH_RepairModule) && hediffSet.HasHediff(WTH_DefOf.WTH_RepairArm)) { gizmoList.Add(CreateGizmo_Repair(__instance, pawnData)); } if (hediffSet.HasHediff(WTH_DefOf.WTH_BeltModule)) { gizmoList.Add(CreateGizmo_EquipBelt(__instance, pawnData)); } }
public static bool BloodStatus(Pawn pawn) { HediffSet hediffSet = pawn.health.hediffSet; bool result = false; bool hasbloodedM = hediffSet.hediffs.Any <Hediff>(x => x.def.defName.StartsWith(markedDef.defName)); if (hasbloodedM) { foreach (var item in hediffSet.hediffs) { if (item.def.defName.StartsWith(markedDef.defName)) { result = true; break; } } } bool hasunblooded = hediffSet.HasHediff(unbloodedDef); if (hasunblooded) { result = false; } bool hasbloodedUM = hediffSet.HasHediff(unmarkedDef); if (hasbloodedUM) { result = true; } return(result); }
/// <summary>gets the random selection weight.</summary> /// <param name="initiator">The initiator.</param> /// <param name="recipient">The recipient.</param> /// <returns></returns> public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { float weight = 0f; Dictionary <string, float> dicc = new Dictionary <string, float>() { { "EtherCowEar", 0.5f }, { "EtherCowTail", 1f }, { "EtherUdder", 2f }, { "EtherHoofHand", 1f }, { "EtherClovenHoofFoot", 0.5f }, { "EtherHorns", 0.5f }, }; HediffSet hs = initiator.health.hediffSet; if (initiator.health.hediffSet.HasHediff(HediffDef.Named("EtherCowSnout"))) { foreach (KeyValuePair <string, float> pair in dicc) { if (hs.HasHediff(HediffDef.Named(pair.Key))) { weight += pair.Value; } } if (hs.HasHediff(HediffDef.Named("EtherUdder"))) { weight += hs.hediffs.Find(x => x.def.defName == "EtherUdder").Severity * 3; } return(weight); } else { return(0f); } }
public static bool isNeomorphInfectedPawn(Pawn pawn) { HediffSet hediffSet = pawn.health.hediffSet; if (hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenNeomorphImpregnation, false)) { return(true); } if (hediffSet.HasHediff(XenomorphDefOf.RRY_NeomorphImpregnation, false)) { return(true); } return(false); }
public static bool BloodStatus(Pawn pawn, out Hediff BloodHD) { HediffSet hediffSet = pawn.health.hediffSet; BodyPartRecord part; bool result = false; BloodHD = null; bool hasbloodedM = hediffSet.hediffs.Any <Hediff>(x => x.def.defName.StartsWith(markedDef.defName)); if (hasbloodedM) { foreach (var item in hediffSet.hediffs) { if (item.def.defName.StartsWith(markedDef.defName)) { BloodHD = item; result = true; break; } } } bool hasunblooded = hediffSet.HasHediff(unbloodedDef); if (hasunblooded) { BloodHD = hediffSet.GetFirstHediffOfDef(unbloodedDef); result = false; } bool hasbloodedUM = hediffSet.HasHediff(unmarkedDef); if (hasbloodedUM) { BloodHD = hediffSet.GetFirstHediffOfDef(unmarkedDef); result = true; } if (BloodHD == null) { foreach (var item in pawn.RaceProps.body.AllParts) { if (item.def == BodyPartDefOf.Head) { part = item; pawn.health.AddHediff(unbloodedDef, part); } } } return(result); }
/// <summary>gets the random selection weight.</summary> /// <param name="initiator">The initiator.</param> /// <param name="recipient">The recipient.</param> /// <returns></returns> public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { float weight = 0f; Dictionary <string, float> dicc = new Dictionary <string, float>() { { "EtherSheepEar", 0.5f }, { "EtherSheepTail", 1f }, { "EtherSheepSnout", 2f }, { "EtherHoofHand", 1f }, { "EtherDigitigradeLeg", 0.5f }, { "EtherClovenHoofFoot", 0.5f }, { "EtherWoolySheep", 1f }, { "EtherSheepEye", 0.2f }, }; HediffSet hs = initiator.health.hediffSet; if (initiator.health.hediffSet.HasHediff(HediffDef.Named("EtherSheepSnout"))) { foreach (KeyValuePair <string, float> pair in dicc) { if (hs.HasHediff(HediffDef.Named(pair.Key))) { weight += pair.Value; } } return(weight); } else { return(0f); } }
public void Check(HediffSet hediffSet) { if (!hediffSet.HasHediff(custom.First?.hediffDef)) { custom = new Pair <CustomPath, Graphic>(); } }
internal static void Postfix(HediffSet diffSet, ref float __result) { if (diffSet.HasHediff(RemediesDefOf.FF_EctostasisHigh)) { __result = 999f; } }
/// <summary>gets the random selection weight.</summary> /// <param name="initiator">The initiator.</param> /// <param name="recipient">The recipient.</param> /// <returns></returns> public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { float weight = 0f; Dictionary <string, float> dicc = new Dictionary <string, float>() { { "EtherFoxEar", 0.5f }, { "EtherFluffyTail", 1f }, { "EtherFoxMuzzle", 2f }, { "EtherPawHand", 1f }, { "EtherDigitigradeLeg", 0.5f }, { "EtherPawFoot", 0.5f }, { "EtherFurredLimb", 0.2f }, { "EtherFoxEye", 0.2f }, }; HediffSet hs = initiator.health.hediffSet; if (initiator.health.hediffSet.HasHediff(HediffDef.Named("EtherFoxMuzzle"))) { foreach (KeyValuePair <string, float> pair in dicc) { if (hs.HasHediff(HediffDef.Named(pair.Key))) { weight += pair.Value; } } return(weight); } else { return(0f); } }
public void Update(HediffSet hediffSet) { foreach (var custom in faceDef.customs) { if (hediffSet.HasHediff(custom.hediffDef) && custom.priority > this.custom.First.priority) { this.custom = new Pair <CustomPath, Graphic>(custom, custom.path.GetGraphic(neutral.Shader, neutral.Color, neutral.ColorTwo)); return; } } }
private static IEnumerable <Gizmo> AddHackedPawnGizmos(Pawn __instance, ExtendedDataStorage store) { ExtendedPawnData pawnData = store.GetExtendedDataFor(__instance); yield return(CreateGizmo_SearchAndDestroy(__instance, pawnData)); Need_Power powerNeed = __instance.needs.TryGetNeed <Need_Power>(); Need_Maintenance maintenanceNeed = __instance.needs.TryGetNeed <Need_Maintenance>(); if (powerNeed != null) { yield return(CreateGizmo_AutoRecharge(__instance, powerNeed)); } HediffSet hediffSet = __instance.health.hediffSet; if (!__instance.IsColonistPlayerControlled) { if (__instance.apparel != null) { foreach (Gizmo apparelGizmo in __instance.apparel.GetGizmos()) { yield return(apparelGizmo); } } } if (__instance.workSettings != null) { yield return(CreateGizmo_Work(__instance, pawnData)); if (powerNeed != null) { yield return(CreateGizmo_WorkThreshold(__instance, powerNeed)); } } if (maintenanceNeed != null) { yield return(CreateGizmo_MaintenanceThreshold(__instance, maintenanceNeed)); } if (hediffSet.HasHediff(WTH_DefOf.WTH_SelfDestruct)) { yield return(CreateGizmo_SelfDestruct(__instance, pawnData)); } if (hediffSet.HasHediff(WTH_DefOf.WTH_RepairModule)) { yield return(CreateGizmo_SelfRepair(__instance, pawnData)); } if (hediffSet.HasHediff(WTH_DefOf.WTH_RepairModule) && hediffSet.HasHediff(WTH_DefOf.WTH_RepairArm)) { yield return(CreateGizmo_Repair(__instance, pawnData)); } if (hediffSet.HasHediff(WTH_DefOf.WTH_BeltModule)) { yield return(CreateGizmo_EquipBelt(__instance, pawnData)); } if (hediffSet.HasHediff(WTH_DefOf.WTH_OverdriveModule)) { yield return(CreateGizmo_Overdrive(__instance, pawnData)); } }
public void Check(HediffSet hediffSet) { if (!hediffSet.HasHediff(custom.First?.hediffDef, linkedBodyPart)) { custom = new Pair <CustomPath, Graphic>(); customRotting = new Pair <CustomPath, Graphic>(); Update(hediffSet); } if (partDamaged && linkedBodyPart != null) { partDamaged = hediffSet.GetInjuredParts().Contains(linkedBodyPart); } }
public static bool HasIrregularBloodSugar(Pawn pawn) { HediffSet set = pawn.health.hediffSet; if (set.HasHediff(TypeGetter.HediffDef(EHediffDef.Hypoglycaemia))) { return(true); } if (set.HasHediff(TypeGetter.HediffDef(EHediffDef.Hyperglycaemia))) { if (set.HasHediff(TypeGetter.HediffDef(EHediffDef.InsulinHigh))) { return(false); } if (set.HasHediff(TypeGetter.HediffDef(EHediffDef.AdvancedInsulinPump))) { return(false); } return(true); } return(false); }
public void Update(HediffSet hediffSet) { foreach (var custom in data.addonDef.addonPath.customs) { if (hediffSet.HasHediff(custom.hediffDef, linkedBodyPart) && (this.custom.First == null || custom.priority > this.custom.First.priority)) { this.custom = new Pair <CustomPath, Graphic>(custom, custom.path.GetGraphic(normal.Shader, normal.Color, normal.ColorTwo)); customRotting = new Pair <CustomPath, Graphic>(custom, custom.path.GetGraphic(normalRotting.Shader, normalRotting.Color, normalRotting.ColorTwo)); break; } } if (linkedBodyPart != null) { partDamaged = hediffSet.GetInjuredParts().Contains(linkedBodyPart); } }
// Token: 0x06002A4A RID: 10826 RVA: 0x00138F4C File Offset: 0x0013734C public override IEnumerable <FloatMenuOption> CompFloatMenuOptions(Pawn myPawn) { string failReason; HediffSet hediffSet = myPawn.health.hediffSet; if (!hediffSet.HasHediff(YautjaDefOf.RRY_Hediff_BloodedUM, false)) { yield break; } if (!this.CanBeUsedBy(myPawn, out failReason)) { yield break; yield return(new FloatMenuOption(this.FloatMenuOptionLabel + ((failReason == null) ? string.Empty : (" (" + failReason + ")")), null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (!myPawn.CanReach(this.parent, PathEndMode.Touch, Danger.Deadly, false, TraverseMode.ByPawn)) { yield return(new FloatMenuOption(this.FloatMenuOptionLabel + " (" + "NoPath".Translate() + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (!myPawn.CanReserve(this.parent, 1, -1, null, false)) { yield return(new FloatMenuOption(this.FloatMenuOptionLabel + " (" + "Reserved".Translate() + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else if (!myPawn.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation)) { yield return(new FloatMenuOption(this.FloatMenuOptionLabel + " (" + "Incapable".Translate() + ")", null, MenuOptionPriority.Default, null, null, 0f, null, null)); } else { FloatMenuOption useopt = new FloatMenuOption(this.FloatMenuOptionLabel, delegate() { if (myPawn.CanReserveAndReach(this.parent, PathEndMode.Touch, Danger.Deadly, 1, -1, null, false)) { foreach (CompUseEffect compUseEffect in this.parent.GetComps <CompUseEffect>()) { if (compUseEffect.SelectedUseOption(myPawn)) { return; } } this.TryStartUseJob(myPawn); } }, MenuOptionPriority.Default, null, null, 0f, null, null); yield return(useopt); } yield break; }
/// <summary>gets the random selection weight.</summary> /// <param name="initiator">The initiator.</param> /// <param name="recipient">The recipient.</param> /// <returns></returns> public override float RandomSelectionWeight(Pawn initiator, Pawn recipient) { float weight = 0f; Dictionary <string, float> dicc = new Dictionary <string, float>() { { "EtherHuskyMuzzle", 0.5f }, { "EtherWargMuzzle", 0.5f }, { "EtherWolfMuzzle", 0.5f }, { "EtherWolfEar", 0.5f }, { "EtherWargEar", 0.5f }, { "EtherHuskyEar", 0.5f }, { "EtherWolfTail", 1f }, { "EtherWargTail", 1f }, { "EtherHuskyTail", 1f }, { "EtherPawFoot", 0.5f }, { "EtherThickFurLimb", 0.5f }, { "EtherFurredLimb", 0.5f }, }; HediffSet hs = initiator.health.hediffSet; if (initiator.health.hediffSet.HasHediff(HediffDef.Named("EtherHuskyMuzzle")) || initiator.health.hediffSet.HasHediff(HediffDef.Named("EtherWargMuzzle")) || initiator.health.hediffSet.HasHediff(HediffDef.Named("EtherWolfMuzzle"))) { foreach (KeyValuePair <string, float> pair in dicc) { if (hs.HasHediff(HediffDef.Named(pair.Key))) { weight += pair.Value; } } return(weight); } else { return(0f); } }
public static bool BloodStatus(Pawn pawn, out Hediff BloodHD) { HediffSet hediffSet = pawn.health.hediffSet; BodyPartRecord part = pawn.RaceProps.body.AllParts.Find(x => x.def == BodyPartDefOf.Head); HediffDef hediffDef; bool result = false; BloodHD = null; bool hasbloodedM = hediffSet.hediffs.Any <Hediff>(x => x.def.defName.StartsWith(markedDef.defName)); if (hasbloodedM) { BloodHD = hediffSet.hediffs.Find(x => x.def.defName.Contains(markedDef.defName)); // Log.Message(string.Format("hasbloodedM: {0}", BloodHD)); result = true; } bool hasunblooded = hediffSet.HasHediff(unbloodedDef); if (hasunblooded) { BloodHD = hediffSet.GetFirstHediffOfDef(unbloodedDef); if (!PlayerKnowledgeDatabase.IsComplete(YautjaConceptDefOf.RRY_Concept_Unblooded) && pawn.IsColonist && pawn.Spawned && (pawn.Map != null || pawn.MapHeld != null)) { LessonAutoActivator.TeachOpportunity(YautjaConceptDefOf.RRY_Concept_Unblooded, OpportunityType.Important); } // Log.Message(string.Format("hasunblooded: {0}", BloodHD)); result = false; } bool hasbloodedUM = hediffSet.HasHediff(unmarkedDef); if (hasbloodedUM) { BloodHD = hediffSet.GetFirstHediffOfDef(unmarkedDef); if (!PlayerKnowledgeDatabase.IsComplete(YautjaConceptDefOf.RRY_Concept_Blooding) && pawn.IsColonist && pawn.Spawned && (pawn.Map != null || pawn.MapHeld != null)) { LessonAutoActivator.TeachOpportunity(YautjaConceptDefOf.RRY_Concept_Blooding, OpportunityType.Important); } // Log.Message(string.Format("hasbloodedUM: {0}", BloodHD)); result = true; } if (BloodHD == null) { // Log.Message(string.Format("1")); Backstory pawnStoryC = pawn.story.childhood; Backstory pawnStoryA = pawn.story.adulthood ?? null; if (pawn.kindDef.race == YautjaDefOf.RRY_Alien_Yautja && pawnStoryA != null) { // Log.Message(string.Format("2")); if (pawnStoryA != bsDefUnblooded.backstory) { // Log.Message(string.Format("3")); Comp_Yautja _Yautja = pawn.TryGetComp <Comp_Yautja>(); hediffDef = _Yautja.Props.bloodedDefs.RandomElement(); if (hediffDef != null) { // Log.Message(string.Format("4")); PawnKindDef pawnKindDef = YautjaBloodedUtility.RandomMarked(hediffDef); if (_Yautja != null) { // Log.Message(string.Format("5")); _Yautja.MarkHedifflabel = pawnKindDef.LabelCap; _Yautja.MarkedhediffDef = hediffDef; _Yautja.predator = pawnKindDef.RaceProps.predator; _Yautja.BodySize = pawnKindDef.RaceProps.baseBodySize; _Yautja.combatPower = pawnKindDef.combatPower; } } } else { // Log.Message(string.Format("6")); hediffDef = unbloodedDef; } } else { // Log.Message(string.Format("7")); hediffDef = unbloodedDef; } // Log.Message(string.Format("8")); pawn.health.AddHediff(hediffDef, part); // Log.Message(string.Format("9")); BloodHD = hediffSet.GetFirstHediffOfDef(hediffDef); // Log.Message(string.Format("10")); result = true; // Log.Message(string.Format("11")); } else { // Log.Message(string.Format("12")); Comp_Yautja _Yautja = pawn.TryGetComp <Comp_Yautja>(); // Log.Message(string.Format("12 a {0}", BloodHD.def)); if (hasbloodedM) { PawnKindDef pawnKindDef = YautjaBloodedUtility.RandomMarked(BloodHD.def); // Log.Message(string.Format("12 B {0}", pawnKindDef)); if (_Yautja != null && _Yautja.MarkHedifflabel.NullOrEmpty()) { // Log.Message(string.Format("13 ")); _Yautja.MarkHedifflabel = pawnKindDef.LabelCap; // Log.Message(string.Format("13 a")); _Yautja.MarkedhediffDef = BloodHD.def; // Log.Message(string.Format("13 b")); _Yautja.predator = pawnKindDef.RaceProps.predator; // Log.Message(string.Format("13 c")); _Yautja.BodySize = pawnKindDef.RaceProps.baseBodySize; // Log.Message(string.Format("13 d")); _Yautja.combatPower = pawnKindDef.combatPower; // Log.Message(string.Format("13 f")); } } } // Log.Message(string.Format("14")); return(result); }