// Token: 0x06000188 RID: 392 RVA: 0x0000ECA4 File Offset: 0x0000D0A4 public static float GetPreyScoreFor(Pawn predator, Pawn prey, bool findhost) { float offset = XenomorphUtil.TotalSpawnedXenomorphPawnCount(prey.Map); float num = prey.kindDef.combatPower / predator.kindDef.combatPower; float num2 = prey.health.summaryHealth.SummaryHealthPercent; float bodySizeFactor = prey.ageTracker.CurLifeStage.bodySizeFactor / predator.ageTracker.CurLifeStage.bodySizeFactor; float lengthHorizontal = (predator.Position - prey.Position).LengthHorizontal; if (prey.Downed) { num2 = Mathf.Min(num2, 0.2f); } float num3 = -lengthHorizontal - 56f * num2 * num2 * num * bodySizeFactor; float num4 = -56f * num2 * num2 * num * bodySizeFactor; if (prey.isHost()) { if (prey.isXenoHost()) { num3 -= 350f; } if (prey.isNeoHost() && findhost) { num3 -= 350f; } } if (prey.isNeomorph()) { num3 -= 350f; } if (prey.isPotentialHost()) { num3 += 20f; } if (prey.RaceProps.Humanlike) { num3 -= 35f; } num3 += offset * 3; bool selected = Find.Selector.SelectedObjects.Contains(predator) && Prefs.DevMode; if (selected) { Log.Message(string.Format("{0} found: {1} @: {2}\nPreyScore: {3}, BFPreyScore: {4}, isXenoHost: {5}, isNeoHost: {6}, isXenomorph: {7}, isNeomorph: {8}, isPotentialHost: {9}, Humanlike: {10}", predator.LabelShortCap, prey.LabelShortCap, prey.Position, num3, num4, prey.isXenoHost(), prey.isNeoHost(), prey.isXenomorph(), prey.isNeomorph(), prey.isPotentialHost(), prey.RaceProps.Humanlike)); } return(num3); }
// Token: 0x060004D2 RID: 1234 RVA: 0x00031074 File Offset: 0x0002F474 public static bool TryFindGoodImpregnateVictim(Pawn kidnapper, float maxDist, out Pawn victim, List <Thing> disallowed = null) { if (!kidnapper.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation) || !kidnapper.Map.reachability.CanReachMapEdge(kidnapper.Position, TraverseParms.For(kidnapper, Danger.Some, TraverseMode.ByPawn, false))) { // Log.Message(string.Format("TryFindGoodImpregnateVictim \n{0} incapable of job", kidnapper.LabelShortCap)); victim = null; return(false); } Predicate <Thing> validator = delegate(Thing t) { Pawn pawn = t as Pawn; bool cocoonFlag = !pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_Hediff_Cocooned); bool pawnFlag = ((XenomorphUtil.isInfectablePawn(pawn))) && !XenomorphUtil.IsXenomorph(pawn) && pawn.gender == Gender.Female && pawn.Downed && (pawn.Faction == null || pawn.Faction.HostileTo(kidnapper.Faction) || kidnapper.Faction == null); // Log.Message(string.Format(" cocoonFlag; {0} \n pawnFlag: {1}", cocoonFlag, pawnFlag)); return((cocoonFlag && pawnFlag) && (kidnapper.CanReserve(pawn, 1, -1, null, false) && (disallowed == null || !disallowed.Contains(pawn))) && pawn != kidnapper && pawn.gender == Gender.Female); }; // Log.Message(string.Format("TryFindGoodImpregnateVictim \nvalidator {0}", validator)); victim = (Pawn)GenClosest.ClosestThingReachable(kidnapper.Position, kidnapper.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Some, false), maxDist, validator, null, 0, -1, false, RegionType.Set_Passable, false); // Log.Message(string.Format("TryFindGoodImpregnateVictim \nvictim {0}", victim)); return(victim != null); }
// Token: 0x060004D2 RID: 1234 RVA: 0x00031074 File Offset: 0x0002F474 public static bool TryFindGoodKidnapVictim(Pawn kidnapper, float maxDist, out Pawn victim, List <Thing> disallowed = null) { if (!kidnapper.health.capacities.CapableOf(PawnCapacityDefOf.Manipulation) || !kidnapper.Map.reachability.CanReachMapEdge(kidnapper.Position, TraverseParms.For(kidnapper, Danger.Some, TraverseMode.ByPawn, false))) { victim = null; return(false); } Predicate <Thing> validator = delegate(Thing t) { Pawn pawn = t as Pawn; bool cocoonFlag = !pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_Hediff_Cocooned); bool xenoimpregnationFlag = !pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_XenomorphImpregnation) || (pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_XenomorphImpregnation) && pawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_XenomorphImpregnation).CurStageIndex != pawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_XenomorphImpregnation).def.stages.Count - 2); bool xenohiddenimpregnationFlag = !pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenXenomorphImpregnation) || (pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenXenomorphImpregnation) && pawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_HiddenXenomorphImpregnation).CurStageIndex != pawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_HiddenXenomorphImpregnation).def.stages.Count - 2); bool neoimpregnationFlag = !pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_NeomorphImpregnation); bool neohiddenimpregnationFlag = !pawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenNeomorphImpregnation); bool impregnationFlag = xenoimpregnationFlag && xenohiddenimpregnationFlag && neoimpregnationFlag && neohiddenimpregnationFlag; bool pawnFlag = ((XenomorphUtil.isInfectablePawn(pawn, true))) && pawn.Downed && (pawn.Faction == null || pawn.Faction.HostileTo(kidnapper.Faction)); return(cocoonFlag && pawnFlag && kidnapper.CanReserve(pawn, 1, -1, null, false) && (disallowed == null || !disallowed.Contains(pawn))); }; victim = (Pawn)GenClosest.ClosestThingReachable(kidnapper.Position, kidnapper.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Some, false), maxDist, validator, null, 0, -1, false, RegionType.Set_Passable, false); return(victim != null); }
// Token: 0x060039DF RID: 14815 RVA: 0x001B80A4 File Offset: 0x001B64A4 protected override DamageWorker.DamageResult ApplyMeleeDamageToTarget(LocalTargetInfo target) { DamageWorker.DamageResult result = new DamageWorker.DamageResult(); Pawn hitPawn = (Pawn)target; if (infect && !XenomorphUtil.IsInfectedPawn(hitPawn) && !hitPawn.Dead && hitPawn.RaceProps.body.AllParts.Any(x => x.def.defName.Contains("Head"))) { foreach (var part in hitPawn.RaceProps.body.AllParts.Where(x => x.def.defName.Contains("Head"))) { Hediff hediff = HediffMaker.MakeHediff(XenomorphDefOf.RRY_FaceHuggerInfection, hitPawn, null); Comp_Facehugger _Facehugger = CasterPawn.TryGetComp <Comp_Facehugger>(); HediffComp_XenoFacehugger comp = hediff.TryGetComp <HediffComp_XenoFacehugger>(); comp.instigator = CasterPawn; comp.instigatorKindDef = CasterPawn.kindDef; comp.royaleHugger = _Facehugger.RoyaleHugger; comp.previousImpregnations = _Facehugger.Impregnations; hitPawn.health.AddHediff(hediff, part, null); string text = TranslatorFormattedStringExtensions.Translate("Xeno_Facehugger_Attach", hitPawn.LabelShort, part.LabelShortCap); MoteMaker.ThrowText(hitPawn.Position.ToVector3(), hitPawn.Map, text, 5f); comp.GetDirectlyHeldThings(); caster.DeSpawn(); infect = false; } } else { foreach (DamageInfo dinfo in this.DamageInfosToApply(target)) { if (target.ThingDestroyed) { break; } result = target.Thing.TakeDamage(dinfo); } } return(result); }
// Token: 0x06000002 RID: 2 RVA: 0x00002090 File Offset: 0x00000290 private static void MakeButcherProducts_PostFix(Thing __instance, ref IEnumerable <Thing> __result, Pawn butcher, float efficiency) { // Log.Message(string.Format("{0}", __instance)); if (__instance is Pawn pawn) { // Log.Message(string.Format("{0} is Pawn pawn", __instance)); if (XenomorphUtil.IsXenomorph(pawn)) { // Log.Message(string.Format("{0} Pawn pawn is Xenomorph", __instance)); foreach (var item in pawn.health.hediffSet.GetNotMissingParts()) { if (item.def == XenomorphDefOf.RRY_Xeno_TailSpike) { ThingDefCountClass thingDefCountClass = new ThingDefCountClass { thingDef = XenomorphDefOf.RRY_Xenomorph_TailSpike, count = 1 }; Thing thing = ThingMaker.MakeThing(thingDefCountClass.thingDef, null); thing.stackCount = thingDefCountClass.count; __result = __result.AddItem(thing); } if (item.def == XenomorphDefOf.RRY_Xeno_Shell) { ThingDefCountClass thingDefCountClass = new ThingDefCountClass { thingDef = XenomorphDefOf.RRY_Xenomorph_HeadShell, count = 1 }; Thing thing = ThingMaker.MakeThing(thingDefCountClass.thingDef, null); thing.stackCount = thingDefCountClass.count; __result = __result.AddItem(thing); } } } } }
// Patch_PawnRenderer_WigglerTick /* * public static void Patch_PawnRenderer_WigglerTick(PawnRenderer __instance) * { * Pawn pawn = HarmonyPatches.PawnRenderer_GetPawn(__instance); * foreach (var hd in pawn.health.hediffSet.hediffs) * { * HediffComp_XenoSpawner comp = hd.TryGetComp<HediffComp_XenoSpawner>(); * if (comp != null) * { * int num = Find.TickManager.TicksGame % 300 * 2; * if (num < 90) * { * this.downedAngle += 0.35f; * } * else if (num < 390 && num >= 300) * { * this.downedAngle -= 0.35f; * } * } * } * * } */ /* * * int num = Find.TickManager.TicksGame % 300 * 2; * if (num < 90) * { * this.downedAngle += 0.35f; * } * else if (num < 390 && num >= 300) * { * this.downedAngle -= 0.35f; * } */ // Token: 0x0600000C RID: 12 RVA: 0x0000283C File Offset: 0x00000A3C public static void RareTickPostfix(Corpse __instance) { if (XenomorphUtil.IsInfectedPawn(__instance.InnerPawn)) { HediffWithComps hediff = null; if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_FaceHuggerInfection)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_FaceHuggerInfection); } else if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_XenomorphImpregnation)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_XenomorphImpregnation); } else if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenXenomorphImpregnation)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_HiddenXenomorphImpregnation); } else if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_NeomorphImpregnation)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_NeomorphImpregnation); } else if (__instance.InnerPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_HiddenNeomorphImpregnation)) { hediff = (HediffWithComps)__instance.InnerPawn.health.hediffSet.GetFirstHediffOfDef(XenomorphDefOf.RRY_HiddenNeomorphImpregnation); } if (hediff != null) { for (int i = 0; i <= 250; i++) { // float sev = 0f; // hediff.TryGetComp<HediffComp_XenoSpawner>().CompPostTick(ref sev); hediff.PostTick(); } } } }
public void GiveHediff(Pawn pawn) { if (!XenomorphUtil.isInfectablePawn(pawn)) { return; } //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); }
// Token: 0x060005D9 RID: 1497 RVA: 0x0003930C File Offset: 0x0003770C private static bool TryFindSpotToPlaceHaulableCloseTo(Thing haulable, Pawn worker, IntVec3 center, IntVec3 center2, int radius, out IntVec3 spot) { Region region = center.GetRegion(worker.Map, RegionType.Set_Passable); if (region == null) { spot = center; return(false); } TraverseParms traverseParms = TraverseParms.For(worker, Danger.Deadly, TraverseMode.ByPawn, false); IntVec3 foundCell = IntVec3.Invalid; RegionTraverser.BreadthFirstTraverse(region, (Region from, Region r) => r.Allows(traverseParms, false), delegate(Region r) { XenomorphUtil.candidates.Clear(); XenomorphUtil.candidates.AddRange(r.Cells); XenomorphUtil.candidates.Sort((IntVec3 a, IntVec3 b) => a.DistanceToSquared(center).CompareTo(b.DistanceToSquared(center))); for (int i = 0; i < XenomorphUtil.candidates.Count; i++) { IntVec3 intVec = XenomorphUtil.candidates[i]; if (XenomorphUtil.HaulablePlaceValidator(haulable, worker, intVec, center2, radius)) { foundCell = intVec; return(true); } } return(false); }, 100, RegionType.Set_Passable); if (foundCell.IsValid) { spot = foundCell; return(true); } spot = center; return(false); }
// public static IntVec3 HiveLocation(Map map) // Token: 0x060005D7 RID: 1495 RVA: 0x00039248 File Offset: 0x00037648 public static bool CanHaulAside(Pawn p, Thing t, IntVec3 center, int radius, out IntVec3 storeCell) { storeCell = IntVec3.Invalid; return(t.def.EverHaulable && !t.IsBurning() && p.CanReserveAndReach(t, PathEndMode.ClosestTouch, p.NormalMaxDanger(), 1, -1, null, false) && XenomorphUtil.TryFindSpotToPlaceHaulableCloseTo(t, p, t.PositionHeld, center, radius, out storeCell)); }
public static Thing ClosestReachableChildHivelike(Pawn pawn) { Thing thing = GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.BuildingArtificial), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), 9999f, (x => XenomorphUtil.SpawnedChildHivelikes(pawn.Map).Contains(x)), null, 0, -1, false, RegionType.Set_Passable, false); return(thing); }
// Token: 0x060005DA RID: 1498 RVA: 0x000393CC File Offset: 0x000377CC private static bool HaulablePlaceValidator(Thing haulable, Pawn worker, IntVec3 c, IntVec3 center, int radius) { if (!worker.CanReserveAndReach(c, PathEndMode.OnCell, worker.NormalMaxDanger(), 1, -1, null, false)) { return(false); } if (GenPlace.HaulPlaceBlockerIn(haulable, c, worker.Map, true) != null) { return(false); } if (!c.Standable(worker.Map)) { return(false); } if (c == haulable.Position && haulable.Spawned) { return(false); } if (c.ContainsStaticFire(worker.Map)) { return(false); } if (XenomorphUtil.DistanceBetween(c, center) <= radius) { return(false); } /* * if (XenomorphUtil.DistanceBetween(c, center) > radius*2) * { * return false; * } */ /* * if (c.AdjacentTo8Way(center)) * { * return false; * } */ if (haulable != null && haulable.def.BlockPlanting) { Zone zone = worker.Map.zoneManager.ZoneAt(c); if (zone is Zone_Growing) { return(false); } } if (haulable.def.passability != Traversability.Standable) { for (int i = 0; i < 8; i++) { IntVec3 c2 = c + GenAdj.AdjacentCells[i]; if (worker.Map.designationManager.DesignationAt(c2, DesignationDefOf.Mine) != null) { return(false); } } } Building edifice = c.GetEdifice(worker.Map); if (edifice != null) { Building_Trap building_Trap = edifice as Building_Trap; if (building_Trap != null) { return(false); } } return(true); }
// Token: 0x060039DE RID: 14814 RVA: 0x001B8078 File Offset: 0x001B6478 private IEnumerable <DamageInfo> DamageInfosToApply(LocalTargetInfo target) { Pawn hitPawn = (Pawn)target; bool flag = XenomorphUtil.isInfectablePawn(hitPawn); float tgtmelee = 0f; float tgtdodge = 0f; float armourBlunt = 0f; float armourSharp = 0f; float armourHeat = 0f; float armour = 0f; if (hitPawn.RaceProps.Humanlike) { tgtmelee = hitPawn.skills.GetSkill(SkillDefOf.Melee).Level; } if (hitPawn.RaceProps.Humanlike) { tgtdodge = hitPawn.GetStatValue(StatDefOf.MeleeDodgeChance); } if (hitPawn.RaceProps.Humanlike) { if (hitPawn.apparel.WornApparel.Count > 0 && hitPawn.apparel.WornApparel is List <Apparel> wornApparel) { for (int i = 0; i < wornApparel.Count; i++) { bool flag2 = wornApparel[i].def.apparel.CoversBodyPart(Head); if (flag2) { armourBlunt = wornApparel[i].def.statBases.GetStatOffsetFromList(StatDefOf.ArmorRating_Blunt); // hitPawn.GetStatValue(StatDefOf.ArmorRating_Blunt, false); armourSharp = wornApparel[i].def.statBases.GetStatOffsetFromList(StatDefOf.ArmorRating_Sharp); //hitPawn.GetStatValue(StatDefOf.ArmorRating_Sharp, false); armourHeat = wornApparel[i].def.statBases.GetStatOffsetFromList(StatDefOf.ArmorRating_Heat); //hitPawn.GetStatValue(StatDefOf.ArmorRating_Heat, false); armour = (armourBlunt + armourSharp + armourHeat); // Log.Message(string.Format("Pawn: {4}\narmourBlunt: {0}, armourSharp: {1}, armourHeat: {2}, Total Armour {3}", armourBlunt, armourSharp, armourHeat, armour, wornApparel[i].LabelShortCap)); } } } } float InfecterRoll = (Rand.Value * 100) * (1 - tgtdodge); float InfectionDefence = 50 + tgtmelee + (armour * 10); if ((InfecterRoll > InfectionDefence || hitPawn.Downed) && flag && hitPawn is Pawn && !hitPawn.health.hediffSet.HasHediff(XenomorphDefOf.RRY_Hediff_Anesthetic)) { infect = true; } else { infect = false; } float damAmount = this.verbProps.AdjustedMeleeDamageAmount(this, base.CasterPawn); float armorPenetration = this.verbProps.AdjustedArmorPenetration(this, base.CasterPawn); DamageDef damDef = this.verbProps.meleeDamageDef; BodyPartGroupDef bodyPartGroupDef = null; HediffDef hediffDef = null; damAmount = Rand.Range(damAmount * 0.8f, damAmount * 1.2f); if (base.CasterIsPawn) { bodyPartGroupDef = this.verbProps.AdjustedLinkedBodyPartsGroup(this.tool); if (damAmount >= 1f) { if (base.HediffCompSource != null) { hediffDef = base.HediffCompSource.Def; } } else { damAmount = 1f; damDef = DamageDefOf.Blunt; } } ThingDef source; if (base.EquipmentSource != null) { source = base.EquipmentSource.def; } else { source = base.CasterPawn.def; } Vector3 direction = (target.Thing.Position - base.CasterPawn.Position).ToVector3(); DamageDef def = damDef; float num = damAmount; float num2 = armorPenetration; Thing caster = this.caster; DamageInfo mainDinfo = new DamageInfo(def, num, num2, -1f, caster, null, source, DamageInfo.SourceCategory.ThingOrUnknown, null); mainDinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); mainDinfo.SetWeaponBodyPartGroup(bodyPartGroupDef); mainDinfo.SetWeaponHediff(hediffDef); mainDinfo.SetAngle(direction); yield return(mainDinfo); if (this.surpriseAttack && ((this.verbProps.surpriseAttack != null && !this.verbProps.surpriseAttack.extraMeleeDamages.NullOrEmpty <ExtraMeleeDamage>()) || (this.tool != null && this.tool.surpriseAttack != null && !this.tool.surpriseAttack.extraMeleeDamages.NullOrEmpty <ExtraMeleeDamage>()))) { IEnumerable <ExtraMeleeDamage> extraDamages = Enumerable.Empty <ExtraMeleeDamage>(); if (this.verbProps.surpriseAttack != null && this.verbProps.surpriseAttack.extraMeleeDamages != null) { extraDamages = extraDamages.Concat(this.verbProps.surpriseAttack.extraMeleeDamages); } if (this.tool != null && this.tool.surpriseAttack != null && !this.tool.surpriseAttack.extraMeleeDamages.NullOrEmpty <ExtraMeleeDamage>()) { extraDamages = extraDamages.Concat(this.tool.surpriseAttack.extraMeleeDamages); } foreach (ExtraMeleeDamage extraDamage in extraDamages) { int extraDamageAmount = GenMath.RoundRandom(extraDamage.AdjustedDamageAmount(this, base.CasterPawn)); float extraDamageArmorPenetration = extraDamage.AdjustedArmorPenetration(this, base.CasterPawn); def = extraDamage.def; num2 = (float)extraDamageAmount; num = extraDamageArmorPenetration; caster = this.caster; DamageInfo extraDinfo = new DamageInfo(def, num2, num, -1f, caster, null, source, DamageInfo.SourceCategory.ThingOrUnknown, null); extraDinfo.SetBodyRegion(BodyPartHeight.Undefined, BodyPartDepth.Outside); extraDinfo.SetWeaponBodyPartGroup(bodyPartGroupDef); extraDinfo.SetWeaponHediff(hediffDef); extraDinfo.SetAngle(direction); yield return(extraDinfo); } } yield break; }
public void XenoLordTick() { if (map != null) { IntVec3 c = IntVec3.Invalid; Lord lord = null; List <Lord> Hivelords = new List <Lord>(); Lord Hivelord = null; LordJob Hivejob = null; Pawn Hivequeen = null; IEnumerable <Lord> lords = pawn.Map.lordManager.lords.Where(x => x.faction == pawn.Faction); bool isDefendPoint = pawn.GetLord() != null?pawn.GetLord().LordJob is LordJob_DefendPoint : false; bool isAssaultColony = pawn.GetLord() != null?pawn.GetLord().LordJob is LordJob_AssaultColony : false; bool hostsPresent = map.mapPawns.AllPawnsSpawned.Any(x => x.isPotentialHost() && !x.isCocooned() && IsAcceptablePreyFor(pawn, x, true)); bool LordReplaceable = (isDefendPoint || (isAssaultColony && !hostsPresent)); // Log.Message(string.Format("LordReplaceable: {0}, isDefendPoint: {1}, isAssaultColony: {2}, hostsPresent: {3}", LordReplaceable, isDefendPoint, isAssaultColony, !hostsPresent)); if (lords.Count() != 0 && ((pawn.GetLord() != null && LordReplaceable) || pawn.GetLord() == null)) { foreach (var l in lords) { if (l != null) { if (XenomorphUtil.HivelikesPresent(map)) { if (l.LordJob is LordJob_DefendAndExpandHiveLike j) { Hivelord = l; Hivejob = j; if (l.ownedPawns.Any(x => x.kindDef == QueenDef)) { Hivequeen = l.ownedPawns.Find(x => x.kindDef == QueenDef); } if (pawn.kindDef != XenomorphDefOf.RRY_Xenomorph_Queen || (pawn.kindDef == XenomorphDefOf.RRY_Xenomorph_Queen && Hivequeen != null)) { Hivelords.Add(l); } } } else if (XenomorphUtil.HiveSlimePresent(map)) { if (l.LordJob is LordJob_DefendHiveLoc j) { Hivelord = l; Hivejob = j; if (l.ownedPawns.Any(x => x.kindDef == QueenDef)) { Hivequeen = l.ownedPawns.Find(x => x.kindDef == QueenDef); } if (pawn.kindDef != XenomorphDefOf.RRY_Xenomorph_Queen || (pawn.kindDef == XenomorphDefOf.RRY_Xenomorph_Queen && Hivequeen != null)) { Hivelords.Add(l); } } } } else { /* * lord = l; * lord.AddPawn(pawn); * pawn.mindState.duty = lord.ownedPawns.FindAll(x => x.mindState.duty != null && x != pawn).RandomElement().mindState.duty; * break; */ } } } if (pawn.GetLord() != null && LordReplaceable) { lord = pawn.GetLord(); if (lord.ownedPawns.Count == 0) { Log.Message(string.Format("got no pawns, wtf?")); } if (lord.ownedPawns.Count == 1) { } if (c == IntVec3.Invalid && XenomorphUtil.HivelikesPresent(map)) { c = !XenomorphUtil.ClosestReachableHivelike(pawn).DestroyedOrNull() ? XenomorphUtil.ClosestReachableHivelike(pawn).Position : IntVec3.Invalid; } if (c == IntVec3.Invalid && XenomorphUtil.EggsPresent(map)) { c = !XenomorphUtil.ClosestReachableEgg(pawn).DestroyedOrNull() ? XenomorphUtil.ClosestReachableEgg(pawn).Position : IntVec3.Invalid; } if (c == IntVec3.Invalid && XenomorphUtil.CocoonsPresent(map, XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon)) { c = !XenomorphUtil.ClosestReachableCocoon(pawn, XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon).DestroyedOrNull() ? XenomorphUtil.ClosestReachableCocoon(pawn, XenomorphDefOf.RRY_Xenomorph_Humanoid_Cocoon).Position : IntVec3.Invalid; } if (c == IntVec3.Invalid && XenomorphUtil.CocoonsPresent(map, XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon)) { c = !XenomorphUtil.ClosestReachableCocoon(pawn, XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon).DestroyedOrNull() ? XenomorphUtil.ClosestReachableCocoon(pawn, XenomorphDefOf.RRY_Xenomorph_Animal_Cocoon).Position : IntVec3.Invalid; } if (c == IntVec3.Invalid) { if (InfestationLikeCellFinder.TryFindCell(out c, pawn.Map, false)) { if (Prefs.DevMode) { ThingDef td = XenomorphDefOf.RRY_Filth_Slime; GenSpawn.Spawn(td, c, pawn.Map); Find.LetterStack.ReceiveLetter(string.Format("Lord Created"), string.Format("@: {0} ", c), LetterDefOf.NegativeEvent, c.GetFirstThing(pawn.Map, td), null, null); } } if (pawn.CanReach(c, PathEndMode.OnCell, Danger.Deadly, true)) { c = RCellFinder.RandomWanderDestFor(pawn, c, 3f, null, Danger.Some); } else { c = RCellFinder.RandomWanderDestFor(pawn, pawn.Position, 3f, null, Danger.Some); } } if (c != IntVec3.Invalid) { LordJob newJob; if (XenomorphUtil.HivelikesPresent(map)) { newJob = new LordJob_DefendAndExpandHiveLike(false); } else { newJob = new LordJob_DefendHiveLoc(parent.Faction, c); } if (LordReplaceable) { if (!Hivelords.NullOrEmpty()) { Hivelord = Hivelords.RandomElement(); SwitchToLord(Hivelord); CreateNewLord(pawn, c, newJob); } else { CreateNewLord(pawn, c, newJob); } if (HiveLoc == IntVec3.Invalid) { HiveLoc = c; } } } } else if (c == IntVec3.Invalid && (pawn.GetLord() != null && pawn.GetLord().LordJob is LordJob LordJob)) { lord = pawn.GetLord(); c = LordJob.lord.Graph.StartingToil.FlagLoc; if (c == IntVec3.Invalid) { c = LordJob.lord.CurLordToil.FlagLoc; } } else if (pawn.GetLord() == null) { if (!Hivelords.NullOrEmpty()) { Hivelord = Hivelords.RandomElement(); SwitchToLord(Hivelord); } } if (pawn.GetLord() != null) { List <Pawn> list = pawn.GetLord().ownedPawns.Where(x => x.mindState.duty != null).ToList(); if (pawn.GetLord() != null && pawn.mindState.duty == null && !list.NullOrEmpty()) { pawn.mindState.duty = list.RandomElement().mindState.duty; } } } }
// Token: 0x0600295E RID: 10590 RVA: 0x00139BAC File Offset: 0x00137FAC public override void CompTickRare() { float ambientTemperature = this.parent.AmbientTemperature; bool selected = Find.Selector.SelectedObjects.Contains(this.parent) && Prefs.DevMode; Thing thing = null; if (MyMap != null && MyPos.InBounds(MyMap)) { thing = GenClosest.ClosestThingReachable(MyPos, MyMap, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), Props.triggerRadius, x => XenomorphUtil.isInfectablePawn(((Pawn)x)), null, 0, -1, false, RegionType.Set_Passable, false); } int huggercount = thing != null?XenomorphUtil.TotalSpawnedFacehuggerPawnCount(MyMap, 10, (Pawn)thing) : 0; int hostcount = thing != null?XenomorphUtil.TotalSpawnedInfectablePawnCount(MyMap, 10, this.MyPos) : 0; bool shouldHatch = huggercount < hostcount; if (thing != null && ambientTemperature > -20f) { Pawn pawn = (Pawn)thing; bool flag = XenomorphUtil.isInfectablePawn(pawn); if (selected) { // Log.Message(string.Format("{0} isInfectable?: {1}", pawn.Label, flag)); } if (flag) { this.canHatch = true; } if (canHatch && shouldHatch && DistanceBetween(MyPos, pawn.Position) < 10f) { float thingdist = DistanceBetween(MyPos, pawn.Position); float thingsize = pawn.BodySize; float thingstealth = thing.GetStatValue(StatDefOf.HuntingStealth); float thingmovespeed = thing.GetStatValue(StatDefOf.MoveSpeed); if (selected) { // Log.Message(string.Format("distance between {1} @{3} and {2} @ {4}: {0}", DistanceBetween(MyPos, pawn.Position), this.parent.LabelShort, pawn.Label, MyPos, pawn.Position)); // Log.Message(string.Format("{0} thingsize: {1}, thingstealth: {2}, thingmovespeed: {3}", pawn.Label, thingsize, thingstealth, thingmovespeed)); } float hatchon = ((10 * thingdist) - (thingsize * 5)); float roll = thingstealth > 0 ? (Rand.RangeInclusive(0, 100) * thingstealth): (Rand.RangeInclusive(0, 100)); if (roll > hatchon) { this.willHatch = true; } if (selected) { Log.Message(string.Format("{0} hatchon: {1}, roll: {2}, willHatch: {3}", pawn.Label, hatchon, roll, willHatch)); } } } if (thing == null) { // if (selected) Log.Message(string.Format("{0} @ {1}, Cant hatch No suitable Host Found", this.parent.Label, MyPos, canHatch)); } }
public static List <Pawn> SpawnedInfectedPawns(Map map) { return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsInfectedPawn(x))); }
public static List <Thing> SpawnedEggsNeedHosts(Map map) { List <Thing> list = new List <Thing>(); foreach (var item in SpawnedEggs(map)) { Pawn host = (Pawn)GenClosest.ClosestThingReachable(item.Position, item.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), 1, x => XenomorphUtil.isInfectablePawn(((Pawn)x)), null, 0, -1, false, RegionType.Set_Passable, false); if (host == null) { list.Add(item); } } return(list); }
public static List <Pawn> SpawnedFacehuggerPawns(Map map, int radius, IntVec3 position, IntVec3 otherposition) { return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsXenomorphFacehugger(x) && XenomorphUtil.DistanceBetween(otherposition, position) < radius)); }
public static bool Ignore_Acid_Damage(Pawn __instance, ref DamageInfo dinfo, out bool absorbed) { if (__instance.health.hediffSet.HasHediff(XenomorphDefOf.RRY_Hediff_Cocooned) || XenomorphUtil.IsXenomorph(__instance)) { absorbed = dinfo.Def == XenomorphDefOf.RRY_AcidBurn || dinfo.Def == XenomorphDefOf.RRY_AcidDamage; } else { absorbed = false; } if (absorbed) { #if DEBUG // Log.Message(string.Format("absorbed")); #endif } return(!absorbed); }
// Token: 0x0600001B RID: 27 RVA: 0x00002854 File Offset: 0x00000A54 public void TickTack() { bool destroyed = base.Destroyed; if (!destroyed) { MoteMaker.ThrowDustPuff(this.Position, base.Map, 0.2f); List <Thing> thingList = GridsUtility.GetThingList(base.Position, base.Map); for (int i = 0; i < thingList.Count; i++) { bool flag = thingList[i] != null; if (flag) { Thing thing = thingList[i]; Pawn pawn = thingList[i] as Pawn; bool flaga = thing.def.useHitPoints && !this.touchingThings.Contains(thing) && thing.def != XenomorphDefOf.RRY_FilthBloodXenomorph && thing.GetType() != typeof(Pawn); bool flag2 = thing != null && !this.touchingThings.Contains(thing) && thing.def != XenomorphDefOf.RRY_FilthBloodXenomorph && thing.GetType() != typeof(Mote) && thing.GetType() != typeof(MoteThrown) && thing.GetType() != typeof(Bullet) && thing.GetType() != typeof(Pawn); bool flag2a = !(thing is Corpse corpse && XenomorphUtil.IsXenoCorpse(corpse)); bool flag2b = !(thing is Pawn && XenomorphUtil.IsXenomorph((Pawn)thing)); if (flaga && flag2a && flag2b) { this.touchingThings.Add(thing); this.damageEntities(thing, Mathf.RoundToInt((float)this.AcidDamage * Rand.Range(0.5f, 1.25f))); MoteMaker.ThrowDustPuff(thing.Position, base.Map, 0.2f); } bool flag3 = pawn != null; if (flag3 && flag2b) { this.touchingPawns.Add(pawn); bool flag4 = !XenomorphUtil.IsXenomorph(pawn); if (flag4) { this.addAcidDamage(pawn); MoteMaker.ThrowDustPuff(pawn.Position, base.Map, 0.2f); } } } } /* * for (int j = 0; j < this.touchingPawns.Count; j++) * { * Pawn pawn2 = this.touchingPawns[j]; * bool flag5 = !pawn2.Spawned || pawn2.Position != base.Position || XenomorphUtil.IsXenomorph(pawn2); * if (flag5) * { * this.touchingPawns.Remove(pawn2); * } * else * { * bool flag6 = !pawn2.RaceProps.Animal; * if (flag6) * { * this.addAcidDamage(pawn2); * } * } * } * for (int k = 0; k < this.touchingThings.Count; k++) * { * Thing thing2 = this.touchingThings[k]; * bool flag7 = !thing2.Spawned || thing2.Position != base.Position; * if (flag7) * { * this.touchingThings.Remove(thing2); * } * else * { * this.damageEntities(thing2, Mathf.RoundToInt((float)this.AcidDamage * Rand.Range(0.5f, 1.25f))); * } * } */ this.damageBuildings(Mathf.RoundToInt((float)this.AcidDamage * Rand.Range(0.5f, 1.25f))); this.cachedLabelMouseover = null; } }
// Token: 0x06003EF3 RID: 16115 RVA: 0x001D7E89 File Offset: 0x001D6289 protected override IntVec3 GetWanderRoot(Pawn pawn) { bool anyPotentialHosts = !pawn.Map.ViableHosts().NullOrEmpty(); if (anyPotentialHosts) { bool anyReachablePotentialHosts = pawn.Map.ViableHosts().Any(x => pawn.CanReach(x, PathEndMode.ClosestTouch, Danger.Deadly, false, TraverseMode.NoPassClosedDoors)); if (anyReachablePotentialHosts) { Pawn potentialHost = (Pawn)GenClosest.ClosestThingReachable(pawn.Position, pawn.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.ClosestTouch, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Some), float.MaxValue, (x => ((Pawn)x).isPotentialHost())) ?? null; if (potentialHost != null) { Predicate <IntVec3> validator = delegate(IntVec3 y) { return(XenomorphUtil.DistanceBetween(y, potentialHost.Position) < XenomorphUtil.DistanceBetween(y, pawn.Position)); }; if (RCellFinder.TryFindRandomCellNearWith(pawn.Position, validator, pawn.Map, out IntVec3 lc, 6, (int)wanderRadius)) { return(lc); } } } } return(pawn.Position); }
// Token: 0x060028F1 RID: 10481 RVA: 0x00136C04 File Offset: 0x00135004 public void Hatch() { try { PawnKindDef hatchKindDef = Rand.Chance(royalProgress) && !QueenPresent && !XenomorphUtil.HivelikesPresent(MyMap) && !RoyalPresent ? XenomorphDefOf.RRY_Xenomorph_RoyaleHugger : this.Props.hatcherPawn; #if DEBUG // Log.Message(string.Format("hatchKindDef: {0}", hatchKindDef)); #endif PawnGenerationRequest request = new PawnGenerationRequest(hatchKindDef, this.hatcheeFaction, PawnGenerationContext.NonPlayer, -1, false, true, false, false, true, false, 1f, false, true, true, false, false, false, false, null, null, null, null, null, null, null, null); for (int i = 0; i < this.parent.stackCount; i++) { Pawn pawn = PawnGenerator.GeneratePawn(request); if (PawnUtility.TrySpawnHatchedOrBornPawn(pawn, this.parent)) { if (pawn != null) { if (this.hatcheeParent != null) { if (pawn.playerSettings != null && this.hatcheeParent.playerSettings != null && this.hatcheeParent.Faction == this.hatcheeFaction) { pawn.playerSettings.AreaRestriction = this.hatcheeParent.playerSettings.AreaRestriction; } if (pawn.RaceProps.IsFlesh) { pawn.relations.AddDirectRelation(PawnRelationDefOf.Parent, this.hatcheeParent); } } if (this.otherParent != null && (this.hatcheeParent == null || this.hatcheeParent.gender != this.otherParent.gender) && pawn.RaceProps.IsFlesh) { pawn.relations.AddDirectRelation(PawnRelationDefOf.Parent, this.otherParent); } } if (this.parent.Spawned) { FilthMaker.MakeFilth(MyPos, MyMap, ThingDefOf.Filth_AmnioticFluid, 1); } } else { Find.WorldPawns.PassToWorld(pawn, PawnDiscardDecideMode.Discard); } } } finally { this.parent.Destroy(DestroyMode.Vanish); } }
public static List <Pawn> SpawnedInfectablePawns(Map map, int radius, IntVec3 position, IntVec3 otherposition) { return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.isInfectablePawn(x) && XenomorphUtil.DistanceBetween(otherposition, position) < radius)); }
// Token: 0x0600295E RID: 10590 RVA: 0x00139BAC File Offset: 0x00137FAC public override void CompTickRare() { bool selected = Find.Selector.SingleSelectedThing == this.parent; Thing thing = GenClosest.ClosestThingReachable(this.parent.Position, this.parent.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), Props.triggerRadius, x => XenomorphUtil.isInfectablePawn(((Pawn)x)), null, 0, -1, false, RegionType.Set_Passable, false); if (thing != null) { Pawn pawn = (Pawn)thing; bool flag = XenomorphUtil.isInfectablePawn(pawn); #if DEBUG if (selected) { Log.Message(string.Format("{0} isInfectable?: {1}", pawn.Label, flag)); } #endif if (flag) { this.canHatch = true; } if (canHatch) { float thingdist = DistanceBetween(this.parent.Position, pawn.Position); float thingsize = pawn.BodySize; float thingstealth = thing.GetStatValue(StatDefOf.HuntingStealth); float thingmovespeed = thing.GetStatValue(StatDefOf.MoveSpeed); Stance thingstance = pawn.stances.curStance; #if DEBUG if (selected) { Log.Message(string.Format("distance between {1} @{3} and {2} @ {4}: {0}", DistanceBetween(this.parent.Position, pawn.Position), this.parent.LabelShort, pawn.Label, this.parent.Position, pawn.Position)); Log.Message(string.Format("{0} thingsize: {1}, thingstealth: {2}, thingmovespeed: {3}, thingstance: {4}", pawn.Label, thingsize, thingstealth, thingmovespeed, thingstance)); } #endif float hatchon = ((100 / thingdist) * thingsize); if (thingstance.GetType() == typeof(Stance_Mobile)) { hatchon = (((100 / thingdist) * thingmovespeed) * thingsize); } float roll = (Rand.RangeInclusive(0, 100) / thingstealth); #if DEBUG if (selected) { Log.Message(string.Format("{0} hatchon: {1}, roll: {2}, moving?: {3}", pawn.Label, hatchon, roll, thingstance.GetType() == typeof(Stance_Mobile))); } #endif if (roll < hatchon) { this.willHatch = true; } } } #if DEBUG if (thing == null) { if (selected) { Log.Message(string.Format("{0} @ {1}, Cant hatch No suitable Host Found", this.parent.Label, this.parent.Position, canHatch)); } } #endif }
public override void TickLong() { base.TickLong(); bool selected = Find.Selector.SingleSelectedThing == this; if (!this.IsBurning() && !this.Destroyed && this.Map != null) { Thing thing = GenClosest.ClosestThingReachable(this.Position, this.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), 6f, x => XenomorphUtil.isInfectablePawn(((Pawn)x)), null, 0, -1, false, RegionType.Set_Passable, false); if (thing != null && this.Growth > 0.95f && !thing.Destroyed && !((Pawn)thing).Dead) { List <Thing> thingList = GridsUtility.GetThingList(thing.Position, this.Map); Thing thing2; if (this.def == XenomorphDefOf.RRY_Plant_Neomorph_Fungus) { thing2 = ThingMaker.MakeThing(XenomorphDefOf.RRY_Neomorph_Spores); } else { thing2 = ThingMaker.MakeThing(XenomorphDefOf.RRY_Neomorph_Spores_Hidden); } float Chance = ((0.5f * Growth) * ((Pawn)thing).BodySize) / DistanceBetween(this.Position, thing.Position); if (selected) { Log.Message(string.Format("Chance: {0}", Chance)); } if (Rand.Chance(Chance) && !thingList.Exists(x => x.def == XenomorphDefOf.RRY_Neomorph_Spores)) { if (thing.Faction == Faction.OfPlayer) { string text = TranslatorFormattedStringExtensions.Translate("Xeno_Neospores_Trigger", thing.LabelShortCap, this.Label); Log.Message(text); MoteMaker.ThrowText(this.Position.ToVector3(), this.Map, text, 5f); } GenSpawn.Spawn(thing2, thing.Position, this.Map); } } else { Plant plant = (Plant)GenClosest.ClosestThingReachable(this.Position, this.Map, ThingRequest.ForGroup(ThingRequestGroup.Plant), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), 3f, x => ((Plant)x).Growth > 0.65f && x.def != XenomorphDefOf.RRY_Plant_Neomorph_Fungus && x.def != XenomorphDefOf.RRY_Plant_Neomorph_Fungus_Hidden && (x.def.defName.Contains("Grass") || x.def.defName.Contains("Moss")), null, 0, -1, false, RegionType.Set_Passable, false); if (plant != null && !plant.Destroyed && !plant.IsBurning() && this.Growth > 0.95f) { if (selected) { Log.Message(string.Format("plant: {0}", plant)); } float Chance2 = ((0.5f * Growth) * plant.Growth / DistanceBetween(this.Position, plant.Position)); if (selected) { Log.Message(string.Format("Chance2: {0}", Chance2)); } if (Rand.Chance(Chance2)) { Thing thing2; if (this.def == XenomorphDefOf.RRY_Plant_Neomorph_Fungus) { thing2 = ThingMaker.MakeThing(XenomorphDefOf.RRY_Neomorph_Spores); } else { thing2 = ThingMaker.MakeThing(XenomorphDefOf.RRY_Neomorph_Spores_Hidden); } if (selected) { Log.Message(string.Format("was: {0}", plant)); } IntVec3 vec3 = plant.Position; GenSpawn.Spawn(thing2, vec3, this.Map); plant.Destroy(); GenSpawn.Spawn(ThingMaker.MakeThing(this.def), vec3, this.Map); } } } } }
public static List <Pawn> SpawnedFacehuggerPawns(Map map) { return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsXenomorphFacehugger(x))); }
// Token: 0x060028F0 RID: 10480 RVA: 0x00136BB0 File Offset: 0x00134FB0 public override void CompTick() { if (!this.TemperatureDamaged) { //Log.Message(string.Format("!this.TemperatureDamaged")); float ambientTemperature = this.parent.AmbientTemperature; float num = 1f / (this.Props.hatcherDaystoHatch * 60000f); if (ambientTemperature > -20f) { // Log.Message(string.Format("ambientTemperature > -20")); if (this.gestateProgress < 1f) { this.gestateProgress += num; // Log.Message(string.Format("gestateProgress: {0}", gestateProgress)); } else if (this.royalProgress < 1f && !QueenPresent && !RoyalPresent && (!RoyalEggPresent || (RoyalEggPresent && this.royalProgress > 0f)) && !XenomorphUtil.HivelikesPresent(MyMap)) { this.royalProgress += num; } } if (Find.TickManager.TicksGame % 250 + (Rand.RangeInclusive(0, 10) * 100) == 0) { this.CompTickRare(); if (this.gestateProgress >= 1f && (this.royalProgress == 0f || this.royalProgress >= 1f)) { bool selected = Find.Selector.SingleSelectedThing == this.parent && false; // if (selected) Log.Message(string.Format("{0} @ {1}, Can hatch?: {2}, Will hatch?: {3}", this.parent.Label, MyPos, canHatch, willHatch)); if (this.canHatch && this.willHatch && ambientTemperature > -20f) { this.Hatch(); } } } } }
public static List <Pawn> SpawnedFacehuggerPawns(Map map, int radius, Pawn pawn) { return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsXenomorphFacehugger(x) && XenomorphUtil.DistanceBetween(x.Position, pawn.Position) < radius && x.CanReach(pawn, PathEndMode.ClosestTouch, Danger.Deadly))); }
public static List <Pawn> SpawnedInfectablePawns(Map map, int radius, IntVec3 position) { return(map.mapPawns.AllPawnsSpawned.FindAll(x => x.isPotentialHost() && XenomorphUtil.DistanceBetween(x.Position, position) < radius)); }
public override void TickLong() { base.TickLong(); bool selected = Find.Selector.SingleSelectedThing == this; if (!this.IsBurning() && !this.Destroyed && this.Map != null) { Thing thing = GenClosest.ClosestThingReachable(this.Position, this.Map, ThingRequest.ForGroup(ThingRequestGroup.Pawn), PathEndMode.OnCell, TraverseParms.For(TraverseMode.NoPassClosedDoors, Danger.Deadly, false), radius, x => XenomorphUtil.isInfectablePawn(((Pawn)x)), null, 0, -1, false, RegionType.Set_Passable, false); if (thing != null && this.Growth > 0.95f && !thing.Destroyed && !((Pawn)thing).Dead) { List <Thing> thingList = GridsUtility.GetThingList(thing.Position, this.Map); Thing thing2; if (!PlayerKnowledgeDatabase.IsComplete(XenomorphConceptDefOf.RRY_Concept_Fungus)) { thing2 = ThingMaker.MakeThing(XenomorphDefOf.RRY_Neomorph_Spores_Hidden); } else { thing2 = ThingMaker.MakeThing(XenomorphDefOf.RRY_Neomorph_Spores); } float Chance = ((0.5f * Growth) * ((Pawn)thing).BodySize) / DistanceBetween(this.Position, thing.Position); // if (selected) Log.Message(string.Format("Chance: {0}", Chance)); if (Rand.Chance(Chance) && !thingList.Exists(x => x.def == XenomorphDefOf.RRY_Neomorph_Spores)) { if (thing.Faction == Faction.OfPlayer) { string text = TranslatorFormattedStringExtensions.Translate("Xeno_Neospores_Trigger", thing.LabelShortCap, this.Label); // Log.Message(text); MoteMaker.ThrowText(this.Position.ToVector3(), this.Map, text, 5f); } GenSpawn.Spawn(thing2, thing.Position, this.Map); } } else { HarmRandomPlantInRadius(radius / 2); } } }
public static List <Pawn> SpawnedFacehuggerPawns(Map map, int radius, IntVec3 position) { return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsXenomorphFacehugger(x) && position.InHorDistOf(x.Position, radius))); }