protected override bool TryExecuteWorker(IncidentParms parms)
        {
            var map = parms.target as Map;

            //Generate the zombie
            var pawn   = ReanimatedPawnUtility.DoGenerateZombiePawnFromSource(innerSacrifice(map));
            var intVec = innerSacrifice(map).Position.RandomAdjacentCell8Way();

            GenSpawn.Spawn(pawn, intVec, map);
            innerSacrifice(map).Corpse.Destroy();
            //Destroy the corpse
            //Replace the innerSacrifice with the new pawn just in-case
            //altar.innerSacrifice = thing;
            map.GetComponent <MapComponent_SacrificeTracker>().lastLocation = intVec;
            Messages.Message("The innerSacrifice reanimates and attacks.", MessageTypeDefOf.ThreatBig);
            Utility.ApplyTaleDef("Cults_SpellReanimator", pawn);
            return(true);
        }
 public override void Tick()
 {
     try
     {
         if (DebugSettings.noAnimals && base.RaceProps.Animal)
         {
             this.Destroy(0);
         }
         else if (!base.Downed)
         {
             if (Find.TickManager.TicksGame % 250 == 0)
             {
                 this.TickRare();
             }
             if (base.Spawned)
             {
                 this.pather.PatherTick();
             }
             base.Drawer.DrawTrackerTick();
             this.health.HealthTick();
             this.records.RecordsTick();
             if (base.Spawned)
             {
                 this.stances.StanceTrackerTick();
             }
             if (base.Spawned)
             {
                 this.verbTracker.VerbsTick();
             }
             if (base.Spawned)
             {
                 this.natives.NativeVerbsTick();
             }
             if (this.equipment != null)
             {
                 this.equipment.EquipmentTrackerTick();
             }
             if (this.apparel != null)
             {
                 this.apparel.ApparelTrackerTick();
             }
             if (base.Spawned)
             {
                 this.jobs.JobTrackerTick();
             }
             if (!base.Dead)
             {
                 this.carryTracker.CarryHandsTick();
             }
             if (this.skills != null)
             {
                 this.skills.SkillsTick();
             }
             if (this.inventory != null)
             {
                 this.inventory.InventoryTrackerTick();
             }
         }
         if (this.needs != null && this.needs.food != null && this.needs.food.CurLevel <= 0.95f)
         {
             this.needs.food.CurLevel = 1f;
         }
         if (this.needs != null && this.needs.joy != null && this.needs.joy.CurLevel <= 0.95f)
         {
             this.needs.joy.CurLevel = 1f;
         }
         if (this.needs != null && this.needs.beauty != null && this.needs.beauty.CurLevel <= 0.95f)
         {
             this.needs.beauty.CurLevel = 1f;
         }
         if (this.needs != null && this.needs.comfort != null && this.needs.comfort.CurLevel <= 0.95f)
         {
             this.needs.comfort.CurLevel = 1f;
         }
         if (this.needs != null && this.needs.rest != null && this.needs.rest.CurLevel <= 0.95f)
         {
             this.needs.rest.CurLevel = 1f;
         }
         if (this.needs != null && this.needs.mood != null && this.needs.mood.CurLevel <= 0.45f)
         {
             this.needs.mood.CurLevel = 0.5f;
         }
         if (!this.setZombie)
         {
             this.mindState.mentalStateHandler.neverFleeIndividual = true;
             this.setZombie = ReanimatedPawnUtility.Zombify(this);
             //ZombieMod_Utility.SetZombieName(this);
         }
         if (base.Downed || this.health.Downed || this.health.InPainShock)
         {
             DamageInfo damageInfo = new DamageInfo(DamageDefOf.Blunt, 9999, 1f, -1f, this, null, null);
             damageInfo.SetHitPart(this.health.hediffSet.GetBrain());
             //damageInfo.SetPart(new BodyPartDamageInfo(this.health.hediffSet.GetBrain(), false, HediffDefOf.Cut));
             base.TakeDamage(damageInfo);
         }
     }
     catch (Exception)
     {
     }
 }
Exemple #3
0
        public override void Tick()
        {
            try
            {
                if (DebugSettings.noAnimals && RaceProps.Animal)
                {
                    Destroy();
                }
                else if (!Downed)
                {
                    if (Find.TickManager.TicksGame % 250 == 0)
                    {
                        TickRare();
                    }

                    if (Spawned)
                    {
                        pather.PatherTick();
                    }

                    Drawer.DrawTrackerTick();
                    health.HealthTick();
                    records.RecordsTick();
                    if (Spawned)
                    {
                        stances.StanceTrackerTick();
                    }

                    if (Spawned)
                    {
                        verbTracker.VerbsTick();
                    }

                    if (Spawned)
                    {
                        natives.NativeVerbsTick();
                    }

                    equipment?.EquipmentTrackerTick();

                    apparel?.ApparelTrackerTick();

                    if (Spawned)
                    {
                        jobs.JobTrackerTick();
                    }

                    if (!Dead)
                    {
                        carryTracker.CarryHandsTick();
                    }

                    skills?.SkillsTick();

                    inventory?.InventoryTrackerTick();
                }

                if (needs?.food != null && needs.food.CurLevel <= 0.95f)
                {
                    needs.food.CurLevel = 1f;
                }

                if (needs?.joy != null && needs.joy.CurLevel <= 0.95f)
                {
                    needs.joy.CurLevel = 1f;
                }

                if (needs?.beauty != null && needs.beauty.CurLevel <= 0.95f)
                {
                    needs.beauty.CurLevel = 1f;
                }

                if (needs?.comfort != null && needs.comfort.CurLevel <= 0.95f)
                {
                    needs.comfort.CurLevel = 1f;
                }

                if (needs?.rest != null && needs.rest.CurLevel <= 0.95f)
                {
                    needs.rest.CurLevel = 1f;
                }

                if (needs?.mood != null && needs.mood.CurLevel <= 0.45f)
                {
                    needs.mood.CurLevel = 0.5f;
                }

                if (!setZombie)
                {
                    mindState.mentalStateHandler.neverFleeIndividual = true;
                    setZombie = ReanimatedPawnUtility.Zombify(this);
                    //ZombieMod_Utility.SetZombieName(this);
                }

                if (!Downed && !health.Downed && !health.InPainShock)
                {
                    return;
                }

                var damageInfo = new DamageInfo(DamageDefOf.Blunt, 9999, 1f, -1f, this);
                damageInfo.SetHitPart(health.hediffSet.GetBrain());
                //damageInfo.SetPart(new BodyPartDamageInfo(this.health.hediffSet.GetBrain(), false, HediffDefOf.Cut));
                TakeDamage(damageInfo);
            }
            catch
            {
                // ignored
            }
        }