public static void AddPsychologyThoughts(TaleNewsPawnDied __instance, Pawn recipient) { Pawn killer = __instance.Killer; Pawn victim = __instance.Victim; // Killer != null => DamageInfo != null if (killer != null) { // Currently you can't really kill yourself. if (recipient == killer) { if (__instance.KillingBlowDamageDef.ExternalViolenceFor(victim)) { if (killer.story != null) { // Try to add "Killed Enemy Humanlike" thought // Check the conditions if (victim.RaceProps.Humanlike) { if (killer.HostileTo(victim) && killer.Faction != null && killer.Faction.HostileTo(victim.Faction)) { new IndividualThoughtToAdd(Psycho_ThoughtDefOf.KilledHumanlikeEnemy, killer, victim).Add(); } } } } } } }
private static void GenerateAndProcessNews(Pawn victim, DeathBrutality brutality) { /* * Note: * Due to Allow Tools giving out thoughts before the kill, * we have to add in an additional statement to account for the cases * as generated by Allow Tools. * Map mapOfOccurence = [Allow Tool Cases] ?? [Vanilla Cases]; * Even though vanilla cases are more common, placing them at the front * will result in rather clumsy code. See for yourself. */ Map mapOfOccurence = victim.Map ?? victim.Corpse.Map; if (mapOfOccurence == null) { return; } TaleNewsPawnDied executionNews = TaleNewsPawnDied.GenerateAsExecution(victim, brutality); foreach (Pawn other in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonistsAndPrisoners) { if (other.Map == mapOfOccurence) { other.GetNewsKnowledgeTracker().KnowNews(executionNews, WitnessShockGrade.UNDEFINED); } } }
public static void AppendPsychologyThoughts(TaleNewsPawnDied __instance, Pawn recipient) { Pawn killer = __instance.Killer; Pawn victim = __instance.Victim; // Psychology did a lot of work to exclude thoughts from Bleeding Heart. if (recipient.Faction == victim.Faction) { new IndividualThoughtToAdd(Psycho_ThoughtDefOf.WitnessedDeathAllyBleedingHeart, recipient).Add(); } else if (victim.Faction == null || victim.Faction.HostileTo(recipient.Faction) || recipient.story.traits.HasTrait(Psycho_TraitDefOf.BleedingHeart)) { new IndividualThoughtToAdd(Psycho_ThoughtDefOf.WitnessedDeathNonAllyBleedingHeart, recipient).Add(); } bool traitsDisallowDesensitization = recipient.story.traits.HasTrait(Psycho_TraitDefOf.BleedingHeart) || recipient.story.traits.HasTrait(TraitDefOf.Psychopath) || recipient.story.traits.HasTrait(TraitDefOf.Bloodlust) || recipient.story.traits.HasTrait(Psycho_TraitDefOf.Desensitized); // ALL PRAISE GOD RANDY OUR ONE TRUE LORD bool randyAllowsDesensitization = (recipient.GetHashCode() ^ ((GenLocalDate.DayOfYear(recipient) + GenLocalDate.Year(recipient) + (int)(GenLocalDate.DayPercent(recipient) * 5f) * 60) * 391)) % 1000 == 0; // No Bleeding Heart + No Psychopath + No Bloodlust + No Desensitised + Random Genner if (!traitsDisallowDesensitization && randyAllowsDesensitization) { // Gain Desensitized recipient.story.traits.GainTrait(new Trait(Psycho_TraitDefOf.Desensitized)); recipient.needs.mood.thoughts.memories.TryGainMemory(Psycho_ThoughtDefOf.RecentlyDesensitized); } }
/// <summary> /// The main difficulty lies in determining the correct thought to be given; /// there are so many methods out there that ultimately calls this method. /// </summary> /// <param name="victim"></param> /// <param name="dinfo"></param> private static void GenerateAndProcessNews(Pawn victim, DamageInfo?dinfo) { /* * Some possibilities: * 1. Victim died on the ground. * 2. Victim died while being carried around. * * [General Case] ?? [General Case (victim died before code)] ?? [Victim died in Embrace (ewww)] */ Map mapOfOccurence = victim.Map ?? victim.Corpse?.Map ?? victim.CarriedBy?.Map; if (mapOfOccurence == null) { return; } TaleNewsPawnDied deathNews = TaleNewsPawnDied.GenerateGenerally(victim, dinfo); foreach (Pawn other in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists) { if (other.Map == mapOfOccurence) { // Temp code for testing. other.GetNewsKnowledgeTracker().KnowNews(deathNews, WitnessShockGrade.NEARBY_WITNESS); } } }
public static void ApplyPsychologyThoughts(TaleNewsPawnDied __instance, bool __result, Pawn recipient) { // Original method returns true if successfully identifying execution event. if (__result) { // Copied from Desynchronized code. int forcedStage = (int)__instance.BrutalityDegree; ThoughtDef thoughtToGive = __instance.Victim.IsColonist ? Psycho_ThoughtDefOf.KnowColonistExecutedBleedingHeart : Psycho_ThoughtDefOf.KnowGuestExecutedBleedingHeart; recipient.needs.mood.thoughts.memories.TryGainMemory(ThoughtMaker.MakeThought(thoughtToGive, forcedStage), null); } }
private static void GenerateAndProcessNews(Pawn victim, DeathBrutality brutality) { //TaleNewsPawnDied executionNews = TaleNewsPawnDied.GenerateAsExecution(victim, brutality); TaleNewsPawnDied executionNews = new TaleNewsPawnDied(victim, brutality); foreach (Pawn other in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_FreeColonistsAndPrisoners) { if (other.IsInSameMapOrCaravan(victim)) { other.GetNewsKnowledgeTracker().KnowNews(executionNews); } } }
/// <summary> /// Protocol updated in v1.6.3. Now also reports the hediff that is causing the death. /// </summary> /// <param name="victim"></param> /// <param name="dinfo"></param> /// <param name="culpritHediff"></param> private static void GenerateAndProcessNews(Pawn victim, DamageInfo?dinfo, Hediff culpritHediff) { // Generate one. //TaleNewsPawnDied taleNews = TaleNewsPawnDied.GenerateGenerally(victim, dinfo, culpritHediff); var taleNews = new TaleNewsPawnDied(victim, dinfo, culpritHediff); // Distribute news. foreach (var other in PawnsFinder.AllMapsCaravansAndTravelingTransportPods_Alive_Colonists) { if (other.IsNearEnough(victim)) { other.GetNewsKnowledgeTracker()?.KnowNews(taleNews); } } }
public static void ApplyPsychologyThoughts(TaleNewsPawnDied __instance, Pawn recipient) { Pawn killer = __instance.Killer; Pawn victim = __instance.Victim; if (victim.Faction == Faction.OfPlayer && victim.Faction == recipient.Faction && victim.HostFaction != recipient.Faction) { recipient.needs.mood.thoughts.memories.TryGainMemory(Psycho_ThoughtDefOf.KnowColonistDiedBleedingHeart); } bool prisonerIsInnocent = victim.IsPrisonerOfColony && !victim.guilt.IsGuilty && !victim.InAggroMentalState; if (prisonerIsInnocent && recipient.Faction == Faction.OfPlayer && !recipient.IsPrisoner) { recipient.needs.mood.thoughts.memories.TryGainMemory(Psycho_ThoughtDefOf.KnowPrisonerDiedInnocentBleedingHeart); } }