public List <Pawn> TryGeneratingBloodline(Pawn childe, BloodlineDef bloodline) { List <Pawn> tempOldGen = new List <Pawn>(DormantVampires); if (bloodline == null) { bloodline = VampireUtility.RandBloodline; } Pawn thirdGenVamp = tempOldGen.FirstOrDefault(x => x?.VampComp() is CompVampire v && v.Generation == 3 && v.Bloodline == bloodline); List <Pawn> futureGenerations = new List <Pawn>(); Pawn curSire = thirdGenVamp; if (curSire == null) { Log.Error("Cannot find third generation sire."); return(null); } for (int curGen = 4; curGen < 14; curGen++) { Pawn newVamp = VampireGen.GenerateVampire(curGen, bloodline, curSire); futureGenerations.Add(newVamp); curSire = newVamp; } activeVampires.AddRange(futureGenerations); PrintVampires(); return(futureGenerations); }
public static void DebugCommand_SpawnVampire(Pawn p) { Pawn randomVampire = VampireGen.GenerateVampire(VampireGen.RandHigherGeneration, VampireUtility.RandBloodline, null); GenSpawn.Spawn(randomVampire, UI.MouseCell(), Find.CurrentMap); }
// Verse.Dialog_DebugActionsMenu public static void DoListingItems_MapTools_Vamp(Dialog_DebugActionsMenu __instance) { AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DoLabel").Invoke(__instance, new object[] { "Tools - Vampirism" }); AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DebugToolMap").Invoke(__instance, new object[] { "Spawn Vampire (Random)", new Action(() => { Pawn randomVampire = VampireGen.GenerateVampire(VampireUtility.RandHigherGeneration, VampireUtility.RandBloodline, null, null, false); GenSpawn.Spawn(randomVampire, UI.MouseCell(), Find.VisibleMap); }) }); AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DebugToolMap").Invoke(__instance, new object[] { "Give Vampirism (Default)", new Action(() => { Pawn pawn = Find.VisibleMap.thingGrid.ThingsAt(UI.MouseCell()).Where((Thing t) => t is Pawn).Cast <Pawn>().FirstOrDefault <Pawn>(); if (pawn != null) { if (!pawn.IsVampire()) { pawn.health.AddHediff(VampDefOf.ROM_Vampirism, null, null); pawn.Drawer.Notify_DebugAffected(); MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, pawn.LabelShort + " is now a vampire", -1f); } else { Messages.Message(pawn.LabelCap + " is already a vampire.", MessageSound.RejectInput); } } }) }); AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DebugToolMap").Invoke(__instance, new object[] { "Give Vampirism (w/Settings)", new Action(() => { Pawn pawn = Find.VisibleMap.thingGrid.ThingsAt(UI.MouseCell()).Where((Thing t) => t is Pawn).Cast <Pawn>().FirstOrDefault <Pawn>(); if (pawn != null) { //pawn.health.AddHediff(VampDefOf.ROM_Vampirism, null, null); Find.WindowStack.Add(new Dialog_DebugOptionListLister(HarmonyPatches.Options_Bloodlines(pawn))); //DebugTools.curTool = null; } }) }); AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DebugToolMap").Invoke(__instance, new object[] { "Add Blood (1)", new Action(() => { Pawn pawn = Find.VisibleMap.thingGrid.ThingsAt(UI.MouseCell()).Where((Thing t) => t is Pawn).Cast <Pawn>().FirstOrDefault <Pawn>(); if (pawn != null && pawn?.BloodNeed() is Need_Blood b) { b.AdjustBlood(1); pawn.Drawer.Notify_DebugAffected(); MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, "+1 Blood", -1f); } }) });
public override void PostMake() { base.PostMake(); LongEventHandler.QueueLongEvent(delegate { sealedVampire = VampireGen.GenerateVampire(Rand.Range(4, 7), VampireUtility.RandBloodline, null, Find.FactionManager.FirstFactionOfDef(FactionDef.Named("ROMV_LegendaryVampires"))); GenSpawn.Spawn(sealedVampire, this.PositionHeld, this.MapHeld); sealedVampire.DeSpawn(); this.innerContainer.TryAdd(sealedVampire); }, "ROMV_GeneratingAncientVampire", false, exception => { }); }
// Verse.Dialog_DebugActionsMenu public static void DoListingItems_MapTools_Vamp(Dialog_DebugActionsMenu __instance) { AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DoLabel").Invoke(__instance, new object[] { "Tools - Vampirism" }); AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DebugToolMap").Invoke(__instance, new object[] { "Spawn Vampire (Random)", new Action(() => { Pawn randomVampire = VampireGen.GenerateVampire(VampireUtility.RandHigherGeneration, VampireUtility.RandBloodline, null); GenSpawn.Spawn(randomVampire, UI.MouseCell(), Find.CurrentMap); }) }); AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DebugToolMap").Invoke(__instance, new object[] { "Give Vampirism (Default)", new Action(() => { Pawn pawn = Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).Where((Thing t) => t is Pawn).Cast <Pawn>().FirstOrDefault(); if (pawn != null) { if (!pawn.IsVampire()) { pawn.health.AddHediff(VampDefOf.ROM_Vampirism, null, null); pawn.Drawer.Notify_DebugAffected(); MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, pawn.LabelShort + " is now a vampire"); } else { Messages.Message(pawn.LabelCap + " is already a vampire.", MessageTypeDefOf.RejectInput); } } }) }); AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DebugToolMap").Invoke(__instance, new object[] { "Give Vampirism (w/Settings)", new Action(() => { Pawn pawn = Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).Where((Thing t) => t is Pawn).Cast <Pawn>().FirstOrDefault(); if (pawn != null) { //pawn.health.AddHediff(VampDefOf.ROM_Vampirism, null, null); Find.WindowStack.Add(new Dialog_DebugOptionListLister(Options_Bloodlines(pawn))); //DebugTools.curTool = null; } }) }); AccessTools.Method(typeof(Dialog_DebugActionsMenu), "DebugToolMap").Invoke(__instance, new object[] { "Remove Vampirism", new Action(() => { Pawn pawn = Find.CurrentMap.thingGrid.ThingsAt(UI.MouseCell()).Where((Thing t) => t is Pawn).Cast <Pawn>().FirstOrDefault(); if (pawn != null) { if (pawn.IsVampire()) { if (pawn.health.hediffSet.GetFirstHediffOfDef(VampDefOf.ROM_Vampirism) is HediffVampirism vampirism) { pawn.health.RemoveHediff(vampirism); } if (pawn?.health?.hediffSet?.GetHediffs <Hediff_AddedPart>()?.First() is Hediff_AddedPart_Fangs fangs) { BodyPartRecord rec = fangs.Part; pawn.health.RemoveHediff(fangs); pawn.health.RestorePart(rec); } pawn.Drawer.Notify_DebugAffected(); MoteMaker.ThrowText(pawn.DrawPos, pawn.Map, pawn.LabelShort + " is no longer a vampire"); } else { Messages.Message(pawn.LabelCap + " is already a vampire.", MessageTypeDefOf.RejectInput); } } }) });
public override void Effect(Pawn target) { base.Effect(target); VampireGen.RemoveMortalHediffs(target); VampireUtility.Heal(target); }