Compare commits

..

No commits in common. "765e6c0778545537d44d59a4b56c4116a3a08b61" and "2855ae3f6c7601e82313ceb680cfb758bfa73835" have entirely different histories.

14 changed files with 28 additions and 279 deletions

View file

@ -320,6 +320,9 @@
<impact>High</impact> <impact>High</impact>
<displayOrderInIssue>0</displayOrderInIssue> <displayOrderInIssue>0</displayOrderInIssue>
<displayOrderInImpact>1000</displayOrderInImpact> <displayOrderInImpact>1000</displayOrderInImpact>
<conflictingMemes>
<li>Zoophile</li>
</conflictingMemes>
<comps> <comps>
<li Class="PreceptComp_KnowsMemoryThought"> <li Class="PreceptComp_KnowsMemoryThought">
<eventDef>RSI_NonIncestuosMarriage</eventDef> <eventDef>RSI_NonIncestuosMarriage</eventDef>

View file

@ -9,6 +9,4 @@
<RSNotAnimal>not animal</RSNotAnimal> <RSNotAnimal>not animal</RSNotAnimal>
<RSShouldCanFuck>capable of sex is required</RSShouldCanFuck> <RSShouldCanFuck>capable of sex is required</RSShouldCanFuck>
<!-- Rewrite vanilla key -->
<CantRomanceTargetIncest>forbidden by ideology</CantRomanceTargetIncest>
</LanguageData> </LanguageData>

View file

@ -1,9 +0,0 @@
namespace RJWSexperience.Ideology
{
public enum BloodRelationDegree
{
CloseRelative,
FarRelative,
NotRelated
}
}

View file

@ -1,7 +1,5 @@
using rjw; using rjw;
using RJWSexperience.Ideology.HistoryEvents; using RJWSexperience.Ideology.HistoryEvents;
using RJWSexperience.Ideology.Patches;
using System.Collections.Generic;
using System.Linq; using System.Linq;
using Verse; using Verse;
@ -18,20 +16,5 @@ namespace RJWSexperience.Ideology
RsiHistoryEventDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(hero, p); RsiHistoryEventDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(hero, p);
RsiHistoryEventDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(p, hero); RsiHistoryEventDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(p, hero);
} }
[DebugAction("RJW Sexperience Ideology", "Manual romance check", false, true, actionType = DebugActionType.Action, allowedGameStates = AllowedGameStates.PlayingOnMap)]
public static void DisplayDebugTable()
{
IEnumerable<Pawn> pawns = Find.CurrentMap.mapPawns.AllPawnsSpawned.Where(pawn => pawn.IsColonist);
IEnumerable<TableDataGetter<Pawn>> columns = pawns
.Select(pawn => new TableDataGetter<Pawn>(pawn.Name.ToStringShort, (Pawn p) => Rimworld_Patch_IncestuousManualRomance.RsiIncestuous(p, pawn)));
var name = new TableDataGetter<Pawn>("Name", (Pawn pawn) => pawn.Name.ToStringShort);
TableDataGetter<Pawn>[] getters = (new List<TableDataGetter<Pawn>>() { name }).Concat(columns).ToArray();
DebugTables.MakeTablesDialog(pawns, getters);
}
} }
} }

View file

@ -12,9 +12,9 @@ namespace RJWSexperience.Ideology
if (ideo == null) if (ideo == null)
return false; return false;
if (ideo.HasPrecept(RsiPreceptDefOf.Submissive_Female) && pawn.gender == Gender.Female) if (ideo.HasPrecept(VariousDefOf.Submissive_Female) && pawn.gender == Gender.Female)
return true; return true;
else if (ideo.HasPrecept(RsiPreceptDefOf.Submissive_Male) && pawn.gender == Gender.Male) else if (ideo.HasPrecept(VariousDefOf.Submissive_Male) && pawn.gender == Gender.Male)
return true; return true;
return false; return false;

View file

