Move sextypes into precept xml

This commit is contained in:
amevarashi 2022-06-18 17:46:40 +05:00
parent 3557988f89
commit d270674bef
7 changed files with 157 additions and 92 deletions

View file

@ -0,0 +1,10 @@
using RimWorld;
namespace RJWSexperience.Ideology.Ideology
{
[DefOf]
public static class IssueDefOf
{
[MayRequireIdeology] public static readonly IssueDef Sextype;
}
}

View file

@ -0,0 +1,33 @@
using RimWorld;
using System.Collections.Generic;
using Verse;
namespace RJWSexperience.Ideology
{
public static class IssueUtility
{
private static readonly Dictionary<IssueDef, List<PreceptDef>> issuePrecepts = new Dictionary<IssueDef, List<PreceptDef>>();
public static List<PreceptDef> GetAllPrecepts(this IssueDef issue)
{
if (issuePrecepts.TryGetValue(issue, out List<PreceptDef> precepts))
return precepts;
precepts = DefDatabase<PreceptDef>.AllDefsListForReading.FindAll(x => x.issue == issue);
issuePrecepts.Add(issue, precepts);
return precepts;
}
public static Precept GetPreceptOfIssue(this Ideo ideo, IssueDef issue)
{
foreach (PreceptDef preceptDef in issue.GetAllPrecepts())
{
Precept precept = ideo.GetPrecept(preceptDef);
if (precept != null)
return precept;
}
return null;
}
}
}

View file

@ -0,0 +1,12 @@
using System.Collections.Generic;
using System.Diagnostics.CodeAnalysis;
using Verse;
namespace RJWSexperience.Ideology
{
public class PreceptDefExtension_PreferSextype : DefModExtension
{
[SuppressMessage("Minor Code Smell", "S1104:Fields should not have public accessibility", Justification = "Field value loaded from XML")]
public HashSet<string> sextypes = new HashSet<string>();
}
}

View file

@ -279,31 +279,16 @@ namespace RJWSexperience.Ideology
if (!context.Inputs.IsRape && ideo != null) PreceptSextype(ideo, context.Inputs.Partner.GetStatValue(xxx.sex_drive_stat), ref __result, interaction);
}
private static readonly Dictionary<string, PreceptDef> PreceptBySextype = new Dictionary<string, PreceptDef>
{
{ "Vaginal", VariousDefOf.Sex_VaginalOnly },
{ "Anal", VariousDefOf.Sex_AnalOnly },
{ "Rimming", VariousDefOf.Sex_AnalOnly },
{ "Cunnilingus", VariousDefOf.Sex_OralOnly },
{ "Fellatio", VariousDefOf.Sex_OralOnly },
{ "Beakjob", VariousDefOf.Sex_OralOnly },
{ "DoublePenetration", VariousDefOf.Sex_Promiscuous },
{ "Scissoring", VariousDefOf.Sex_Promiscuous },
{ "Sixtynine", VariousDefOf.Sex_Promiscuous },
{ "Fisting", VariousDefOf.Sex_Promiscuous }
};
public static void PreceptSextype(Ideo ideo, float sexdrive, ref float result, InteractionWithExtension interaction)
{
if (!PreceptBySextype.TryGetValue(interaction.Extension.rjwSextype, out PreceptDef preceptDef))
Precept sextypePrecept = ideo.GetPreceptOfIssue(Ideology.IssueDefOf.Sextype);
bool boostSextype = sextypePrecept.def.GetModExtension<PreceptDefExtension_PreferSextype>().sextypes.Contains(interaction.Extension.rjwSextype);
if (!boostSextype)
return;
float mult = 8.0f * Math.Max(0.3f, 1 / Math.Max(0.01f, sexdrive));
if (ideo.HasPrecept(preceptDef))
{
result *= mult;
}
result *= mult;
}
}

View file

@ -45,7 +45,10 @@
<Compile Include="GlobalSuppressions.cs" />
<Compile Include="Ideology\GoodwillSituationWorker_MemeCompatibility.cs" />
<Compile Include="Harmony.cs" />
<Compile Include="Ideology\IssueDefOf.cs" />
<Compile Include="Ideology\IssueUtility.cs" />
<Compile Include="Ideology\Keyed.cs" />
<Compile Include="Ideology\PreceptDefExtension_PreferSextype.cs" />
<Compile Include="Ideology\PreceptDefExtension_MultipleMemesRequired.cs" />
<Compile Include="Ideology\Rituals\JobGiver_GangbangConsensual.cs" />
<Compile Include="Ideology\Rituals\LordJob_Rituals.cs" />
@ -60,7 +63,7 @@
<Compile Include="Ideology\Rituals\RitualOutcomeComps.cs" />
<Compile Include="Ideology\Rituals\RitualRoles.cs" />
<Compile Include="Ideology\StatParts.cs" />
<Compile Include="Ideology\Utility.cs" />
<Compile Include="Ideology\IdeoUtility.cs" />
<Compile Include="Thoughts\ThoughtDefExtension_IncreaseRecord.cs" />
<Compile Include="Thoughts\ThoughtDefExtension_StageFromOpinion.cs" />
<Compile Include="Thoughts\Thought_IncreaseRecord.cs" />

View file

@ -1,76 +1,64 @@
using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using RimWorld;
using Verse;
using RimWorld;
namespace RJWSexperience.Ideology
{
public static class VariousDefOf
{
public static readonly JobDef RapeVictim = DefDatabase<JobDef>.GetNamed("RapeVictim");
public static readonly JobDef Gangbang = DefDatabase<JobDef>.GetNamed("Gangbang");
public static readonly JobDef GettinGangbang = DefDatabase<JobDef>.GetNamed("GettinGangbang");
public static readonly JobDef DrugSex = DefDatabase<JobDef>.GetNamed("DrugSex");
public static readonly JobDef GettinDrugSex = DefDatabase<JobDef>.GetNamed("GettinDrugSex");
public static readonly JobDef DrugMasturbate = DefDatabase<JobDef>.GetNamed("DrugMasturbate");
[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");
[MayRequireIdeology] public static readonly HistoryEventDef Raped = DefDatabase<HistoryEventDef>.GetNamed("Raped");
[MayRequireIdeology] public static readonly HistoryEventDef RapedSlave = DefDatabase<HistoryEventDef>.GetNamed("RapedSlave");
[MayRequireIdeology] public static readonly HistoryEventDef RapedPrisoner = DefDatabase<HistoryEventDef>.GetNamed("RapedPrisoner");
[MayRequireIdeology] public static readonly HistoryEventDef WasRaped = DefDatabase<HistoryEventDef>.GetNamed("WasRaped");
[MayRequireIdeology] public static readonly HistoryEventDef WasRapedSlave = DefDatabase<HistoryEventDef>.GetNamed("WasRapedSlave");
[MayRequireIdeology] public static readonly HistoryEventDef WasRapedPrisoner = DefDatabase<HistoryEventDef>.GetNamed("WasRapedPrisoner");
[MayRequireIdeology] public static readonly HistoryEventDef VaginalSex = DefDatabase<HistoryEventDef>.GetNamed("VaginalSex");
[MayRequireIdeology] public static readonly HistoryEventDef AnalSex = DefDatabase<HistoryEventDef>.GetNamed("AnalSex");
[MayRequireIdeology] public static readonly HistoryEventDef OralSex = DefDatabase<HistoryEventDef>.GetNamed("OralSex");
[MayRequireIdeology] public static readonly HistoryEventDef MiscSex = DefDatabase<HistoryEventDef>.GetNamed("MiscSex");
[MayRequireIdeology] public static readonly HistoryEventDef PromiscuousSex = DefDatabase<HistoryEventDef>.GetNamed("PromiscuousSex");
[MayRequireIdeology] public static readonly HistoryEventDef Incestuos_Marriage = DefDatabase<HistoryEventDef>.GetNamed("Incestuos_Marriage");
[MayRequireIdeology] public static readonly HistoryEventDef SexWithCorpse = DefDatabase<HistoryEventDef>.GetNamed("SexWithCorpse");
[MayRequireIdeology] public static readonly HistoryEventDef Virgin_TakenF = DefDatabase<HistoryEventDef>.GetNamed("Virgin_TakenF");
[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_Abhorrent = DefDatabase<PreceptDef>.GetNamed("Bestiality_Abhorrent");
[MayRequireIdeology] public static readonly PreceptDef Bestiality_Horrible = DefDatabase<PreceptDef>.GetNamed("Bestiality_Horrible");
[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 Sex_Free = DefDatabase<PreceptDef>.GetNamed("Sex_Free");
[MayRequireIdeology] public static readonly PreceptDef Sex_VaginalOnly = DefDatabase<PreceptDef>.GetNamed("Sex_VaginalOnly");
[MayRequireIdeology] public static readonly PreceptDef Sex_AnalOnly = DefDatabase<PreceptDef>.GetNamed("Sex_AnalOnly");
[MayRequireIdeology] public static readonly PreceptDef Sex_OralOnly = DefDatabase<PreceptDef>.GetNamed("Sex_OralOnly");
[MayRequireIdeology] public static readonly PreceptDef Sex_Promiscuous = DefDatabase<PreceptDef>.GetNamed("Sex_Promiscuous");
[MayRequireIdeology] public static readonly PreceptDef Incestuos_Free = DefDatabase<PreceptDef>.GetNamed("Incestuos_Free");
[MayRequireIdeology] public static readonly PreceptDef Incestuos_Disapproved = DefDatabase<PreceptDef>.GetNamed("Incestuos_Disapproved");
[MayRequireIdeology] public static readonly PreceptDef Incestuos_Forbidden = DefDatabase<PreceptDef>.GetNamed("Incestuos_Forbidden");
[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_None = DefDatabase<PreceptDef>.GetNamed("Submissive_None");
[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");
}
public static class VariousDefOf
{
public static readonly JobDef RapeVictim = DefDatabase<JobDef>.GetNamed("RapeVictim");
public static readonly JobDef Gangbang = DefDatabase<JobDef>.GetNamed("Gangbang");
public static readonly JobDef GettinGangbang = DefDatabase<JobDef>.GetNamed("GettinGangbang");
public static readonly JobDef DrugSex = DefDatabase<JobDef>.GetNamed("DrugSex");
public static readonly JobDef GettinDrugSex = DefDatabase<JobDef>.GetNamed("GettinDrugSex");
public static readonly JobDef DrugMasturbate = DefDatabase<JobDef>.GetNamed("DrugMasturbate");
[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");
[MayRequireIdeology] public static readonly HistoryEventDef Raped = DefDatabase<HistoryEventDef>.GetNamed("Raped");
[MayRequireIdeology] public static readonly HistoryEventDef RapedSlave = DefDatabase<HistoryEventDef>.GetNamed("RapedSlave");
[MayRequireIdeology] public static readonly HistoryEventDef RapedPrisoner = DefDatabase<HistoryEventDef>.GetNamed("RapedPrisoner");
[MayRequireIdeology] public static readonly HistoryEventDef WasRaped = DefDatabase<HistoryEventDef>.GetNamed("WasRaped");
[MayRequireIdeology] public static readonly HistoryEventDef WasRapedSlave = DefDatabase<HistoryEventDef>.GetNamed("WasRapedSlave");
[MayRequireIdeology] public static readonly HistoryEventDef WasRapedPrisoner = DefDatabase<HistoryEventDef>.GetNamed("WasRapedPrisoner");
[MayRequireIdeology] public static readonly HistoryEventDef VaginalSex = DefDatabase<HistoryEventDef>.GetNamed("VaginalSex");
[MayRequireIdeology] public static readonly HistoryEventDef AnalSex = DefDatabase<HistoryEventDef>.GetNamed("AnalSex");
[MayRequireIdeology] public static readonly HistoryEventDef OralSex = DefDatabase<HistoryEventDef>.GetNamed("OralSex");
[MayRequireIdeology] public static readonly HistoryEventDef MiscSex = DefDatabase<HistoryEventDef>.GetNamed("MiscSex");
[MayRequireIdeology] public static readonly HistoryEventDef PromiscuousSex = DefDatabase<HistoryEventDef>.GetNamed("PromiscuousSex");
[MayRequireIdeology] public static readonly HistoryEventDef Incestuos_Marriage = DefDatabase<HistoryEventDef>.GetNamed("Incestuos_Marriage");
[MayRequireIdeology] public static readonly HistoryEventDef SexWithCorpse = DefDatabase<HistoryEventDef>.GetNamed("SexWithCorpse");
[MayRequireIdeology] public static readonly HistoryEventDef Virgin_TakenF = DefDatabase<HistoryEventDef>.GetNamed("Virgin_TakenF");
[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_Abhorrent = DefDatabase<PreceptDef>.GetNamed("Bestiality_Abhorrent");
[MayRequireIdeology] public static readonly PreceptDef Bestiality_Horrible = DefDatabase<PreceptDef>.GetNamed("Bestiality_Horrible");
[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_Disapproved = DefDatabase<PreceptDef>.GetNamed("Incestuos_Disapproved");
[MayRequireIdeology] public static readonly PreceptDef Incestuos_Forbidden = DefDatabase<PreceptDef>.GetNamed("Incestuos_Forbidden");
[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

@ -88,6 +88,13 @@
<thought>Sex_Know_Promiscuous</thought>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.PreceptDefExtension_PreferSextype">
<sextypes>
<li>Vaginal</li>
</sextypes>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -133,6 +140,14 @@
<thought>Sex_Know_Promiscuous</thought>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.PreceptDefExtension_PreferSextype">
<sextypes>
<li>Anal</li>
<li>Rimming</li>
</sextypes>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -178,6 +193,15 @@
<thought>Sex_Know_Promiscuous</thought>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.PreceptDefExtension_PreferSextype">
<sextypes>
<li>Cunnilingus</li>
<li>Fellatio</li>
<li>Beakjob</li>
</sextypes>
</li>
</modExtensions>
</PreceptDef>
<PreceptDef>
@ -230,6 +254,16 @@
<thought>Sex_Know_Promiscuous_Approval</thought>
</li>
</comps>
<modExtensions>
<li Class="RJWSexperience.Ideology.PreceptDefExtension_PreferSextype">
<sextypes>
<li>DoublePenetration</li>
<li>Scissoring</li>
<li>Sixtynine</li>
<li>Fisting</li>
</sextypes>
</li>
</modExtensions>
</PreceptDef>