code
stringlengths
0
56.1M
repo_name
stringlengths
3
57
path
stringlengths
2
176
language
stringclasses
672 values
license
stringclasses
8 values
size
int64
0
56.8M
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.DefModExtensions { public class GenitalPartExtension : DefModExtension { public GenitalFamily family = default; public List<GenitalTag> tags = new(); public static bool TryGet(Hediff hed, out GenitalPartExtension ext) => TryGet(hed?.def, out ext); public static bool TryGet(HediffDef def, out GenitalPartExtension ext) { ext = def?.GetModExtension<GenitalPartExtension>(); return ext is not null; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/DefModExtensions/GenitalPartExtension.cs
C#
mit
672
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Defs.DefFragment; using rjw.Modules.Interactions.Enums; using System; using System.Collections.Generic; using System.Linq; using Verse; namespace rjw.Modules.Interactions.DefModExtensions { public class InteractionSelectorExtension : DefModExtension { public List<RulePackDef> rulepacks = new List<RulePackDef>(); public List<InteractionTag> tags = new List<InteractionTag>(); public InteractionRequirement dominantRequirement; public InteractionRequirement submissiveRequirement; public string customRequirementHandler; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/DefModExtensions/InteractionSelectorExtension.cs
C#
mit
610
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Shared.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Defs.DefFragment { public class InteractionRequirement { //Default = false public bool hand = false; public bool tail = false; public bool foot = false; public bool mouth = false; public bool beak = false; public bool mouthORbeak = false; public bool oral = false; public bool tongue = false; ///<summary>Default = 1</summary> public Nullable<int> minimumCount = 1; ///<summary>Default = 1</summary> ///@ed86 - nullables are good for you ! don't use default values :b public Nullable<float> minimumSeverity; //Default = empty public List<string> partProps = new List<string>(); //Default = empty public List<GenitalTag> tags = new List<GenitalTag>(); //Default = empty public List<GenitalFamily> families = new List<GenitalFamily>(); //Default = PawnState.Healthy public List<PawnState> pawnStates = new List<PawnState>(); //overrides - edging, spanking? //public bool canOrgasm = true; // true - orgasm satisfy need, false - ruin orgasm/ dont satisfy need //public bool canCum = true; // orgasm with cum effects -semen, pregnancy etc //public float Sensetivity = 1.0f; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Defs/DefFragment/InteractionRequirement.cs
C#
mit
1,398
using RimWorld; using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Defs { public class InteractionDefOf { public static IList<InteractionWithExtension> Interactions { get; set; } public static InteractionWithExtension DefaultConsensualSex => Interactions .Where(e => e.Interaction.defName == "Sex_Vaginal") .FirstOrDefault(); public static InteractionWithExtension DefaultWhoringSex => Interactions .Where(e => e.Interaction.defName == "Sex_Vaginal") .FirstOrDefault(); public static InteractionWithExtension DefaultRapeSex => Interactions .Where(e => e.Interaction.defName == "Rape_Vaginal") .FirstOrDefault(); public static InteractionWithExtension DefaultMechImplantSex => Interactions .Where(e => e.Interaction.defName == "Rape_MechImplant") .FirstOrDefault(); public static InteractionWithExtension DefaultNecrophiliaSex => Interactions .Where(e => e.Interaction.defName == "Rape_Vaginal") .FirstOrDefault(); public static InteractionWithExtension DefaultBestialitySex => Interactions .Where(e => e.Interaction.defName == "Bestiality_Vaginal") .FirstOrDefault(); public static InteractionWithExtension DefaultAnimalSex => Interactions .Where(e => e.Interaction.defName == "Bestiality_Vaginal") .FirstOrDefault(); static InteractionDefOf() { Interactions = DefDatabase<InteractionDef>.AllDefs .Where(def => def.HasModExtension<InteractionSelectorExtension>()) .Where(def => def.HasModExtension<InteractionExtension>()) .Select(def => new InteractionWithExtension { Interaction = def, Extension = def.GetModExtension<InteractionExtension>(), SelectorExtension = def.GetModExtension<InteractionSelectorExtension>() }) .Where(defWithExtensions => ParseHelper.FromString<xxx.rjwSextype>(defWithExtensions.Extension.rjwSextype) != xxx.rjwSextype.None) .ToList(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Defs/InteractionDefOf.cs
C#
mit
2,094
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Enums { public enum GenitalFamily { Vagina, Penis, Breasts, Udders, Anus, FemaleOvipositor, MaleOvipositor } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Enums/GenitalFamily.cs
C#
mit
283
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Enums { public enum GenitalTag { CanPenetrate, CanBePenetrated, CanFertilize, CanBeFertilized, CanEgg, CanFertilizeEgg, CanLactate } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Enums/GenitalTag.cs
C#
mit
307
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Enums { public enum InteractionTag { Reverse, Fertilization, EggFertilization, EggLaying, Masturbation, Rape, Whoring, Consensual, Bestiality, Necrophilia, Animal, MechImplant } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Enums/InteractionTag.cs
C#
mit
364
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Enums { public enum InteractionType { Masturbation, Consensual, Whoring, Rape, Bestiality, Animal, Necrophilia, Mechanoid } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Enums/InteractionType.cs
C#
mit
300
namespace rjw.Modules.Interactions.Enums { public enum LewdablePartKind { Unsupported, Penis, Vagina, Anus, FemaleOvipositor, MaleOvipositor, Breasts, Udders, Hand, Foot, Tail, Mouth, Beak, Tongue } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Enums/LewdablePartKind.cs
C#
mit
237
using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared.Logs; using System.Text; using Verse; namespace rjw.Modules.Interactions.Exposable { public class HediffWithExtensionExposable : IExposable { private static ILog _log = LogManager.GetLogger<HediffWithExtensionExposable>(); public Hediff hediff; public GenitalPartExtension GenitalPart { get { return hediff.def.GetModExtension<GenitalPartExtension>(); } } public PartProps PartProps { get { return hediff.def.GetModExtension<PartProps>(); } } public void ExposeData() { Scribe_References.Look(ref hediff, nameof(hediff)); } public static HediffWithExtension Convert(HediffWithExtensionExposable self) { _log.Debug(self.ToString()); return new HediffWithExtension() { Hediff = self.hediff, GenitalPart = self.GenitalPart, PartProps = self.PartProps }; } public static HediffWithExtensionExposable Convert(HediffWithExtension self) { return new HediffWithExtensionExposable() { hediff = self.Hediff }; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"{nameof(hediff)} = {hediff?.def.defName}"); return stringBuilder.ToString(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Exposable/HediffWithExtensionExposable.cs
C#
mit
1,347
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Verse; namespace rjw.Modules.Interactions.Exposable { public class InteractionExposable : IExposable { private static ILog _log = LogManager.GetLogger<InteractionExposable>(); private InteractionType interactionType; private bool isReverse; private InteractionPawnExposable initiator; private InteractionPawnExposable receiver; private InteractionWithExtensionExposable interactionWithExtension; private RulePackDef rulePack; private xxx.rjwSextype RjwSexType { get { return ParseHelper.FromString<xxx.rjwSextype>(interactionWithExtension.Extension.rjwSextype); } } private List<RJWLewdablePartExposable> selectedDominantParts_RJW; private List<VanillaLewdablePartExposable> selectedDominantParts_Vanilla; private List<RJWLewdablePartExposable> selectedSubmissiveParts_RJW; private List<VanillaLewdablePartExposable> selectedSubmissiveParts_Vanilla; public void ExposeData() { Scribe_Values.Look(ref interactionType, nameof(interactionType)); Scribe_Values.Look(ref isReverse, nameof(isReverse)); Scribe_Deep.Look(ref initiator, nameof(initiator)); Scribe_Deep.Look(ref receiver, nameof(receiver)); Scribe_Deep.Look(ref interactionWithExtension, nameof(interactionWithExtension)); Scribe_Defs.Look(ref rulePack, nameof(rulePack)); Scribe_Collections.Look(ref selectedDominantParts_RJW, nameof(selectedDominantParts_RJW)); Scribe_Collections.Look(ref selectedDominantParts_Vanilla, nameof(selectedDominantParts_Vanilla)); Scribe_Collections.Look(ref selectedSubmissiveParts_RJW, nameof(selectedSubmissiveParts_RJW)); Scribe_Collections.Look(ref selectedSubmissiveParts_Vanilla, nameof(selectedSubmissiveParts_Vanilla)); } public static Interaction Convert(InteractionExposable toCast) { return new Interaction() { InteractionType = toCast.interactionType, Initiator = InteractionPawnExposable.Convert(toCast.initiator), Receiver = InteractionPawnExposable.Convert(toCast.receiver), Dominant = InteractionPawnExposable.Convert(toCast.initiator), Submissive = InteractionPawnExposable.Convert(toCast.receiver), InteractionDef = InteractionWithExtensionExposable.Convert(toCast.interactionWithExtension), RjwSexType = toCast.RjwSexType, RulePack = toCast.rulePack, SelectedDominantParts = Enumerable.Concat( toCast.selectedDominantParts_RJW.Select(RJWLewdablePartExposable.Convert).OfType<ILewdablePart>(), toCast.selectedDominantParts_Vanilla.Select(VanillaLewdablePartExposable.Convert).OfType<ILewdablePart>() ).ToList(), SelectedSubmissiveParts = Enumerable.Concat( toCast.selectedSubmissiveParts_RJW.Select(RJWLewdablePartExposable.Convert).OfType<ILewdablePart>(), toCast.selectedSubmissiveParts_Vanilla.Select(VanillaLewdablePartExposable.Convert).OfType<ILewdablePart>() ).ToList() }; } public static InteractionExposable Convert(Interaction toCast) { return new InteractionExposable() { interactionType = toCast.InteractionType, initiator = InteractionPawnExposable.Convert(toCast.Initiator), receiver = InteractionPawnExposable.Convert(toCast.Receiver), interactionWithExtension = InteractionWithExtensionExposable.Convert(toCast.InteractionDef), rulePack = toCast.RulePack, selectedDominantParts_RJW = toCast.SelectedDominantParts .OfType<RJWLewdablePart>() .Select(RJWLewdablePartExposable.Convert) .ToList(), selectedDominantParts_Vanilla = toCast.SelectedDominantParts .OfType<VanillaLewdablePart>() .Select(VanillaLewdablePartExposable.Convert) .ToList(), selectedSubmissiveParts_RJW = toCast.SelectedDominantParts .OfType<RJWLewdablePart>() .Select(RJWLewdablePartExposable.Convert) .ToList(), selectedSubmissiveParts_Vanilla = toCast.SelectedDominantParts .OfType<VanillaLewdablePart>() .Select(VanillaLewdablePartExposable.Convert) .ToList() }; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"{nameof(interactionType)} = {interactionType}"); stringBuilder.AppendLine($"{nameof(initiator)} = {initiator?.pawn.GetName()}"); stringBuilder.AppendLine($"{nameof(receiver)} = {receiver?.pawn.GetName()}"); stringBuilder.AppendLine($"{nameof(interactionWithExtension)} = {interactionWithExtension?.interactionDef.defName}"); stringBuilder.AppendLine($"{nameof(rulePack)} = {rulePack?.defName}"); return stringBuilder.ToString(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Exposable/InteractionExposable.cs
C#
mit
4,837
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using Verse; namespace rjw.Modules.Interactions.Exposable { public class InteractionPawnExposable : IExposable { private static ILog _log = LogManager.GetLogger<InteractionPawnExposable>(); public Pawn pawn; public List<BodyPartRecord> mouths; public List<BodyPartRecord> beaks; public List<BodyPartRecord> tongues; public List<BodyPartRecord> hands; public List<BodyPartRecord> tails; public List<HediffWithExtensionExposable> penises; public List<HediffWithExtensionExposable> vaginas; public List<HediffWithExtensionExposable> breasts; public List<HediffWithExtensionExposable> udders; public List<HediffWithExtensionExposable> anuses; public List<HediffWithExtensionExposable> femaleOvipositors; public List<HediffWithExtensionExposable> maleOvipositors; public List<LewdablePartKind> blockedParts; public Dictionary<LewdablePartKind, float> partPreferences; public void ExposeData() { Scribe_References.Look(ref pawn, nameof(pawn)); Scribe_Collections.Look(ref beaks, nameof(beaks), LookMode.BodyPart); Scribe_Collections.Look(ref mouths, nameof(mouths), LookMode.BodyPart); Scribe_Collections.Look(ref tongues, nameof(tongues), LookMode.BodyPart); Scribe_Collections.Look(ref hands, nameof(hands), LookMode.BodyPart); Scribe_Collections.Look(ref tails, nameof(tails), LookMode.BodyPart); Scribe_Collections.Look(ref penises, nameof(penises), LookMode.Deep); Scribe_Collections.Look(ref vaginas, nameof(vaginas), LookMode.Deep); Scribe_Collections.Look(ref breasts, nameof(breasts), LookMode.Deep); Scribe_Collections.Look(ref udders, nameof(udders), LookMode.Deep); Scribe_Collections.Look(ref anuses, nameof(anuses), LookMode.Deep); Scribe_Collections.Look(ref femaleOvipositors, nameof(femaleOvipositors), LookMode.Deep); Scribe_Collections.Look(ref maleOvipositors, nameof(maleOvipositors), LookMode.Deep); Scribe_Collections.Look(ref blockedParts, nameof(blockedParts), LookMode.Value); Scribe_Collections.Look(ref partPreferences, nameof(partPreferences), LookMode.Value, LookMode.Value); } public static InteractionPawn Convert(InteractionPawnExposable toCast) { return new InteractionPawn() { Pawn = toCast.pawn, Parts = new SexablePawnParts() { Mouths = toCast.mouths, Beaks = toCast.beaks, Tongues = toCast.tongues, Hands = toCast.hands, Tails = toCast.tails, Penises = toCast.penises.Select(HediffWithExtensionExposable.Convert).ToList(), Vaginas = toCast.vaginas.Select(HediffWithExtensionExposable.Convert).ToList(), Breasts = toCast.breasts.Select(HediffWithExtensionExposable.Convert).ToList(), Udders = toCast.udders.Select(HediffWithExtensionExposable.Convert).ToList(), Anuses = toCast.anuses.Select(HediffWithExtensionExposable.Convert).ToList(), FemaleOvipositors = toCast.femaleOvipositors.Select(HediffWithExtensionExposable.Convert).ToList(), MaleOvipositors = toCast.maleOvipositors.Select(HediffWithExtensionExposable.Convert).ToList(), }, BlockedParts = toCast.blockedParts, PartPreferences = toCast.partPreferences }; } public static InteractionPawnExposable Convert(InteractionPawn toCast) { return new InteractionPawnExposable() { pawn = toCast.Pawn, mouths = toCast.Parts.Mouths.ToList(), beaks = toCast.Parts.Beaks.ToList(), tongues = toCast.Parts.Tongues.ToList(), hands = toCast.Parts.Hands.ToList(), tails = toCast.Parts.Tails.ToList(), penises = toCast.Parts.Penises.Select(HediffWithExtensionExposable.Convert).ToList(), vaginas = toCast.Parts.Vaginas.Select(HediffWithExtensionExposable.Convert).ToList(), breasts = toCast.Parts.Breasts.Select(HediffWithExtensionExposable.Convert).ToList(), udders = toCast.Parts.Udders.Select(HediffWithExtensionExposable.Convert).ToList(), anuses = toCast.Parts.Anuses.Select(HediffWithExtensionExposable.Convert).ToList(), femaleOvipositors = toCast.Parts.FemaleOvipositors.Select(HediffWithExtensionExposable.Convert).ToList(), maleOvipositors = toCast.Parts.MaleOvipositors.Select(HediffWithExtensionExposable.Convert).ToList(), blockedParts = toCast.BlockedParts.ToList(), partPreferences = toCast.PartPreferences.ToDictionary(e => e.Key, e => e.Value) }; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"{nameof(pawn)} = {pawn.GetName()}"); stringBuilder.AppendLine($"{nameof(blockedParts)} = {String.Join("/", blockedParts)}"); stringBuilder.AppendLine($"{nameof(partPreferences)} = {String.Join("/", partPreferences.Select(e => $"{e.Key}-{e.Value}"))}"); return stringBuilder.ToString(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Exposable/InteractionPawnExposable.cs
C#
mit
4,984
using RimWorld; using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared.Logs; using System.Text; using Verse; namespace rjw.Modules.Interactions.Exposable { public class InteractionWithExtensionExposable : IExposable { private static ILog _log = LogManager.GetLogger<InteractionWithExtensionExposable>(); public InteractionDef interactionDef; public InteractionSelectorExtension InteractionSelectorExtension { get { return interactionDef.GetModExtension<InteractionSelectorExtension>(); } } public InteractionExtension Extension { get { return interactionDef.GetModExtension<InteractionExtension>(); } } public void ExposeData() { Scribe_Defs.Look(ref interactionDef, nameof(interactionDef)); } public static InteractionWithExtension Convert(InteractionWithExtensionExposable toCast) { return new InteractionWithExtension() { Interaction = toCast.interactionDef, Extension = toCast.Extension, SelectorExtension = toCast.InteractionSelectorExtension }; } public static InteractionWithExtensionExposable Convert(InteractionWithExtension toCast) { return new InteractionWithExtensionExposable() { interactionDef = toCast.Interaction }; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"{nameof(interactionDef)} = {interactionDef?.defName}"); return stringBuilder.ToString(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Exposable/InteractionWithExtensionExposable.cs
C#
mit
1,528
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects.Parts; using rjw.Modules.Shared.Logs; using System.Collections.Generic; using System.Text; using Verse; namespace rjw.Modules.Interactions.Exposable { public class RJWLewdablePartExposable : IExposable { private static ILog _log = LogManager.GetLogger<RJWLewdablePartExposable>(); public HediffWithExtensionExposable hediff; public LewdablePartKind partKind; public float Size => hediff.hediff.Severity; public IList<string> Props => hediff.PartProps?.props ?? new(); public void ExposeData() { Scribe_Deep.Look(ref hediff, nameof(hediff)); Scribe_Values.Look(ref partKind, nameof(partKind)); } public static RJWLewdablePart Convert(RJWLewdablePartExposable toCast) { return new RJWLewdablePart( HediffWithExtensionExposable.Convert(toCast.hediff), toCast.partKind ); } public static RJWLewdablePartExposable Convert(RJWLewdablePart toCast) { return new RJWLewdablePartExposable() { hediff = HediffWithExtensionExposable.Convert(toCast.Hediff), partKind = toCast.PartKind }; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"{nameof(partKind)} = {partKind}"); return stringBuilder.ToString(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Exposable/RJWLewdablePartExposable.cs
C#
mit
1,340
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects.Parts; using rjw.Modules.Shared.Logs; using System.Text; using Verse; namespace rjw.Modules.Interactions.Exposable { public class VanillaLewdablePartExposable : IExposable { private static ILog _log = LogManager.GetLogger<VanillaLewdablePartExposable>(); public Pawn pawn; public BodyPartRecord part; public LewdablePartKind partKind; public void ExposeData() { Scribe_References.Look(ref pawn, nameof(pawn)); Scribe_BodyParts.Look(ref part, nameof(part)); Scribe_Values.Look(ref partKind, nameof(partKind)); } public static VanillaLewdablePart Convert(VanillaLewdablePartExposable toCast) { return new VanillaLewdablePart( toCast.pawn, toCast.part, toCast.partKind ); } public static VanillaLewdablePartExposable Convert(VanillaLewdablePart toCast) { return new VanillaLewdablePartExposable() { pawn = toCast.Owner, part = toCast.Part, partKind = toCast.PartKind }; } public override string ToString() { StringBuilder stringBuilder = new StringBuilder(); stringBuilder.AppendLine($"{nameof(partKind)} = {partKind}"); return stringBuilder.ToString(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Exposable/VanillaLewdablePartExposable.cs
C#
mit
1,242
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; namespace rjw.Modules.Interactions.Extensions { public static class EnumerableExtensions { public static IEnumerable<ILewdablePart> FilterSeverity(this IEnumerable<ILewdablePart> self, Nullable<float> severity) { IEnumerable<ILewdablePart> result = self; if (severity.HasValue == true) { result = Enumerable.Union( result.Where(e => e is VanillaLewdablePart), result.Where(e => e is RJWLewdablePart) .Where(e => (e as RJWLewdablePart).Hediff.Hediff.Severity >= severity.Value) ); } foreach (ILewdablePart part in result) { yield return part; } } public static IEnumerable<ILewdablePart> WithPartKind(this IEnumerable<ILewdablePart> self, LewdablePartKind partKind) { return self .Where(e => e.PartKind == partKind); } public static IEnumerable<ILewdablePart> WithPartTag(this IEnumerable<ILewdablePart> self, GenitalTag tag) { return self .OfType<RJWLewdablePart>() .Where(e => e.Hediff.GenitalPart.tags.Contains(tag)); } public static IEnumerable<ILewdablePart> WithPartKindAndTag(this IEnumerable<ILewdablePart> self, LewdablePartKind partKind, GenitalTag tag) { return self .WithPartKind(partKind) .WithPartTag(tag); } public static bool HasPartKind(this IEnumerable<ILewdablePart> self, LewdablePartKind partKind) { return self .WithPartKind(partKind) .Any(); } public static bool HasPartTag(this IEnumerable<ILewdablePart> self, GenitalTag tag) { return self .WithPartTag(tag) .Any(); } public static bool HasPartKindAndTag(this IEnumerable<ILewdablePart> self, LewdablePartKind partKind, GenitalTag tag) { return self .WithPartKindAndTag(partKind, tag) .Any(); } public static IEnumerable<HediffWithExtension> BigBreasts(this IEnumerable<HediffWithExtension> self) { if (self == null) { return null; } return self .Where(e => e.GenitalPart.family == GenitalFamily.Breasts) .Where(e => e.Hediff.CurStageIndex >= 1); } public static bool HasBigBreasts(this IEnumerable<HediffWithExtension> self) { if (self == null) { return false; } return self .BigBreasts() .Any(); } public static HediffWithExtension Largest(this IEnumerable<HediffWithExtension> self) { if (self == null) { return null; } return self .OrderByDescending(e => e.Hediff.Severity) .FirstOrDefault(); } public static HediffWithExtension Smallest(this IEnumerable<HediffWithExtension> self) { if (self == null) { return null; } return self .OrderBy(e => e.Hediff.Severity) .FirstOrDefault(); } public static HediffWithExtension GetBestSizeAppropriate(this IEnumerable<HediffWithExtension> self, HediffWithExtension toFit) { if (self == null) { return null; } return self .OrderBy(e => Mathf.Abs(e.Hediff.Severity - toFit.Hediff.Severity)) .FirstOrDefault(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Extensions/EnumerableExtensions.cs
C#
mit
3,220
using rjw.Modules.Interactions.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Extensions { public static class GenitalFamilyExtension { public static LewdablePartKind ToPartKind(this GenitalFamily self) { switch (self) { case GenitalFamily.Vagina: return LewdablePartKind.Vagina; case GenitalFamily.Penis: return LewdablePartKind.Penis; case GenitalFamily.Breasts: return LewdablePartKind.Breasts; case GenitalFamily.Udders: return LewdablePartKind.Udders; case GenitalFamily.Anus: return LewdablePartKind.Anus; case GenitalFamily.FemaleOvipositor: return LewdablePartKind.FemaleOvipositor; case GenitalFamily.MaleOvipositor: return LewdablePartKind.MaleOvipositor; default: return LewdablePartKind.Unsupported; } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Extensions/GenitalFamilyExtension.cs
C#
mit
925
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Extensions { public static class HediffWithGenitalPartExtentions { //Vanilla public static IEnumerable<HediffWithExtension> Penises(this IEnumerable<HediffWithExtension> self) => self.Where(e => e.GenitalPart.family == GenitalFamily.Penis); public static IEnumerable<HediffWithExtension> Vaginas(this IEnumerable<HediffWithExtension> self) => self.Where(e => e.GenitalPart.family == GenitalFamily.Vagina); public static IEnumerable<HediffWithExtension> Breasts(this IEnumerable<HediffWithExtension> self) => self.Where(e => e.GenitalPart.family == GenitalFamily.Breasts); public static IEnumerable<HediffWithExtension> Udders(this IEnumerable<HediffWithExtension> self) => self.Where(e => e.GenitalPart.family == GenitalFamily.Udders); public static IEnumerable<HediffWithExtension> Anuses(this IEnumerable<HediffWithExtension> self) => self.Where(e => e.GenitalPart.family == GenitalFamily.Anus); //Ovi public static IEnumerable<HediffWithExtension> FemaleOvipositors(this IEnumerable<HediffWithExtension> self) => self.Where(e => e.GenitalPart.family == GenitalFamily.FemaleOvipositor); public static IEnumerable<HediffWithExtension> MaleOvipositors(this IEnumerable<HediffWithExtension> self) => self.Where(e => e.GenitalPart.family == GenitalFamily.MaleOvipositor); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Extensions/HediffWithGenitalPartExtentions.cs
C#
mit
1,587
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Extensions { public static class InteractionWithExtensions { public static IEnumerable<InteractionWithExtension> Reverse(this IEnumerable<InteractionWithExtension> self) { return self .Where(interaction => interaction.HasInteractionTag(InteractionTag.Reverse)); } public static IEnumerable<InteractionWithExtension> NonReverse(this IEnumerable<InteractionWithExtension> self) { return self .Where(interaction => interaction.HasInteractionTag(InteractionTag.Reverse) == false); } public static IEnumerable<InteractionWithExtension> FilterReverse(this IEnumerable<InteractionWithExtension> self, bool isReverse) { return self .Where(interaction => interaction.HasInteractionTag(InteractionTag.Reverse) == isReverse); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Extensions/InteractionWithExtensions.cs
C#
mit
1,033
using RimWorld; using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared.Extensions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Extensions { public static class PawnExtensions { public static SexablePawnParts GetSexablePawnParts(this Pawn self) { if (self == null) { return null; } //We get the genital parts once so we don't parse ALL the hediff all the time IList<HediffWithExtension> hediffWithGenitalParts = self.health.hediffSet.hediffs .Where(hediff => hediff.def.HasModExtension<GenitalPartExtension>()) .Select(ToHediffWithExtension) .ToList(); return new SexablePawnParts { Mouths = self.Mouths(), Beaks = self.Beaks(), Tongues = self.Tongues(), Hands = self.Hands(), Feet = self.Feet(), Tails = self.Tails(), AllParts = hediffWithGenitalParts, Penises = hediffWithGenitalParts.Penises(), Vaginas = hediffWithGenitalParts.Vaginas(), Breasts = hediffWithGenitalParts.Breasts(), Udders = hediffWithGenitalParts.Udders(), Anuses = hediffWithGenitalParts.Anuses(), FemaleOvipositors = hediffWithGenitalParts.FemaleOvipositors(), MaleOvipositors = hediffWithGenitalParts.MaleOvipositors() }; } private static HediffWithExtension ToHediffWithExtension(Hediff hediff) { HediffWithExtension result = new HediffWithExtension() { Hediff = hediff, GenitalPart = hediff.def.GetModExtension<GenitalPartExtension>() }; if (hediff.def.HasModExtension<PartProps>()) { result.PartProps = hediff.def.GetModExtension<PartProps>(); } return result; } private static IList<BodyPartRecord> Mouths(this Pawn self) { return self.RaceProps.body.AllParts //EatingSource = mouth .Where(part => part.def.tags.Contains(RimWorld.BodyPartTagDefOf.EatingSource)) .Where(part => part.def.defName?.ToLower().Contains("beak") == false) .Where(part => part.IsMissingForPawn(self) == false) .ToList(); } private static IList<BodyPartRecord> Beaks(this Pawn self) { return self.RaceProps.body.AllParts //EatingSource = mouth .Where(part => part.def.tags.Contains(RimWorld.BodyPartTagDefOf.EatingSource)) .Where(part => part.def.defName?.ToLower().Contains("beak") == true) .Where(part => part.IsMissingForPawn(self) == false) .ToList(); } private static IList<BodyPartRecord> Tongues(this Pawn self) { return self.RaceProps.body.AllParts //EatingSource = mouth .Where(part => part.def.defName?.ToLower().Contains("tongue") == true) .Where(part => part.IsMissingForPawn(self) == false) .ToList(); } private static IList<BodyPartRecord> Tails(this Pawn self) { return self.RaceProps.body.AllParts .Where(part => part.def.defName?.ToLower().Contains("tail") == true) .Where(part => part.IsMissingForPawn(self) == false) .ToList(); } private static IList<BodyPartRecord> Hands(this Pawn self) { return self.RaceProps.body.AllParts .Where(part => part.IsInGroup(BodyPartGroupDefOf.LeftHand) || part.IsInGroup(BodyPartGroupDefOf.RightHand) || part.def.defName?.ToLower().Contains("hand") == true || part.def.defName?.ToLower().Contains("arm") == true) .Where(part => part.IsMissingForPawn(self) == false) .ToList(); } private static IList<BodyPartRecord> Feet(this Pawn self) { return self.RaceProps.body.AllParts .Where(part => part.def.defName?.ToLower().Contains("leftfoot") == true || part.def.defName?.ToLower().Contains("rightfoot") == true|| part.def.defName?.ToLower().Contains("foot") == true || part.def.defName?.ToLower().Contains("paw") == true) .Where(part => part.IsMissingForPawn(self) == false) .ToList(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Extensions/PawnExtensions.cs
C#
mit
3,911
using RimWorld; using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Helpers { public static class InteractionHelper { public static InteractionWithExtension GetWithExtension(InteractionDef interactionDef) { if (interactionDef.HasModExtension<InteractionSelectorExtension>() == false) { return null; } if (interactionDef.HasModExtension<InteractionExtension>() == false) { return null; } return new InteractionWithExtension { Interaction = interactionDef, Extension = interactionDef.GetModExtension<InteractionExtension>(), SelectorExtension = interactionDef.GetModExtension<InteractionSelectorExtension>() }; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Helpers/InteractionHelper.cs
C#
mit
865
using RimWorld; using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using rjw.Modules.Interactions.Extensions; using rjw.Modules.Interactions.Objects.Parts; using Verse; namespace rjw.Modules.Interactions.Helpers { public static class PartHelper { private readonly static Internals.IPartFinderService _partFinderService; private readonly static Internals.IBlockedPartDetectorService _blockedPartDetectorService; static PartHelper() { _partFinderService = Internals.Implementation.PartFinderService.Instance; _blockedPartDetectorService = Internals.Implementation.BlockedPartDetectorService.Instance; } public static IList<ILewdablePart> FindParts(Pawn pawn, GenitalFamily family) { InteractionPawn interactionPawn = ToInteractionPawn(pawn); return _partFinderService.FindUnblockedForPawn(interactionPawn, family) .ToList(); } public static IList<ILewdablePart> FindParts(Pawn pawn, GenitalFamily family, IList<string> props) { InteractionPawn interactionPawn = ToInteractionPawn(pawn); return _partFinderService.FindUnblockedForPawn(interactionPawn, family, props) .ToList(); } public static IList<ILewdablePart> FindParts(Pawn pawn, GenitalTag tag) { InteractionPawn interactionPawn = ToInteractionPawn(pawn); return _partFinderService.FindUnblockedForPawn(interactionPawn, tag) .ToList(); } public static IList<ILewdablePart> FindParts(Pawn pawn, GenitalTag tag, IList<string> props) { InteractionPawn interactionPawn = ToInteractionPawn(pawn); return _partFinderService.FindUnblockedForPawn(interactionPawn, tag, props) .ToList(); } private static InteractionPawn ToInteractionPawn(Pawn pawn) { InteractionPawn interactionPawn = new InteractionPawn { Pawn = pawn, Parts = pawn.GetSexablePawnParts() }; interactionPawn.BlockedParts = _blockedPartDetectorService.BlockedPartsForPawn(interactionPawn); return interactionPawn; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Helpers/PartHelper.cs
C#
mit
2,149
using rjw.Modules.Interactions.Objects; namespace rjw.Modules.Interactions { public interface ICustomRequirementHandler { /// <summary> /// Will be used to match the field <see cref="InteractionSelectorExtension.customRequirementHandler"/> /// </summary> string HandlerKey { get; } bool FufillRequirements(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/ICustomRequirementHandler.cs
C#
mit
421
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals { public interface IInteractionRequirementService { bool FufillRequirements(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/IInteractionRequirementService.cs
C#
mit
421
using rjw.Modules.Interactions.Contexts; namespace rjw.Modules.Interactions { public interface ILewdInteractionService { InteractionOutputs GenerateInteraction(InteractionInputs inputs); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/ILewdInteractionService.cs
C#
mit
200
using rjw.Modules.Interactions.Contexts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using RimWorld; using Verse; namespace rjw.Modules.Interactions { public interface ILewdInteractionValidatorService { bool IsValid(InteractionDef interaction, Pawn dominant, Pawn submissive); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/ILewdInteractionValidatorService.cs
C#
mit
362
using rjw.Modules.Interactions.Contexts; namespace rjw.Modules.Interactions { public interface ISpecificLewdInteractionService { InteractionOutputs GenerateSpecificInteraction(SpecificInteractionInputs inputs); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/ISpecificLewdInteractionService.cs
C#
mit
224
using rjw.Modules.Interactions.Defs.DefFragment; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Extensions; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using rjw.Modules.Shared; using rjw.Modules.Shared.Enums; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Implementation; using rjw.Modules.Shared.Logs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Internals.Implementation { public class InteractionRequirementService : IInteractionRequirementService { private static ILog _log = LogManager.GetLogger<InteractionRequirementService, InteractionLogProvider>(); public static IInteractionRequirementService Instance { get; private set; } public static IList<ICustomRequirementHandler> CustomRequirementHandlers { get; private set; } static InteractionRequirementService() { Instance = new InteractionRequirementService(); _partFinderService = PartFinderService.Instance; _pawnStateService = PawnStateService.Instance; CustomRequirementHandlers = new List<ICustomRequirementHandler>(); } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private InteractionRequirementService() { } private static readonly IPartFinderService _partFinderService; private static readonly IPawnStateService _pawnStateService; /// <summary> /// Check if the pawns don't have the lewdable parts required /// to partake in this interaction /// </summary> public bool FufillRequirements(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive) { _log.Debug($"{interaction.Interaction.defName} checks"); if (String.IsNullOrWhiteSpace(interaction.SelectorExtension.customRequirementHandler) == false) { if (TryCustomHandler(interaction, dominant, submissive, out bool result) == false) { _log.Debug($"{interaction.Interaction.defName} TryCustomHandler fail"); return false; } } if (CheckRequirement(dominant, interaction.SelectorExtension.dominantRequirement) == false) { return false; } _log.Debug($"{submissive.Pawn.GetName()} checks"); if (CheckRequirement(submissive, interaction.SelectorExtension.submissiveRequirement) == false) { return false; } return true; } private bool CheckRequirement(InteractionPawn pawn, InteractionRequirement requirement) { int required = 0; List<ILewdablePart> availableParts = new List<ILewdablePart>(); _log.Debug($"{pawn.Pawn.GetName()} checks"); //pawn state should match if (IsPawnstateValid(pawn, requirement) == false) { return false; } //need hand if (requirement.hand == true) { AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Hand), LewdablePartKind.Hand); required++; } //need foot if (requirement.foot == true) { AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Foot), LewdablePartKind.Foot); required++; } //need mouth if (requirement.mouth == true || requirement.mouthORbeak == true) { AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Mouth), LewdablePartKind.Mouth); required++; } //need beak if (requirement.beak == true || requirement.mouthORbeak == true) { AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Beak), LewdablePartKind.Beak); required++; } //need tongue if (requirement.tongue == true) { AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Tongue), LewdablePartKind.Tongue); required++; } //any oral thingy if (requirement.oral == true) { AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Tongue), LewdablePartKind.Tongue); AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Beak), LewdablePartKind.Beak); AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Mouth), LewdablePartKind.Mouth); required++; } //need tail if (requirement.tail == true) { AppendByKind(availableParts, _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Tail), LewdablePartKind.Tail); required++; } //need family if (requirement.families != null && requirement.families.Any()) { foreach (GenitalFamily family in requirement.families) { AppendByFamily(availableParts, _partFinderService.FindUnblockedForPawn(pawn, family, requirement.partProps), family); } required++; } //need tag if (requirement.tags != null && requirement.tags.Any()) { foreach (GenitalTag tag in requirement.tags) { AppendByTag(availableParts, _partFinderService.FindUnblockedForPawn(pawn, tag, requirement.partProps), tag); } required++; } //_log.Debug($"Requirement for {pawn.Pawn.GetName()} Min {requirement.minimumCount} Got {matches}"); //The interaction have NO requirements if (required == 0) { return true; } int matches = availableParts .FilterSeverity(requirement.minimumSeverity) .Count(); //Now ... all that's left is to check we have enough ! if (requirement.minimumCount.HasValue) { return matches >= requirement.minimumCount.Value; } return matches >= 1; } private static void AppendByFamily(List<ILewdablePart> parts, IEnumerable<ILewdablePart> toAppend, GenitalFamily familly) { var array = toAppend.ToArray(); if (array.Length > 0) { parts.AddRange(array); } else { _log.Debug($"Missing requirement : {familly}"); } } private static void AppendByKind(List<ILewdablePart> parts, IEnumerable<ILewdablePart> toAppend, LewdablePartKind kind) { var array = toAppend.ToArray(); if (array.Length > 0) { parts.AddRange(array); } else { _log.Debug($"Missing requirement : {kind}"); } } private static void AppendByTag(List<ILewdablePart> parts, IEnumerable<ILewdablePart> toAppend, GenitalTag tag) { var array = toAppend.ToArray(); if (array.Length > 0) { parts.AddRange(array); } else { _log.Debug($"Missing requirement : {tag}"); } } private bool IsPawnstateValid(InteractionPawn pawn, InteractionRequirement requirement) { PawnState state = _pawnStateService.Detect(pawn.Pawn); //By default, the pawn must be healthy if (requirement.pawnStates == null || requirement.pawnStates.Any() == false) { return state == PawnState.Healthy; } return requirement.pawnStates.Contains(state); } private bool TryCustomHandler(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive, out bool result) { ICustomRequirementHandler handler = CustomRequirementHandlers .Where(e => e.HandlerKey == interaction.SelectorExtension.customRequirementHandler) .FirstOrDefault(); if (handler == null) { result = false; return false; } try { result = handler.FufillRequirements(interaction, dominant, submissive); } catch(Exception e) { _log.Error($"Exception occured during call to custom handler {handler.GetType().FullName}. Will use regular requirement as fallback.", e); result = false; return false; } return result; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Implementation/InteractionRequirementService.cs
C#
mit
7,596
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Extensions; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System; using System.Linq; namespace rjw.Modules.Interactions.Implementation { public class LewdInteractionService : ILewdInteractionService { private static ILog _log = LogManager.GetLogger<LewdInteractionService, InteractionLogProvider>(); public static ILewdInteractionService Instance { get; private set; } static LewdInteractionService() { Instance = new LewdInteractionService(); _interactionTypeDetectorService = InteractionTypeDetectorService.Instance; _reverseDetectorService = ReverseDetectorService.Instance; _interactionSelectorService = InteractionSelectorService.Instance; _interactionBuilderService = InteractionBuilderService.Instance; _blockedPartDetectorService = BlockedPartDetectorService.Instance; _partPreferenceDetectorService = PartPreferenceDetectorService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private LewdInteractionService() { } private readonly static IInteractionTypeDetectorService _interactionTypeDetectorService; private readonly static IReverseDetectorService _reverseDetectorService; private readonly static IInteractionSelectorService _interactionSelectorService; private readonly static IInteractionBuilderService _interactionBuilderService; private readonly static IBlockedPartDetectorService _blockedPartDetectorService; private readonly static IPartPreferenceDetectorService _partPreferenceDetectorService; public InteractionOutputs GenerateInteraction(InteractionInputs inputs) { ///TODO : remove the logs once it works InteractionContext context = new InteractionContext(inputs); _log.Debug($"Generating Interaction for {context.Inputs.Initiator.GetName()} and {context.Inputs.Partner.GetName()}"); Initialize(context); _log.Debug($"Initialized as InteractionType : {context.Internals.InteractionType} IsReverse : {context.Internals.IsReverse}"); //Detect parts that are unusable / missing _blockedPartDetectorService.DetectBlockedParts(context.Internals); _log.Debug($"Blocked parts for dominant {context.Internals.Dominant.BlockedParts.Select(e => $"[{e}]").Aggregate(String.Empty, (e,f) => $"{e}-{f}")}"); _log.Debug($"Blocked parts for submissive {context.Internals.Submissive.BlockedParts.Select(e => $"[{e}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); //Calculate parts usage preferences for Dominant and Submissive _partPreferenceDetectorService.DetectPartPreferences(context); _log.Debug($"Part preferences for dominant {context.Internals.Dominant.PartPreferences.Select(e => $"[{e.Key}-{e.Value}]").Aggregate(String.Empty, (e,f)=> $"{e}-{f}")}"); _log.Debug($"Part preferences for submissive {context.Internals.Submissive.PartPreferences.Select(e => $"[{e.Key}-{e.Value}]").Aggregate(String.Empty, (e,f)=> $"{e}-{f}")}"); context.Internals.Selected = _interactionSelectorService.Select(context); _log.Message($"Selected Interaction [{context.Internals.Selected.Interaction.defName}] for {context.Inputs.Initiator.GetName()} and {context.Inputs.Partner.GetName()}"); _interactionBuilderService.Build(context); _log.Debug($"SelectedParts for dominant {context.Outputs.Generated.SelectedDominantParts.Select(e => $"[{e.PartKind}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); _log.Debug($"SelectedParts for submissive {context.Outputs.Generated.SelectedSubmissiveParts.Select(e => $"[{e.PartKind}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); return context.Outputs; } private void Initialize(InteractionContext context) { context.Internals.InteractionType = context.Outputs.Generated.InteractionType = _interactionTypeDetectorService.DetectInteractionType(context); context.Internals.Dominant = new Objects.InteractionPawn { Pawn = context.Inputs.Initiator, Parts = context.Inputs.Initiator.GetSexablePawnParts() }; context.Internals.Submissive = new Objects.InteractionPawn { Pawn = context.Inputs.Partner, Parts = context.Inputs.Partner.GetSexablePawnParts() }; context.Internals.Dominant.Gender = Genitals.Helpers.GenderHelper.GetGender(context.Internals.Dominant); context.Internals.Submissive.Gender = Genitals.Helpers.GenderHelper.GetGender(context.Internals.Submissive); context.Internals.IsReverse = _reverseDetectorService.IsReverse(context); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Implementation/LewdInteractionService.cs
C#
mit
4,644
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Extensions; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System; using System.Linq; using RimWorld; using Verse; namespace rjw.Modules.Interactions.Implementation { public class LewdInteractionValidatorService : ILewdInteractionValidatorService { private static ILog _log = LogManager.GetLogger<LewdInteractionService, InteractionLogProvider>(); public static ILewdInteractionValidatorService Instance { get; private set; } static LewdInteractionValidatorService() { Instance = new LewdInteractionValidatorService(); _interactionRequirementService = InteractionRequirementService.Instance; _blockedPartDetectorService = BlockedPartDetectorService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private LewdInteractionValidatorService() { } private readonly static IInteractionRequirementService _interactionRequirementService; private readonly static IBlockedPartDetectorService _blockedPartDetectorService; public bool IsValid(InteractionDef interaction, Pawn dominant, Pawn submissive) { InteractionPawn iDominant, iSubmissive; InteractionWithExtension iInteraction; try { Assert(interaction); } catch(NotImplementedException) { return false; } iDominant = ConvertPawn(dominant); iSubmissive = ConvertPawn(submissive); iInteraction = ConvertInteraction(interaction); //Detect parts that are unusable / missing iDominant.BlockedParts = _blockedPartDetectorService.BlockedPartsForPawn(iDominant); iSubmissive.BlockedParts = _blockedPartDetectorService.BlockedPartsForPawn(iSubmissive); return _interactionRequirementService.FufillRequirements(iInteraction, iDominant, iSubmissive); } private void Assert(InteractionDef interaction) { if (interaction.HasModExtension<InteractionSelectorExtension>() == false) { string message = $"The interaction {interaction.defName} doesn't have the required {nameof(InteractionSelectorExtension)} extention"; _log.Error(message); throw new NotImplementedException(message); } if (interaction.HasModExtension<InteractionExtension>() == false) { string message = $"The interaction {interaction.defName} doesn't have the required {nameof(InteractionExtension)} extention"; _log.Error(message); throw new NotImplementedException(message); } } private InteractionWithExtension ConvertInteraction(InteractionDef interaction) { return new InteractionWithExtension { Interaction = interaction, Extension = interaction.GetModExtension<InteractionExtension>(), SelectorExtension = interaction.GetModExtension<InteractionSelectorExtension>() }; } private InteractionPawn ConvertPawn(Pawn pawn) { return new InteractionPawn { Pawn = pawn, Parts = pawn.GetSexablePawnParts() }; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Implementation/LewdInteractionValidatorService.cs
C#
mit
3,152
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Extensions; using rjw.Modules.Interactions.Helpers; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System; using System.Linq; namespace rjw.Modules.Interactions.Implementation { public class SpecificLewdInteractionService : ISpecificLewdInteractionService { private static ILog _log = LogManager.GetLogger<SpecificLewdInteractionService, InteractionLogProvider>(); public static ISpecificLewdInteractionService Instance { get; private set; } static SpecificLewdInteractionService() { Instance = new SpecificLewdInteractionService(); _interactionTypeDetectorService = InteractionTypeDetectorService.Instance; _interactionBuilderService = InteractionBuilderService.Instance; _blockedPartDetectorService = BlockedPartDetectorService.Instance; _partPreferenceDetectorService = PartPreferenceDetectorService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private SpecificLewdInteractionService() { } private readonly static IInteractionTypeDetectorService _interactionTypeDetectorService; private readonly static IInteractionBuilderService _interactionBuilderService; private readonly static IBlockedPartDetectorService _blockedPartDetectorService; private readonly static IPartPreferenceDetectorService _partPreferenceDetectorService; public InteractionOutputs GenerateSpecificInteraction(SpecificInteractionInputs inputs) { ///TODO : remove the logs once it works InteractionContext context = new InteractionContext(); _log.Debug($"Generating Specific Interaction {inputs.Interaction.defName} for {context.Inputs.Initiator?.GetName()} and {context.Inputs.Partner?.GetName()}"); Initialize(context, inputs); //Detect parts that are unusable / missing _blockedPartDetectorService.DetectBlockedParts(context.Internals); _log.Debug($"Blocked parts for dominant {context.Internals.Dominant.BlockedParts.Select(e => $"[{e}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); _log.Debug($"Blocked parts for submissive {context.Internals.Submissive.BlockedParts.Select(e => $"[{e}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); //Calculate parts usage preferences for Dominant and Submissive _partPreferenceDetectorService.DetectPartPreferences(context); _log.Debug($"Part preferences for dominant {context.Internals.Dominant.PartPreferences.Select(e => $"[{e.Key}-{e.Value}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); _log.Debug($"Part preferences for submissive {context.Internals.Submissive.PartPreferences.Select(e => $"[{e.Key}-{e.Value}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); _interactionBuilderService.Build(context); _log.Debug($"SelectedParts for dominant {context.Outputs.Generated.SelectedDominantParts.Select(e => $"[{e.PartKind}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); _log.Debug($"SelectedParts for submissive {context.Outputs.Generated.SelectedSubmissiveParts.Select(e => $"[{e.PartKind}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); return context.Outputs; } private void Initialize(InteractionContext context, SpecificInteractionInputs inputs) { context.Internals.Selected = InteractionHelper.GetWithExtension(inputs.Interaction); context.Outputs.Generated = new Objects.Interaction() { InteractionDef = context.Internals.Selected }; context.Inputs = new InteractionInputs() { Initiator = inputs.Initiator, Partner = inputs.Partner, IsRape = context.Outputs.Generated.InteractionDef.HasInteractionTag(Enums.InteractionTag.Rape), IsWhoring = context.Outputs.Generated.InteractionDef.HasInteractionTag(Enums.InteractionTag.Whoring) }; context.Internals.InteractionType = context.Outputs.Generated.InteractionType = _interactionTypeDetectorService.DetectInteractionType( context ); context.Internals.Dominant = new Objects.InteractionPawn { Pawn = context.Inputs.Initiator, Parts = context.Inputs.Initiator.GetSexablePawnParts() }; context.Internals.Submissive = new Objects.InteractionPawn { Pawn = context.Inputs.Partner, Parts = context.Inputs.Partner.GetSexablePawnParts() }; context.Internals.Dominant.Gender = Genitals.Helpers.GenderHelper.GetGender(context.Internals.Dominant); context.Internals.Submissive.Gender = Genitals.Helpers.GenderHelper.GetGender(context.Internals.Submissive); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Implementation/SpecificLewdInteractionService.cs
C#
mit
4,627
using rjw.Modules.Shared.Logs; namespace rjw.Modules.Interactions { public class InteractionLogProvider : ILogProvider { public bool IsActive => RJWSettings.DebugInteraction; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/InteractionLogProvider.cs
C#
mit
188
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System.Collections.Generic; namespace rjw.Modules.Interactions.Internals { public interface IBlockedPartDetectorService { IList<LewdablePartKind> BlockedPartsForPawn(InteractionPawn pawn); /// <summary> /// Detect the blocked parts for both pawn and fill /// <see cref="InteractionPawn.BlockedParts"/> /// </summary> /// <param name="context"></param> void DetectBlockedParts(InteractionInternals context); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IBlockedPartDetectorService.cs
C#
mit
558
using rjw.Modules.Interactions.Contexts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals { public interface IInteractionBuilderService { /// <summary> /// Fill the output interaction with all the good stuff ! /// </summary> void Build(InteractionContext context); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IInteractionBuilderService.cs
C#
mit
396
using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals { public interface IInteractionRepository { IEnumerable<InteractionWithExtension> List(); IEnumerable<InteractionWithExtension> ListForMasturbation(); IEnumerable<InteractionWithExtension> ListForAnimal(); IEnumerable<InteractionWithExtension> ListForBestiality(); IEnumerable<InteractionWithExtension> ListForRape(); IEnumerable<InteractionWithExtension> ListForConsensual(); IEnumerable<InteractionWithExtension> ListForMechanoid(); IEnumerable<InteractionWithExtension> ListForWhoring(); IEnumerable<InteractionWithExtension> ListForNecrophilia(); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IInteractionRepository.cs
C#
mit
782
using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals { public interface IInteractionScoringService { InteractionScore Score(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IInteractionScoringService.cs
C#
mit
378
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals { public interface IInteractionSelectorService { InteractionWithExtension Select(InteractionContext context); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IInteractionSelectorService.cs
C#
mit
403
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using Verse; namespace rjw.Modules.Interactions.Internals { public interface IInteractionTypeDetectorService { InteractionType DetectInteractionType(InteractionContext context); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IInteractionTypeDetectorService.cs
C#
mit
270
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals { public interface IPartFinderService { IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, string partProp); IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, LewdablePartKind partKind); IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, GenitalFamily family); IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, GenitalFamily family, IList<string> partProp); IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, GenitalTag tag); IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, GenitalTag tag, IList<string> partProp); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IPartFinderService.cs
C#
mit
942
using rjw.Modules.Interactions.Contexts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals { public interface IPartPreferenceDetectorService { void DetectPartPreferences(InteractionContext context); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IPartPreferenceDetectorService.cs
C#
mit
323
using rjw.Modules.Interactions.Defs.DefFragment; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using System.Collections.Generic; namespace rjw.Modules.Interactions.Internals { public interface IPartSelectorService { IList<ILewdablePart> SelectPartsForPawn(InteractionPawn pawn, InteractionRequirement requirement); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IPartSelectorService.cs
C#
mit
368
using rjw.Modules.Interactions.Contexts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals { public interface IReverseDetectorService { bool IsReverse(InteractionContext context); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IReverseDetectorService.cs
C#
mit
304
using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Internals { public interface IRulePackService { RulePackDef FindInteractionRulePack(InteractionWithExtension interaction); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/IRulePackService.cs
C#
mit
340
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Rules.PartBlockedRules; using rjw.Modules.Interactions.Rules.PartBlockedRules.Implementation; using System.Collections.Generic; using System.Linq; namespace rjw.Modules.Interactions.Internals.Implementation { public class BlockedPartDetectorService : IBlockedPartDetectorService { public static IBlockedPartDetectorService Instance { get; private set; } static BlockedPartDetectorService() { Instance = new BlockedPartDetectorService(); _partBlockedRules = new List<IPartBlockedRule>() { DeadPartBlockedRule.Instance, DownedPartBlockedRule.Instance, UnconsciousPartBlockedRule.Instance, MainPartBlockedRule.Instance, PartAvailibilityPartBlockedRule.Instance, }; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private BlockedPartDetectorService() { } private readonly static IList<IPartBlockedRule> _partBlockedRules; public void DetectBlockedParts(InteractionInternals context) { context.Dominant.BlockedParts = BlockedPartsForPawn(context.Dominant); context.Submissive.BlockedParts = BlockedPartsForPawn(context.Submissive); } public IList<LewdablePartKind> BlockedPartsForPawn(InteractionPawn pawn) { return _partBlockedRules .SelectMany(e => e.BlockedParts(pawn)) //Eliminate the duplicates .Distinct() .ToList(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/BlockedPartDetectorService.cs
C#
mit
1,509
using rjw.Modules.Interactions.Contexts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Internals.Implementation { public class InteractionBuilderService : IInteractionBuilderService { public static IInteractionBuilderService Instance { get; private set; } static InteractionBuilderService() { Instance = new InteractionBuilderService(); _rulePackService = RulePackService.Instance; _partSelectorService = PartSelectorService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private InteractionBuilderService() { } private readonly static IRulePackService _rulePackService; private readonly static IPartSelectorService _partSelectorService; public void Build(InteractionContext context) { context.Outputs.Generated.Dominant = context.Internals.Dominant; context.Outputs.Generated.Submissive = context.Internals.Submissive; //Participants if (context.Internals.IsReverse) { context.Outputs.Generated.Initiator = context.Internals.Submissive; context.Outputs.Generated.Receiver = context.Internals.Dominant; } else { context.Outputs.Generated.Initiator = context.Internals.Dominant; context.Outputs.Generated.Receiver = context.Internals.Submissive; } context.Outputs.Generated.InteractionDef = context.Internals.Selected; context.Outputs.Generated.RjwSexType = ParseHelper.FromString<xxx.rjwSextype>(context.Internals.Selected.Extension.rjwSextype); context.Outputs.Generated.RulePack = _rulePackService.FindInteractionRulePack(context.Internals.Selected); context.Outputs.Generated.SelectedDominantParts = _partSelectorService.SelectPartsForPawn( context.Internals.Dominant, context.Internals.Selected.SelectorExtension.dominantRequirement ); context.Outputs.Generated.SelectedSubmissiveParts = _partSelectorService.SelectPartsForPawn( context.Internals.Submissive, context.Internals.Selected.SelectorExtension.submissiveRequirement ); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/InteractionBuilderService.cs
C#
mit
2,137
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals.Implementation { public class InteractionRepository : IInteractionRepository { public static IInteractionRepository Instance { get; private set; } static InteractionRepository() { Instance = new InteractionRepository(); } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private InteractionRepository() { } public IEnumerable<InteractionWithExtension> List() { return InteractionDefOf.Interactions; } public IEnumerable<InteractionWithExtension> ListForMasturbation() { return List() .Where(interaction => interaction.HasInteractionTag(InteractionTag.Masturbation)); } public IEnumerable<InteractionWithExtension> ListForAnimal() { return List() .Where(interaction => interaction.HasInteractionTag(InteractionTag.Animal)); } public IEnumerable<InteractionWithExtension> ListForBestiality() { return List() .Where(interaction => interaction.HasInteractionTag(InteractionTag.Bestiality)); } public IEnumerable<InteractionWithExtension> ListForConsensual() { return List() .Where(interaction => interaction.HasInteractionTag(InteractionTag.Consensual)); } public IEnumerable<InteractionWithExtension> ListForRape() { return List() .Where(interaction => interaction.HasInteractionTag(InteractionTag.Rape)); } public IEnumerable<InteractionWithExtension> ListForWhoring() { return List() .Where(interaction => interaction.HasInteractionTag(InteractionTag.Whoring)); } public IEnumerable<InteractionWithExtension> ListForNecrophilia() { return List() .Where(interaction => interaction.HasInteractionTag(InteractionTag.Necrophilia)); } public IEnumerable<InteractionWithExtension> ListForMechanoid() { return List() .Where(interaction => interaction.HasInteractionTag(InteractionTag.MechImplant)); } public IEnumerable<InteractionWithExtension> List(InteractionType interactionType) { switch (interactionType) { case InteractionType.Whoring: return ListForWhoring(); case InteractionType.Rape: return ListForRape(); case InteractionType.Bestiality: return ListForBestiality(); case InteractionType.Animal: return ListForAnimal(); case InteractionType.Necrophilia: return ListForNecrophilia(); case InteractionType.Mechanoid: return ListForMechanoid(); case InteractionType.Consensual: default: return ListForConsensual(); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/InteractionRepository.cs
C#
mit
2,797
using rjw.Modules.Interactions.Defs.DefFragment; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace rjw.Modules.Interactions.Internals.Implementation { public class InteractionScoringService : IInteractionScoringService { public static IInteractionScoringService Instance { get; private set; } static InteractionScoringService() { Instance = new InteractionScoringService(); _partFinderService = PartFinderService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private InteractionScoringService() { } private static readonly IPartFinderService _partFinderService; public InteractionScore Score(InteractionWithExtension interaction, InteractionPawn dominant, InteractionPawn submissive) { return new InteractionScore() { Dominant = Score(interaction.SelectorExtension.dominantRequirement, dominant), Submissive = Score(interaction.SelectorExtension.submissiveRequirement, submissive), Setting = SettingScore(interaction) }; } private float Score(InteractionRequirement requirement, InteractionPawn pawn) { int allowed = 1; IList<ILewdablePart> availableParts; IEnumerable<(ILewdablePart Part, float Score)> scoredParts; //Find the parts ! availableParts = GetAvailablePartsForInteraction(requirement, pawn); //Score the parts ! scoredParts = availableParts .Select(e => (e, pawn.PartPreferences[e.PartKind])); //Order the parts ! scoredParts = scoredParts .OrderByDescending(e => e.Score); if (requirement.minimumCount.HasValue == true && requirement.minimumCount.Value > 0) { allowed = requirement.minimumCount.Value; } return scoredParts //Take the allowed part count .Take(allowed) .Select(e => e.Score) //Multiply the parts scores .Aggregate(1f, (e, f) => e * f); } private IList<ILewdablePart> GetAvailablePartsForInteraction(InteractionRequirement requirement, InteractionPawn pawn) { List<ILewdablePart> result = new List<ILewdablePart>(); //need hand if (requirement.hand == true) { result.AddRange(_partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Hand)); } //need foot if (requirement.foot == true) { result.AddRange(_partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Foot)); } //need mouth if (requirement.mouth == true || requirement.mouthORbeak == true) { result.AddRange(_partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Mouth)); } //need beak if (requirement.beak == true || requirement.mouthORbeak == true) { result.AddRange(_partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Beak)); } //need tongue if (requirement.tongue == true) { result.AddRange(_partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Tongue)); } //need tail if (requirement.tail == true) { result.AddRange(_partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Tail)); } //need family if (requirement.families != null && requirement.families.Any()) { foreach (GenitalFamily family in requirement.families) { result.AddRange(_partFinderService.FindUnblockedForPawn(pawn, family)); } } //need tag if (requirement.tags != null && requirement.tags.Any()) { foreach (GenitalTag tag in requirement.tags) { result.AddRange(_partFinderService.FindUnblockedForPawn(pawn, tag)); } } return result; } private float SettingScore(InteractionWithExtension interaction) { xxx.rjwSextype type = ParseHelper.FromString<xxx.rjwSextype>(interaction.Extension.rjwSextype); switch (type) { case xxx.rjwSextype.Vaginal: return RJWPreferenceSettings.vaginal; case xxx.rjwSextype.Anal: return RJWPreferenceSettings.anal; case xxx.rjwSextype.DoublePenetration: return RJWPreferenceSettings.double_penetration; case xxx.rjwSextype.Boobjob: return RJWPreferenceSettings.breastjob; case xxx.rjwSextype.Handjob: return RJWPreferenceSettings.handjob; case xxx.rjwSextype.Footjob: return RJWPreferenceSettings.footjob; case xxx.rjwSextype.Fingering: return RJWPreferenceSettings.fingering; case xxx.rjwSextype.Scissoring: return RJWPreferenceSettings.scissoring; case xxx.rjwSextype.MutualMasturbation: return RJWPreferenceSettings.mutual_masturbation; case xxx.rjwSextype.Fisting: return RJWPreferenceSettings.fisting; case xxx.rjwSextype.Rimming: return RJWPreferenceSettings.rimming; case xxx.rjwSextype.Fellatio: return RJWPreferenceSettings.fellatio; case xxx.rjwSextype.Cunnilingus: return RJWPreferenceSettings.cunnilingus; case xxx.rjwSextype.Sixtynine: return RJWPreferenceSettings.sixtynine; default: return 1; } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/InteractionScoringService.cs
C#
mit
5,099
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Extensions; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Rules.InteractionRules; using rjw.Modules.Interactions.Rules.InteractionRules.Implementation; using rjw.Modules.Shared; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Helpers; using rjw.Modules.Shared.Logs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals.Implementation { public class InteractionSelectorService : IInteractionSelectorService { private static ILog _log = LogManager.GetLogger<InteractionSelectorService, InteractionLogProvider>(); public static IInteractionSelectorService Instance { get; private set; } static InteractionSelectorService() { Instance = new InteractionSelectorService(); _interactionCompatibilityService = InteractionRequirementService.Instance; _interactionScoringService = InteractionScoringService.Instance; _interactionRules = new List<IInteractionRule>() { new MasturbationInteractionRule(), new AnimalInteractionRule(), new BestialityInteractionRule(), new ConsensualInteractionRule(), new RapeInteractionRule(), new WhoringInteractionRule(), new NecrophiliaInteractionRule(), new MechImplantInteractionRule() }; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private InteractionSelectorService() { } private static readonly IInteractionRequirementService _interactionCompatibilityService; private static readonly IInteractionScoringService _interactionScoringService; private static readonly IList<IInteractionRule> _interactionRules; public InteractionWithExtension Select(InteractionContext context) { IInteractionRule rule = FindRule(context.Internals.InteractionType); _log.Debug($"[available] {rule.Interactions.Select(e => $"[{e.Interaction.defName}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); IEnumerable<InteractionWithExtension> interactions = rule.Interactions .FilterReverse(context.Internals.IsReverse) // Filter the interaction by removing those where the requirements are not met .Where(e => _interactionCompatibilityService.FufillRequirements(e, context.Internals.Dominant, context.Internals.Submissive)); _log.Debug($"[available] {rule.Interactions.Select(e => $"[{e.Interaction.defName}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); //Now we score each remaining interactions IList<Weighted<InteractionWithExtension>> scored = interactions .Select(e => new Weighted<InteractionWithExtension>(Score(context, e, rule), e)) .ToList(); _log.Debug($"[Scores] {scored.Select(e => $"[{e.Element.Interaction.defName}-{e.Weight}]").Aggregate(String.Empty, (e, f) => $"{e}-{f}")}"); InteractionWithExtension result = RandomHelper.WeightedRandom(scored); if (result == null) { result = rule.Default; _log.Warning($"No eligible interaction found for Type {context.Internals.InteractionType}, IsReverse {context.Internals.IsReverse}, Initiator {context.Inputs.Initiator.GetName()}, Partner {context.Inputs.Partner.GetName()}. Using default {result?.Interaction.defName}."); } return result; } private float Score(InteractionContext context, InteractionWithExtension interaction, IInteractionRule rule) { return _interactionScoringService.Score(interaction, context.Internals.Dominant, context.Internals.Submissive) .GetScore(rule.SubmissivePreferenceWeight); } private IInteractionRule FindRule(InteractionType interactionType) { return _interactionRules .Where(e => e.InteractionType == interactionType) .FirstOrDefault(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/InteractionSelectorService.cs
C#
mit
3,880
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Internals.Implementation { public class InteractionTypeDetectorService : IInteractionTypeDetectorService { private static ILog _log = LogManager.GetLogger<InteractionTypeDetectorService, InteractionLogProvider>(); public static IInteractionTypeDetectorService Instance { get; private set; } static InteractionTypeDetectorService() { Instance = new InteractionTypeDetectorService(); } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private InteractionTypeDetectorService() { } public InteractionType DetectInteractionType(InteractionContext context) { InteractionType result = DetectInteractionType( context.Inputs.Initiator, context.Inputs.Partner, context.Inputs.IsRape, context.Inputs.IsWhoring ); if (result == InteractionType.Masturbation) { context.Inputs.Partner = context.Inputs.Initiator; } return result; } private InteractionType DetectInteractionType(Pawn initiator, Pawn partner, bool isRape, bool isWhoring) { _log.Debug(initiator.GetName()); _log.Debug(partner.GetName()); if (initiator == partner || partner == null) { partner = initiator; return InteractionType.Masturbation; } if (partner.health.Dead == true) { return InteractionType.Necrophilia; } if (xxx.is_mechanoid(initiator)) { return InteractionType.Mechanoid; } //Either one or the other but not both if (xxx.is_animal(initiator) ^ xxx.is_animal(partner)) { return InteractionType.Bestiality; } if (xxx.is_animal(initiator) && xxx.is_animal(partner)) { return InteractionType.Animal; } if (isWhoring) { return InteractionType.Whoring; } if (isRape) { return InteractionType.Rape; } return InteractionType.Consensual; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/InteractionTypeDetectorService.cs
C#
mit
2,185
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Extensions; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals.Implementation { public class PartFinderService : IPartFinderService { public static IPartFinderService Instance { get; private set; } static PartFinderService() { Instance = new PartFinderService(); } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private PartFinderService() { } public IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, string partProp) { return pawn.ListLewdableParts() .Where(e => pawn.BlockedParts.Contains(e.PartKind) == false) .OfType<RJWLewdablePart>() .Where(e => e.Props.Contains(partProp)); } public IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, LewdablePartKind partKind) { if (pawn.BlockedParts.Contains(partKind)) { return Enumerable.Empty<ILewdablePart>(); } return pawn.ListLewdableParts() .Where(e => e.PartKind == partKind); } public IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, GenitalFamily family) { return pawn.ListLewdableParts() .Where(e => pawn.BlockedParts.Contains(e.PartKind) == false) .OfType<RJWLewdablePart>() .Where(e => e.Hediff.GenitalPart.family == family); } public IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, GenitalFamily family, IList<string> partProp) { var eligibles = pawn.ListLewdableParts() .Where(e => pawn.BlockedParts.Contains(e.PartKind) == false) .OfType<RJWLewdablePart>() .Where(e => e.Hediff.GenitalPart.family == family); if (partProp == null || partProp.Any() == false) { return eligibles; } return eligibles .Where(e => e.Props.Any()) .Where(e => partProp.All(prop => e.Props.Contains(prop))); } public IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, GenitalTag tag) { return pawn.ListLewdableParts() .Where(e => pawn.BlockedParts.Contains(e.PartKind) == false) .OfType<RJWLewdablePart>() .Where(e => e.Hediff.GenitalPart.tags.Contains(tag)); } public IEnumerable<ILewdablePart> FindUnblockedForPawn(InteractionPawn pawn, GenitalTag tag, IList<string> partProp) { var eligibles = pawn.ListLewdableParts() .Where(e => pawn.BlockedParts.Contains(e.PartKind) == false) .OfType<RJWLewdablePart>() .Where(e => e.Hediff.GenitalPart.tags.Contains(tag)); if (partProp == null || partProp.Any() == false) { return eligibles; } return eligibles .Where(e => e.Props.Any()) .Where(e => partProp.All(prop => e.Props.Contains(prop))); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/PartFinderService.cs
C#
mit
2,895
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Rules.PartKindUsageRules; using rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals.Implementation { public class PartPreferenceDetectorService : IPartPreferenceDetectorService { public static IPartPreferenceDetectorService Instance { get; private set; } static PartPreferenceDetectorService() { Instance = new PartPreferenceDetectorService(); _partKindUsageRules = new List<IPartPreferenceRule>() { new AnimalPartKindUsageRule(), new BestialityForZoophilePartKindUsageRule(), new BestialityPartKindUsageRule(), new BigBreastsPartKindUsageRule(), new MainPartKindUsageRule(), new PawnAlreadySatisfiedPartKindUsageRule(), new QuirksPartKindUsageRule(), new RapePartKindUsageRule(), new SizeDifferencePartKindUsageRule(), new WhoringPartKindUsageRule(), new PregnancyApproachPartKindUsageRule(), }; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private PartPreferenceDetectorService() { } private readonly static IList<IPartPreferenceRule> _partKindUsageRules; public void DetectPartPreferences(InteractionContext context) { context.Internals.Dominant.PartPreferences = PartPreferencesForDominant(context); context.Internals.Submissive.PartPreferences = BlockedPartsForSubmissive(context); } private IDictionary<LewdablePartKind, float> PartPreferencesForDominant(InteractionContext context) { IList<Weighted<LewdablePartKind>> preferences = _partKindUsageRules .SelectMany(e => e.ModifiersForDominant(context)) .ToList(); return MergeWithDefaultDictionary(context.Internals.Dominant, preferences); } private IDictionary<LewdablePartKind, float> BlockedPartsForSubmissive(InteractionContext context) { IList<Weighted<LewdablePartKind>> preferences = _partKindUsageRules .SelectMany(e => e.ModifiersForSubmissive(context)) .ToList(); return MergeWithDefaultDictionary(context.Internals.Submissive, preferences); } private IDictionary<LewdablePartKind, float> MergeWithDefaultDictionary(InteractionPawn pawn, IList<Weighted<LewdablePartKind>> preferences) { //A dictionary containing every part kind with a value of 1.0f (aka defaults) //it'll prevent exceptions to be thrown if you did preferences[missingKey] IDictionary<LewdablePartKind, float> result = Enum.GetValues(typeof(LewdablePartKind)) .OfType<LewdablePartKind>() //We don't want that ... .Where(e => e != LewdablePartKind.Unsupported) //We don't want these either .Where(e => pawn.BlockedParts.Contains(e) == false) .ToDictionary(e => e, e => 1.0f); //Put the values in the dictionary foreach (KeyValuePair<LewdablePartKind, float> element in result.ToList()) { if (preferences.Where(e => e.Element == element.Key).Any()) { result[element.Key] *= preferences .Where(e => e.Element == element.Key) .Select(e => e.Weight) .Aggregate((e, f) => e * f); } } return result; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/PartPreferenceDetectorService.cs
C#
mit
3,360
using rjw.Modules.Interactions.Defs.DefFragment; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using System.Collections.Generic; using System.Linq; namespace rjw.Modules.Interactions.Internals.Implementation { public class PartSelectorService : IPartSelectorService { public static IPartSelectorService Instance { get; private set; } static PartSelectorService() { Instance = new PartSelectorService(); _partFinderService = PartFinderService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private PartSelectorService() { } private readonly static IPartFinderService _partFinderService; public IList<ILewdablePart> SelectPartsForPawn(InteractionPawn pawn, InteractionRequirement requirement) { int required = 1; if (requirement.minimumCount.HasValue) { required = requirement.minimumCount.Value; } return EligebleParts(pawn, requirement) .Where(e => pawn.PartPreferences.ContainsKey(e.PartKind)) .Select(e => new { Part = e, Preference = pawn.PartPreferences[e.PartKind] }) .OrderByDescending(e => e.Preference) .Take(required) .Select(e => e.Part) .ToList(); } private IEnumerable<ILewdablePart> EligebleParts(InteractionPawn pawn, InteractionRequirement requirement) { if (requirement.hand == true) { foreach (var part in _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Hand)) { yield return part; } } if (requirement.foot == true) { foreach (var part in _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Foot)) { yield return part; } } if (requirement.mouth == true || requirement.mouthORbeak == true) { foreach (var part in _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Mouth)) { yield return part; } } if (requirement.beak == true || requirement.mouthORbeak == true) { foreach (var part in _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Beak)) { yield return part; } } if (requirement.tongue == true) { foreach (var part in _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Tongue)) { yield return part; } } if (requirement.tail == true) { foreach (var part in _partFinderService.FindUnblockedForPawn(pawn, LewdablePartKind.Tail)) { yield return part; } } if (requirement.families != null && requirement.families.Any()) { foreach (GenitalFamily family in requirement.families) { foreach (var part in _partFinderService.FindUnblockedForPawn(pawn, family)) { yield return part; } } } if (requirement.tags != null && requirement.tags.Any()) { foreach (GenitalTag tag in requirement.tags) { foreach (var part in _partFinderService.FindUnblockedForPawn(pawn, tag)) { yield return part; } } } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/PartSelectorService.cs
C#
mit
3,032
using rjw.Modules.Genitals.Enums; using rjw.Modules.Interactions.Contexts; using rjw.Modules.Shared.Logs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Internals.Implementation { public class ReverseDetectorService : IReverseDetectorService { private static ILog _log = LogManager.GetLogger<ReverseDetectorService, InteractionLogProvider>(); public static IReverseDetectorService Instance { get; private set; } static ReverseDetectorService() { Instance = new ReverseDetectorService(); _random = new Random(); } private static readonly Random _random; /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private ReverseDetectorService() { } private const float ReverseRapeChanceForFemale = 90 / 100f; private const float ReverseRapeChanceForMale = 10 / 100f; private const float ReverseRapeChanceForFuta = (ReverseRapeChanceForFemale + ReverseRapeChanceForMale) / 2f; private const float ReverseConsensualChanceForFemale = 75 / 100f; private const float ReverseConsensualChanceForMale = 25 / 100f; private const float ReverseConsensualChanceForFuta = (ReverseConsensualChanceForFemale + ReverseConsensualChanceForMale) / 2f; private const float ReverseBestialityChanceForFemale = 90 / 100f; private const float ReverseBestialityChanceForMale = 10 / 100f; private const float ReverseBestialityChanceForFuta = (ReverseBestialityChanceForFemale + ReverseBestialityChanceForMale) / 2f; private const float ReverseAnimalChanceForFemale = 90 / 100f; private const float ReverseAnimalChanceForMale = 10 / 100f; private const float ReverseAnimalChanceForFuta = (ReverseAnimalChanceForFemale + ReverseAnimalChanceForMale) / 2f; private const float ReverseWhoringChanceForFemale = 90 / 100f; private const float ReverseWhoringChanceForMale = 10 / 100f; private const float ReverseWhoringChanceForFuta = (ReverseWhoringChanceForFemale + ReverseWhoringChanceForMale) / 2f; public bool IsReverse(InteractionContext context) { //Necrophilia if (context.Internals.InteractionType == Enums.InteractionType.Necrophilia) { context.Internals.IsReverse = false; } //MechImplant if (context.Internals.InteractionType == Enums.InteractionType.Mechanoid) { context.Internals.IsReverse = false; } //Masturbation if (context.Internals.InteractionType == Enums.InteractionType.Masturbation) { context.Internals.IsReverse = false; } Gender initiatorGender = context.Internals.Dominant.Gender; Gender partnerGender = context.Internals.Submissive.Gender; float roll = (float)_random.NextDouble(); bool result; if (context.Outputs.Generated.InteractionType == Enums.InteractionType.Consensual) { result = IsReverseRape(initiatorGender, partnerGender, roll, ReverseConsensualChanceForFemale, ReverseConsensualChanceForMale, ReverseConsensualChanceForFuta); } else if (context.Outputs.Generated.InteractionType == Enums.InteractionType.Animal) { result = IsReverseRape(initiatorGender, partnerGender, roll, ReverseAnimalChanceForFemale, ReverseAnimalChanceForMale, ReverseAnimalChanceForFuta); } else if (context.Outputs.Generated.InteractionType == Enums.InteractionType.Whoring) { result = IsReverseRape(initiatorGender, partnerGender, roll, ReverseWhoringChanceForFemale, ReverseWhoringChanceForMale, ReverseWhoringChanceForFuta); } else if (context.Outputs.Generated.InteractionType == Enums.InteractionType.Bestiality) { result = IsReverseRape(initiatorGender, partnerGender, roll, ReverseBestialityChanceForFemale, ReverseBestialityChanceForMale, ReverseBestialityChanceForFuta); } else if (context.Outputs.Generated.InteractionType == Enums.InteractionType.Rape) { result = IsReverseRape(initiatorGender, partnerGender, roll, ReverseRapeChanceForFemale, ReverseRapeChanceForMale, ReverseRapeChanceForFuta); } else { result = false; } return result; } private bool IsReverseRape(Gender initiator, Gender partner, float roll, float femaleChance, float maleChance, float futaChance) { _log.Debug($"{initiator}/{partner} - {roll} -> [f{femaleChance},m{maleChance},fu{futaChance}]"); switch (initiator) { case Gender.Male: return roll < maleChance; case Gender.Female: return roll < femaleChance; case Gender.Trap: return roll < maleChance; case Gender.Futa: case Gender.FemaleOvi: return roll < futaChance; case Gender.MaleOvi: return roll < maleChance; case Gender.Unknown: break; } return false; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/ReverseDetectorService.cs
C#
mit
4,739
using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Internals.Implementation { public class RulePackService : IRulePackService { public static IRulePackService Instance { get; private set; } static RulePackService() { Instance = new RulePackService(); } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private RulePackService() { } public RulePackDef FindInteractionRulePack(InteractionWithExtension interaction) { RulePackDef result; if (TryFindRulePack(interaction.SelectorExtension, out result)) { return result; } if (TryFindRulePack(interaction.Extension, out result)) { return result; } return null; } private bool TryFindRulePack(InteractionSelectorExtension extension, out RulePackDef def) { def = null; if (extension.rulepacks == null || extension.rulepacks.Any() == false) { return false; } def = extension.rulepacks.RandomElement(); return def != null; } private bool TryFindRulePack(InteractionExtension extension, out RulePackDef def) { def = null; //no defs if (extension.rulepack_defs == null || extension.rulepack_defs.Any() == false) { return false; } string defname = extension.rulepack_defs.RandomElement(); //null name ? should not happen if (String.IsNullOrWhiteSpace(defname) == true) { return false; } def = RulePackDef.Named(defname); return def != null; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Internals/Implementation/RulePackService.cs
C#
mit
1,676
using rjw.Modules.Interactions.DefModExtensions; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Objects { public class HediffWithExtension { public Hediff Hediff { get; set; } public GenitalPartExtension GenitalPart { get; set; } public PartProps PartProps { get; set; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/HediffWithExtension.cs
C#
mit
405
using RimWorld; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects.Parts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Objects { public class Interaction { public InteractionPawn Dominant { get; set; } public InteractionPawn Submissive { get; set; } public InteractionPawn Initiator { get; set; } public InteractionPawn Receiver { get; set; } public InteractionWithExtension InteractionDef { get; set; } public InteractionType InteractionType { get; internal set; } public xxx.rjwSextype RjwSexType { get; set; } public RulePackDef RulePack { get; set; } public IList<ILewdablePart> SelectedDominantParts { get; set; } public IList<ILewdablePart> SelectedSubmissiveParts { get; set; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/Interaction.cs
C#
mit
866
using rjw.Modules.Interactions.Enums; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; using rjw.Modules.Interactions.Extensions; namespace rjw.Modules.Interactions.Objects { public class InteractionPawn { public Pawn Pawn { get; set; } public SexablePawnParts Parts { get; set; } public Genitals.Enums.Gender Gender { get; set; } public IEnumerable<Parts.ILewdablePart> ListLewdableParts() { foreach (var part in Parts.Penises) { yield return new Parts.RJWLewdablePart(part, LewdablePartKind.Penis); } foreach (var part in Parts.Vaginas) { yield return new Parts.RJWLewdablePart(part, LewdablePartKind.Vagina); } foreach (var part in Parts.Anuses) { yield return new Parts.RJWLewdablePart(part, LewdablePartKind.Anus); } foreach (var part in Parts.FemaleOvipositors) { yield return new Parts.RJWLewdablePart(part, LewdablePartKind.FemaleOvipositor); } foreach (var part in Parts.MaleOvipositors) { yield return new Parts.RJWLewdablePart(part, LewdablePartKind.MaleOvipositor); } foreach (var part in Parts.Breasts) { yield return new Parts.RJWLewdablePart(part, LewdablePartKind.Breasts); } foreach (var part in Parts.Udders) { yield return new Parts.RJWLewdablePart(part, LewdablePartKind.Udders); } foreach (var part in Parts.Mouths) { yield return new Parts.VanillaLewdablePart(Pawn, part, LewdablePartKind.Mouth); } foreach (var part in Parts.Beaks) { yield return new Parts.VanillaLewdablePart(Pawn, part, LewdablePartKind.Beak); } foreach (var part in Parts.Tongues) { yield return new Parts.VanillaLewdablePart(Pawn, part, LewdablePartKind.Tongue); } foreach (var part in Parts.Hands) { yield return new Parts.VanillaLewdablePart(Pawn, part, LewdablePartKind.Hand); } foreach (var part in Parts.Feet) { yield return new Parts.VanillaLewdablePart(Pawn, part, LewdablePartKind.Foot); } foreach (var part in Parts.Tails) { yield return new Parts.VanillaLewdablePart(Pawn, part, LewdablePartKind.Tail); } } public IList<LewdablePartKind> BlockedParts { get; set; } public IDictionary<LewdablePartKind, float> PartPreferences { get; set; } public bool HasBigBreasts() { return Parts.Breasts .BigBreasts() .Any(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/InteractionPawn.cs
C#
mit
2,455
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; namespace rjw.Modules.Interactions.Objects { public class InteractionScore { /// <summary> /// The dominant score, calculated using part preference /// </summary> public float Dominant { get; set; } /// <summary> /// The submissive score, calculated using part preference /// </summary> public float Submissive { get; set; } /// <summary> /// The interaction score, value from the settings /// </summary> public float Setting { get; set; } /// <summary> /// When compiling the final score of an interaction, we take into account a weight that can be applied to /// the submissive score /// for exemple, the submissive's preferences should not be taken into account in a rape /// </summary> /// <returns> /// the final interaction score /// </returns> //public float GetScore(float submissiveWeight) //{ // //if it's ignored, pulls toward 1 // float finalSubmissiveScore; // { // float invertedWeight = Mathf.Max(0, 1 - submissiveWeight); // //no, i'm not sure that it's right // finalSubmissiveScore = (1 * invertedWeight) + (Submissive * submissiveWeight); // } // return Dominant * finalSubmissiveScore * Setting; //} public float GetScore(float submissiveWeight) { // Get weighted average of dom and subs prefs and mutiply by the system weight // Fix sub weights of less than zero float fixedSubmissiveWeight = Mathf.Max(0, submissiveWeight); float dominantWeight = 1f; return Setting * ( (Dominant * dominantWeight + Submissive * fixedSubmissiveWeight) / (dominantWeight + fixedSubmissiveWeight) ); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/InteractionScore.cs
C#
mit
1,757
using RimWorld; using rjw.Modules.Interactions.DefModExtensions; using rjw.Modules.Interactions.Defs.DefFragment; using rjw.Modules.Interactions.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Objects { public class InteractionWithExtension { public InteractionDef Interaction { get; set; } public InteractionSelectorExtension SelectorExtension { get; set; } public InteractionExtension Extension { get; set; } #region InteractionTag public bool HasInteractionTag(InteractionTag tag) { if (SelectorExtension == null || SelectorExtension.tags == null || SelectorExtension.tags.Any() == false) { return false; } return SelectorExtension.tags.Contains(tag); } #endregion #region PartProps public bool DominantHasPartProp(string partProp) { return HasPartProp(SelectorExtension.dominantRequirement, partProp); } public bool SubmissiveHasPartProp(string partProp) { return HasPartProp(SelectorExtension.submissiveRequirement, partProp); } private bool HasPartProp(InteractionRequirement requirement, string partProp) { if (requirement == null || requirement.partProps == null || requirement.partProps.Any() == false) { return false; } return requirement.partProps.Contains(partProp); } #endregion #region Familly public bool DominantHasFamily(GenitalFamily family) { return HasFamily(SelectorExtension.dominantRequirement, family); } public bool SubmissiveHasFamily(GenitalFamily family) { return HasFamily(SelectorExtension.submissiveRequirement, family); } private bool HasFamily(InteractionRequirement requirement, GenitalFamily family) { if (requirement == null || requirement.families == null || requirement.families.Any() == false) { return false; } return requirement.families.Contains(family); } #endregion #region Tag public bool DominantHasTag(GenitalTag tag) { return HasTag(SelectorExtension.dominantRequirement, tag); } public bool SubmissiveHasTag(GenitalTag tag) { return HasTag(SelectorExtension.submissiveRequirement, tag); } private bool HasTag(InteractionRequirement requirement, GenitalTag tag) { if (requirement == null || requirement.tags == null || requirement.tags.Any() == false) { return false; } return requirement.tags.Contains(tag); } #endregion } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/InteractionWithExtension.cs
C#
mit
2,490
using rjw.Modules.Interactions.Objects.Parts; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Objects { public class LewdablePartComparer : IEqualityComparer<ILewdablePart> { public bool Equals(ILewdablePart x, ILewdablePart y) { RJWLewdablePart rjwPartX = x as RJWLewdablePart; RJWLewdablePart rjwPartY = y as RJWLewdablePart; VanillaLewdablePart vanillaPartX = x as VanillaLewdablePart; VanillaLewdablePart vanillaPartY = y as VanillaLewdablePart; //One of them is rjw if (rjwPartX != null || rjwPartY != null) { //Compare the hediffs if (rjwPartX?.Hediff != rjwPartY?.Hediff) { return false; } } //One of them is vanilla if (vanillaPartX != null || vanillaPartY != null) { //Compare the BPR if (vanillaPartX?.Part != vanillaPartY?.Part) { return false; } } return true; } public int GetHashCode(ILewdablePart obj) { RJWLewdablePart rjwPart = obj as RJWLewdablePart; VanillaLewdablePart vanillaPart = obj as VanillaLewdablePart; if (rjwPart != null) { rjwPart.Hediff.GetHashCode(); } if (vanillaPart != null) { vanillaPart.Part.GetHashCode(); } return 0; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/LewdablePartComparer.cs
C#
mit
1,309
using rjw.Modules.Interactions.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Objects.Parts { public interface ILewdablePart { LewdablePartKind PartKind { get; } /// <summary> /// The severity of the hediff /// </summary> float Size { get; } IList<string> Props { get; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/Parts/ILewdablePart.cs
C#
mit
407
using rjw.Modules.Interactions.Enums; using System.Collections.Generic; namespace rjw.Modules.Interactions.Objects.Parts { public class RJWLewdablePart : ILewdablePart { public HediffWithExtension Hediff { get; private set; } public LewdablePartKind PartKind { get; private set; } public float Size => Hediff.Hediff.Severity; private readonly IList<string> _props; public IList<string> Props => _props; public RJWLewdablePart(HediffWithExtension hediff, LewdablePartKind partKind) { Hediff = hediff; PartKind = partKind; _props = hediff.PartProps?.props ?? new(); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/Parts/RJWLewdablePart.cs
C#
mit
606
using rjw.Modules.Interactions.Enums; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Objects.Parts { public class VanillaLewdablePart : ILewdablePart { public Pawn Owner { get; private set; } public BodyPartRecord Part { get; private set; } public LewdablePartKind PartKind { get; private set; } public float Size { get { //For reference, averge size penis = 0.25f switch (PartKind) { case LewdablePartKind.Hand: return 0.3f * Owner.BodySize; case LewdablePartKind.Foot: return 0.4f * Owner.BodySize; case LewdablePartKind.Tail: return 0.15f * Owner.BodySize; default: return 0.25f; } } } //No props in vanilla parts ... sad day ... public IList<string> Props => new List<string>(); public VanillaLewdablePart(Pawn owner, BodyPartRecord part, LewdablePartKind partKind) { Owner = owner; Part = part; PartKind = partKind; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/Parts/VanillaLewdablePart.cs
C#
mit
1,056
using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using UnityEngine; using Verse; namespace rjw.Modules.Interactions.Objects { public class SexablePawnParts { public IEnumerable<BodyPartRecord> Mouths { get; set; } public IEnumerable<BodyPartRecord> Beaks { get; set; } public IEnumerable<BodyPartRecord> Tongues { get; set; } public IEnumerable<BodyPartRecord> Feet { get; set; } public IEnumerable<BodyPartRecord> Hands { get; set; } public IEnumerable<BodyPartRecord> Tails { get; set; } public bool HasMouth => Mouths == null ? false : Mouths.Any(); public bool HasHand => Hands == null ? false : Hands.Any(); public bool HasTail => Tails == null ? false : Tails.Any(); public IEnumerable<HediffWithExtension> AllParts { get; set; } public IEnumerable<HediffWithExtension> Penises { get; set; } public IEnumerable<HediffWithExtension> Vaginas { get; set; } public IEnumerable<HediffWithExtension> Breasts { get; set; } public IEnumerable<HediffWithExtension> Udders { get; set; } public IEnumerable<HediffWithExtension> Anuses { get; set; } public IEnumerable<HediffWithExtension> FemaleOvipositors { get; set; } public IEnumerable<HediffWithExtension> MaleOvipositors { get; set; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Objects/SexablePawnParts.cs
C#
mit
1,302
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules { public interface IInteractionRule { InteractionType InteractionType { get; } IEnumerable<InteractionWithExtension> Interactions { get; } float SubmissivePreferenceWeight { get; } InteractionWithExtension Default { get; } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/IInteractionRule.cs
C#
mit
497
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules.Implementation { public class AnimalInteractionRule : IInteractionRule { static AnimalInteractionRule() { _interactionRepository = InteractionRepository.Instance; } private readonly static IInteractionRepository _interactionRepository; public InteractionType InteractionType => InteractionType.Animal; public IEnumerable<InteractionWithExtension> Interactions => _interactionRepository .ListForAnimal(); public float SubmissivePreferenceWeight { get { return 0.0f; } } public InteractionWithExtension Default => InteractionDefOf.DefaultAnimalSex; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/Implementation/AnimalInteractionRule.cs
C#
mit
990
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules.Implementation { public class BestialityInteractionRule : IInteractionRule { static BestialityInteractionRule() { _interactionRepository = InteractionRepository.Instance; } private readonly static IInteractionRepository _interactionRepository; public InteractionType InteractionType => InteractionType.Bestiality; public IEnumerable<InteractionWithExtension> Interactions => _interactionRepository .ListForBestiality(); public float SubmissivePreferenceWeight { get { return 0.0f; } } public InteractionWithExtension Default => InteractionDefOf.DefaultBestialitySex; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/Implementation/BestialityInteractionRule.cs
C#
mit
1,010
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules.Implementation { public class ConsensualInteractionRule : IInteractionRule { static ConsensualInteractionRule() { _random = new Random(); _interactionRepository = InteractionRepository.Instance; } private readonly static Random _random; private readonly static IInteractionRepository _interactionRepository; public InteractionType InteractionType => InteractionType.Consensual; public IEnumerable<InteractionWithExtension> Interactions => _interactionRepository .ListForConsensual(); public float SubmissivePreferenceWeight { get { //+/- 20% float variant = (-1 + (float)_random.NextDouble() * 2) * 0.2f; return 1.0f + variant; } } public InteractionWithExtension Default => InteractionDefOf.DefaultConsensualSex; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/Implementation/ConsensualInteractionRule.cs
C#
mit
1,171
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules.Implementation { public class MasturbationInteractionRule : IInteractionRule { static MasturbationInteractionRule() { _interactionRepository = InteractionRepository.Instance; } private readonly static IInteractionRepository _interactionRepository; public InteractionType InteractionType => InteractionType.Masturbation; public IEnumerable<InteractionWithExtension> Interactions => _interactionRepository .ListForMasturbation(); public float SubmissivePreferenceWeight { get { return 0.0f; } } public InteractionWithExtension Default => InteractionDefOf.DefaultAnimalSex; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/Implementation/MasturbationInteractionRule.cs
C#
mit
1,014
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules.Implementation { public class MechImplantInteractionRule : IInteractionRule { static MechImplantInteractionRule() { _random = new Random(); _interactionRepository = InteractionRepository.Instance; } private readonly static Random _random; private readonly static IInteractionRepository _interactionRepository; public InteractionType InteractionType => InteractionType.Mechanoid; public IEnumerable<InteractionWithExtension> Interactions => _interactionRepository .ListForMechanoid(); public float SubmissivePreferenceWeight { get { //+/- 20% float variant = -1 + (float)_random.NextDouble() * 2; return 1.0f + variant; } } public InteractionWithExtension Default => InteractionDefOf.DefaultMechImplantSex; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/Implementation/MechImplantInteractionRule.cs
C#
mit
1,163
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules.Implementation { public class NecrophiliaInteractionRule : IInteractionRule { static NecrophiliaInteractionRule() { _interactionRepository = InteractionRepository.Instance; } private readonly static IInteractionRepository _interactionRepository; public InteractionType InteractionType => InteractionType.Necrophilia; public IEnumerable<InteractionWithExtension> Interactions => _interactionRepository .ListForNecrophilia(); public float SubmissivePreferenceWeight { get { return 0.0f; } } public InteractionWithExtension Default => InteractionDefOf.DefaultNecrophiliaSex; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/Implementation/NecrophiliaInteractionRule.cs
C#
mit
1,015
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules.Implementation { public class RapeInteractionRule : IInteractionRule { static RapeInteractionRule() { _random = new Random(); _interactionRepository = InteractionRepository.Instance; } private readonly static Random _random; private readonly static IInteractionRepository _interactionRepository; public InteractionType InteractionType => InteractionType.Rape; public IEnumerable<InteractionWithExtension> Interactions => _interactionRepository .ListForRape(); public float SubmissivePreferenceWeight { get { //+/- 20% float variant = -1 + (float)_random.NextDouble() * 2; return 0.0f + variant; } } public InteractionWithExtension Default => InteractionDefOf.DefaultRapeSex; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/Implementation/RapeInteractionRule.cs
C#
mit
1,132
using rjw.Modules.Interactions.Defs; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Internals; using rjw.Modules.Interactions.Internals.Implementation; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.InteractionRules.Implementation { public class WhoringInteractionRule : IInteractionRule { static WhoringInteractionRule() { _random = new Random(); _interactionRepository = InteractionRepository.Instance; } private readonly static Random _random; private readonly static IInteractionRepository _interactionRepository; public InteractionType InteractionType => InteractionType.Whoring; public IEnumerable<InteractionWithExtension> Interactions => _interactionRepository .ListForWhoring(); public float SubmissivePreferenceWeight { get { return (float)_random.NextDouble(); // Full random ! } } public InteractionWithExtension Default => InteractionDefOf.DefaultWhoringSex; } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/InteractionRules/Implementation/WhoringInteractionRule.cs
C#
mit
1,103
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Interactions.Objects.Parts; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Interactions.Rules.PartBlockedRules { public interface IPartBlockedRule { IEnumerable<LewdablePartKind> BlockedParts(InteractionPawn pawn); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartBlockedRules/IPartBlockedRule.cs
C#
mit
495
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using rjw.Modules.Shared.Implementation; using System.Collections.Generic; namespace rjw.Modules.Interactions.Rules.PartBlockedRules.Implementation { public class DeadPartBlockedRule : IPartBlockedRule { public static IPartBlockedRule Instance { get; private set; } static DeadPartBlockedRule() { Instance = new DeadPartBlockedRule(); _pawnStateService = PawnStateService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private DeadPartBlockedRule() { } private static readonly IPawnStateService _pawnStateService; public IEnumerable<LewdablePartKind> BlockedParts(InteractionPawn pawn) { yield break; //if (_pawnStateService.Detect(pawn.Pawn) == Shared.Enums.PawnState.Dead) //{ //} } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartBlockedRules/Implementation/DeadPartBlockedRule.cs
C#
mit
893
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using rjw.Modules.Shared.Implementation; using System.Collections.Generic; namespace rjw.Modules.Interactions.Rules.PartBlockedRules.Implementation { public class DownedPartBlockedRule : IPartBlockedRule { public static IPartBlockedRule Instance { get; private set; } static DownedPartBlockedRule() { Instance = new DownedPartBlockedRule(); _pawnStateService = PawnStateService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private DownedPartBlockedRule() { } private static readonly IPawnStateService _pawnStateService; public IEnumerable<LewdablePartKind> BlockedParts(InteractionPawn pawn) { yield break; //if (_pawnStateService.Detect(pawn.Pawn) == Shared.Enums.PawnState.Downed) //{ //} } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartBlockedRules/Implementation/DownedPartBlockedRule.cs
C#
mit
903
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System.Collections.Generic; namespace rjw.Modules.Interactions.Rules.PartBlockedRules.Implementation { public class MainPartBlockedRule : IPartBlockedRule { public static IPartBlockedRule Instance { get; private set; } static MainPartBlockedRule() { Instance = new MainPartBlockedRule(); } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private MainPartBlockedRule() { } public IEnumerable<LewdablePartKind> BlockedParts(InteractionPawn pawn) { if (Genital_Helper.anus_blocked(pawn.Pawn)) { yield return LewdablePartKind.Anus; } if (Genital_Helper.penis_blocked(pawn.Pawn)) { yield return LewdablePartKind.Penis; } if (Genital_Helper.breasts_blocked(pawn.Pawn)) { yield return LewdablePartKind.Breasts; } if (Genital_Helper.vagina_blocked(pawn.Pawn)) { yield return LewdablePartKind.Vagina; } if (Genital_Helper.hands_blocked(pawn.Pawn)) { yield return LewdablePartKind.Hand; } if (Genital_Helper.oral_blocked(pawn.Pawn)) { yield return LewdablePartKind.Mouth; yield return LewdablePartKind.Beak; yield return LewdablePartKind.Tongue; } if (Genital_Helper.genitals_blocked(pawn.Pawn)) { yield return LewdablePartKind.Penis; yield return LewdablePartKind.Vagina; yield return LewdablePartKind.FemaleOvipositor; yield return LewdablePartKind.MaleOvipositor; } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartBlockedRules/Implementation/MainPartBlockedRule.cs
C#
mit
1,527
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartBlockedRules.Implementation { public class PartAvailibilityPartBlockedRule : IPartBlockedRule { public static IPartBlockedRule Instance { get; private set; } static PartAvailibilityPartBlockedRule() { Instance = new PartAvailibilityPartBlockedRule(); } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private PartAvailibilityPartBlockedRule() { } public IEnumerable<LewdablePartKind> BlockedParts(InteractionPawn pawn) { if (pawn.Parts.Hands.Any() == false) { yield return LewdablePartKind.Hand; } if (pawn.Parts.Mouths.Any() == false) { yield return LewdablePartKind.Mouth; } if (pawn.Parts.Tails.Any() == false) { yield return LewdablePartKind.Tail; } //No feet detection, pawn always have thoose ... guess you can still do a good job with a peg leg ! //if (pawn.Parts.Feet.Any() == false) //{ // yield return LewdablePartKind.Foot; //} if (pawn.Parts.Penises.Any() == false) { yield return LewdablePartKind.Penis; } if (pawn.Parts.Vaginas.Any() == false) { yield return LewdablePartKind.Vagina; } if (pawn.Parts.FemaleOvipositors.Any() == false) { yield return LewdablePartKind.FemaleOvipositor; } if (pawn.Parts.MaleOvipositors.Any() == false) { yield return LewdablePartKind.MaleOvipositor; } if (pawn.Parts.Anuses.Any() == false) { yield return LewdablePartKind.Anus; } if (pawn.Parts.Breasts.Where(e => e.Hediff.CurStageIndex > 1).Any() == false) { yield return LewdablePartKind.Breasts; } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartBlockedRules/Implementation/PartAvailibilityPartBlockedRule.cs
C#
mit
1,883
using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using rjw.Modules.Shared.Implementation; using System.Collections.Generic; namespace rjw.Modules.Interactions.Rules.PartBlockedRules.Implementation { public class UnconsciousPartBlockedRule : IPartBlockedRule { public static IPartBlockedRule Instance { get; private set; } static UnconsciousPartBlockedRule() { Instance = new UnconsciousPartBlockedRule(); _pawnStateService = PawnStateService.Instance; } /// <summary> /// Do not instantiate, use <see cref="Instance"/> /// </summary> private UnconsciousPartBlockedRule() { } private static readonly IPawnStateService _pawnStateService; public IEnumerable<LewdablePartKind> BlockedParts(InteractionPawn pawn) { yield break; //if (_pawnStateService.Detect(pawn.Pawn) == Shared.Enums.PawnState.Unconscious) //{ //} } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartBlockedRules/Implementation/UnconsciousPartBlockedRule.cs
C#
mit
927
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using System.Collections.Generic; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules { public interface IPartPreferenceRule { IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context); IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context); } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/IPartKindUsageRule.cs
C#
mit
477
using RimWorld; using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class AnimalPartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { if (xxx.is_animal(context.Internals.Dominant.Pawn)) { return ForAnimal(); } return Enumerable.Empty<Weighted<LewdablePartKind>>(); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { if (xxx.is_animal(context.Internals.Submissive.Pawn)) { return ForAnimal(); } return Enumerable.Empty<Weighted<LewdablePartKind>>(); } private IEnumerable<Weighted<LewdablePartKind>> ForAnimal() { yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.Never, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Beak); } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/AnimalPartKindUsageRule.cs
C#
mit
2,157
using RimWorld; using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class BestialityForZoophilePartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { //Only bestiality here if (context.Internals.InteractionType != InteractionType.Bestiality) { return Enumerable.Empty<Weighted<LewdablePartKind>>(); } InteractionPawn pawn = context.Internals.Dominant; if (xxx.is_zoophile(pawn.Pawn) && xxx.is_animal(pawn.Pawn) == false) { return ForPawn(pawn, context.Internals.Submissive); } return Enumerable.Empty<Weighted<LewdablePartKind>>(); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { //Only bestiality here if (context.Internals.InteractionType != InteractionType.Bestiality) { return Enumerable.Empty<Weighted<LewdablePartKind>>(); } InteractionPawn pawn = context.Internals.Submissive; if (xxx.is_zoophile(pawn.Pawn) && xxx.is_animal(pawn.Pawn) == false) { return ForPawn(pawn, context.Internals.Dominant); } return Enumerable.Empty<Weighted<LewdablePartKind>>(); } private IEnumerable<Weighted<LewdablePartKind>> ForPawn(InteractionPawn pawn, InteractionPawn animal) { //bonded if (pawn.Pawn.relations.DirectRelationExists(PawnRelationDefOf.Bond, animal.Pawn)) { yield return new Weighted<LewdablePartKind>(Multipliers.VeryFrequent, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.VeryFrequent, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.VeryFrequent, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.VeryFrequent, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Breasts); } else //faction animal if (pawn.Pawn.Faction == animal.Pawn.Faction) { yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Beak); } //wild or other faction else { yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Beak); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/BestialityForZoophilePartKindUsageRule.cs
C#
mit
4,738
using RimWorld; using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class BestialityPartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { //Only bestiality here if (context.Internals.InteractionType != InteractionType.Bestiality) { return Enumerable.Empty<Weighted<LewdablePartKind>>(); } InteractionPawn pawn = context.Internals.Dominant; if (xxx.is_zoophile(pawn.Pawn) == false && xxx.is_animal(pawn.Pawn) == false && context.Internals.InteractionType == InteractionType.Bestiality) { return ForPawn(pawn, context.Internals.Submissive, context.Inputs.Initiator == pawn.Pawn); } return Enumerable.Empty<Weighted<LewdablePartKind>>(); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { //Only bestiality here if (context.Internals.InteractionType != InteractionType.Bestiality) { return Enumerable.Empty<Weighted<LewdablePartKind>>(); } InteractionPawn pawn = context.Internals.Submissive; if (xxx.is_zoophile(pawn.Pawn) == false && xxx.is_animal(pawn.Pawn) == false) { return ForPawn(pawn, context.Internals.Dominant, context.Inputs.Initiator == pawn.Pawn); } return Enumerable.Empty<Weighted<LewdablePartKind>>(); } private IEnumerable<Weighted<LewdablePartKind>> ForPawn(InteractionPawn pawn, InteractionPawn animal, bool isInitiator) { //Well ... the pawn probably would not want anything penetrative ... if (isInitiator == false) { yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Beak); } //bonded if (pawn.Pawn.relations.DirectRelationExists(PawnRelationDefOf.Bond, animal.Pawn)) { yield return new Weighted<LewdablePartKind>(Multipliers.Average, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Average, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Average, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Average, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Beak); } else { yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Beak); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/BestialityPartKindUsageRule.cs
C#
mit
5,502
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class BigBreastsPartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { return Modifiers(context.Internals.Dominant); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { return Modifiers(context.Internals.Submissive); } public IEnumerable<Weighted<LewdablePartKind>> Modifiers(InteractionPawn pawn) { if (pawn.HasBigBreasts()) { yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Beak); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/BigBreastsPartKindUsageRule.cs
C#
mit
1,426
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class MainPartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { return Modifiers(context.Internals.Dominant); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { return Modifiers(context.Internals.Submissive); } private IEnumerable<Weighted<LewdablePartKind>> Modifiers(InteractionPawn pawn) { bool hasMainPart = false; if (pawn.Parts.Penises.Any()) { yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Penis); hasMainPart = true; } if (pawn.Parts.Vaginas.Any()) { yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Vagina); hasMainPart = true; } if (pawn.Parts.FemaleOvipositors.Any()) { yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.FemaleOvipositor); hasMainPart = true; } if (pawn.Parts.MaleOvipositors.Any()) { yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.MaleOvipositor); hasMainPart = true; } //Since the pawn has a "main" part, we lower the rest if (hasMainPart == true) { yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Beak); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/MainPartKindUsageRule.cs
C#
mit
2,362
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class PawnAlreadySatisfiedPartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { return Modifiers(context.Internals.Dominant); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { return Modifiers(context.Internals.Submissive); } public IEnumerable<Weighted<LewdablePartKind>> Modifiers(InteractionPawn pawn) { Need_Sex need = pawn.Pawn.needs?.TryGetNeed<Need_Sex>(); if (need != null && need.CurLevel >= need.thresh_neutral()) { yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.MaleOvipositor); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/PawnAlreadySatisfiedPartKindUsageRule.cs
C#
mit
1,438
using System.Collections.Generic; using RimWorld; using Verse; using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Shared; using rjw.Modules.Interactions.Objects; using System.Linq; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class PregnancyApproachPartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { return ModifiersForEither(context.Internals.Dominant, context.Internals.Submissive); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { return ModifiersForEither(context.Internals.Submissive, context.Internals.Dominant); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForEither(InteractionPawn OwO, InteractionPawn UwU) { if (OwO.Pawn.relations == null || UwU.Pawn.relations == null) { yield break; } float weight = OwO.Pawn.relations.GetPregnancyApproachForPartner(UwU.Pawn).GetPregnancyChanceFactor(); if (OwO.Parts.Vaginas.Any() && UwU.Parts.Penises.Any()) { yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Penis); } if (OwO.Parts.Penises.Any() && UwU.Parts.Vaginas.Any()) { yield return new Weighted<LewdablePartKind>(weight, LewdablePartKind.Vagina); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/PregnancyApproachPartKindUsageRule.cs
C#
mit
1,556
using RimWorld; using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Quirks; using rjw.Modules.Quirks.Implementation; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class QuirksPartKindUsageRule : IPartPreferenceRule { private IQuirkService _quirkService => QuirkService.Instance; public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { return Enumerable.Concat( ModifierForPodophile(context.Internals.Dominant, context.Internals.Submissive, true), ModifierForImpregnationFetish(context.Internals.Dominant, context.Internals.Submissive, true) ); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { return Enumerable.Concat( ModifierForPodophile(context.Internals.Submissive, context.Internals.Dominant, false), ModifierForImpregnationFetish(context.Internals.Submissive, context.Internals.Dominant, false) ); } private IEnumerable<Weighted<LewdablePartKind>> ModifierForPodophile(InteractionPawn pawn, InteractionPawn partner, bool isDominant) { if(_quirkService.HasQuirk(pawn.Pawn, Quirks.Quirks.Podophile)) { yield return new Weighted<LewdablePartKind>(Multipliers.Doubled, LewdablePartKind.Foot); } //Partner is podophile and dominant (aka requesting pawjob !) if(_quirkService.HasQuirk(partner.Pawn, Quirks.Quirks.Podophile) && isDominant == false) { yield return new Weighted<LewdablePartKind>(Multipliers.Doubled, LewdablePartKind.Foot); } } private IEnumerable<Weighted<LewdablePartKind>> ModifierForImpregnationFetish(InteractionPawn pawn, InteractionPawn partner, bool isDominant) { if (_quirkService.HasQuirk(pawn.Pawn, Quirks.Quirks.Impregnation)) { yield return new Weighted<LewdablePartKind>(Multipliers.Doubled, LewdablePartKind.Vagina); } //Partner likes impregnation and is requesting the deal ! if (_quirkService.HasQuirk(partner.Pawn, Quirks.Quirks.Impregnation) && isDominant == false) { yield return new Weighted<LewdablePartKind>(Multipliers.Doubled, LewdablePartKind.Penis); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/QuirksPartKindUsageRule.cs
C#
mit
2,391
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class RapePartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { if (context.Internals.InteractionType == InteractionType.Rape) { yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Beak); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.Average, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.Average, LewdablePartKind.Foot); } } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { if (context.Internals.InteractionType == InteractionType.Rape) { yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Beak); yield return new Weighted<LewdablePartKind>(Multipliers.VeryRare, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tail); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Foot); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/RapePartKindUsageRule.cs
C#
mit
3,021
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Interactions.Objects; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class SizeDifferencePartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { return Modifiers(context.Internals.Dominant, context.Internals.Submissive); } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { return Modifiers(context.Internals.Submissive, context.Internals.Dominant); } public IEnumerable<Weighted<LewdablePartKind>> Modifiers(InteractionPawn current, InteractionPawn partner) { if (current.Pawn.BodySize * 2 < partner.Pawn.BodySize) { yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.FemaleOvipositor); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/SizeDifferencePartKindUsageRule.cs
C#
mit
1,261
using rjw.Modules.Interactions.Contexts; using rjw.Modules.Interactions.Enums; using rjw.Modules.Shared; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; namespace rjw.Modules.Interactions.Rules.PartKindUsageRules.Implementation { public class WhoringPartKindUsageRule : IPartPreferenceRule { public IEnumerable<Weighted<LewdablePartKind>> ModifiersForDominant(InteractionContext context) { if (context.Internals.InteractionType == InteractionType.Whoring) { yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Beak); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tail); } } public IEnumerable<Weighted<LewdablePartKind>> ModifiersForSubmissive(InteractionContext context) { if (context.Internals.InteractionType == InteractionType.Whoring) { yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Vagina); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.Penis); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.FemaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Frequent, LewdablePartKind.MaleOvipositor); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Mouth); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Tongue); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Beak); yield return new Weighted<LewdablePartKind>(Multipliers.Common, LewdablePartKind.Breasts); yield return new Weighted<LewdablePartKind>(Multipliers.Uncommon, LewdablePartKind.Anus); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Hand); yield return new Weighted<LewdablePartKind>(Multipliers.AlmostNever, LewdablePartKind.Foot); yield return new Weighted<LewdablePartKind>(Multipliers.Rare, LewdablePartKind.Tail); } } } }
jojo1541/rjw
1.4/Source/Modules/Interactions/Rules/PartPreferenceRules/Implementation/WhoringPartKindUsageRule.cs
C#
mit
3,056
using Verse; using RimWorld; using Multiplayer.API; namespace rjw { [StaticConstructorOnStartup] public static class RJW_Multiplayer { static RJW_Multiplayer() { if (!MP.enabled) return; // This is where the magic happens and your attributes // auto register, similar to Harmony's PatchAll. MP.RegisterAll(); /* Log.Message("RJW MP compat testing"); var type = AccessTools.TypeByName("rjw.RJWdesignations"); //Log.Message("rjw MP compat " + type.Name); Log.Message("is host " + MP.IsHosting); Log.Message("PlayerName " + MP.PlayerName); Log.Message("IsInMultiplayer " + MP.IsInMultiplayer); //MP.RegisterSyncMethod(type, "Comfort"); /* MP.RegisterSyncMethod(type, "<GetGizmos>Service"); MP.RegisterSyncMethod(type, "<GetGizmos>BreedingHuman"); MP.RegisterSyncMethod(type, "<GetGizmos>BreedingAnimal"); MP.RegisterSyncMethod(type, "<GetGizmos>Breeder"); MP.RegisterSyncMethod(type, "<GetGizmos>Milking"); MP.RegisterSyncMethod(type, "<GetGizmos>Hero"); */ // You can choose to not auto register and do it manually // with the MP.Register* methods. // Use MP.IsInMultiplayer to act upon it in other places // user can have it enabled and not be in session } //generate PredictableSeed for Verse.Rand public static int PredictableSeed() { int seed = 0; try { Map map = Find.CurrentMap; //int seedHourOfDay = GenLocalDate.HourOfDay(map); //int seedDayOfYear = GenLocalDate.DayOfYear(map); //int seedYear = GenLocalDate.Year(map); seed = (GenLocalDate.HourOfDay(map) + GenLocalDate.DayOfYear(map)) * GenLocalDate.Year(map); //int seed = (seedHourOfDay + seedDayOfYear) * seedYear; //Log.Warning("seedHourOfDay: " + seedHourOfDay + "\nseedDayOfYear: " + seedDayOfYear + "\nseedYear: " + seedYear + "\n" + seed); } catch { seed = Rand.Int; } return seed; } //generate PredictableSeed for Verse.Rand [SyncMethod] public static float RJW_MP_RAND() { return Rand.Value; } } }
jojo1541/rjw
1.4/Source/Modules/Multiplayer/Multiplayer.cs
C#
mit
2,049
using RimWorld; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Nymphs { public interface INymphService { Pawn GenerateNymph(Map map, PawnKindDef nymphKind = null, Faction faction = null); IEnumerable<Pawn> GenerateNymphs(Map map, int count); PawnKindDef RandomNymphKind(); IEnumerable<PawnKindDef> ListNymphKindDefs(); void SetManhunter(Pawn nymph); } }
jojo1541/rjw
1.4/Source/Modules/Nymphs/INymphService.cs
C#
mit
478
using RimWorld; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System; using System.Collections.Generic; using System.Linq; using System.Text; using System.Threading.Tasks; using Verse; namespace rjw.Modules.Nymphs.Implementation { public class NymphService : INymphService { private static ILog _log = LogManager.GetLogger<NymphService, NymphLogProvider>(); public static readonly INymphService Instance; static NymphService() { Instance = new NymphService(); } public Pawn GenerateNymph(Map map, PawnKindDef nymphKind = null, Faction faction = null) { if (nymphKind == null) { nymphKind = RandomNymphKind(); } PawnGenerationRequest request = new PawnGenerationRequest( kind: nymphKind, faction: faction, tile: map.Tile, forceGenerateNewPawn: true, canGeneratePawnRelations: true, colonistRelationChanceFactor: 0.0f, inhabitant: true, relationWithExtraPawnChanceFactor: 0 ); Pawn nymph = PawnGenerator.GeneratePawn(request); _log.Debug($"Generated Nymph {nymph.GetName()}"); return nymph; } public IEnumerable<Pawn> GenerateNymphs(Map map, int count) { if (count <= 0) { yield break; } PawnKindDef nymphKind = RandomNymphKind(); for (int i = 0; i < count; i++) { yield return GenerateNymph(map, nymphKind); } } public PawnKindDef RandomNymphKind() { return ListNymphKindDefs() .RandomElement(); } public IEnumerable<PawnKindDef> ListNymphKindDefs() { return DefDatabase<PawnKindDef>.AllDefs .Where(x => x.defName.Contains("Nymph")); } public void SetManhunter(Pawn nymph) { if (RJWSettings.NymphPermanentManhunter) { nymph.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.ManhunterPermanent); } else { nymph.mindState.mentalStateHandler.TryStartMentalState(MentalStateDefOf.Manhunter); } } } }
jojo1541/rjw
1.4/Source/Modules/Nymphs/Implementation/NymphService.cs
C#
mit
1,931
using Multiplayer.API; using RimWorld; using rjw.Modules.Nymphs.Implementation; using rjw.Modules.Shared.Logs; using System.Collections.Generic; using UnityEngine; using Verse; namespace rjw.Modules.Nymphs.Incidents { public abstract class IncidentWorker_BaseNymphRaid : IncidentWorker_NeutralGroup { private static ILog _log = LogManager.GetLogger<IncidentWorker_BaseNymphRaid, NymphLogProvider>(); protected static readonly INymphService _nymphGeneratorService; static IncidentWorker_BaseNymphRaid() { _nymphGeneratorService = NymphService.Instance; } protected virtual float ThreatPointMultiplier => 1f; [SyncMethod] protected override bool CanFireNowSub(IncidentParms parms) { //No multiplayer support ... I guess if (MP.IsInMultiplayer) { _log.Debug("Could not fire because multiplayer api is on"); return false; } //No map if (parms.target is Map == false) { _log.Debug("Could not fire because the incident target is not a map"); return false; } return base.CanFireNowSub(parms); } protected virtual int GetNymphCount(IncidentParms parms, Map map) { //Calculating nymphs manyness int count; count = Mathf.RoundToInt(parms.points / parms.pawnKind.combatPower * ThreatPointMultiplier); //Cap the min count = Mathf.Max(count, 1); return count; } [SyncMethod] protected override void ResolveParmsPoints(IncidentParms parms) { if (parms.points <= 0) { parms.points = StorytellerUtility.DefaultThreatPointsNow(parms.target) * ThreatPointMultiplier; } _log.Debug($"Incident generated with {parms.points} points"); } [SyncMethod] protected override bool TryExecuteWorker(IncidentParms parms) { _log.Debug($"Generating incident"); //Walk from the edge parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn; if (parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms) == false) { _log.Debug($"Incident failed to fire, no spawn points available"); return false; } //Find PawnKind parms.pawnKind = Nymph_Generator.GetFixedNymphPawnKindDef(); if(parms.pawnKind == null) { _log.Debug($"Incident failed to fire, no Pawn Kind for nymphs"); return false; } //Calculating nymphs manyness int count = GetNymphCount(parms, (Map)parms.target); _log.Debug($"Will generate {count} nymphs"); List<Pawn> nymphs = GenerateNymphs(parms.target as Map, count); parms.raidArrivalMode.Worker.Arrive(nymphs, parms); SetManhunters(nymphs); Find.LetterStack.ReceiveLetter( "RJW_nymph_incident_raid_title".Translate(), "RJW_nymph_incident_raid_description".Translate(), LetterDefOf.ThreatBig, nymphs); return true; } protected List<Pawn> GenerateNymphs(Map map, int count) { List<Pawn> result = new List<Pawn>(); PawnKindDef nymphKind = _nymphGeneratorService.RandomNymphKind(); for (int i = 1; i <= count; ++i) { Pawn nymph = _nymphGeneratorService.GenerateNymph(map, nymphKind); //Set it wild nymph.ChangeKind(PawnKindDefOf.WildMan); result.Add(nymph); } return result; } protected void SetManhunters(List<Pawn> nymphs) { foreach (var nymph in nymphs) { _nymphGeneratorService.SetManhunter(nymph); } } } }
jojo1541/rjw
1.4/Source/Modules/Nymphs/Incidents/IncidentWorker_BaseNymphRaid.cs
C#
mit
3,294
using Multiplayer.API; using RimWorld; using rjw.Modules.Nymphs.Implementation; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System.Collections.Generic; using Verse; namespace rjw.Modules.Nymphs.Incidents { public class IncidentWorker_NymphJoin : IncidentWorker { private static ILog _log = LogManager.GetLogger<IncidentWorker_NymphJoin, NymphLogProvider>(); protected static readonly INymphService _nymphGeneratorService; static IncidentWorker_NymphJoin() { _nymphGeneratorService = NymphService.Instance; } [SyncMethod] protected override bool CanFireNowSub(IncidentParms parms) { //The event is disabled, don't fire ! if (RJWSettings.NymphTamed == false) { _log.Debug("The incident can't fire as it is disabled in RJW settings"); return false; } //No multiplayer support if (MP.IsInMultiplayer) { _log.Debug("Could not fire because multiplayer api is on"); return false; } //No map if (parms.target is Map == false) { _log.Debug("Could not fire because the incident target is not a map"); return false; } return base.CanFireNowSub(parms); } [SyncMethod] protected override bool TryExecuteWorker(IncidentParms parms) { _log.Debug($"Generating incident"); //Walk from the edge parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn; if (parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms) == false) { _log.Debug($"Incident failed to fire, no spawn points available"); return false; } Pawn nymph = GenerateNymph(parms.target as Map); _log.Debug($"Generated nymph {nymph.GetName()}"); parms.raidArrivalMode.Worker.Arrive(new List<Pawn>() { nymph }, parms); JoinPlayerFaction(nymph); Find.LetterStack.ReceiveLetter( "RJW_nymph_incident_join_title".Translate(), "RJW_nymph_incident_join_description".Translate(), LetterDefOf.PositiveEvent, nymph); return true; } protected Pawn GenerateNymph(Map map) { Pawn nymph = _nymphGeneratorService.GenerateNymph(map); nymph.ChangeKind(PawnKindDefOf.WildMan); return nymph; } protected void JoinPlayerFaction(Pawn nymph) { nymph.SetFaction(Faction.OfPlayer); } } }
jojo1541/rjw
1.4/Source/Modules/Nymphs/Incidents/IncidentWorker_NymphJoin.cs
C#
mit
2,245
using Multiplayer.API; using RimWorld; using rjw.Modules.Shared.Logs; using UnityEngine; using Verse; namespace rjw.Modules.Nymphs.Incidents { public class IncidentWorker_NymphRaidEasy : IncidentWorker_BaseNymphRaid { private static ILog _log = LogManager.GetLogger<IncidentWorker_NymphRaidEasy, NymphLogProvider>(); [SyncMethod] protected override bool CanFireNowSub(IncidentParms parms) { //The event is disabled, don't fire ! if (RJWSettings.NymphRaidEasy == false) { _log.Debug("The incident can't fire as it is disabled in RJW settings"); return false; } return base.CanFireNowSub(parms); } protected override int GetNymphCount(IncidentParms parms, Map map) { int count; //Calculating nymphs manyness if (RJWSettings.NymphRaidRP) { count = base.GetNymphCount(parms, map); } else { count = (Find.World.worldPawns.AllPawnsAlive.Count + map.mapPawns.FreeColonistsAndPrisonersSpawnedCount); //Cap the max count = Mathf.Min(count, 100); //Cap the min count = Mathf.Max(count, 1); } return count; } } }
jojo1541/rjw
1.4/Source/Modules/Nymphs/Incidents/IncidentWorker_NymphRaidEasy.cs
C#
mit
1,103
using Multiplayer.API; using RimWorld; using rjw.Modules.Shared.Logs; using UnityEngine; using Verse; namespace rjw.Modules.Nymphs.Incidents { public class IncidentWorker_NymphRaidHard : IncidentWorker_BaseNymphRaid { private static ILog _log = LogManager.GetLogger<IncidentWorker_NymphRaidHard, NymphLogProvider>(); protected override float ThreatPointMultiplier => 1.5f; [SyncMethod] protected override bool CanFireNowSub(IncidentParms parms) { //The event is disabled, don't fire ! if (RJWSettings.NymphRaidHard == false) { _log.Debug("The incident can't fire as it is disabled in RJW settings"); return false; } return base.CanFireNowSub(parms); } protected override int GetNymphCount(IncidentParms parms, Map map) { int count; //Calculating nymphs manyness if (RJWSettings.NymphRaidRP) { count = base.GetNymphCount(parms, map); } else { count = map.mapPawns.AllPawnsSpawnedCount; //Cap the max count = Mathf.Min(count, 1000); //Cap the min count = Mathf.Max(count, 1); } return count; } } }
jojo1541/rjw
1.4/Source/Modules/Nymphs/Incidents/IncidentWorker_NymphRaidHard.cs
C#
mit
1,100
using Multiplayer.API; using RimWorld; using rjw.Modules.Nymphs.Implementation; using rjw.Modules.Shared.Extensions; using rjw.Modules.Shared.Logs; using System.Collections.Generic; using Verse; namespace rjw.Modules.Nymphs.Incidents { public class IncidentWorker_NymphVisitor : IncidentWorker { private static ILog _log = LogManager.GetLogger<IncidentWorker_NymphVisitor, NymphLogProvider>(); protected static readonly INymphService _nymphService; static IncidentWorker_NymphVisitor() { _nymphService = NymphService.Instance; } [SyncMethod] protected override bool CanFireNowSub(IncidentParms parms) { //The event is disabled, don't fire ! if (RJWSettings.NymphWild == false) { _log.Debug("The incident can't fire as it is disabled in RJW settings"); return false; } //No multiplayer support ... I guess if (MP.IsInMultiplayer) { _log.Debug("Could not fire because multiplayer api is on"); return false; } //No map if (parms.target is Map == false) { _log.Debug("Could not fire because the incident target is not a map"); return false; } return base.CanFireNowSub(parms); } [SyncMethod] protected override bool TryExecuteWorker(IncidentParms parms) { _log.Debug($"Generating incident"); //Walk from the edge parms.raidArrivalMode = PawnsArrivalModeDefOf.EdgeWalkIn; if (parms.raidArrivalMode.Worker.TryResolveRaidSpawnCenter(parms) == false) { _log.Debug($"Incident failed to fire, no spawn points available"); return false; } Pawn nymph = GenerateNymph(parms.target as Map); _log.Debug($"Generated nymph {nymph.GetName()}"); parms.raidArrivalMode.Worker.Arrive(new List<Pawn>() { nymph }, parms); SetManhunter(nymph); Find.LetterStack.ReceiveLetter( "RJW_nymph_incident_wander_title".Translate(), "RJW_nymph_incident_wander_description".Translate(), LetterDefOf.ThreatSmall, nymph); return true; } protected Pawn GenerateNymph(Map map) { Pawn nymph = _nymphService.GenerateNymph(map); nymph.ChangeKind(PawnKindDefOf.WildMan); return nymph; } protected void SetManhunter(Pawn nymph) { _nymphService.SetManhunter(nymph); } } }
jojo1541/rjw
1.4/Source/Modules/Nymphs/Incidents/IncidentWorker_NymphVisitor.cs
C#
mit
2,229
using System; using System.Linq; using Verse; using Verse.AI; using Verse.AI.Group; using RimWorld; namespace rjw { // Token: 0x020006B5 RID: 1717 public class JobGiver_NymphSapper : ThinkNode_JobGiver { // Token: 0x06002E54 RID: 11860 RVA: 0x001041A7 File Offset: 0x001023A7 public override ThinkNode DeepCopy(bool resolve = true) { JobGiver_NymphSapper jobGiver_NymphSapper = (JobGiver_NymphSapper)base.DeepCopy(resolve); jobGiver_NymphSapper.canMineMineables = this.canMineMineables; jobGiver_NymphSapper.canMineNonMineables = this.canMineNonMineables; return jobGiver_NymphSapper; } // Token: 0x06002E55 RID: 11861 RVA: 0x001041D0 File Offset: 0x001023D0 protected override Job TryGiveJob(Pawn pawn) { if (!RJWSettings.NymphSappers) return null; if (!xxx.is_nympho(pawn)) return null; IntVec3 intVec; { IAttackTarget attackTarget; if (!(from x in pawn.Map.mapPawns.FreeColonistsAndPrisonersSpawned where !x.ThreatDisabled(pawn) && pawn.CanReach(x, PathEndMode.OnCell, Danger.Deadly, false, false, TraverseMode.PassAllDestroyableThings) select x).TryRandomElement(out attackTarget)) { return null; } intVec = attackTarget.Thing.Position; } using (PawnPath pawnPath = pawn.Map.pathFinder.FindPath(pawn.Position, intVec, TraverseParms.For(pawn, Danger.Deadly, TraverseMode.PassDoors, false), PathEndMode.OnCell)) { IntVec3 cellBeforeBlocker; Thing thing = pawnPath.FirstBlockingBuilding(out cellBeforeBlocker, pawn); if (thing != null) { Job job = DigUtility.PassBlockerJob(pawn, thing, cellBeforeBlocker, this.canMineMineables, this.canMineNonMineables); if (job != null) { return job; } } } return JobMaker.MakeJob(JobDefOf.Goto, intVec, 500, true); } // Token: 0x04001A64 RID: 6756 private bool canMineMineables = false; // Token: 0x04001A65 RID: 6757 private bool canMineNonMineables = false; // Token: 0x04001A66 RID: 6758 private const float ReachDestDist = 10f; // Token: 0x04001A67 RID: 6759 private const int CheckOverrideInterval = 500; } }
jojo1541/rjw
1.4/Source/Modules/Nymphs/JobGivers/JobGiver_NymphSapper.cs
C#
mit
2,124