@ -42,7 +42,6 @@
<Reference Include="System.Net.Http" /> <Reference Include="System.Net.Http" />
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<Compile Include="BloodRelationDegree.cs" />
<Compile Include="DebugAction.cs" /> <Compile Include="DebugAction.cs" />
<Compile Include="GlobalSuppressions.cs" /> <Compile Include="GlobalSuppressions.cs" />
<Compile Include="HistoryEvents\DefExtension_SecondaryEvents.cs" /> <Compile Include="HistoryEvents\DefExtension_SecondaryEvents.cs" />
@ -60,10 +59,7 @@
<Compile Include="PreceptWorkers\ThoughtWorker_Precept_Pregnant.cs" /> <Compile Include="PreceptWorkers\ThoughtWorker_Precept_Pregnant.cs" />
<Compile Include="PreceptWorkers\ThoughtWorker_Precept_Pregnant_Social.cs" /> <Compile Include="PreceptWorkers\ThoughtWorker_Precept_Pregnant_Social.cs" />
<Compile Include="RelationFilter.cs" /> <Compile Include="RelationFilter.cs" />
<Compile Include="RelationHelpers.cs" />
<Compile Include="RomanceChanceFactorHelpers.cs" />
<Compile Include="RsiHistoryEventDefOf.cs" /> <Compile Include="RsiHistoryEventDefOf.cs" />
<Compile Include="RsiPreceptDefOf.cs" />
<Compile Include="TwoPawnFilter.cs" /> <Compile Include="TwoPawnFilter.cs" />
<Compile Include="SinglePawnFilter.cs" /> <Compile Include="SinglePawnFilter.cs" />
<Compile Include="Precepts\Comp_SelfTookMemoryThought_Gendered.cs" /> <Compile Include="Precepts\Comp_SelfTookMemoryThought_Gendered.cs" />
@ -98,7 +94,7 @@
</ItemGroup> </ItemGroup>
<ItemGroup> <ItemGroup>
<PackageReference Include="Krafs.Rimworld.Ref"> <PackageReference Include="Krafs.Rimworld.Ref">
<Version>1.4.3542</Version> <Version>1.4.3537</Version>
</PackageReference> </PackageReference>
<PackageReference Include="Lib.Harmony"> <PackageReference Include="Lib.Harmony">
<Version>2.2.2</Version> <Version>2.2.2</Version>

View file

