Ejemplo n.º 1
0
        public override void PostRemoved()
        {
            if (XenomorphUtil.IsXenomorph(this.pawn))
            {
                LifeStageDef stage = pawn.ageTracker.CurLifeStage;
                if (stage == pawn.RaceProps.lifeStageAges[pawn.RaceProps.lifeStageAges.Count - 1].def)
                {
                    Log.Message(string.Format("{0}", oldGraphics.nakedGraphic.path));
                    Log.Message(string.Format("{0}", oldGraphics.AllResolved.ToString()));
                }
            }
            pawn.Drawer.renderer.graphics = oldGraphics;
            pawn.Drawer.renderer.graphics.ResolveAllGraphics();
            SetShadowGraphic(pawn.Drawer.renderer, oldShadow);
            Thing holding = pawn.carryTracker.CarriedThing;

            if (holding != null)
            {
                SetGraphicInt(holding, lastCarriedGraphic);
            }
            else if (lastCarried != null)
            {
                SetGraphicInt(lastCarried, lastCarriedGraphic);
            }
            if (!pawn.Spawned && (holding != null || lastCarried != null))
            {
                Messages.Message("A thief has stolen " + (holding != null ? holding.LabelNoCount : lastCarried.LabelNoCount) + "!", MessageTypeDefOf.ThreatSmall);
            }
        }
        public static bool Patch_CheckCreateVerbProperties(ref Pawn_NativeVerbs __instance)
        {
            bool flag = HarmonyPatches._cachedVerbProperties.GetValue(__instance) != null;
            bool result;

            if (flag)
            {
                result = true;
            }
            else
            {
                bool flag2 = XenomorphUtil.IsXenomorph(HarmonyPatches.pawnPawnNativeVerbs(__instance));
                if (flag2)
                {
                    HarmonyPatches._cachedVerbProperties.SetValue(__instance, new List <VerbProperties>());
                    HarmonyPatches.cachedVerbProperties(__instance).Add(NativeVerbPropertiesDatabase.VerbWithCategory((VerbCategory)1));
                    result = false;
                }
                else
                {
                    result = true;
                }
            }
            return(result);
        }
Ejemplo n.º 3
0
 public override ushort PathFindCostFor(Pawn p)
 {
     if (!XenomorphUtil.IsXenomorph(p))
     {
         if (p.Faction == Faction.OfPlayer)
         {
             if (!PlayerKnowledgeDatabase.IsComplete(XenomorphConceptDefOf.RRY_Concept_Fungus) && p.Spawned && p.IsColonist)
             {
                 return(base.PathFindCostFor(p));
             }
             return(800);
         }
     }
     return(base.PathFindCostFor(p));
 }
        // 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: 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);
                 }
             }
         }
     }
 }
Ejemplo n.º 6
0
 public static List <Pawn> SpawnedXenomorphPawns(Map map)
 {
     return(map.mapPawns.AllPawnsSpawned.FindAll(x => XenomorphUtil.IsXenomorph(x)));
 }
Ejemplo n.º 7
0
        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;
            }
        }