public virtual void DoEffect(CompVampire sireComp, CompVampire childeComp) { if (childeComp.AbilityUser is Pawn p) { Pawn vampToBe = p; if (childeComp?.BloodPool is Need_Blood bloodOfVampToBe && sireComp?.BloodPool is Need_Blood bloodOfVampMaster) { bloodOfVampToBe.TransferBloodTo(9999, bloodOfVampMaster); } bool wasColonist = p.Faction == Faction.OfPlayer; ResurrectionUtility.Resurrect(vampToBe); if (vampToBe.Faction != sireComp?.AbilityUser?.Faction) { vampToBe.SetFaction(sireComp.AbilityUser.Faction, sireComp.AbilityUser); } RemoveColonistDiedThoughts(vampToBe, wasColonist); if (sireComp?.BloodPool is Need_Blood sB && vampToBe?.BloodNeed() is Need_Blood cB) { cB.CurBloodPoints = 0; sB.TransferBloodTo(1, cB); cB.CurBloodPoints = 1; } vampToBe.VampComp().Notify_Embraced(sireComp); } }
/* * public override void PostPostApplyDamage(DamageInfo dinfo, float totalDamageDealt) * { * base.PostPostApplyDamage(dinfo, totalDamageDealt); * if (base.parent != null) * { * Log.Message(string.Format("{0} took damage", base.parent.Label)); * if (base.parent is Pawn) * { * Log.Message(string.Format("{0} is a pawn", base.parent.Label)); * this.pawn = (Pawn)base.parent; * this.pawnCorpse = pawn.Corpse; * if (this.pawn.Dead) * { * Log.Message(string.Format("{0} is dead", base.parent.Label)); * * this.fatalDamageDef = dinfo.Def; * Props.fatalDamageDef = fatalDamageDef; * if (fatalDamageDef?.defaultArmorPenetration!=null) * { * fatalDamageDef.defaultArmorPenetration = 0f; * } * if (fatalDamageDef.defName.StartsWith("Power") || fatalDamageDef.defaultArmorPenetration >= 1f) * { * Props.reviveFlag = false; * } * else * { * Props.reviveFlag = true; * } * } * } * else if (base.parent is Corpse) * { * this.pawnCorpse = (Corpse)base.parent; * this.pawn = pawnCorpse.InnerPawn; * * if (this.pawnCorpse != null && this.pawn != null) * { * fatalDamageDef = dinfo.Def; * Props.fatalDamageDef = fatalDamageDef; * if (fatalDamageDef.defName.StartsWith("Power") || fatalDamageDef.defaultArmorPenetration >= 1f) * { * Props.reviveFlag = false; * } * else * { * Props.reviveFlag = true; * } * } * } * } * } */ public override void CompTickRare() { base.CompTickRare(); if (base.parent is Corpse && base.parent != null && Props.reviveFlag) { pawnCorpse = (Corpse)base.parent; pawn = pawnCorpse.InnerPawn; if (pawn.Dead && Props.reviveFlag && pawn.Dead && !this.reviveTried) { if (Rand.Chance(pawn.BodySize)) { ResurrectionUtility.Resurrect(pawn); MoteMaker.ThrowLightningGlow(base.parent.TrueCenter(), base.parent.Map, 13f); // MoteMaker.MakeStaticMote(base.parent.TrueCenter(), base.parent.Map, ThingDefOf.Mote_ExplosionFlash, 12f); // pawn.jobs.StopAll(); // pawn.mindState. } this.reviveTried = true; } } else if (base.parent is Pawn && this.pawn != null && pawn.Dead == false && Props.reviveFlag && !pawn.Dead) { this.pawn = (Pawn)base.parent; this.pawnCorpse = pawn.Corpse; CompSelfRepair(); } }
private void AgeCorpse(Thing thing) { CompRottable compRot = thing.TryGetComp <CompRottable>(); if (compRot != null) { if (compRot.RotProgress <= (5000 + (5000 * pwrVal))) { Corpse corpse = thing as Corpse; if (corpse != null && verVal >= 3) { TransmutateEffects(corpse.Position, 10); Pawn innerPawn = corpse.InnerPawn; ResurrectionUtility.ResurrectWithSideEffects(innerPawn); AgePawn(innerPawn, Mathf.RoundToInt(6 * 2500 * (1 + (.1f * verVal))), false); HealthUtility.AdjustSeverity(innerPawn, TorannMagicDefOf.TM_DeathReversalHD, 1f); Projectile_Resurrection.ApplyHealthDefects(innerPawn, .25f, .3f); Projectile_Resurrection.ReduceSkillsOfPawn(innerPawn, Rand.Range(.30f, .40f)); HealthUtility.AdjustSeverity(this.CasterPawn, TorannMagicDefOf.TM_DeathReversalHD, Rand.Range(.4f, .6f)); //Projectile_Resurrection.ApplyHealthDefects(this.CasterPawn, .15f, .2f); Projectile_Resurrection.ReduceSkillsOfPawn(this.CasterPawn, Rand.Range(.15f, .25f)); } } else { compRot.RotProgress = compRot.RotProgress * (.4f - (.125f * pwrVal)); if (compRot.RotProgress <= 20000) { compRot.RotProgress = 20001; } } } }
private void Resurrect() { Pawn innerPawn = this.Corpse.InnerPawn; ResurrectionUtility.Resurrect(innerPawn); //make sure pawn is alive again var mutagen = MutagenDefOf.defaultMutagen; PawnKindDef animalKind; TransformationRequest request; request = MakeRequest(innerPawn); animalKind = request.outputDef; var tfPawn = mutagen.MutagenCached.Transform(request); if (tfPawn != null) { var comp = Find.World.GetComponent <PawnmorphGameComp>(); var oFirst = tfPawn.TransformedPawns.First(); comp.AddTransformedPawn(tfPawn); var messageContent = RESURRECTION_MESSAGE_LABEL.Translate(innerPawn.Named("original"), oFirst.Named("animal"), animalKind.Named(nameof(animalKind))) .CapitalizeFirst(); Messages.Message(messageContent, oFirst, MessageTypeDefOf.PositiveEvent, true); } else { Log.Warning($"resurrected pawn {pawn.Name} who cannot be transformed normally! is this intended?"); } //Messages.Message("MessagePawnResurrected".Translate(innerPawn).CapitalizeFirst(), innerPawn, MessageTypeDefOf.PositiveEvent, true); this.Item.SplitOff(1).Destroy(DestroyMode.Vanish); }
public override void TryExecute() { try { if (pawn.SpawnedParentOrMe != pawn.Corpse) { // Someone is holding the corpse, try to drop it if (pawn.SpawnedParentOrMe is Pawn carryingPawn) { if (!carryingPawn.carryTracker.TryDropCarriedThing(carryingPawn.Position, ThingPlaceMode.Near, out Thing droppedThing)) { // Failed to drop carried thing. Log.Error($"Submit this bug to TwitchToolkit Discord: Could not drop {pawn} at {carryingPawn.Position} from {carryingPawn}"); return; } } } pawn.ClearAllReservations(); ResurrectionUtility.ResurrectWithSideEffects(pawn); PawnTracker.pawnsToRevive.Remove(pawn); Find.LetterStack.ReceiveLetter("Pawn Revived", $"{pawn.Name} has been revived but is experiencing some side effects.", LetterDefOf.PositiveEvent, pawn); } catch (Exception e) { Log.Error("Submit this bug to TwitchToolkit Discord: " + e.Message); } }
private void AgeCorpse(Thing thing) { CompRottable compRot = thing.TryGetComp <CompRottable>(); if (compRot != null) { if (compRot.RotProgress <= (5000 + (5000 * pwrVal))) { Corpse corpse = thing as Corpse; if (corpse != null && verVal >= 3) { TransmutateEffects(corpse.Position, 10); Pawn innerPawn = corpse.InnerPawn; ResurrectionUtility.ResurrectWithSideEffects(innerPawn); AgePawn(innerPawn, Mathf.RoundToInt((6 * 2500) * (1 + (.1f * verVal))), false); HealthUtility.AdjustSeverity(innerPawn, HediffDef.Named("TM_ResurrectionHD"), 1f); HealthUtility.AdjustSeverity(this.CasterPawn, HediffDef.Named("TM_ResurrectionHD"), 1f); } } else { compRot.RotProgress = compRot.RotProgress * (.4f - (.125f * pwrVal)); if (compRot.RotProgress <= 20000) { compRot.RotProgress = 20001; } } } }
public void HasturResurrection() { Pawn sourceCorpse = toBeResurrected.RandomElement(); toBeResurrected.Remove(sourceCorpse); IntVec3 spawnLoc = IntVec3.Invalid; if (sourceCorpse.Corpse != null) { //Use B18's Resurrect Feature ResurrectionUtility.Resurrect(sourceCorpse); //Remove everything that conflicts with Psychopathic behavior sourceCorpse.story.traits.allTraits.RemoveAll( x => (x.def.conflictingTraits is List <TraitDef> conflicts && !conflicts.NullOrEmpty() && conflicts.Contains(TraitDefOf.Psychopath)) || x.def.defName == "Cults_OathtakerHastur"); //Remove a random trait and add Psychopath if (sourceCorpse.story.traits.allTraits is List <Trait> allTraits && allTraits.Count > 1 && allTraits.FirstOrDefault(x => x.def == TraitDefOf.Psychopath) == null) { sourceCorpse.story.traits.allTraits.RemoveLast(); sourceCorpse.story.traits.GainTrait(new Trait(TraitDefOf.Psychopath, 0, true)); } //Adds the "Reanimated" trait sourceCorpse.story.traits.GainTrait(new Trait(TraitDef.Named("Cults_OathtakerHastur2"), 0, true)); //Message to the player #pragma warning disable CS0618 // Type or member is obsolete Messages.Message("ReanimatedOath".Translate(sourceCorpse.Name), MessageTypeDefOf.PositiveEvent); #pragma warning restore CS0618 // Type or member is obsolete } }
public override void Use() { List <Thing> corpses = Map.listerThings.ThingsInGroup(ThingRequestGroup.Corpse).ToList(); for (int i = 0; i < corpses.Count; i++) { Thing corpseThing = corpses[i]; Corpse corpse = corpseThing as Corpse; if (corpse != null) { Pawn pawn = corpse.InnerPawn; if (pawn != null && pawn.RaceProps.IsFlesh) { ResurrectionUtility.ResurrectWithSideEffects(pawn); Hediff hediff = pawn.health.hediffSet.GetFirstHediffOfDef(HediffDefOf.ResurrectionSickness); if (hediff != null) { pawn.health.RemoveHediff(hediff); } HealthUtility.AdjustSeverity(pawn, HediffDefOfLocal.SphereOfResurrection, 0.1f); } } } Destroy(); }
// Token: 0x06000367 RID: 871 RVA: 0x00022410 File Offset: 0x00020810 private void Resurrect() { Pawn innerPawn = this.Corpse.InnerPawn; bool canResurrect = false; string deadPawnRaceName = innerPawn.kindDef.race.defName.ToLower(); switch (Item.def.defName) { case "RepairKitResurrectorB": canResurrect = deadPawnRaceName.Contains("1tier"); break; case "RepairKitResurrectorA": canResurrect = deadPawnRaceName.Contains("1tier") || deadPawnRaceName.Contains("2tier"); break; case "RepairKitResurrectorS": canResurrect = deadPawnRaceName.Contains("android"); break; } if (canResurrect) { ResurrectionUtility.Resurrect(innerPawn); Messages.Message("MessagePawnResurrected".Translate(innerPawn).CapitalizeFirst(), innerPawn, MessageTypeDefOf.PositiveEvent, true); this.Item.SplitOff(1).Destroy(DestroyMode.Vanish); } else { Messages.Message("CantRepair".Translate(innerPawn).CapitalizeFirst(), innerPawn, MessageTypeDefOf.RejectInput, true); } }
public override void Notify_PawnDied() { base.Notify_PawnDied(); Pawn pawn = parent.pawn; ResurrectionUtility.ResurrectWithSideEffects(pawn); Messages.Message("MessagePawnResurrected".Translate(pawn), pawn, MessageTypeDefOf.PositiveEvent); resurrected = true; }
public void HasturResurrection() { if (toBeResurrected?.FirstOrDefault() == null) { ticksUntilResurrection = -999; return; } var sourceCorpse = toBeResurrected.RandomElement(); toBeResurrected.Remove(sourceCorpse); var unused = IntVec3.Invalid; if (sourceCorpse.Corpse == null) { return; } try { if (sourceCorpse?.Corpse?.holdingOwner is ThingOwner owner) { Thing lastThing = null; owner.TryDrop(sourceCorpse.Corpse, ThingPlaceMode.Near, out lastThing); } } catch { } //Use B18's Resurrect Feature ResurrectionUtility.Resurrect(sourceCorpse); //Remove everything that conflicts with Psychopathic behavior sourceCorpse.story.traits.allTraits.RemoveAll( x => x.def.conflictingTraits is List <TraitDef> conflicts && !conflicts.NullOrEmpty() && conflicts.Contains(TraitDefOf.Psychopath) || x.def.defName == "Cults_OathtakerHastur"); //Remove a random trait and add Psychopath if (sourceCorpse.story.traits.allTraits is List <Trait> { Count : > 1 } allTraits&& allTraits.FirstOrDefault(x => x.def == TraitDefOf.Psychopath) == null) { sourceCorpse.story.traits.allTraits.RemoveLast(); sourceCorpse.story.traits.GainTrait(new Trait(TraitDefOf.Psychopath, 0, true)); } //Adds the "Reanimated" trait sourceCorpse.story.traits.GainTrait(new Trait(TraitDef.Named("Cults_OathtakerHastur2"), 0, true)); //Message to the player #pragma warning disable CS0618 // Type or member is obsolete Messages.Message("ReanimatedOath".Translate(sourceCorpse.Name), MessageTypeDefOf.PositiveEvent); #pragma warning restore CS0618 // Type or member is obsolete }
public override void Notify_PawnDied() { if (Props.resurrectionEffect) { Map map = this.parent.pawn.Corpse.Map; if (map != null) { SoundDefOf.PsychicPulseGlobal.PlayOneShot(new TargetInfo(this.parent.pawn.Corpse.Position, this.parent.pawn.Corpse.Map, false)); MoteMaker.MakeAttachedOverlay(this.parent.pawn.Corpse, ThingDef.Named("Mote_PsycastPsychicEffect"), Vector3.zero, 1f, -1f); ResurrectionUtility.Resurrect(this.parent.pawn.Corpse.InnerPawn); } } }
public void TickRare() { Corpse corpse = this.parent as Corpse; if (this.IsResurrectable == true) { this.resurrectAfterTimestamp = corpse.Age + 2000; } if (this.ShouldResurrect) { ResurrectionUtility.Resurrect(corpse.InnerPawn); } }
public override void TryExecute() { try { pawn.ClearAllReservations(); ResurrectionUtility.ResurrectWithSideEffects(pawn); PawnTracker.pawnsToRevive.Remove(pawn); Find.LetterStack.ReceiveLetter("Pawn Revived", $"{pawn.Name} has been revived but is experiencing some side effects.", LetterDefOf.PositiveEvent, pawn); } catch (Exception e) { Log.Error("Submit this bug to TwitchToolkit Discord: " + e.Message); } }
public override void Notify_PawnDied() { base.Notify_PawnDied(); Apparel ap = base.Pawn.apparel.WornApparel.Find(x => x.TryGetComp <CompCartridge>() != null); if (ap != null) { ap.Destroy(DestroyMode.Vanish); base.Pawn.apparel.Remove(ap); ResurrectionUtility.Resurrect(base.Pawn); Messages.Message("PolarisMessageSomeoneResurrected".Translate(ap.LabelShort, base.Pawn.LabelShort), MessageTypeDefOf.PositiveEvent); } base.Pawn.health.RemoveHediff(base.parent); }
private static void Resurrect(this Pawn pawn) { try { ResurrectionUtility.ResurrectWithSideEffects(pawn); } catch (NullReferenceException) { TkUtils.Logger.Warn("Failed to revive with side effects -- falling back to a regular revive"); ResurrectionUtility.Resurrect(pawn); } PawnTracker.pawnsToRevive.Remove(pawn); }
public override void CompTickRare() { base.CompTickRare(); Corpse corpse = this.parent as Corpse; if (this.IsResurrectable == true && resurrectTime < 0) { resurrectTime = Current.Game.tickManager.TicksGame + ticksToResurrection; } if (this.ShouldResurrect()) { ResurrectionUtility.Resurrect(corpse.InnerPawn); } }
public override void Notify_PawnDied() { Map map = this.parent.pawn.Corpse.Map; if (map != null) { if (resurrectionsLeft > 1) { SoundDefOf.PsychicPulseGlobal.PlayOneShot(new TargetInfo(this.parent.pawn.Corpse.Position, this.parent.pawn.Corpse.Map, false)); FleckMaker.AttachedOverlay(this.parent.pawn.Corpse, DefDatabase <FleckDef> .GetNamed("PsycastPsychicEffect"), Vector3.zero, 1f, -1f); ResurrectionUtility.Resurrect(this.parent.pawn.Corpse.InnerPawn); resurrectionsLeft--; } } }
public override void Notify_PawnDied() { //This is just pure laziness, I hooked this code here so Vanilla Cooking Expanded's mechanite resurrector condiment //resurrects the pawn if it dies. But properly this should be a separate class. if (Props.resurrectionEffect) { Map map = this.parent.pawn.Corpse.Map; if (map != null) { SoundDefOf.PsychicPulseGlobal.PlayOneShot(new TargetInfo(this.parent.pawn.Corpse.Position, this.parent.pawn.Corpse.Map, false)); MoteMaker.MakeAttachedOverlay(this.parent.pawn.Corpse, ThingDef.Named("Mote_PsycastPsychicEffect"), Vector3.zero, 1f, -1f); ResurrectionUtility.Resurrect(this.parent.pawn.Corpse.InnerPawn); } } }
protected override bool TryExecuteWorker(IncidentParms parms) { Map map = parms.target as Map; Faction faction = altar(map).Faction; foreach (Pawn p in map.PlayerPawnsForStoryteller) { if (p.Dead && p.Faction == faction) { ResurrectionUtility.Resurrect(p); Messages.Message("MoreDeities_Aqua_Resurrected".Translate(), p, MessageTypeDefOf.PositiveEvent); } } return(true); }
public static void Ressurrect(Pawn pawn, Thing thing) { if (thing is HoloEmitter) { if (pawn.Corpse.holdingOwner != null) { pawn.Corpse.GetDirectlyHeldThings().TryTransferToContainer(pawn, pawn.Corpse.holdingOwner, true); } else if (pawn.Corpse.Spawned) { ResurrectionUtility.Resurrect(pawn); PawnDiedOrDownedThoughtsUtility.RemoveDiedThoughts(pawn); PawnComponentsUtility.AddAndRemoveDynamicComponents(pawn, false); CompOsiris.FixPawnRelationships(pawn); pawn.health.Reset(); if (pawn.Corpse != null && pawn.Corpse.Spawned) { pawn.Corpse.DeSpawn(); } GenSpawn.Spawn(pawn, pawn.Corpse.Position, pawn.Corpse.Map); GiveSideEffects(pawn); } if (pawn.Corpse != null) { pawn.Corpse.Destroy(DestroyMode.Vanish); } } else { ResurrectionUtility.Resurrect(pawn); PawnDiedOrDownedThoughtsUtility.RemoveDiedThoughts(pawn); CompOsiris.FixPawnRelationships(pawn); pawn.health.Reset(); if (pawn.Corpse != null && pawn.Corpse.Spawned) { pawn.Corpse.DeSpawn(); } GenSpawn.Spawn(pawn, thing.Position, thing.Map); GiveSideEffects(pawn); Building_Casket building_Casket = thing as Building_Casket; if (building_Casket != null) { building_Casket.GetDirectlyHeldThings().Clear(); } } }
// Token: 0x06000367 RID: 871 RVA: 0x00022410 File Offset: 0x00020810 private void Resurrect() { Pawn innerPawn = this.Corpse.InnerPawn; bool canResurrect = false; ThingDef race = innerPawn.kindDef.race; string deadPawnRaceName = race.defName; switch (Item.def.defName) { case "RepairKitResurrectorB": canResurrect = deadPawnRaceName == "Android1Tier"; break; case "RepairKitResurrectorA": canResurrect = deadPawnRaceName == "Android1Tier" || deadPawnRaceName == "Android2Tier" || deadPawnRaceName.StartsWith("ATPP_Android2"); break; case "RepairKitResurrectorS": canResurrect = deadPawnRaceName.ToLower().Contains("android") || race.label.ToLower().Contains("android") || deadPawnRaceName == "M7Mech"; break; } if (canResurrect) { ResurrectionUtility.Resurrect(innerPawn); // If hostile, force it to reboot, so that it can be captured and reprogrammed if (innerPawn.Faction != null && innerPawn.Faction != Faction.OfPlayer && innerPawn.HostileTo(Faction.OfPlayer)) { HediffDef rebootHediffDef = DefDatabase <HediffDef> .GetNamed("RebootingSequenceAT"); Hediff hediff = HediffMaker.MakeHediff(rebootHediffDef, innerPawn); hediff.Severity = 1f; innerPawn.health.AddHediff(hediff); } Messages.Message("MessagePawnResurrected".Translate(innerPawn).CapitalizeFirst(), innerPawn, MessageTypeDefOf.PositiveEvent, true); this.Item.SplitOff(1).Destroy(DestroyMode.Vanish); } else { Messages.Message("CantRepair".Translate(innerPawn).CapitalizeFirst(), innerPawn, MessageTypeDefOf.RejectInput, true); } }
public static void GiveSideEffects(Pawn pawn) { BodyPartRecord brain = pawn.health.hediffSet.GetBrain(); Hediff hediff = HediffMaker.MakeHediff(HediffDefOf.ResurrectionSickness, pawn, null); if (!pawn.health.WouldDieAfterAddingHediff(hediff)) { pawn.health.AddHediff(hediff, null, null, null); } if (Rand.Chance(0.8f) && brain != null) { Hediff hediff2 = HediffMaker.MakeHediff(HediffDefOf.Dementia, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff2)) { pawn.health.AddHediff(hediff2, null, null, null); } } if (Rand.Chance(0.8f)) { IEnumerable <BodyPartRecord> enumerable = from x in pawn.health.hediffSet.GetNotMissingParts(BodyPartHeight.Undefined, BodyPartDepth.Undefined, null, null) where x.def == BodyPartDefOf.Eye select x; foreach (BodyPartRecord partRecord in enumerable) { Hediff hediff3 = HediffMaker.MakeHediff(HediffDefOf.Blindness, pawn, partRecord); pawn.health.AddHediff(hediff3, null, null, null); } } if (brain != null) { if (Rand.Chance(0.8f)) { Hediff hediff4 = HediffMaker.MakeHediff(HediffDefOf.ResurrectionPsychosis, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff4)) { pawn.health.AddHediff(hediff4, null, null, null); } } } if (pawn.Dead) { Log.Error("The pawn has died while being resurrected."); ResurrectionUtility.Resurrect(pawn); } }
/// <summary> /// Actions used to perform Chronomancer ability "Recall" /// Loaded in static to allow immediate execution when downed or dead /// </summary> /// <param name="pawn"></param> /// <param name="comp"></param> /// <param name="deathTrigger"></param> public static void DoRecall(Pawn pawn, CompAbilityUserMagic comp, bool deathTrigger) { try { if (ModCheck.Validate.GiddyUp.Core_IsInitialized()) { ModCheck.GiddyUp.ForceDismount(pawn); } } catch { } MoteMaker.ThrowSmoke(pawn.DrawPos, pawn.Map, 1.4f); TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_AlterFate, pawn.DrawPos, pawn.Map, 1.6f, .2f, .1f, .8f, -500, 0, 0, Rand.Range(0, 360)); Effecter RecallFromEffect = TorannMagicDefOf.TM_RecallFromED.Spawn(); RecallFromEffect.Trigger(new TargetInfo(pawn), new TargetInfo(pawn)); RecallFromEffect.Cleanup(); RecallHediffs(pawn, comp); RecallNeeds(pawn, comp); RecallPosition(pawn, comp); ResetPowers(pawn, comp); comp.recallSet = false; comp.recallSpell = false; comp.RemovePawnAbility(TorannMagicDefOf.TM_Recall); TM_MoteMaker.ThrowGenericMote(TorannMagicDefOf.Mote_AlterFate, pawn.DrawPos, pawn.Map, 1.6f, .2f, .1f, .8f, 500, 0, 0, Rand.Range(0, 360)); Effecter RecallToEffect = TorannMagicDefOf.TM_RecallToED.Spawn(); RecallToEffect.Trigger(new TargetInfo(pawn), new TargetInfo(pawn)); RecallToEffect.Cleanup(); HealthUtility.AdjustSeverity(pawn, TorannMagicDefOf.TM_HediffInvulnerable, .02f); if (pawn.Dead) { ResurrectionUtility.Resurrect(pawn); deathTrigger = true; } if (deathTrigger && Rand.Chance(.5f)) { pawn.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Wander_Psychotic); } }
public override void Notify_PawnDied() { base.Notify_PawnDied(); if (this.HediffApparel != null) { Hediff combatChip = this.Pawn.health.hediffSet.hediffs.Find(x => x is Hediff_CombatChip); if (combatChip != null) { this.Pawn.health.RemoveHediff(combatChip); this.Pawn.health.AddHediff(PolarisblocDefOf.PolarisCombatChip_Assassin, this.Pawn.health.hediffSet.GetBrain()); } Apparel ap = this.HediffApparel.wornApparel; if (ap != null) { ap.Destroy(DestroyMode.Vanish); //base.Pawn.apparel.Remove(ap); ResurrectionUtility.Resurrect(base.Pawn); Messages.Message("PolarisMessageSomeoneResurrected".Translate(ap.LabelShort, base.Pawn.LabelShort), MessageTypeDefOf.PositiveEvent); } if (!this.Pawn.Faction.IsPlayer) { List <Lord> lords = base.Pawn.Map.lordManager.lords; foreach (Lord lord in lords) { lord.RemovePawn(this.Pawn); } this.Pawn.mindState.exitMapAfterTick = Find.TickManager.TicksGame + 150; IntVec3 invalid = IntVec3.Invalid; if (!RCellFinder.TryFindRandomCellOutsideColonyNearTheCenterOfTheMap(this.Pawn.Position, this.Pawn.Map, 10f, out invalid)) { invalid = IntVec3.Invalid; } if (invalid.IsValid) { this.Pawn.mindState.forcedGotoPosition = CellFinder.RandomClosewalkCellNear(invalid, this.Pawn.Map, 10, null); } } base.Pawn.health.RemoveHediff(base.parent); } }
public override void CompTickRare() { base.CompTickRare(); if (!_activated || !parent.Spawned) { return; } _progress -= 250; if (_progress < 0 && InnerPawn != null) { if (Props.hediffCondition != null && Props.removeHediffAfterResurrect) { var hediff = InnerPawn.health?.hediffSet?.GetFirstHediffOfDef(Props.hediffCondition); InnerPawn.health.RemoveHediff(hediff); } ResurrectionUtility.ResurrectWithSideEffects(InnerPawn); _activated = false; } }
private void Resurrect() { Pawn innerPawn = this.Corpse.InnerPawn; ResurrectionUtility.Resurrect(innerPawn); //make sure pawn is alive again var mutagen = MutagenDefOf.defaultMutagen; PawnKindDef animalKind = ThingProps.Animals.RandomElement(); float maxSeverity = ThingProps.makePermanentlyFeral ? 0.01f : 1f; TransformationRequest request = new TransformationRequest(animalKind, innerPawn, maxSeverity) { cause = null, forcedGender = ThingProps.genderTf, tale = ThingProps.taleDef, }; var tfPawn = mutagen.MutagenCached.Transform(request); if (tfPawn != null) { var comp = Find.World.GetComponent <PawnmorphGameComp>(); var oFirst = tfPawn.TransformedPawns.First(); comp.AddTransformedPawn(tfPawn); var messageContent = RESURRECTION_MESSAGE_LABEL.Translate(innerPawn.Named("original"), oFirst.Named("animal"), animalKind.Named(nameof(animalKind))) .CapitalizeFirst(); Messages.Message(messageContent, oFirst, MessageTypeDefOf.PositiveEvent, true); } else { Log.Warning($"resurrected pawn {pawn.Name} who cannot be transformed normally! is this intended?"); } //Messages.Message("MessagePawnResurrected".Translate(innerPawn).CapitalizeFirst(), innerPawn, MessageTypeDefOf.PositiveEvent, true); this.Item.SplitOff(1).Destroy(DestroyMode.Vanish); }
public static void GiveSideEffects(Pawn pawn) { BodyPartRecord brain = pawn.health.hediffSet.GetBrain(); Hediff hediff = HediffMaker.MakeHediff(HediffDefOf.ResurrectionSickness, pawn, null); if (!pawn.health.WouldDieAfterAddingHediff(hediff)) { pawn.health.AddHediff(hediff, null, null, null); } if (Rand.Chance(0.8f) && brain != null) { Hediff hediff2 = HediffMaker.MakeHediff(HediffDefOf.Dementia, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff2)) { pawn.health.AddHediff(hediff2, null, null, null); } } if (Rand.Chance(0.8f)) { foreach (BodyPartRecord bodyPartRecord in Enumerable.Where <BodyPartRecord>(pawn.health.hediffSet.GetNotMissingParts(0, 0, null, null), (BodyPartRecord x) => x.def == BodyPartDefOf.Eye)) { Hediff hediff3 = HediffMaker.MakeHediff(HediffDefOf.Blindness, pawn, bodyPartRecord); pawn.health.AddHediff(hediff3, null, null, null); } } if (brain != null && Rand.Chance(0.8f)) { Hediff hediff4 = HediffMaker.MakeHediff(HediffDefOf.ResurrectionPsychosis, pawn, brain); if (!pawn.health.WouldDieAfterAddingHediff(hediff4)) { pawn.health.AddHediff(hediff4, null, null, null); } } if (pawn.Dead) { Log.Error("The pawn has died while being resurrected.", false); ResurrectionUtility.Resurrect(pawn); } }
public static IEnumerable <Gizmo> GraveGizmoGetter(Pawn AbilityUser, Building_Grave grave) { bool dFlag = false; string dReason = ""; if ((AbilityUser?.BloodNeed()?.CurBloodPoints ?? 0) <= 0) { dFlag = true; dReason = "ROMV_NoBloodRemaining".Translate(); } VitaeAbilityDef bloodAwaken = DefDatabase <VitaeAbilityDef> .GetNamedSilentFail("ROMV_VampiricAwaken"); if (!AbilityUser?.Dead ?? false) { yield return(new Command_Action() { defaultLabel = bloodAwaken.label, defaultDesc = bloodAwaken.GetDescription(), icon = bloodAwaken.uiIcon, action = delegate { AbilityUser.BloodNeed().AdjustBlood(-1); grave.EjectContents(); if (grave.def == VampDefOf.ROMV_HideyHole) { grave.Destroy(); } }, disabled = dFlag, disabledReason = dReason }); } VitaeAbilityDef bloodResurrection = DefDatabase <VitaeAbilityDef> .GetNamedSilentFail("ROMV_VampiricResurrection"); if (AbilityUser?.Corpse?.GetRotStage() < RotStage.Dessicated) { yield return(new Command_Action() { defaultLabel = bloodResurrection.label, defaultDesc = bloodResurrection.GetDescription(), icon = bloodResurrection.uiIcon, action = delegate { AbilityUser.Drawer.Notify_DebugAffected(); ResurrectionUtility.Resurrect(AbilityUser); MoteMaker.ThrowText(AbilityUser.PositionHeld.ToVector3(), AbilityUser.MapHeld, StringsToTranslate.AU_CastSuccess); AbilityUser.BloodNeed().AdjustBlood(-99999999); HealthUtility.AdjustSeverity(AbilityUser, VampDefOf.ROMV_TheBeast, 1.0f); MentalStateDef MentalState_VampireBeast = DefDatabase <MentalStateDef> .GetNamed("ROMV_VampireBeast"); AbilityUser.mindState.mentalStateHandler.TryStartMentalState(MentalState_VampireBeast, null, true); }, disabled = (AbilityUser?.BloodNeed()?.CurBloodPoints ?? 0) < 0 }); } }
protected override void Impact(Thing hitThing) { Map map = base.Map; base.Impact(hitThing); ThingDef def = this.def; int raisedPawns = 0; Pawn pawn = this.launcher as Pawn; Pawn victim = hitThing as Pawn; CompAbilityUserMagic comp = pawn.GetComp <CompAbilityUserMagic>(); pwr = comp.MagicData.MagicPowerSkill_RaiseUndead.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_RaiseUndead_pwr"); ver = comp.MagicData.MagicPowerSkill_RaiseUndead.FirstOrDefault((MagicPowerSkill x) => x.label == "TM_RaiseUndead_ver"); Thing corpseThing = null; IntVec3 curCell; IEnumerable <IntVec3> targets = GenRadial.RadialCellsAround(base.Position, this.def.projectile.explosionRadius, true); for (int i = 0; i < targets.Count(); i++) { curCell = targets.ToArray <IntVec3>()[i]; TM_MoteMaker.ThrowPoisonMote(curCell.ToVector3Shifted(), map, .3f); if (curCell.InBounds(map)) { Corpse corpse = null; List <Thing> thingList; thingList = curCell.GetThingList(map); int z = 0; while (z < thingList.Count) { corpseThing = thingList[z]; if (corpseThing != null) { bool validator = corpseThing is Corpse; if (validator) { corpse = corpseThing as Corpse; Pawn undeadPawn = corpse.InnerPawn; CompRottable compRottable = corpse.GetComp <CompRottable>(); float rotStage = 0; if (compRottable != null && compRottable.Stage == RotStage.Dessicated) { rotStage = 1f; } if (compRottable != null) { rotStage += compRottable.RotProgressPct; } bool flag_SL = false; if (undeadPawn.def.defName == "SL_Runner" || undeadPawn.def.defName == "SL_Peon" || undeadPawn.def.defName == "SL_Archer" || undeadPawn.def.defName == "SL_Hero") { PawnGenerationRequest pgr = new PawnGenerationRequest(PawnKindDef.Named("Tribesperson"), pawn.Faction, PawnGenerationContext.NonPlayer, -1, true, false, false, false, false, true, 0, false, false, false, false, false, false, false, false, 0, null, 0); Pawn newUndeadPawn = PawnGenerator.GeneratePawn(pgr); GenSpawn.Spawn(newUndeadPawn, corpse.Position, corpse.Map, WipeMode.Vanish); corpse.Strip(); corpse.Destroy(DestroyMode.Vanish); rotStage = 1f; flag_SL = true; undeadPawn = newUndeadPawn; } if (!undeadPawn.def.defName.Contains("ROM_") && undeadPawn.RaceProps.IsFlesh && (undeadPawn.Dead || flag_SL) && undeadPawn.def.thingClass.FullName != "TorannMagic.TMPawnSummoned") { bool wasVampire = false; IEnumerable <ThingDef> enumerable = from hd in DefDatabase <HediffDef> .AllDefs where (def.defName == "ROM_Vampirism") select def; if (enumerable.Count() > 0) { bool hasVampHediff = undeadPawn.health.hediffSet.HasHediff(HediffDef.Named("ROM_Vampirism")) || undeadPawn.health.hediffSet.HasHediff(HediffDef.Named("ROM_GhoulHediff")); if (hasVampHediff) { wasVampire = true; } } if (!wasVampire) { undeadPawn.SetFaction(pawn.Faction); if (undeadPawn.Dead) { ResurrectionUtility.Resurrect(undeadPawn); } raisedPawns++; comp.supportedUndead.Add(undeadPawn); if (undeadPawn.kindDef != null && undeadPawn.kindDef.RaceProps != null && undeadPawn.kindDef.RaceProps.Animal) { RemoveHediffsAddictionsAndPermanentInjuries(undeadPawn); HealthUtility.AdjustSeverity(undeadPawn, TorannMagicDefOf.TM_UndeadAnimalHD, -4f); HealthUtility.AdjustSeverity(undeadPawn, TorannMagicDefOf.TM_UndeadAnimalHD, .5f + ver.level); undeadPawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_UndeadAnimalHD).TryGetComp <HediffComp_Undead>().linkedPawn = pawn; HealthUtility.AdjustSeverity(undeadPawn, HediffDef.Named("TM_UndeadStageHD"), -2f); HealthUtility.AdjustSeverity(undeadPawn, HediffDef.Named("TM_UndeadStageHD"), rotStage); if (undeadPawn.training.CanAssignToTrain(TrainableDefOf.Tameness).Accepted) { while (!undeadPawn.training.HasLearned(TrainableDefOf.Tameness)) { undeadPawn.training.Train(TrainableDefOf.Tameness, pawn); } } if (undeadPawn.training.CanAssignToTrain(TrainableDefOf.Obedience).Accepted) { while (!undeadPawn.training.HasLearned(TrainableDefOf.Obedience)) { undeadPawn.training.Train(TrainableDefOf.Obedience, pawn); } } if (undeadPawn.training.CanAssignToTrain(TrainableDefOf.Release).Accepted) { while (!undeadPawn.training.HasLearned(TrainableDefOf.Release)) { undeadPawn.training.Train(TrainableDefOf.Release, pawn); } } if (undeadPawn.training.CanAssignToTrain(TorannMagicDefOf.Haul).Accepted) { while (!undeadPawn.training.HasLearned(TorannMagicDefOf.Haul)) { undeadPawn.training.Train(TorannMagicDefOf.Haul, pawn); } } if (undeadPawn.training.CanAssignToTrain(TorannMagicDefOf.Rescue).Accepted) { while (!undeadPawn.training.HasLearned(TorannMagicDefOf.Rescue)) { undeadPawn.training.Train(TorannMagicDefOf.Rescue, pawn); } } undeadPawn.playerSettings.medCare = MedicalCareCategory.NoMeds; undeadPawn.def.tradeability = Tradeability.None; } else if (undeadPawn.story != null && undeadPawn.story.traits != null && undeadPawn.needs != null && undeadPawn.playerSettings != null) { CompAbilityUserMagic compMagic = undeadPawn.GetComp <CompAbilityUserMagic>(); if (compMagic != null && TM_Calc.IsMagicUser(undeadPawn)) //(compMagic.IsMagicUser && !undeadPawn.story.traits.HasTrait(TorannMagicDefOf.Faceless)) || { compMagic.Initialize(); compMagic.RemovePowers(true); } CompAbilityUserMight compMight = undeadPawn.GetComp <CompAbilityUserMight>(); if (compMight != null && TM_Calc.IsMightUser(undeadPawn)) //compMight.IsMightUser || { compMight.Initialize(); compMight.RemovePowers(true); } RemoveHediffsAddictionsAndPermanentInjuries(undeadPawn); RemovePsylinkAbilities(undeadPawn); HealthUtility.AdjustSeverity(undeadPawn, TorannMagicDefOf.TM_UndeadHD, -4f); HealthUtility.AdjustSeverity(undeadPawn, TorannMagicDefOf.TM_UndeadHD, .5f + ver.level); undeadPawn.health.hediffSet.GetFirstHediffOfDef(TorannMagicDefOf.TM_UndeadHD).TryGetComp <HediffComp_Undead>().linkedPawn = pawn; HealthUtility.AdjustSeverity(undeadPawn, HediffDef.Named("TM_UndeadStageHD"), -2f); HealthUtility.AdjustSeverity(undeadPawn, HediffDef.Named("TM_UndeadStageHD"), rotStage); RedoSkills(undeadPawn, pawn.health.hediffSet.HasHediff(HediffDef.Named("TM_LichHD"))); if (undeadPawn.story.traits.HasTrait(TorannMagicDefOf.ChaosMage)) { compMagic.RemovePawnAbility(TorannMagicDefOf.TM_ChaosTradition); } RemoveTraits(undeadPawn, undeadPawn.story.traits.allTraits); undeadPawn.story.traits.GainTrait(new Trait(TraitDef.Named("Undead"), 0, false)); undeadPawn.story.traits.GainTrait(new Trait(TraitDef.Named("Psychopath"), 0, false)); undeadPawn.needs.AddOrRemoveNeedsAsAppropriate(); RemoveClassHediff(undeadPawn); if (undeadPawn.health.hediffSet.HasHediff(HediffDef.Named("DeathAcidifier"))) { Hediff hd = undeadPawn.health.hediffSet.GetFirstHediffOfDef(HediffDef.Named("DeathAcidifier")); undeadPawn.health.RemoveHediff(hd); } //Color undeadColor = new Color(.2f, .4f, 0); //undeadPawn.story.hairColor = undeadColor; //CompAbilityUserMagic undeadComp = undeadPawn.GetComp<CompAbilityUserMagic>(); //if (undeadComp.IsMagicUser) //{ // undeadComp.ClearPowers(); //} List <SkillRecord> skills = undeadPawn.skills.skills; for (int j = 0; j < skills.Count; j++) { skills[j].passion = Passion.None; } undeadPawn.playerSettings.hostilityResponse = HostilityResponseMode.Attack; undeadPawn.playerSettings.medCare = MedicalCareCategory.NoMeds; for (int h = 0; h < 24; h++) { undeadPawn.timetable.SetAssignment(h, TimeAssignmentDefOf.Work); } } } else { Messages.Message("Vampiric powers have prevented undead reanimation of " + undeadPawn.LabelShort, MessageTypeDefOf.RejectInput); } } } else if (corpseThing is Pawn) { Pawn undeadPawn = corpseThing as Pawn; if (undeadPawn != pawn && !TM_Calc.IsNecromancer(undeadPawn) && TM_Calc.IsUndead(corpseThing as Pawn)) { RemoveHediffsAddictionsAndPermanentInjuries(undeadPawn); TM_MoteMaker.ThrowPoisonMote(curCell.ToVector3Shifted(), map, .6f); } } } z++; } } if (raisedPawns > pwr.level + 1) { i = targets.Count(); } } }