Change implementation of sex Mtb patches

This commit is contained in:
amevarashi 2022-06-19 23:49:17 +05:00
parent 65201ed086
commit 9c44a7b7ba
11 changed files with 114 additions and 49 deletions

View file

@ -55,5 +55,17 @@ namespace RJWSexperience.Ideology
}
return false;
}
public static float GetPreceptsMtbMultiplier<T>(Ideo ideo) where T : Precepts.DefExtension_ModifyMtb
{
float finalMultiplier = 1f;
for (int i = 0; i < ideo.PreceptsListForReading.Count; i++)
{
float? multiplier = ideo.PreceptsListForReading[i].def.GetModExtension<T>()?.multiplier;
if (multiplier != null)
finalMultiplier *= (float)multiplier;
}
return finalMultiplier;
}
}
}

View file

@ -0,0 +1,6 @@
namespace RJWSexperience.Ideology.Precepts
{
public class DefExtension_ModifyBestialityMtb : DefExtension_ModifyMtb
{
}
}

View file

@ -0,0 +1,11 @@
using System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience.Ideology.Precepts
{
public abstract class DefExtension_ModifyMtb : DefModExtension
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public float multiplier = 1f;
}
}

View file

@ -0,0 +1,6 @@
namespace RJWSexperience.Ideology.Precepts
{
public class DefExtension_ModifyNecroMtb : DefExtension_ModifyMtb
{
}
}

View file

@ -0,0 +1,6 @@
namespace RJWSexperience.Ideology.Precepts
{
public class DefExtension_ModifyRapeCPMtb : DefExtension_ModifyMtb
{
}
}

View file

@ -47,16 +47,8 @@ namespace RJWSexperience.Ideology
public static void Postfix(Pawn pawn, ref float __result)
{
Ideo ideo = pawn.Ideo;
if (ideo != null) __result *= BestialityByPrecept(ideo); // ideo is null if don't have dlc
}
public static float BestialityByPrecept(Ideo ideo)
{
if (ideo.HasPrecept(VariousDefOf.Bestiality_Honorable)) return 0.5f;
else if (ideo.HasPrecept(VariousDefOf.Bestiality_OnlyVenerated)) return 0.65f;
else if (ideo.HasPrecept(VariousDefOf.Bestiality_Acceptable)) return 0.75f;
else if (ideo.HasPrecept(VariousDefOf.Bestiality_Disapproved)) return 1.0f;
else return 5f;
if (ideo != null) // ideo is null if don't have dlc
__result *= IdeoUtility.GetPreceptsMtbMultiplier<DefExtension_ModifyBestialityMtb>(ideo);
}
}
@ -66,15 +58,8 @@ namespace RJWSexperience.Ideology
public static void Postfix(Pawn pawn, ref float __result)
{
Ideo ideo = pawn.Ideo;
if (ideo != null) __result *= RapeByPrecept(ideo); // ideo is null if don't have dlc
}
public static float RapeByPrecept(Ideo ideo)
{
if (ideo.HasPrecept(VariousDefOf.Rape_Honorable)) return 0.5f;
else if (ideo.HasPrecept(VariousDefOf.Rape_Acceptable)) return 0.75f;
else if (ideo.HasPrecept(VariousDefOf.Rape_Disapproved)) return 1.0f;
else return 3f;
if (ideo != null) // ideo is null if don't have dlc
__result *= IdeoUtility.GetPreceptsMtbMultiplier<DefExtension_ModifyRapeCPMtb>(ideo);
}
}
@ -84,15 +69,8 @@ namespace RJWSexperience.Ideology
public static void Postfix(Pawn pawn, ref float __result)
{
Ideo ideo = pawn.Ideo;
if (ideo != null) __result *= NecroByPrecept(ideo); // ideo is null if don't have dlc
}
public static float NecroByPrecept(Ideo ideo)
{
if (ideo.HasPrecept(VariousDefOf.Necrophilia_Approved)) return 0.5f;
else if (ideo.HasPrecept(VariousDefOf.Necrophilia_Acceptable)) return 0.75f;
else if (ideo.HasPrecept(VariousDefOf.Necrophilia_Disapproved)) return 1.0f;
else return 8f;
if (ideo != null) // ideo is null if don't have dlc
__result *= IdeoUtility.GetPreceptsMtbMultiplier<DefExtension_ModifyNecroMtb>(ideo);
}
}
@ -142,13 +120,11 @@ namespace RJWSexperience.Ideology
{
Pawn pawn = props.pawn;
Pawn partner = props.partner;
bool rape = props.isRape;
xxx.rjwSextype sextype = props.sexType;
if (partner != null)
{
if (xxx.is_human(pawn)) AfterSexHuman(pawn, partner, rape, sextype);
else if (xxx.is_human(partner)) AfterSexHuman(partner, pawn, false, sextype, true);
if (xxx.is_human(pawn)) AfterSexHuman(pawn, partner, props.isRape, props.sexType);
else if (xxx.is_human(partner)) AfterSexHuman(partner, pawn, false, props.sexType, true);
}
}
@ -271,10 +247,12 @@ namespace RJWSexperience.Ideology
public static void Postfix(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive, ref InteractionScore __result)
{
Ideo ideo = dominant.Pawn.Ideo;
if (ideo != null) __result.Dominant = PreceptSextype(ideo, dominant.Pawn.GetStatValue(xxx.sex_drive_stat), __result.Dominant, interaction);
if (ideo != null)
__result.Dominant = PreceptSextype(ideo, dominant.Pawn.GetStatValue(xxx.sex_drive_stat), __result.Dominant, interaction);
ideo = submissive.Pawn.Ideo;
if (ideo != null) __result.Submissive = PreceptSextype(ideo, submissive.Pawn.GetStatValue(xxx.sex_drive_stat), __result.Submissive, interaction);
if (ideo != null)
__result.Submissive = PreceptSextype(ideo, submissive.Pawn.GetStatValue(xxx.sex_drive_stat), __result.Submissive, interaction);
}
public static float PreceptSextype(Ideo ideo, float sexdrive, float score, InteractionWithExtension interaction)