@ -213,14 +213,14 @@ namespace RJWSexperience.Ideology.Patches
Ideo mainideo = playerfaction.ideos.PrimaryIdeo; Ideo mainideo = playerfaction.ideos.PrimaryIdeo;
if (mainideo != null) if (mainideo != null)
{ {
if (mainideo.HasPrecept(RsiPreceptDefOf.BabyFaction_AlwaysFather)) if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysFather))
{ {
Pawn parent = baby.GetFather() ?? baby.GetMother(); Pawn parent = baby.GetFather() ?? baby.GetMother();
ideo = parent.Ideo; ideo = parent.Ideo;
return parent.Faction; return parent.Faction;
} }
else if (mainideo.HasPrecept(RsiPreceptDefOf.BabyFaction_AlwaysColony)) else if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysColony))
{ {
ideo = mainideo; ideo = mainideo;
return playerfaction; return playerfaction;
@ -241,7 +241,7 @@ namespace RJWSexperience.Ideology.Patches
if (props.pawn?.Ideo == null || !props.hasPartner()) if (props.pawn?.Ideo == null || !props.hasPartner())
return; return;
if (props.partner.Ideo?.HasPrecept(RsiPreceptDefOf.ProselyzingByOrgasm) == true) if (props.partner.Ideo?.HasPrecept(VariousDefOf.ProselyzingByOrgasm) == true)
{ {
// Pawn is the one having the orgasm // Pawn is the one having the orgasm
// Partner is "giving" the orgasm, hence the pawn will be converted towards the partners ideology // Partner is "giving" the orgasm, hence the pawn will be converted towards the partners ideology

View file

@ -4,7 +4,6 @@ using rjw;
using RJWSexperience.Ideology.HistoryEvents; using RJWSexperience.Ideology.HistoryEvents;
using RJWSexperience.Ideology.Precepts; using RJWSexperience.Ideology.Precepts;
using System.Collections.Generic; using System.Collections.Generic;
using System.Linq;
using Verse; using Verse;
namespace RJWSexperience.Ideology.Patches namespace RJWSexperience.Ideology.Patches
@ -54,55 +53,4 @@ namespace RJWSexperience.Ideology.Patches
} }
} }
} }
public static class Rimworld_Patch_IncestuousManualRomance
{
/// <summary>
/// Override incestuous check in the manual romance
/// </summary>
/// <param name="one">Pawn to try do romance</param>
/// <param name="two">Target for romance</param>
/// <param name="__result">Result of the original method</param>
/// <returns>Run original method implementation</returns>
[HarmonyPatch(typeof(RelationsUtility), "Incestuous")]
public static bool Prefix(Pawn one, Pawn two, ref bool __result)
{
__result = RsiIncestuous(one, two);
return false;
}
/// <summary>
/// Check if Ideology allows romance attempt
/// </summary>
/// <param name="one">Pawn to try do romance</param>
/// <param name="two">Target for romance</param>
/// <returns>Forbid romance option</returns>
public static bool RsiIncestuous(Pawn one, Pawn two)
{
PreceptDef incestuousPrecept = one.Ideo?.PreceptsListForReading.Select(precept => precept.def).FirstOrFallback(def => def.issue == VariousDefOf.Incestuos);
BloodRelationDegree relationDegree = RelationHelpers.GetBloodRelationDegree(one, two);
if (incestuousPrecept == null ||
incestuousPrecept == RsiPreceptDefOf.Incestuos_Disapproved ||
incestuousPrecept == RsiPreceptDefOf.Incestuos_Forbidden)
{
return relationDegree < BloodRelationDegree.NotRelated;
}
else if (incestuousPrecept == RsiPreceptDefOf.Incestuos_Free)
{
return false;
}
else if (incestuousPrecept == RsiPreceptDefOf.Incestuos_Disapproved_CloseOnly)
{
return relationDegree == BloodRelationDegree.CloseRelative;
}
else if (incestuousPrecept == RsiPreceptDefOf.Incestuos_IncestOnly)
{
return relationDegree == BloodRelationDegree.NotRelated;
}
// Modded incestuous precept?
return true;
}
}
} }

View file

@ -1,47 +0,0 @@
using RimWorld;
using System.Linq;
using Verse;
namespace RJWSexperience.Ideology
{
public static class RelationHelpers
{
/// <summary>
/// Get degree of blood relation between two pawns
/// </summary>
public static BloodRelationDegree GetBloodRelationDegree(Pawn pawn, Pawn partner)
{
PawnRelationDef closestBloodRelation = pawn
.GetRelations(partner)
?.Where(def => def.familyByBloodRelation)
?.OrderByDescending(def => def.importance)
?.FirstOrFallback();
if (closestBloodRelation == null)
{
return BloodRelationDegree.NotRelated;
}
return GetBloodRelationDegree(closestBloodRelation);
}
/// <summary>
/// Get degree of blood relation for a relationDef
/// </summary>
public static BloodRelationDegree GetBloodRelationDegree(PawnRelationDef relationDef)
{
if (!relationDef.familyByBloodRelation)
{
return BloodRelationDegree.NotRelated;
}
else if (relationDef.importance <= PawnRelationDefOf.Cousin.importance)
{
return BloodRelationDegree.FarRelative;
}
else
{
return BloodRelationDegree.CloseRelative;
}
}
}
}

View file

