Added a thoughtworker for pawns to dislike pawns with more genetic diseases

This commit is contained in:
Vegapnk 2024-07-04 12:26:15 +02:00
parent 5920de6bbd
commit 35454db937
6 changed files with 85 additions and 1 deletions

View File

@ -75,6 +75,8 @@ but they are meant mostly to have infectors immune against their own diseases.
- Disease Gene: Fluctual Sexual Need. (Configurable) Chance to reset sex-need to near-zero and gain a bit of rest-need.
- Disease Gene: Size Blinded. Pawns have a higher chance for hooking up with pawns with a big cock, lower chance for small cocks.
- Infector Gene: Genetic Stretcher. Pawns can infect other pawns with *Size Blinded*
- Gene: Hardwired Progenity. Pawns with this get a malus on having no-children, and bonus on having a lot.
- Pawns will have negative thoughts about pawns with more genetic diseases than themselves.
**Fixes:**

View File

@ -24,4 +24,26 @@
</stages>
</ThoughtDef>
<ThoughtDef>
<defName>rjw_genes_has_more_diseases</defName>
<thoughtClass>Thought_SituationalSocial</thoughtClass>
<workerClass>RJW_Genes.ThoughtWorker_HasMoreDiseasesThanMe_Social</workerClass>
<validWhileDespawned>true</validWhileDespawned>
<stages>
<li>
<label>carries more genetic diseases than me</label>
<baseOpinionOffset>-3</baseOpinionOffset>
</li>
<li>
<label>carries more way genetic diseases than me</label>
<baseOpinionOffset>-8</baseOpinionOffset>
</li>
<li>
<label>the genetic diseases on this fellow are off charts</label>
<baseOpinionOffset>-18</baseOpinionOffset>
</li>
</stages>
</ThoughtDef>
</Defs>

View File

@ -0,0 +1,59 @@
using RimWorld;
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Verse;
namespace RJW_Genes
{
public class ThoughtWorker_HasMoreDiseasesThanMe_Social : ThoughtWorker
{
protected override ThoughtState CurrentSocialStateInternal(Pawn pawn, Pawn other)
{
// Return for trivial errors
if (pawn == null || other == null || pawn == other)
return (ThoughtState)false;
// Check for position-existance
if (pawn.Position == null || other.Position == null || pawn.Map == null || other.Map == null)
return (ThoughtState)false;
// Do nothing if pawn is carried
if (pawn.CarriedBy != null)
return (ThoughtState)false;
// Do nothing if Pawn is Baby or Child (#25)
if (!pawn.ageTracker.Adult)
return (ThoughtState)false;
if (!other.ageTracker.Adult)
return (ThoughtState)false;
// Only check if they are spawned humans
if (!pawn.Spawned || !other.Spawned)
return (ThoughtState)false;
if (!pawn.RaceProps.Humanlike)
return (ThoughtState)false;
if (!other.RaceProps.Humanlike)
return (ThoughtState)false;
// Pawns that have not "met" wont give each other Mali
// Known-Each-Other is a key-word for Rimworld that shows they have had any interaction and stored each other in relations.
if (!RelationsUtility.PawnsKnowEachOther(pawn, other))
return (ThoughtState)false;
// If the pawn is not on Map (e.g. caravan), no mali
if (!MapUtility.PawnIsOnHomeMap(pawn))
return (ThoughtState)false;
int pawn_diseases = DiseaseHelper.GetGeneticDiseaseGenes(pawn).Count();
int other_diseases = DiseaseHelper.GetGeneticDiseaseGenes(other).Count();
int disease_diff = other_diseases - pawn_diseases;
if (disease_diff >= 5)
return ThoughtState.ActiveAtStage(2);
else if (disease_diff >= 2)
return ThoughtState.ActiveAtStage(1);
else if (disease_diff >= 1)
return ThoughtState.ActiveAtStage(0);
else
return (ThoughtState)false;
}
}
}

View File

@ -44,7 +44,6 @@ namespace RJW_Genes
if (!MapUtility.PawnIsOnHomeMap(pawn))
return (ThoughtState)false;
//ModLog.Debug($"ThoughtWorker Checks Size Blinded {pawn} -> {other}");
// Do nothing if there is no size-blinded involved
if (!GeneUtility.HasGeneNullCheck(pawn, GeneDefOf.rjw_genes_size_blinded))

View File

@ -86,6 +86,7 @@
<Compile Include="Genes\Diseases\Patches\Patch_AfterSexUtility_ApplyGeneticInfectors.cs" />
<Compile Include="Genes\Diseases\Patches\Patch_AftersexUtility_TransferGeneticDiseases.cs" />
<Compile Include="Genes\Diseases\Patches\Patch_SecondaryRomanceChanceFactor_Gene_SizeBlinded.cs" />
<Compile Include="Genes\Diseases\Thoughts\ThoughtWorker_HasMoreDiseasesThanMe_Social.cs" />
<Compile Include="Genes\Diseases\Thoughts\ThoughtWorker_SizeBlinded_Social.cs" />
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\IncidentWorker_SuccubusVisit.cs" />
<Compile Include="Genes\Life_Force\Events\SuccubusVisit\LordJob_SuccubusVisit.cs" />

View File

@ -16,6 +16,7 @@ namespace RJW_Genes
public static readonly ThoughtDef rjw_genes_pheromone_carrier_nearby;
public static readonly ThoughtDef rjw_genes_appealing_cock;
public static readonly ThoughtDef rjw_genes_has_more_diseases;
//Others with same names but other defs than in genedefof
public static readonly InteractionDef rjw_genes_flirt;