Ejemplo n.º 1
0
        public override void Tick()
        {
            if (Find.TickManager.TicksGame % 60 == 0)
            {
                List <Thing> list = new List <Thing>();
                try
                {
                    if (GenGrid.InBounds(this.Position, this.Map))
                    {
                        list = this.Map.thingGrid.ThingsListAt(this.Position);
                    }
                }
                catch
                {
                    return;
                }
                if (list == null || list.Count <= 0)
                {
                    return;
                }
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i] == null || list[i].Faction == PurpleIvyData.AlienFaction)
                    {
                        continue;
                    }
                    switch (list[i])
                    {
                    case Pawn _:
                    {
                        try
                        {
                            PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map);
                            Pawn pawn = (Pawn)list[i];
                            if (!pawn.RaceProps.IsMechanoid)
                            {
                                HealthUtility.AdjustSeverity(pawn, HediffDefOf.ToxicBuildup, 0.005f);
                                HealthUtility.AdjustSeverity(pawn, PurpleIvyDefOf.PI_VaporToxicFilth, 1f);
                            }
                        }
                        catch { }
                        break;
                    }

                    case Plant _:
                    {
                        if (list[i].def != PurpleIvyDefOf.PurpleIvy &&
                            list[i].def != PurpleIvyDefOf.PI_Nest &&
                            list[i].def != PurpleIvyDefOf.PlantVenomousToothwort &&
                            list[i].def != PurpleIvyDefOf.PI_CorruptedTree)
                        {
                            PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map);
                            list[i].TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicBurn, 1));
                        }
                        break;
                    }
                    }
                }
            }
        }
Ejemplo n.º 2
0
        public override void Tick()
        {
            if (Find.TickManager.TicksGame % 60 == 0)
            {
                List <Thing> list = new List <Thing>();
                try
                {
                    if (GenGrid.InBounds(this.Position, this.Map))
                    {
                        list = this.Map.thingGrid.ThingsListAt(this.Position);
                    }
                }
                catch
                {
                    return;
                }
                if (list == null || list.Count <= 0)
                {
                    return;
                }
                for (int i = 0; i < list.Count; i++)
                {
                    if (list[i] == null || list[i].Faction == PurpleIvyData.AlienFaction)
                    {
                        continue;
                    }
                    switch (list[i])
                    {
                    //If we find a pawn and its not a hatchling
                    case Pawn _:
                    {
                        try
                        {
                            //PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map);
                            Pawn pawn = (Pawn)list[i];
                            if (!pawn.RaceProps.IsMechanoid)
                            {
                                pawn.TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicBurn, 1, 0, -1, this,
                                                               pawn.health.hediffSet.GetNotMissingParts(0, 0, null, null)
                                                               .Where(x => x.groups.Contains(BodyPartGroupDefOf.Legs))
                                                               .FirstOrDefault()));
                                HealthUtility.AdjustSeverity(pawn, HediffDefOf.ToxicBuildup, 0.01f);
                                HealthUtility.AdjustSeverity(pawn, PurpleIvyDefOf.PI_AlienBlood, 1f);
                            }
                        }
                        catch { }
                        break;
                    }

                    //If we find a plant
                    case Plant _:
                    {
                        if (list[i].def != PurpleIvyDefOf.PurpleIvy &&
                            list[i].def != PurpleIvyDefOf.PI_Nest &&
                            list[i].def != PurpleIvyDefOf.PlantVenomousToothwort &&
                            list[i].def != PurpleIvyDefOf.PI_CorruptedTree)
                        {
                            PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map);
                            list[i].TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicBurn, 1));
                        }
                        break;
                    }
                    }
                }
            }
        }
Ejemplo n.º 3
0
        public void DoDamageToThings()
        {
            List <Thing> list = new List <Thing>();

            try
            {
                if (GenGrid.InBounds(this.Position, this.Map))
                {
                    list = this.Map.thingGrid.ThingsListAt(this.Position);
                }
            }
            catch
            {
                return;
            }

            if (list == null || list.Count <= 0)
            {
                return;
            }
            for (int i = 0; i < list.Count; i++)
            {
                if (list[i] == null || list[i].Faction == PurpleIvyData.AlienFaction)
                {
                    continue;
                }
                if (list[i].def.IsCorpse)
                {
                    this.DoDamageToCorpse((Corpse)list[i]);
                }
                else
                {
                    switch (list[i])
                    {
                    case Pawn _:
                    {
                        this.DoDamageToPawn((Pawn)list[i]);
                        break;
                    }

                    case StickyGoo stickyGoo:
                    {
                        if (stickyGoo.HasAnyContents)
                        {
                            var thing = stickyGoo.ContainedThing;
                            if (thing is Pawn pawn)
                            {
                                var damageInfo = new DamageInfo(DamageDefOf.Scratch, 1, 0f, -1f, this, null, null);
                                pawn.TakeDamage(damageInfo);
                                this.Growth += 0.001f;
                                if (pawn.TryGetComp <AlienInfection>() == null)
                                {
                                    var hediff = (AlienInfectionHediff)HediffMaker.MakeHediff
                                                     (PurpleIvyDefOf.PI_AlienInfection, pawn);
                                    hediff.instigator = PawnKindDef.Named("Genny_ParasiteOmega");
                                    pawn.health.AddHediff(hediff);
                                }
                                if (Rand.Chance(0.1f) && pawn.health.hediffSet.GetFirstHediffOfDef(PurpleIvyDefOf.PI_AlienMutation) == null)
                                {
                                    var hediff3 = HediffMaker.MakeHediff(PurpleIvyDefOf.PI_AlienMutation, pawn, null);
                                    pawn.health.AddHediff(hediff3, null, null, null);
                                }
                            }
                            else if (thing is Corpse corpse)
                            {
                                this.DoDamageToCorpse(corpse);
                                stickyGoo.EjectContents();
                            }
                        }
                        break;
                    }

                    case Plant _:
                    {
                        if (list[i].def != PurpleIvyDefOf.PurpleIvy &&
                            list[i].def != PurpleIvyDefOf.PI_Nest &&
                            list[i].def != PurpleIvyDefOf.PlantVenomousToothwort &&
                            list[i].def != PurpleIvyDefOf.PI_CorruptedTree)
                        {
                            PurpleIvyMoteMaker.ThrowToxicSmoke(this.Position.ToVector3Shifted(), this.Map);
                            //FilthMaker.TryMakeFilth(this.Position, this.Map, PurpleIvyDefOf.PI_ToxicFilth);
                            list[i].TakeDamage(new DamageInfo(PurpleIvyDefOf.PI_ToxicBurn, 1));
                        }
                        break;
                    }
                    }
                }
            }
        }