View file

@ -49,6 +49,10 @@
<Compile Include="Ideology\HistoryEventArgsNamesCustom.cs" />
<Compile Include="Ideology\IssueUtility.cs" />
<Compile Include="Ideology\Keyed.cs" />
<Compile Include="Ideology\Precepts\DefExtension_ModifyMtb.cs" />
<Compile Include="Ideology\Precepts\DefExtension_ModifyRapeCPMtb.cs" />
<Compile Include="Ideology\Precepts\DefExtension_ModifyNecroMtb.cs" />
<Compile Include="Ideology\Precepts\DefExtension_ModifyBestialityMtb.cs" />
<Compile Include="Ideology\Precepts\DefExtension_ModifyPreference.cs" />
<Compile Include="Ideology\Precepts\DefExtension_PreferSextype.cs" />
<Compile Include="Ideology\Precepts\DefExtension_MultipleMemesRequired.cs" />

View file

@ -14,7 +14,6 @@ namespace RJWSexperience.Ideology
[MayRequireIdeology] public static readonly MemeDef Zoophile = DefDatabase<MemeDef>.GetNamed("Zoophile");
[MayRequireIdeology] public static readonly MemeDef Rapist = DefDatabase<MemeDef>.GetNamed("Rapist");
[MayRequireIdeology] public static readonly MemeDef Lewd = DefDatabase<MemeDef>.GetNamed("Lewd");
[MayRequireIdeology] public static readonly MemeDef Necrophile = DefDatabase<MemeDef>.GetNamed("Necrophile");
[MayRequireIdeology] public static readonly HistoryEventDef SexWithAnimal = DefDatabase<HistoryEventDef>.GetNamed("SexWithAnimal");
[MayRequireIdeology] public static readonly HistoryEventDef SexWithVeneratedAnimal = DefDatabase<HistoryEventDef>.GetNamed("SexWithVeneratedAnimal");
@ -35,26 +34,12 @@ namespace RJWSexperience.Ideology
[MayRequireIdeology] public static readonly HistoryEventDef Virgin_TakenM = DefDatabase<HistoryEventDef>.GetNamed("Virgin_TakenM");
[MayRequireIdeology] public static readonly HistoryEventDef Virgin_TookF = DefDatabase<HistoryEventDef>.GetNamed("Virgin_TookF");
[MayRequireIdeology] public static readonly HistoryEventDef Virgin_TookM = DefDatabase<HistoryEventDef>.GetNamed("Virgin_TookM");
[MayRequireIdeology] public static readonly PreceptDef Bestiality_Disapproved = DefDatabase<PreceptDef>.GetNamed("Bestiality_Disapproved");
[MayRequireIdeology] public static readonly PreceptDef Bestiality_Acceptable = DefDatabase<PreceptDef>.GetNamed("Bestiality_Acceptable");
[MayRequireIdeology] public static readonly PreceptDef Bestiality_OnlyVenerated = DefDatabase<PreceptDef>.GetNamed("Bestiality_OnlyVenerated");
[MayRequireIdeology] public static readonly PreceptDef Bestiality_Honorable = DefDatabase<PreceptDef>.GetNamed("Bestiality_Honorable");
[MayRequireIdeology] public static readonly PreceptDef Rape_Abhorrent = DefDatabase<PreceptDef>.GetNamed("Rape_Abhorrent");
[MayRequireIdeology] public static readonly PreceptDef Rape_Horrible = DefDatabase<PreceptDef>.GetNamed("Rape_Horrible");
[MayRequireIdeology] public static readonly PreceptDef Rape_Disapproved = DefDatabase<PreceptDef>.GetNamed("Rape_Disapproved");
[MayRequireIdeology] public static readonly PreceptDef Rape_Acceptable = DefDatabase<PreceptDef>.GetNamed("Rape_Acceptable");
[MayRequireIdeology] public static readonly PreceptDef Rape_Honorable = DefDatabase<PreceptDef>.GetNamed("Rape_Honorable");
[MayRequireIdeology] public static readonly PreceptDef Incestuos_IncestOnly = DefDatabase<PreceptDef>.GetNamed("Incestuos_IncestOnly");
[MayRequireIdeology] public static readonly PreceptDef Incestuos_Disapproved_CloseOnly = DefDatabase<PreceptDef>.GetNamed("Incestuos_Disapproved_CloseOnly");
[MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysMother = DefDatabase<PreceptDef>.GetNamed("BabyFaction_AlwaysMother");
[MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysFather = DefDatabase<PreceptDef>.GetNamed("BabyFaction_AlwaysFather");
[MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysColony = DefDatabase<PreceptDef>.GetNamed("BabyFaction_AlwaysColony");
[MayRequireIdeology] public static readonly PreceptDef Submissive_Male = DefDatabase<PreceptDef>.GetNamed("Submissive_Male");
[MayRequireIdeology] public static readonly PreceptDef Submissive_Female = DefDatabase<PreceptDef>.GetNamed("Submissive_Female");
[MayRequireIdeology] public static readonly PreceptDef Necrophilia_Abhorrent = DefDatabase<PreceptDef>.GetNamed("Necrophilia_Abhorrent");
[MayRequireIdeology] public static readonly PreceptDef Necrophilia_Horrible = DefDatabase<PreceptDef>.GetNamed("Necrophilia_Horrible");
[MayRequireIdeology] public static readonly PreceptDef Necrophilia_Disapproved = DefDatabase<PreceptDef>.GetNamed("Necrophilia_Disapproved");
[MayRequireIdeology] public static readonly PreceptDef Necrophilia_Acceptable = DefDatabase<PreceptDef>.GetNamed("Necrophilia_Acceptable");
[MayRequireIdeology] public static readonly PreceptDef Necrophilia_Approved = DefDatabase<PreceptDef>.GetNamed("Necrophilia_Approved");
}
}

View file

@ -68,6 +68,9 @@
</li>
</rules>
</li>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyBestialityMtb">
<multiplier>5.0</multiplier>
</li>
</modExtensions>
</PreceptDef>
@ -119,6 +122,9 @@
</li>
</rules>
</li>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyBestialityMtb">
<multiplier>5.0</multiplier>
</li>
</modExtensions>
</PreceptDef>
@ -182,6 +188,11 @@
<displayOrderInIssue>10</displayOrderInIssue>
<defaultSelectionWeight>10</defaultSelectionWeight>
<approvesOfSlavery>true</approvesOfSlavery>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyBestialityMtb">
<multiplier>0.75</multiplier>
</li>
</modExtensions>
</PreceptDef>
@ -240,6 +251,9 @@
</li>
</rules>
</li>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyBestialityMtb">
<multiplier>0.65</multiplier>
</li>
</modExtensions>
</PreceptDef>
@ -292,6 +306,9 @@
</li>
</rules>
</li>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyBestialityMtb">
<multiplier>0.5</multiplier>
</li>
</modExtensions>
</PreceptDef>

View file

@ -37,6 +37,11 @@
<thought>Necrophilia_Know_Abhorrent</thought>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyNecroMtb">
<multiplier>8.0</multiplier>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -61,6 +66,11 @@
<thought>Necrophilia_Know_Horrible</thought>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyNecroMtb">
<multiplier>8.0</multiplier>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -99,6 +109,11 @@
<requiredMemes>
<li>Necrophile</li>
</requiredMemes>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyNecroMtb">
<multiplier>0.75</multiplier>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -123,6 +138,11 @@
<thought>Necrophilia_Know_Approved</thought>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyNecroMtb">
<multiplier>0.5</multiplier>
</li>
</modExtensions>
</PreceptDef>
<!-- Thoughts -->

View file

@ -89,6 +89,11 @@
<description>Someone raped slave</description>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyRapeCPMtb">
<multiplier>3.0</multiplier>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -130,6 +135,11 @@
<description>Someone raped prisoner</description>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyRapeCPMtb">
<multiplier>3.0</multiplier>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -172,6 +182,11 @@
<displayOrderInIssue>10</displayOrderInIssue>
<defaultSelectionWeight>10</defaultSelectionWeight>
<approvesOfSlavery>true</approvesOfSlavery>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyRapeCPMtb">
<multiplier>0.75</multiplier>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -226,6 +241,11 @@
<onlyForNonSlaves>true</onlyForNonSlaves>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.Precepts.DefExtension_ModifyRapeCPMtb">
<multiplier>0.5</multiplier>
</li>
</modExtensions>
</PreceptDef>
<!-- Thoughts -->