//private Dictionary<Hediff, int> carriedBloodInfectors = null;
        //private Dictionary<Hediff, int> carriedBloodDrugEffects = null;
        //public bool IsInfectionCarrier => carriedBloodInfectors != null;
        //public bool IsDrugCarrier => carriedBloodDrugEffects != null;

        public override void PostTick()
        {
            base.PostTick();
            if (this.pawn.VampComp() is CompVampire v)
            {
                if (!initialized)
                {
                    initialized = true;

                    if (!firstVampire)
                    {
                        if (sire == null)
                        {
                            sire = VampireRelationUtility.FindSireFor(this.pawn, this.bloodline, this.generation).VampComp();
                        }
                        if (generation < 0)
                        {
                            generation = sire.Generation + 1;
                        }
                        if (bloodline == null)
                        {
                            bloodline = sire.Bloodline;
                        }
                    }


                    if (v.IsVampire && v.Sire == null)
                    {
                        v.InitializeVampirism(sire?.AbilityUser ?? null, bloodline, generation, firstVampire);
                    }
                    this.pawn.Drawer.renderer.graphics.ResolveAllGraphics();
                }

                if (Find.TickManager.TicksGame % 60 == 0)
                {
                    if (v.InSunlight)
                    {
                        HealthUtility.AdjustSeverity(pawn, VampDefOf.ROMV_SunExposure, 0.001f);
                    }
                    if (v.BloodPool?.CurLevelPercentage < 0.3f)
                    {
                        HealthUtility.AdjustSeverity(pawn, VampDefOf.ROMV_TheBeast, 0.001f);
                    }
                    if (this.pawn.health.hediffSet is HediffSet hdSet)
                    {
                        if (hdSet.GetFirstHediffOfDef(HediffDefOf.Hypothermia) is Hediff hypoThermia)
                        {
                            hdSet.hediffs.Remove(hypoThermia);
                        }
                        else if (hdSet.GetFirstHediffOfDef(HediffDefOf.Heatstroke) is Hediff heatStroke)
                        {
                            hdSet.hediffs.Remove(heatStroke);
                        }
                    }
                }
            }
        }
Exemplo n.º 2
0
        public override void PostTick()
        {
            base.PostTick();
            if (!(pawn.VampComp() is CompVampire v))
            {
                return;
            }
            if (!initialized)
            {
                initialized = true;

                if (!firstVampire)
                {
                    if (sire == null)
                    {
                        sire = VampireRelationUtility.FindSireFor(pawn, bloodline, generation).VampComp();
                    }
                    if (generation < 0)
                    {
                        generation = sire.Generation + 1;
                    }
                    if (bloodline == null)
                    {
                        bloodline = sire.Bloodline;
                    }
                }


                if (v.IsVampire && v.Sire == null)
                {
                    v.InitializeVampirism(sire?.AbilityUser ?? null, bloodline, generation, firstVampire);
                }
                pawn.Drawer.renderer.graphics.ResolveAllGraphics();
            }

            if (Find.TickManager.TicksGame % 60 != 0)
            {
                return;
            }
            if (v.InSunlight)
            {
                HealthUtility.AdjustSeverity(pawn, VampDefOf.ROMV_SunExposure, 0.001f);
            }
            if (v.BloodPool?.CurLevelPercentage < 0.3f)
            {
                HealthUtility.AdjustSeverity(pawn, VampDefOf.ROMV_TheBeast, 0.001f);
            }

            //Remove nonsensical hediffs
            if (pawn.health.hediffSet is HediffSet hdSet)
            {
                if (hdSet.GetFirstHediffOfDef(HediffDefOf.Hypothermia) is Hediff hypoThermia)
                {
                    hdSet.hediffs.Remove(hypoThermia);
                }
                else if (hdSet.GetFirstHediffOfDef(HediffDefOf.Heatstroke) is Hediff heatStroke)
                {
                    hdSet.hediffs.Remove(heatStroke);
                }
                else if (hdSet.GetFirstHediffOfDef(VampDefOfTwo.GutWorms) is Hediff gutWorms)
                {
                    hdSet.hediffs.Remove(gutWorms);
                }
                else if (hdSet.GetFirstHediffOfDef(VampDefOfTwo.MuscleParasites) is Hediff muscleParasites)
                {
                    hdSet.hediffs.Remove(muscleParasites);
                }
                else if (hdSet.GetFirstHediffOfDef(VampDefOfTwo.FibrousMechanites) is Hediff fibrousMechanites)
                {
                    hdSet.hediffs.Remove(fibrousMechanites);
                }
                else if (hdSet.GetFirstHediffOfDef(VampDefOfTwo.SensoryMechanites) is Hediff sensoryMechanites)
                {
                    hdSet.hediffs.Remove(sensoryMechanites);
                }
            }

            //If no generational bonus exists...
            if (!pawn.health.hediffSet.HasHediff(pawn.GenerationDef()))
            {
                HealthUtility.AdjustSeverity(pawn, pawn.GenerationDef(), 1.0f);
            }
        }