@ -92,7 +92,7 @@ namespace RJWSexperience.Ideology
public static bool CanBeBreeder(Pawn animal, Precept_Ritual precept) public static bool CanBeBreeder(Pawn animal, Precept_Ritual precept)
{ {
if (precept != null && precept.ideo.HasPrecept(RsiPreceptDefOf.Bestiality_OnlyVenerated) && !precept.ideo.IsVeneratedAnimal(animal)) if (precept != null && precept.ideo.HasPrecept(VariousDefOf.Bestiality_OnlyVenerated) && !precept.ideo.IsVeneratedAnimal(animal))
{ {
return false; return false;
} }

View file

@ -1,108 +0,0 @@
using RimWorld;
using System.Collections.Generic;
using System.Linq;
using Verse;
namespace RJWSexperience.Ideology
{
public static class RomanceChanceFactorHelpers
{
/// <summary>
/// Default value for parent relation
/// </summary>
private const float parentRomanceChanceFactor = 0.03f;
/// <summary>
/// Get ideology adjusted romanceChanceFactor
/// </summary>
public static float GetRomanceChanceFactor(Pawn pawn, Pawn partner)
{
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(partner).Where(def => def.familyByBloodRelation);
PreceptDef incestuousPrecept = pawn.Ideo?.PreceptsListForReading.Select(precept => precept.def).FirstOrFallback(def => def.issue == VariousDefOf.Incestuos);
float romanceChanceFactor = 1f;
if (!relations.Any())
{
if (incestuousPrecept == RsiPreceptDefOf.Incestuos_IncestOnly)
{
return parentRomanceChanceFactor;
}
else
{
return romanceChanceFactor;
}
}
foreach (PawnRelationDef relationDef in relations)
{
romanceChanceFactor *= GetRomanceChanceFactor(relationDef, incestuousPrecept);
}
return romanceChanceFactor;
}
/// <summary>
/// Get ideology adjusted romanceChanceFactor for the relation
/// </summary>
public static float GetRomanceChanceFactor(PawnRelationDef relationDef, PreceptDef incestuousPrecept)
{
if (incestuousPrecept == null || incestuousPrecept == RsiPreceptDefOf.Incestuos_Disapproved) // Default game setup
{
return relationDef.romanceChanceFactor;
}
if (incestuousPrecept == RsiPreceptDefOf.Incestuos_Free)
{
return 1f;
}
else if (incestuousPrecept == RsiPreceptDefOf.Incestuos_Disapproved_CloseOnly)
{
if (relationDef.familyByBloodRelation && relationDef.importance > PawnRelationDefOf.Cousin.importance)
{
return relationDef.romanceChanceFactor;
}
else
{
return 1f;
}
}
else if (incestuousPrecept == RsiPreceptDefOf.Incestuos_Forbidden)
{
if (relationDef.familyByBloodRelation)
{
return parentRomanceChanceFactor;
}
}
else if (incestuousPrecept == RsiPreceptDefOf.Incestuos_IncestOnly)
{
if (!relationDef.familyByBloodRelation)
{
return parentRomanceChanceFactor;
}
else
{
return 1f;
}
}
return relationDef.romanceChanceFactor;
}
[DebugAction("RJW Sexperience Ideology", "Show romanceChanceFactors", false, true, actionType = DebugActionType.Action, allowedGameStates = AllowedGameStates.Entry)]
public static void DisplayDebugTable()
{
IEnumerable<PreceptDef> incestuousPrecepts = DefDatabase<PreceptDef>
.AllDefsListForReading
.Where(def => def.issue == VariousDefOf.Incestuos);
IEnumerable<TableDataGetter<PawnRelationDef>> preceptGetters = incestuousPrecepts
.Select(precept => new TableDataGetter<PawnRelationDef>(precept.defName,(PawnRelationDef rel) => GetRomanceChanceFactor(rel, precept)));
var relName = new TableDataGetter<PawnRelationDef>("Relation Def", (PawnRelationDef rel) => rel.defName);
TableDataGetter<PawnRelationDef>[] getters = (new List<TableDataGetter<PawnRelationDef>>() { relName }).Concat(preceptGetters).ToArray();
DebugTables.MakeTablesDialog(DefDatabase<PawnRelationDef>.AllDefsListForReading, getters);
}
}
}

View file

@ -5,14 +5,14 @@ namespace RJWSexperience.Ideology
[DefOf] [DefOf]
public static class RsiHistoryEventDefOf public static class RsiHistoryEventDefOf
{ {
public static readonly HistoryEventDef RSI_SexWithAnimal; [MayRequireIdeology] public static readonly HistoryEventDef RSI_SexWithAnimal;
public static readonly HistoryEventDef RSI_Raped; [MayRequireIdeology] public static readonly HistoryEventDef RSI_Raped;
public static readonly HistoryEventDef RSI_NonIncestuosMarriage; [MayRequireIdeology] public static readonly HistoryEventDef RSI_NonIncestuosMarriage;
public static readonly HistoryEventDef RSI_NonIncestuosSex; [MayRequireIdeology] public static readonly HistoryEventDef RSI_NonIncestuosSex;
public static readonly HistoryEventDef RSI_SexWithCorpse; [MayRequireIdeology] public static readonly HistoryEventDef RSI_SexWithCorpse;
public static readonly HistoryEventDef RSI_VirginTaken; [MayRequireIdeology] public static readonly HistoryEventDef RSI_VirginTaken;
public static readonly HistoryEventDef RSI_VirginStolen; [MayRequireIdeology] public static readonly HistoryEventDef RSI_VirginStolen;
public static readonly HistoryEventDef RSI_TookVirgin; [MayRequireIdeology] public static readonly HistoryEventDef RSI_TookVirgin;
public static readonly HistoryEventDef RSI_Masturbated; [MayRequireIdeology] public static readonly HistoryEventDef RSI_Masturbated;
} }
} }

