mirror of
https://gitgud.io/amevarashi/rjw-sexperience-ideology.git
synced 2024-08-15 00:43:19 +00:00
Compare commits
No commits in common. "f7206347da813223dbc8fafc9495de92a96ba66c" and "7107947cacdba4ac1750c706a9ec09c25b1ce15e" have entirely different histories.
f7206347da
...
7107947cac
8 changed files with 101 additions and 175 deletions
|
@ -27,9 +27,16 @@
|
|||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelationDegrees>
|
||||
<li>CloseRelative</li>
|
||||
</hasOneOfRelationDegrees>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
<li>Sibling</li>
|
||||
<li>HalfSibling</li>
|
||||
<li>Grandparent</li>
|
||||
<li>Grandchild</li>
|
||||
<li>NephewOrNiece</li>
|
||||
<li>UncleOrAunt</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_CloseRelativeMarriage</historyEventDef>
|
||||
|
@ -37,9 +44,7 @@
|
|||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelationDegrees>
|
||||
<li>FarRelative</li>
|
||||
</hasOneOfRelationDegrees>
|
||||
<isBloodRelated>true</isBloodRelated>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_IncestuosMarriage</historyEventDef>
|
||||
|
@ -68,9 +73,16 @@
|
|||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelationDegrees>
|
||||
<li>CloseRelative</li>
|
||||
</hasOneOfRelationDegrees>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
<li>Sibling</li>
|
||||
<li>HalfSibling</li>
|
||||
<li>Grandparent</li>
|
||||
<li>Grandchild</li>
|
||||
<li>NephewOrNiece</li>
|
||||
<li>UncleOrAunt</li>
|
||||
</hasOneOfRelations>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_CloseRelativeSex</historyEventDef>
|
||||
|
@ -78,9 +90,7 @@
|
|||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelationDegrees>
|
||||
<li>FarRelative</li>
|
||||
</hasOneOfRelationDegrees>
|
||||
<isBloodRelated>true</isBloodRelated>
|
||||
</relations>
|
||||
</filter>
|
||||
<historyEventDef>RSI_IncestuosSex</historyEventDef>
|
||||
|
@ -108,20 +118,6 @@
|
|||
<li>FarRelative</li>
|
||||
<li>NotRelated</li>
|
||||
</allowManualRomanceOnlyFor>
|
||||
<bloodRelationDegreeRomanceFactors>
|
||||
<li>
|
||||
<bloodRelationDegree>CloseRelative</bloodRelationDegree>
|
||||
<romanceChanceFactor>1</romanceChanceFactor>
|
||||
</li>
|
||||
<li>
|
||||
<bloodRelationDegree>FarRelative</bloodRelationDegree>
|
||||
<romanceChanceFactor>1</romanceChanceFactor>
|
||||
</li>
|
||||
<li>
|
||||
<bloodRelationDegree>NotRelated</bloodRelationDegree>
|
||||
<romanceChanceFactor>1</romanceChanceFactor>
|
||||
</li>
|
||||
</bloodRelationDegreeRomanceFactors>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</PreceptDef>
|
||||
|
@ -151,9 +147,16 @@
|
|||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelationDegrees>
|
||||
<li>CloseRelative</li>
|
||||
</hasOneOfRelationDegrees>
|
||||
<hasOneOfRelations>
|
||||
<li>Parent</li>
|
||||
<li>Child</li>
|
||||
<li>Sibling</li>
|
||||
<li>HalfSibling</li>
|
||||
<li>Grandparent</li>
|
||||
<li>Grandchild</li>
|
||||
<li>NephewOrNiece</li>
|
||||
<li>UncleOrAunt</li>
|
||||
</hasOneOfRelations>
|
||||
<hasNoneOfRelations>
|
||||
<li>Spouse</li>
|
||||
</hasNoneOfRelations>
|
||||
|
@ -168,16 +171,6 @@
|
|||
<li>FarRelative</li>
|
||||
<li>NotRelated</li>
|
||||
</allowManualRomanceOnlyFor>
|
||||
<bloodRelationDegreeRomanceFactors>
|
||||
<li>
|
||||
<bloodRelationDegree>FarRelative</bloodRelationDegree>
|
||||
<romanceChanceFactor>1</romanceChanceFactor>
|
||||
</li>
|
||||
<li>
|
||||
<bloodRelationDegree>NotRelated</bloodRelationDegree>
|
||||
<romanceChanceFactor>1</romanceChanceFactor>
|
||||
</li>
|
||||
</bloodRelationDegreeRomanceFactors>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</PreceptDef>
|
||||
|
@ -211,10 +204,7 @@
|
|||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelationDegrees>
|
||||
<li>CloseRelative</li>
|
||||
<li>FarRelative</li>
|
||||
</hasOneOfRelationDegrees>
|
||||
<isBloodRelated>true</isBloodRelated>
|
||||
<hasNoneOfRelations>
|
||||
<li>Spouse</li>
|
||||
</hasNoneOfRelations>
|
||||
|
@ -256,10 +246,7 @@
|
|||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelationDegrees>
|
||||
<li>CloseRelative</li>
|
||||
<li>FarRelative</li>
|
||||
</hasOneOfRelationDegrees>
|
||||
<isBloodRelated>true</isBloodRelated>
|
||||
<hasNoneOfRelations>
|
||||
<li>Spouse</li>
|
||||
</hasNoneOfRelations>
|
||||
|
@ -269,18 +256,6 @@
|
|||
</li>
|
||||
</rules>
|
||||
</li>
|
||||
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_Incest">
|
||||
<bloodRelationDegreeRomanceFactors>
|
||||
<li>
|
||||
<bloodRelationDegree>CloseRelative</bloodRelationDegree>
|
||||
<romanceChanceFactor>0.03</romanceChanceFactor> <!-- same as vanilla "parent" -->
|
||||
</li>
|
||||
<li>
|
||||
<bloodRelationDegree>FarRelative</bloodRelationDegree>
|
||||
<romanceChanceFactor>0.03</romanceChanceFactor>
|
||||
</li>
|
||||
</bloodRelationDegreeRomanceFactors>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</PreceptDef>
|
||||
|
||||
|
@ -308,9 +283,7 @@
|
|||
<li>
|
||||
<filter>
|
||||
<relations>
|
||||
<hasOneOfRelationDegrees>
|
||||
<li>NotRelated</li>
|
||||
</hasOneOfRelationDegrees>
|
||||
<isBloodRelated>false</isBloodRelated>
|
||||
</relations>
|
||||
</filter>
|
||||
<multiplier>0.1</multiplier>
|
||||
|
@ -322,20 +295,6 @@
|
|||
<li>CloseRelative</li>
|
||||
<li>FarRelative</li>
|
||||
</allowManualRomanceOnlyFor>
|
||||
<bloodRelationDegreeRomanceFactors>
|
||||
<li>
|
||||
<bloodRelationDegree>CloseRelative</bloodRelationDegree>
|
||||
<romanceChanceFactor>1</romanceChanceFactor>
|
||||
</li>
|
||||
<li>
|
||||
<bloodRelationDegree>FarRelative</bloodRelationDegree>
|
||||
<romanceChanceFactor>1</romanceChanceFactor>
|
||||
</li>
|
||||
<li>
|
||||
<bloodRelationDegree>NotRelated</bloodRelationDegree>
|
||||
<romanceChanceFactor>0.03</romanceChanceFactor>
|
||||
</li>
|
||||
</bloodRelationDegreeRomanceFactors>
|
||||
</li>
|
||||
</modExtensions>
|
||||
</PreceptDef>
|
||||
|
|
|
@ -1,6 +1,7 @@
|
|||
using RimWorld;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology.Filters
|
||||
|
@ -12,14 +13,14 @@ namespace RJWSexperience.Ideology.Filters
|
|||
public class RelationFilter
|
||||
{
|
||||
public bool? isVeneratedAnimal;
|
||||
public bool? isAlien;
|
||||
public bool? isBloodRelated;
|
||||
public List<PawnRelationDef> hasOneOfRelations;
|
||||
public List<PawnRelationDef> hasNoneOfRelations;
|
||||
public List<BloodRelationDegree> hasOneOfRelationDegrees;
|
||||
|
||||
private bool initialized = false;
|
||||
private HashSet<PawnRelationDef> hasOneOfRelationsHashed;
|
||||
private HashSet<PawnRelationDef> hasNoneOfRelationsHashed;
|
||||
private HashSet<BloodRelationDegree> hasOneOfRelationDegreesHashed;
|
||||
|
||||
/// <summary>
|
||||
/// Check if the pair of pawns fits filter conditions
|
||||
|
@ -30,6 +31,9 @@ namespace RJWSexperience.Ideology.Filters
|
|||
if (isVeneratedAnimal != null && isVeneratedAnimal != pawn.Ideo.IsVeneratedAnimal(partner))
|
||||
return false;
|
||||
|
||||
//if (isAlien != null && isAlien != partner)
|
||||
// return false;
|
||||
|
||||
if (!CheckRelations(pawn, partner))
|
||||
return false;
|
||||
|
||||
|
@ -41,16 +45,14 @@ namespace RJWSexperience.Ideology.Filters
|
|||
if (!initialized)
|
||||
Initialize();
|
||||
|
||||
if (hasNoneOfRelationsHashed == null && hasOneOfRelationsHashed == null && hasOneOfRelationDegreesHashed == null)
|
||||
if (hasNoneOfRelationsHashed == null && hasOneOfRelationsHashed == null && isBloodRelated == null)
|
||||
return true;
|
||||
|
||||
if (hasOneOfRelationDegreesHashed != null && !hasOneOfRelationDegreesHashed.Contains(RelationHelpers.GetBloodRelationDegree(pawn, partner)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(partner);
|
||||
|
||||
if (isBloodRelated != null && isBloodRelated != relations.Any(def => def.familyByBloodRelation))
|
||||
return false;
|
||||
|
||||
if (hasOneOfRelationsHashed != null)
|
||||
{
|
||||
if (relations.EnumerableNullOrEmpty())
|
||||
|
@ -76,9 +78,6 @@ namespace RJWSexperience.Ideology.Filters
|
|||
if (!hasOneOfRelations.NullOrEmpty())
|
||||
hasOneOfRelationsHashed = new HashSet<PawnRelationDef>(hasOneOfRelations);
|
||||
|
||||
if (!hasOneOfRelationDegrees.NullOrEmpty())
|
||||
hasOneOfRelationDegreesHashed = new HashSet<BloodRelationDegree>(hasOneOfRelationDegrees);
|
||||
|
||||
initialized = true;
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,14 +1,25 @@
|
|||
using System.Reflection;
|
||||
using HarmonyLib;
|
||||
using RJWSexperience.Ideology.Patches;
|
||||
using System.Reflection;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology
|
||||
{
|
||||
[StaticConstructorOnStartup]
|
||||
internal static class Harmony
|
||||
internal static class First
|
||||
{
|
||||
static Harmony()
|
||||
static First()
|
||||
{
|
||||
new HarmonyLib.Harmony("RJW_Sexperience.Ideology").PatchAll(Assembly.GetExecutingAssembly());
|
||||
var harmony = new Harmony("RJW_Sexperience.Ideology");
|
||||
harmony.PatchAll(Assembly.GetExecutingAssembly());
|
||||
|
||||
if (ModLister.HasActiveModWithName("RJW Sexperience"))
|
||||
{
|
||||
harmony.Patch(AccessTools.Method("RJWSexperience.RJWUtility:ThrowVirginHistoryEvent"),
|
||||
prefix: null,
|
||||
postfix: new HarmonyMethod(typeof(Sexperience_Patch_ThrowVirginHistoryEvent), nameof(Sexperience_Patch_ThrowVirginHistoryEvent.Postfix))
|
||||
);
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -1,15 +1,11 @@
|
|||
using HarmonyLib;
|
||||
using rjw;
|
||||
using rjw;
|
||||
using RJWSexperience.Ideology.HistoryEvents;
|
||||
using Verse;
|
||||
|
||||
namespace RJWSexperience.Ideology.Patches
|
||||
{
|
||||
[HarmonyPatch("RJWSexperience.RJWUtility", "ThrowVirginHistoryEvent")]
|
||||
public static class Sexperience_Patch_ThrowVirginHistoryEvent
|
||||
{
|
||||
public static bool Prepare() => ModsConfig.IsActive("rjw.sexperience");
|
||||
|
||||
public static void Postfix(Pawn exVirgin, Pawn partner, SexProps props, int degree)
|
||||
{
|
||||
const int femaleAfterSurgery = 1;
|
||||
|
|
|
@ -1,4 +1,5 @@
|
|||
using System.Collections.Generic;
|
||||
using RJWSexperience.Ideology.Filters;
|
||||
using System.Collections.Generic;
|
||||
using System.Diagnostics.CodeAnalysis;
|
||||
using Verse;
|
||||
|
||||
|
@ -11,63 +12,5 @@ namespace RJWSexperience.Ideology.Precepts
|
|||
public class DefExtension_Incest : DefModExtension
|
||||
{
|
||||
public List<BloodRelationDegree> allowManualRomanceOnlyFor;
|
||||
public List<BloodRelationDegreeFactor> bloodRelationDegreeRomanceFactors;
|
||||
|
||||
private Dictionary<BloodRelationDegree, float> _relationDegreeFactorsDict;
|
||||
|
||||
public bool TryGetRomanceChanceFactor(BloodRelationDegree relationDegree, out float romanceChanceFactor)
|
||||
{
|
||||
if (bloodRelationDegreeRomanceFactors.NullOrEmpty())
|
||||
{
|
||||
romanceChanceFactor = 1f;
|
||||
return false;
|
||||
}
|
||||
|
||||
if (_relationDegreeFactorsDict == null)
|
||||
{
|
||||
_relationDegreeFactorsDict = new Dictionary<BloodRelationDegree, float>();
|
||||
foreach (BloodRelationDegreeFactor relationDegreeFactor in bloodRelationDegreeRomanceFactors)
|
||||
{
|
||||
_relationDegreeFactorsDict.Add((BloodRelationDegree)relationDegreeFactor.bloodRelationDegree, relationDegreeFactor.romanceChanceFactor);
|
||||
}
|
||||
}
|
||||
|
||||
return _relationDegreeFactorsDict.TryGetValue(relationDegree, out romanceChanceFactor);
|
||||
}
|
||||
|
||||
public override IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
foreach (string error in base.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
|
||||
foreach (BloodRelationDegreeFactor factor in bloodRelationDegreeRomanceFactors)
|
||||
{
|
||||
foreach(string error in factor.ConfigErrors())
|
||||
{
|
||||
yield return error;
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
public class BloodRelationDegreeFactor
|
||||
{
|
||||
public BloodRelationDegree? bloodRelationDegree;
|
||||
public float romanceChanceFactor;
|
||||
|
||||
public IEnumerable<string> ConfigErrors()
|
||||
{
|
||||
if (bloodRelationDegree == null)
|
||||
{
|
||||
yield return "<bloodRelationDegree> is empty";
|
||||
}
|
||||
|
||||
if (romanceChanceFactor == 0f)
|
||||
{
|
||||
yield return "<romanceChanceFactor> should be > 0";
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
}
|
||||
|
|
|
@ -11,11 +11,6 @@ namespace RJWSexperience.Ideology
|
|||
/// </summary>
|
||||
public static BloodRelationDegree GetBloodRelationDegree(Pawn pawn, Pawn partner)
|
||||
{
|
||||
if (!pawn.relations.FamilyByBlood.Contains(partner))
|
||||
{
|
||||
return BloodRelationDegree.NotRelated;
|
||||
}
|
||||
|
||||
PawnRelationDef closestBloodRelation = pawn
|
||||
.GetRelations(partner)
|
||||
?.Where(def => def.familyByBloodRelation)
|
||||
|
|
|
@ -1,5 +1,4 @@
|
|||
using RimWorld;
|
||||
using RJWSexperience.Ideology.Precepts;
|
||||
using System.Collections.Generic;
|
||||
using System.Linq;
|
||||
using Verse;
|
||||
|
@ -18,11 +17,13 @@ namespace RJWSexperience.Ideology
|
|||
/// </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 (!pawn.relations.FamilyByBlood.Contains(partner))
|
||||
if (!relations.Any())
|
||||
{
|
||||
if (pawn.Ideo?.HasPrecept(RsiPreceptDefOf.Incestuos_IncestOnly) == true)
|
||||
if (incestuousPrecept == RsiPreceptDefOf.Incestuos_IncestOnly)
|
||||
{
|
||||
return parentRomanceChanceFactor;
|
||||
}
|
||||
|
@ -32,8 +33,6 @@ namespace RJWSexperience.Ideology
|
|||
}
|
||||
}
|
||||
|
||||
PreceptDef incestuousPrecept = pawn.Ideo?.PreceptsListForReading.Select(precept => precept.def).FirstOrFallback(def => def.issue == VariousDefOf.Incestuos);
|
||||
IEnumerable<PawnRelationDef> relations = pawn.GetRelations(partner).Where(def => def.familyByBloodRelation);
|
||||
foreach (PawnRelationDef relationDef in relations)
|
||||
{
|
||||
romanceChanceFactor *= GetRomanceChanceFactor(relationDef, incestuousPrecept);
|
||||
|
@ -47,23 +46,43 @@ namespace RJWSexperience.Ideology
|
|||
/// </summary>
|
||||
public static float GetRomanceChanceFactor(PawnRelationDef relationDef, PreceptDef incestuousPrecept)
|
||||
{
|
||||
if (incestuousPrecept == null)
|
||||
if (incestuousPrecept == null || incestuousPrecept == RsiPreceptDefOf.Incestuos_Disapproved) // Default game setup
|
||||
{
|
||||
return relationDef.romanceChanceFactor;
|
||||
}
|
||||
|
||||
var incestDefExt = incestuousPrecept.GetModExtension<DefExtension_Incest>();
|
||||
|
||||
if (incestDefExt == null)
|
||||
if (incestuousPrecept == RsiPreceptDefOf.Incestuos_Free)
|
||||
{
|
||||
return relationDef.romanceChanceFactor;
|
||||
return 1f;
|
||||
}
|
||||
|
||||
BloodRelationDegree relationDegree = RelationHelpers.GetBloodRelationDegree(relationDef);
|
||||
|
||||
if (incestDefExt.TryGetRomanceChanceFactor(relationDegree, out var romanceChanceOverride))
|
||||
else if (incestuousPrecept == RsiPreceptDefOf.Incestuos_Disapproved_CloseOnly)
|
||||
{
|
||||
return romanceChanceOverride;
|
||||
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;
|
||||
|
|
|
@ -5,6 +5,10 @@ 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;
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue