From 111b5b2450baf7dce448f97ed1433f966ba0fc93 Mon Sep 17 00:00:00 2001 From: amevarashi Date: Mon, 11 Jul 2022 21:07:35 +0500 Subject: [PATCH] Ideology code cleanup --- .../Keyed/RJW_Sexperience.xml | 6 +- Languages/English/Keyed/RJW_Sexperience.xml | 2 +- Languages/Korean/Keyed/RJW_Sexperience.xml | 5 +- Languages/Russian/Keyed/RJW_Sexperience.xml | 5 +- ...odwillSituationWorker_MemeCompatibility.cs | 44 ++++++-------- .../IdeologyAddon/Ideology/IdeoUtility.cs | 14 ----- .../IdeologyAddon/Ideology/IssueUtility.cs | 33 ----------- .../IdeologyAddon/Ideology/Keyed.cs | 3 +- .../Patches/RJW_Patch_ChancePerHour.cs | 6 +- .../Ideology/Patches/RJW_Patch_Ideo.cs | 56 +++++++++++++----- .../Ideology/Patches/Rimworld_Patch.cs | 18 +++--- .../Ideology/Patches/Sexperience_Patch.cs | 6 +- .../IdeologyAddon/Ideology/RJWUtility_Ideo.cs | 24 -------- .../Ideology/RsiHistoryEventDefOf.cs | 20 +++++++ .../IdeologyAddon/Ideology/StatParts.cs | 58 +++++-------------- .../{ => Ideology}/VariousDefOf.cs | 9 --- .../IdeologyAddon/IdeologyAddon.csproj | 4 +- 17 files changed, 118 insertions(+), 195 deletions(-) delete mode 100644 RJWSexperience/IdeologyAddon/Ideology/IssueUtility.cs create mode 100644 RJWSexperience/IdeologyAddon/Ideology/RsiHistoryEventDefOf.cs rename RJWSexperience/IdeologyAddon/{ => Ideology}/VariousDefOf.cs (57%) diff --git a/Languages/ChineseSimplified/Keyed/RJW_Sexperience.xml b/Languages/ChineseSimplified/Keyed/RJW_Sexperience.xml index 6aff4bc..04e96e2 100644 --- a/Languages/ChineseSimplified/Keyed/RJW_Sexperience.xml +++ b/Languages/ChineseSimplified/Keyed/RJW_Sexperience.xml @@ -2,10 +2,8 @@ RJW 性经验 - 性欲: x{0}% - 囚犯: x{0}% - 非囚犯: x100% - 迷因: x{0}% + 性欲 + 迷因 开启随机性记录 随机化小人的性记录。 diff --git a/Languages/English/Keyed/RJW_Sexperience.xml b/Languages/English/Keyed/RJW_Sexperience.xml index c123140..8a68e80 100644 --- a/Languages/English/Keyed/RJW_Sexperience.xml +++ b/Languages/English/Keyed/RJW_Sexperience.xml @@ -3,7 +3,7 @@ RJW Sexperience - Meme: x{0}% + Meme slave, prisoner, submissive gender only improper animal: cannot breed or forbidden by precepts not human diff --git a/Languages/Korean/Keyed/RJW_Sexperience.xml b/Languages/Korean/Keyed/RJW_Sexperience.xml index a846b56..c12e6cb 100644 --- a/Languages/Korean/Keyed/RJW_Sexperience.xml +++ b/Languages/Korean/Keyed/RJW_Sexperience.xml @@ -2,10 +2,7 @@ RJW Sexperience - 음란함: x{0}% - 노예: x{0}% - 노예가 아님: x100% - 문화 요소: x{0}% + 문화 요소 노예, 죄수, 순종적인 성별만 가능합니다. 부적절한 동물: 번식할수 없거나 규율에의해 금지된 동물입니다. 사람이 아님 diff --git a/Languages/Russian/Keyed/RJW_Sexperience.xml b/Languages/Russian/Keyed/RJW_Sexperience.xml index 210fe8a..6d8bfbd 100644 --- a/Languages/Russian/Keyed/RJW_Sexperience.xml +++ b/Languages/Russian/Keyed/RJW_Sexperience.xml @@ -2,10 +2,7 @@ RJW Sexperience - Похоть: x{0}% - Раб: x{0}% - Не раб: x100% - Принцип идеологии: x{0}% + Принцип идеологии раб, заключенный, подчиненный только по полу неподходящее животное: не может размножаться или запрещено правилами не человек diff --git a/RJWSexperience/IdeologyAddon/Ideology/GoodwillSituationWorker_MemeCompatibility.cs b/RJWSexperience/IdeologyAddon/Ideology/GoodwillSituationWorker_MemeCompatibility.cs index 60cf8a9..a1c4f12 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/GoodwillSituationWorker_MemeCompatibility.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/GoodwillSituationWorker_MemeCompatibility.cs @@ -1,32 +1,24 @@ -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 class GoodwillSituationWorker_OneWayReceive : GoodwillSituationWorker_MemeCompatibility - { - public override int GetNaturalGoodwillOffset(Faction other) - { + public class GoodwillSituationWorker_OneWayReceive : GoodwillSituationWorker_MemeCompatibility + { + public override int GetNaturalGoodwillOffset(Faction other) + { + if (!Applies(other)) + return 0; + return def.naturalGoodwillOffset; + } - if (!Applies(other)) return 0; - return def.naturalGoodwillOffset; - } + protected bool Applies(Faction other) + { + Ideo primaryideo = Faction.OfPlayer.ideos?.PrimaryIdeo; + Ideo primaryideo2 = other.ideos?.PrimaryIdeo; + if (primaryideo == null || primaryideo2 == null) + return false; - protected bool Applies(Faction other) - { - Ideo primaryideo = Faction.OfPlayer.ideos?.PrimaryIdeo; - Ideo primaryideo2 = other.ideos?.PrimaryIdeo; - if (primaryideo == null || primaryideo2 == null) return false; - - return primaryideo.memes.Contains(def.meme) && !primaryideo2.memes.Contains(def.meme); - } - - - } + return primaryideo.memes.Contains(def.meme) && !primaryideo2.memes.Contains(def.meme); + } + } } diff --git a/RJWSexperience/IdeologyAddon/Ideology/IdeoUtility.cs b/RJWSexperience/IdeologyAddon/Ideology/IdeoUtility.cs index bb273ef..2334aec 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/IdeoUtility.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/IdeoUtility.cs @@ -19,20 +19,6 @@ namespace RJWSexperience.Ideology return false; } - public static bool ContainAll(string str, string[] tags) - { - if (tags.NullOrEmpty()) - return true; - - string lstr = str.ToLower(); - for (int i = 0; i < tags.Length; i++) - { - if (!lstr.Contains('[' + tags[i].ToLower() + ']')) - return false; - } - return true; - } - public static float GetPreceptsMtbMultiplier(Ideo ideo) where T : Precepts.DefExtension_ModifyMtb { float finalMultiplier = 1f; diff --git a/RJWSexperience/IdeologyAddon/Ideology/IssueUtility.cs b/RJWSexperience/IdeologyAddon/Ideology/IssueUtility.cs deleted file mode 100644 index ffa3955..0000000 --- a/RJWSexperience/IdeologyAddon/Ideology/IssueUtility.cs +++ /dev/null @@ -1,33 +0,0 @@ -using RimWorld; -using System.Collections.Generic; -using Verse; - -namespace RJWSexperience.Ideology -{ - public static class IssueUtility - { - private static readonly Dictionary> issuePrecepts = new Dictionary>(); - - public static List GetAllPrecepts(this IssueDef issue) - { - if (issuePrecepts.TryGetValue(issue, out List precepts)) - return precepts; - - precepts = DefDatabase.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; - } - } -} diff --git a/RJWSexperience/IdeologyAddon/Ideology/Keyed.cs b/RJWSexperience/IdeologyAddon/Ideology/Keyed.cs index 86f62b7..58c89cf 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Keyed.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Keyed.cs @@ -4,8 +4,7 @@ namespace RJWSexperience { public static class Keyed { - public static string MemeStatFactor(string value) => "MemeStatFactor".Translate(value); - + public static readonly string MemeStatFactor = "MemeStatFactor".Translate(); public static readonly string RSVictimCondition = "RSVictimCondition".Translate(); public static readonly string RSBreederCondition = "RSBreederCondition".Translate(); public static readonly string RSNotHuman = "RSNotHuman".Translate(); diff --git a/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch_ChancePerHour.cs b/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch_ChancePerHour.cs index 676a69f..8966120 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch_ChancePerHour.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch_ChancePerHour.cs @@ -14,7 +14,7 @@ namespace RJWSexperience.Ideology.Patches if (__result < 0f || pawn.Ideo == null) // ideo is null if don't have dlc return; - if (!VariousDefOf.RSI_SexWithAnimal.CreateEvent(pawn).DoerWillingToDo()) + if (!RsiHistoryEventDefOf.RSI_SexWithAnimal.CreateEvent(pawn).DoerWillingToDo()) { __result = -2f; return; @@ -31,7 +31,7 @@ namespace RJWSexperience.Ideology.Patches if (__result < 0f || pawn.Ideo == null) // ideo is null if don't have dlc return; - if (!VariousDefOf.RSI_Raped.CreateEvent(pawn).DoerWillingToDo()) + if (!RsiHistoryEventDefOf.RSI_Raped.CreateEvent(pawn).DoerWillingToDo()) { __result = -2f; return; @@ -47,7 +47,7 @@ namespace RJWSexperience.Ideology.Patches if (__result < 0f || pawn.Ideo == null) // ideo is null if don't have dlc return; - if (!VariousDefOf.RSI_SexWithCorpse.CreateEvent(pawn).DoerWillingToDo()) + if (!RsiHistoryEventDefOf.RSI_SexWithCorpse.CreateEvent(pawn).DoerWillingToDo()) { __result = -2f; return; diff --git a/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch_Ideo.cs b/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch_Ideo.cs index 0aa344a..52a7970 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch_Ideo.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Patches/RJW_Patch_Ideo.cs @@ -10,7 +10,7 @@ using Verse; namespace RJWSexperience.Ideology.Patches { - [HarmonyPatch(typeof(xxx), "is_rapist")] + [HarmonyPatch(typeof(xxx), nameof(xxx.is_rapist))] public static class RJW_Patch_is_rapist { public static void Postfix(Pawn pawn, ref bool __result) @@ -23,7 +23,7 @@ namespace RJWSexperience.Ideology.Patches } } - [HarmonyPatch(typeof(xxx), "is_zoophile")] + [HarmonyPatch(typeof(xxx), nameof(xxx.is_zoophile))] public static class RJW_Patch_is_zoophile { public static void Postfix(Pawn pawn, ref bool __result) @@ -36,7 +36,7 @@ namespace RJWSexperience.Ideology.Patches } } - [HarmonyPatch(typeof(xxx), "is_necrophiliac")] + [HarmonyPatch(typeof(xxx), nameof(xxx.is_necrophiliac))] public static class RJW_Patch_is_necrophiliac { public static void Postfix(Pawn pawn, ref bool __result) @@ -92,17 +92,17 @@ namespace RJWSexperience.Ideology.Patches public static void AfterSexHuman(Pawn human, Pawn partner, bool rape) { - VariousDefOf.RSI_NonIncestuosSex.RecordEventWithPartner(human, partner); - VariousDefOf.RSI_NonIncestuosSex.RecordEventWithPartner(partner, human); + RsiHistoryEventDefOf.RSI_NonIncestuosSex.RecordEventWithPartner(human, partner); + RsiHistoryEventDefOf.RSI_NonIncestuosSex.RecordEventWithPartner(partner, human); if (partner.IsAnimal()) { - VariousDefOf.RSI_SexWithAnimal.RecordEventWithPartner(human, partner); + RsiHistoryEventDefOf.RSI_SexWithAnimal.RecordEventWithPartner(human, partner); } else if (xxx.is_human(partner) && rape) { - VariousDefOf.RSI_Raped.RecordEventWithPartner(human, partner); - VariousDefOf.RSI_WasRaped.RecordEventWithPartner(partner, human); + RsiHistoryEventDefOf.RSI_Raped.RecordEventWithPartner(human, partner); + RsiHistoryEventDefOf.RSI_WasRaped.RecordEventWithPartner(partner, human); } } @@ -168,7 +168,7 @@ namespace RJWSexperience.Ideology.Patches } } - [HarmonyPatch(typeof(PawnDesignations_Breedee), "UpdateCanDesignateBreeding")] + [HarmonyPatch(typeof(PawnDesignations_Breedee), nameof(PawnDesignations_Breedee.UpdateCanDesignateBreeding))] public static class RJW_Patch_UpdateCanDesignateBreeding { public static void Postfix(Pawn pawn, ref bool __result) @@ -182,7 +182,7 @@ namespace RJWSexperience.Ideology.Patches } } - [HarmonyPatch(typeof(PawnDesignations_Comfort), "UpdateCanDesignateComfort")] + [HarmonyPatch(typeof(PawnDesignations_Comfort), nameof(PawnDesignations_Comfort.UpdateCanDesignateComfort))] public static class RJW_PatchUpdateCanDesignateComfort { public static void Postfix(Pawn pawn, ref bool __result) @@ -195,18 +195,46 @@ namespace RJWSexperience.Ideology.Patches } } - [HarmonyPatch(typeof(Hediff_BasePregnancy), "PostBirth")] + [HarmonyPatch(typeof(Hediff_BasePregnancy), nameof(Hediff_BasePregnancy.PostBirth))] public static class RJW_Patch_PostBirth { - public static void Postfix(Pawn mother, Pawn father, Pawn baby) + public static void Postfix(Pawn mother, Pawn baby) { if (!mother.IsAnimal()) { Faction faction = baby.GetFactionUsingPrecept(out Ideo ideo); - if (baby.Faction != faction) baby.SetFaction(faction); + if (baby.Faction != faction) + baby.SetFaction(faction); + baby.ideo?.SetIdeo(ideo); - if (baby.Faction == Find.FactionManager.OfPlayer && !baby.IsSlave) baby.guest?.SetGuestStatus(null, GuestStatus.Guest); + + if (baby.Faction == Find.FactionManager.OfPlayer && !baby.IsSlave) + baby.guest?.SetGuestStatus(null, GuestStatus.Guest); } } + + private static Faction GetFactionUsingPrecept(this Pawn baby, out Ideo ideo) + { + Faction playerfaction = Find.FactionManager.OfPlayer; + Ideo mainideo = playerfaction.ideos.PrimaryIdeo; + if (mainideo != null) + { + if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysFather)) + { + Pawn parent = baby.GetFather() ?? baby.GetMother(); + + ideo = parent.Ideo; + return parent.Faction; + } + else if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysColony)) + { + ideo = mainideo; + return playerfaction; + } + } + Pawn mother = baby.GetMother(); + ideo = mother?.Ideo; + return mother?.Faction ?? baby.Faction; + } } } diff --git a/RJWSexperience/IdeologyAddon/Ideology/Patches/Rimworld_Patch.cs b/RJWSexperience/IdeologyAddon/Ideology/Patches/Rimworld_Patch.cs index 81666d3..6fd75dc 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Patches/Rimworld_Patch.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Patches/Rimworld_Patch.cs @@ -7,31 +7,29 @@ using Verse; namespace RJWSexperience.Ideology.Patches { - [HarmonyPatch(typeof(MarriageCeremonyUtility), "Married")] + [HarmonyPatch(typeof(MarriageCeremonyUtility), nameof(MarriageCeremonyUtility.Married))] public static class Rimworld_Patch_Marriage { public static void Postfix(Pawn firstPawn, Pawn secondPawn) { - VariousDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(firstPawn, secondPawn); - VariousDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(secondPawn, firstPawn); + RsiHistoryEventDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(firstPawn, secondPawn); + RsiHistoryEventDefOf.RSI_NonIncestuosMarriage.RecordEventWithPartner(secondPawn, firstPawn); } } [HarmonyPatch(typeof(RitualOutcomeEffectWorker_FromQuality), "GiveMemoryToPawn")] - public static class Rimworld_Patch_GiveMemoryToPawn + public static class Rimworld_Patch_RitualOutcome_DontGiveMemoryToAnimals { - public static bool Prefix(Pawn pawn, ThoughtDef memory, LordJob_Ritual jobRitual) + public static bool Prefix(Pawn pawn) { - if (pawn.IsAnimal()) return false; - - return true; + return !pawn.IsAnimal(); } } - [HarmonyPatch(typeof(IdeoFoundation), "CanAdd")] + [HarmonyPatch(typeof(IdeoFoundation), nameof(IdeoFoundation.CanAdd))] public static class Rimworld_Patch_IdeoFoundation { - public static void Postfix(PreceptDef precept, bool checkDuplicates, ref IdeoFoundation __instance, ref AcceptanceReport __result) + public static void Postfix(PreceptDef precept, ref IdeoFoundation __instance, ref AcceptanceReport __result) { DefExtension_MultipleMemesRequired extension = precept.GetModExtension(); diff --git a/RJWSexperience/IdeologyAddon/Ideology/Patches/Sexperience_Patch.cs b/RJWSexperience/IdeologyAddon/Ideology/Patches/Sexperience_Patch.cs index f1df465..7fb0e87 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/Patches/Sexperience_Patch.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/Patches/Sexperience_Patch.cs @@ -10,11 +10,11 @@ namespace RJWSexperience.Ideology.Patches const int femaleAfterSurgery = 1; if (props.isRape && exVirgin == props.partner) - VariousDefOf.RSI_VirginStolen.RecordEventWithPartner(exVirgin, partner); + RsiHistoryEventDefOf.RSI_VirginStolen.RecordEventWithPartner(exVirgin, partner); else if (degree != femaleAfterSurgery) - VariousDefOf.RSI_VirginTaken.RecordEventWithPartner(exVirgin, partner); + RsiHistoryEventDefOf.RSI_VirginTaken.RecordEventWithPartner(exVirgin, partner); - VariousDefOf.RSI_TookVirgin.RecordEventWithPartner(partner, exVirgin); + RsiHistoryEventDefOf.RSI_TookVirgin.RecordEventWithPartner(partner, exVirgin); } } } diff --git a/RJWSexperience/IdeologyAddon/Ideology/RJWUtility_Ideo.cs b/RJWSexperience/IdeologyAddon/Ideology/RJWUtility_Ideo.cs index 8efc34f..b172a6d 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/RJWUtility_Ideo.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/RJWUtility_Ideo.cs @@ -42,29 +42,5 @@ namespace RJWSexperience.Ideology return new HistoryEvent(def, pawn.Named(HistoryEventArgsNames.Doer), partner.Named(ArgsNamesCustom.Partner)); } - - public static Faction GetFactionUsingPrecept(this Pawn baby, out Ideo ideo) - { - Faction playerfaction = Find.FactionManager.OfPlayer; - Ideo mainideo = playerfaction.ideos.PrimaryIdeo; - if (mainideo != null) - { - if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysFather)) - { - Pawn parent = baby.GetFather() ?? baby.GetMother(); - - ideo = parent.Ideo; - return parent.Faction; - } - else if (mainideo.HasPrecept(VariousDefOf.BabyFaction_AlwaysColony)) - { - ideo = mainideo; - return playerfaction; - } - } - Pawn mother = baby.GetMother(); - ideo = mother?.Ideo; - return mother?.Faction ?? baby.Faction; - } } } diff --git a/RJWSexperience/IdeologyAddon/Ideology/RsiHistoryEventDefOf.cs b/RJWSexperience/IdeologyAddon/Ideology/RsiHistoryEventDefOf.cs new file mode 100644 index 0000000..05f6e53 --- /dev/null +++ b/RJWSexperience/IdeologyAddon/Ideology/RsiHistoryEventDefOf.cs @@ -0,0 +1,20 @@ +using RimWorld; +using Verse; + +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_WasRaped; + [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; + } +} diff --git a/RJWSexperience/IdeologyAddon/Ideology/StatParts.cs b/RJWSexperience/IdeologyAddon/Ideology/StatParts.cs index a01b214..50b1794 100644 --- a/RJWSexperience/IdeologyAddon/Ideology/StatParts.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/StatParts.cs @@ -1,5 +1,4 @@ using RimWorld; -using System; using System.Diagnostics.CodeAnalysis; using Verse; @@ -15,28 +14,7 @@ namespace RJWSexperience.Ideology if (!req.HasThing || !(req.Thing is Pawn pawn)) return null; - Ideo ideo = pawn.Ideo; - float fact = 1f; - if (ideo?.memes.NullOrEmpty() == false) - { - for (int i = 0; i < ideo.memes.Count; i++) - { - if (ideo.memes[i] == MemeDefOf.MaleSupremacy) - { - if (pawn.gender == Gender.Male) fact = modifier; - else if (pawn.gender == Gender.Female) fact = 1 / modifier; - break; - } - else if (ideo.memes[i] == MemeDefOf.FemaleSupremacy) - { - if (pawn.gender == Gender.Male) fact = 1 / modifier; - else if (pawn.gender == Gender.Female) fact = modifier; - break; - } - } - } - - return Keyed.MemeStatFactor(String.Format("{0:0.##}", fact * 100)); + return $"{Keyed.MemeStatFactor}: x{GetModifier(pawn).ToStringPercent()}"; } public override void TransformValue(StatRequest req, ref float val) @@ -44,26 +22,22 @@ namespace RJWSexperience.Ideology if (!req.HasThing || !(req.Thing is Pawn pawn)) return; - Ideo ideo = pawn.Ideo; + val *= GetModifier(pawn); + } - if (ideo?.memes.NullOrEmpty() == false) - { - for (int i = 0; i < ideo.memes.Count; i++) - { - if (ideo.memes[i] == MemeDefOf.MaleSupremacy) - { - if (pawn.gender == Gender.Male) val *= modifier; - else if (pawn.gender == Gender.Female) val /= modifier; - break; - } - else if (ideo.memes[i] == MemeDefOf.FemaleSupremacy) - { - if (pawn.gender == Gender.Male) val /= modifier; - else if (pawn.gender == Gender.Female) val *= modifier; - break; - } - } - } + private float GetModifier(Pawn pawn) + { + if (pawn.Ideo == null) + return 1f; + + Gender supremeGender = pawn.Ideo.SupremeGender; + + if (pawn.gender == supremeGender) + return modifier; + else if (pawn.gender == supremeGender.Opposite()) + return 1f / modifier; + + return 1f; } } } diff --git a/RJWSexperience/IdeologyAddon/VariousDefOf.cs b/RJWSexperience/IdeologyAddon/Ideology/VariousDefOf.cs similarity index 57% rename from RJWSexperience/IdeologyAddon/VariousDefOf.cs rename to RJWSexperience/IdeologyAddon/Ideology/VariousDefOf.cs index e80efab..8d1f5a4 100644 --- a/RJWSexperience/IdeologyAddon/VariousDefOf.cs +++ b/RJWSexperience/IdeologyAddon/Ideology/VariousDefOf.cs @@ -16,15 +16,6 @@ namespace RJWSexperience.Ideology [MayRequireIdeology] public static readonly MemeDef Zoophile; [MayRequireIdeology] public static readonly MemeDef Rapist; [MayRequireIdeology] public static readonly MemeDef Necrophile; - [MayRequireIdeology] public static readonly HistoryEventDef RSI_SexWithAnimal; - [MayRequireIdeology] public static readonly HistoryEventDef RSI_Raped; - [MayRequireIdeology] public static readonly HistoryEventDef RSI_WasRaped; - [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 PreceptDef Bestiality_OnlyVenerated; [MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysFather; [MayRequireIdeology] public static readonly PreceptDef BabyFaction_AlwaysColony; diff --git a/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj b/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj index bc76a0e..9c192ee 100644 --- a/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj +++ b/RJWSexperience/IdeologyAddon/IdeologyAddon.csproj @@ -50,9 +50,9 @@ - + @@ -83,7 +83,7 @@ - +