View file

@ -1,20 +0,0 @@
using RimWorld;
namespace RJWSexperience.Ideology
{
[DefOf]
public static class RsiPreceptDefOf
{
public static readonly PreceptDef Incestuos_Free;
public static readonly PreceptDef Incestuos_Disapproved_CloseOnly;
public static readonly PreceptDef Incestuos_Disapproved;
public static readonly PreceptDef Incestuos_Forbidden;
public static readonly PreceptDef Incestuos_IncestOnly;
public static readonly PreceptDef Bestiality_OnlyVenerated;
public static readonly PreceptDef BabyFaction_AlwaysFather;
public static readonly PreceptDef BabyFaction_AlwaysColony;
public static readonly PreceptDef Submissive_Male;
public static readonly PreceptDef Submissive_Female;
public static readonly PreceptDef ProselyzingByOrgasm;
}
}

View file

@ -13,10 +13,15 @@ namespace RJWSexperience.Ideology
public static readonly JobDef GettinDrugSex; public static readonly JobDef GettinDrugSex;
public static readonly JobDef DrugMasturbate; public static readonly JobDef DrugMasturbate;
public static readonly MemeDef Zoophile; [MayRequireIdeology] public static readonly MemeDef Zoophile;
public static readonly MemeDef Rapist; [MayRequireIdeology] public static readonly MemeDef Rapist;
public static readonly MemeDef Necrophile; [MayRequireIdeology] public static readonly MemeDef Necrophile;
public static readonly IssueDef Incestuos; [MayRequireIdeology] public static readonly PreceptDef Bestiality_OnlyVenerated;
[MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysFather;
[MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysColony;
[MayRequireIdeology] public static readonly PreceptDef Submissive_Male;
[MayRequireIdeology] public static readonly PreceptDef Submissive_Female;
[MayRequireIdeology] public static readonly PreceptDef ProselyzingByOrgasm;
[MayRequireBiotech] public static readonly HediffDef PregnantHuman; [MayRequireBiotech] public static readonly HediffDef PregnantHuman;
} }
} }