mirror of
https://gitgud.io/amevarashi/rjw-sexperience-ideology.git
synced 2024-08-15 00:43:19 +00:00
Compare commits
3 commits
2855ae3f6c
...
765e6c0778
Author | SHA1 | Date | |
---|---|---|---|
|
765e6c0778 | ||
|
3bedfec30e | ||
|
180404cee1 |
14 changed files with 279 additions and 28 deletions
|
@ -320,9 +320,6 @@
|
|||
<impact>High</impact>
|
||||
<displayOrderInIssue>0</displayOrderInIssue>
|
||||
<displayOrderInImpact>1000</displayOrderInImpact>
|
||||
<conflictingMemes>
|
||||
<li>Zoophile</li>
|
||||
</conflictingMemes>
|
||||
<comps>
|
||||
<li Class="PreceptComp_KnowsMemoryThought">
|
||||
<eventDef>RSI_NonIncestuosMarriage</eventDef>
|
||||
|
|
|
@ -9,4 +9,6 @@
|
|||
<RSNotAnimal>not animal</RSNotAnimal>
|
||||
<RSShouldCanFuck>capable of sex is required</RSShouldCanFuck>
|
||||
|
||||
<!-- Rewrite vanilla key -->
|
||||
<CantRomanceTargetIncest>forbidden by ideology</CantRomanceTargetIncest>
|
||||
</LanguageData>
|
9
Source/IdeologyAddon/BloodRelationDegree.cs
Normal file
9
Source/IdeologyAddon/BloodRelationDegree.cs
Normal file
|
@ -0,0 +1,9 @@
|
|||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
public enum BloodRelationDegree
|
||||
{
|
||||
CloseRelative,
|
||||
FarRelative,
|
||||
NotRelated
|
||||
}
|
||||
}
|
|
@ -1,5 +1,7 @@
|
|||
using rjw;
|
||||
using RJWSexperience.Ideology.HistoryEvents;
|
||||
using RJWSexperience.Ideology.Patches;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
|
@ -16,5 +18,20 @@ namespace RJWSexperience.Ideology
|
|||
RsiHistoryEventDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(hero, p);
|
||||
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);
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -12,9 +12,9 @@ namespace RJWSexperience.Ideology
|
|||
if (ideo == null)
|
||||
return false;
|
||||
|
||||
if (ideo.HasPrecept(VariousDefOf.Submissive_Female) && pawn.gender == Gender.Female)
|
||||
if (ideo.HasPrecept(RsiPreceptDefOf.Submissive_Female) && pawn.gender == Gender.Female)
|
||||
return true;
|
||||
else if (ideo.HasPrecept(VariousDefOf.Submissive_Male) && pawn.gender == Gender.Male)
|
||||
else if (ideo.HasPrecept(RsiPreceptDefOf.Submissive_Male) && pawn.gender == Gender.Male)
|
||||
return true;
|
||||
|
||||
return false;
|
||||
|
|
|
@ -42,6 +42,7 @@
|
|||
<Reference Include="System.Net.Http" />
|
||||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<Compile Include="BloodRelationDegree.cs" />
|
||||
<Compile Include="DebugAction.cs" />
|
||||
<Compile Include="GlobalSuppressions.cs" />
|
||||
<Compile Include="HistoryEvents\DefExtension_SecondaryEvents.cs" />
|
||||
|
@ -59,7 +60,10 @@
|
|||
<Compile Include="PreceptWorkers\ThoughtWorker_Precept_Pregnant.cs" />
|
||||
<Compile Include="PreceptWorkers\ThoughtWorker_Precept_Pregnant_Social.cs" />
|
||||
<Compile Include="RelationFilter.cs" />
|
||||
<Compile Include="RelationHelpers.cs" />
|
||||
<Compile Include="RomanceChanceFactorHelpers.cs" />
|
||||
<Compile Include="RsiHistoryEventDefOf.cs" />
|
||||
<Compile Include="RsiPreceptDefOf.cs" />
|
||||
<Compile Include="TwoPawnFilter.cs" />
|
||||
<Compile Include="SinglePawnFilter.cs" />
|
||||
<Compile Include="Precepts\Comp_SelfTookMemoryThought_Gendered.cs" />
|
||||
|
@ -94,7 +98,7 @@
|
|||
</ItemGroup>
|
||||
<ItemGroup>
|
||||
<PackageReference Include="Krafs.Rimworld.Ref">
|
||||
<Version>1.4.3537</Version>
|
||||
<Version>1.4.3542</Version>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Lib.Harmony">
|
||||
<Version>2.2.2</Version>
|
||||
|
|
|
@ -213,14 +213,14 @@ namespace RJWSexperience.Ideology.Patches
|
|||
Ideo mainideo = playerfaction.ideos.PrimaryIdeo;
|
||||
if (mainideo != null)
|
||||
{
|
||||
if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysFather))
|
||||
if (mainideo.HasPrecept(RsiPreceptDefOf.BabyFaction_AlwaysFather))
|
||||
{
|
||||
Pawn parent = baby.GetFather() ?? baby.GetMother();
|
||||
|
||||
ideo = parent.Ideo;
|
||||
return parent.Faction;
|
||||
}
|
||||
else if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysColony))
|
||||
else if (mainideo.HasPrecept(RsiPreceptDefOf.BabyFaction_AlwaysColony))
|
||||
{
|
||||
ideo = mainideo;
|
||||
return playerfaction;
|
||||
|
@ -241,7 +241,7 @@ namespace RJWSexperience.Ideology.Patches
|
|||
if (props.pawn?.Ideo == null || !props.hasPartner())
|
||||
return;
|
||||
|
||||
if (props.partner.Ideo?.HasPrecept(VariousDefOf.ProselyzingByOrgasm) == true)
|
||||
if (props.partner.Ideo?.HasPrecept(RsiPreceptDefOf.ProselyzingByOrgasm) == true)
|
||||
{
|
||||
// Pawn is the one having the orgasm
|
||||
// Partner is "giving" the orgasm, hence the pawn will be converted towards the partners ideology
|
||||
|
|
|
@ -4,6 +4,7 @@ using rjw;
|
|||
using RJWSexperience.Ideology.HistoryEvents;
|
||||
using RJWSexperience.Ideology.Precepts;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology.Patches
|
||||
|
@ -53,4 +54,55 @@ 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;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
47
Source/IdeologyAddon/RelationHelpers.cs
Normal file
47
Source/IdeologyAddon/RelationHelpers.cs
Normal file
|
@ -0,0 +1,47 @@
|
|||
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;
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
|
@ -92,7 +92,7 @@ namespace RJWSexperience.Ideology
|
|||
|
||||
public static bool CanBeBreeder(Pawn animal, Precept_Ritual precept)
|
||||
{
|
||||
if (precept != null && precept.ideo.HasPrecept(VariousDefOf.Bestiality_OnlyVenerated) && !precept.ideo.IsVeneratedAnimal(animal))
|
||||
if (precept != null && precept.ideo.HasPrecept(RsiPreceptDefOf.Bestiality_OnlyVenerated) && !precept.ideo.IsVeneratedAnimal(animal))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
|
108
Source/IdeologyAddon/RomanceChanceFactorHelpers.cs
Normal file
108
Source/IdeologyAddon/RomanceChanceFactorHelpers.cs
Normal file
|
@ -0,0 +1,108 @@
|
|||
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);
|
||||
}
|
||||
}
|
||||
}
|
|
@ -5,14 +5,14 @@ namespace RJWSexperience.Ideology
|
|||
[DefOf]
|
||||
public static class RsiHistoryEventDefOf
|
||||
{
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_SexWithAnimal;
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_Raped;
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_NonIncestuosMarriage;
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_NonIncestuosSex;
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_SexWithCorpse;
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_VirginTaken;
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_VirginStolen;
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_TookVirgin;
|
||||
[MayRequireIdeology] public static readonly HistoryEventDef RSI_Masturbated;
|
||||
public static readonly HistoryEventDef RSI_SexWithAnimal;
|
||||
public static readonly HistoryEventDef RSI_Raped;
|
||||
public static readonly HistoryEventDef RSI_NonIncestuosMarriage;
|
||||
public static readonly HistoryEventDef RSI_NonIncestuosSex;
|
||||
public static readonly HistoryEventDef RSI_SexWithCorpse;
|
||||
public static readonly HistoryEventDef RSI_VirginTaken;
|
||||
public static readonly HistoryEventDef RSI_VirginStolen;
|
||||
public static readonly HistoryEventDef RSI_TookVirgin;
|
||||
public static readonly HistoryEventDef RSI_Masturbated;
|
||||
}
|
||||
}
|
||||
|
|
20
Source/IdeologyAddon/RsiPreceptDefOf.cs
Normal file
20
Source/IdeologyAddon/RsiPreceptDefOf.cs
Normal file
|
@ -0,0 +1,20 @@
|
|||
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;
|
||||
}
|
||||
}
|
|
@ -13,15 +13,10 @@ namespace RJWSexperience.Ideology
|
|||
public static readonly JobDef GettinDrugSex;
|
||||
public static readonly JobDef DrugMasturbate;
|
||||
|
||||
[MayRequireIdeology] public static readonly MemeDef Zoophile;
|
||||
[MayRequireIdeology] public static readonly MemeDef Rapist;
|
||||
[MayRequireIdeology] public static readonly MemeDef Necrophile;
|
||||
[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;
|
||||
public static readonly MemeDef Zoophile;
|
||||
public static readonly MemeDef Rapist;
|
||||
public static readonly MemeDef Necrophile;
|
||||
public static readonly IssueDef Incestuos;
|
||||
[MayRequireBiotech] public static readonly HediffDef PregnantHuman;
|
||||
}
|
||||
}
|
||||
|
|
Loading…
Reference in a new issue