mirror of
				https://gitgud.io/lutepickle/rjw_menstruation.git
				synced 2024-08-14 22:46:52 +00:00 
			
		
		
		
	Move quirk testing into a dedicated function in anticipation of the RJW quirk submod
This commit is contained in:
		
							parent
							
								
									130ad4df29
								
							
						
					
					
						commit
						e5aa310528
					
				
					 8 changed files with 49 additions and 15 deletions
				
			
		
										
											Binary file not shown.
										
									
								
							| 
						 | 
					@ -89,7 +89,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
                else m.moodPowerFactor = 0.3f;
 | 
					                else m.moodPowerFactor = 0.3f;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (pawn.Has(Quirk.Breeder)) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
 | 
					            if (pawn.HasQuirk(QuirkUtility.Quirks.Breeder)) pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.HateTookContraceptivePill);
 | 
				
			||||||
            else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill);
 | 
					            else pawn.needs.mood.thoughts.memories.TryGainMemoryFast(VariousDefOf.TookContraceptivePill);
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
    }
 | 
					    }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -307,7 +307,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
                        }
 | 
					                        }
 | 
				
			||||||
                        else part.TransformValue(StatRequest.For(Pawn), ref ovulationChance);
 | 
					                        else part.TransformValue(StatRequest.For(Pawn), ref ovulationChance);
 | 
				
			||||||
                    }
 | 
					                    }
 | 
				
			||||||
                    if (Pawn.Has(Quirk.Breeder)) ovulationChance *= 10.0f;
 | 
					                    if (Pawn.HasQuirk(QuirkUtility.Quirks.Breeder)) ovulationChance *= 10.0f;
 | 
				
			||||||
                    try
 | 
					                    try
 | 
				
			||||||
                    {
 | 
					                    {
 | 
				
			||||||
                        calculatingOvulationChance = true;
 | 
					                        calculatingOvulationChance = true;
 | 
				
			||||||
| 
						 | 
					@ -872,8 +872,8 @@ namespace RJW_Menstruation
 | 
				
			||||||
            if (!precum && fertility > 0 && IsDangerDay && pawn.relations.GetPregnancyApproachForPartner(Pawn) == PregnancyApproach.AvoidPregnancy)
 | 
					            if (!precum && fertility > 0 && IsDangerDay && pawn.relations.GetPregnancyApproachForPartner(Pawn) == PregnancyApproach.AvoidPregnancy)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                float successChance = pulloutSuccessRate;
 | 
					                float successChance = pulloutSuccessRate;
 | 
				
			||||||
                if (pawn.Has(Quirk.ImpregnationFetish)) successChance *= fetishPulloutSuccessModifier;
 | 
					                if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish)) successChance *= fetishPulloutSuccessModifier;
 | 
				
			||||||
                if (Pawn.Has(Quirk.ImpregnationFetish)) successChance *= fetishPulloutSuccessModifier;
 | 
					                if (Pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish)) successChance *= fetishPulloutSuccessModifier;
 | 
				
			||||||
                if (Rand.Chance(successChance)) return;
 | 
					                if (Rand.Chance(successChance)) return;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (Pawn.HasIUD()) fertility /= 100f;
 | 
					            if (Pawn.HasIUD()) fertility /= 100f;
 | 
				
			||||||
| 
						 | 
					@ -1772,9 +1772,9 @@ namespace RJW_Menstruation
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (!xxx.is_human(Pawn) || !xxx.is_human(cummer)) return;
 | 
					            if (!xxx.is_human(Pawn) || !xxx.is_human(cummer)) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if ((cummer.Has(Quirk.Teratophile) != (Pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) ||
 | 
					            if ((cummer.HasQuirk(QuirkUtility.Quirks.Teratophile) != (Pawn.GetStatValue(StatDefOf.PawnBeauty) >= 0)) ||
 | 
				
			||||||
                cummer.Has(Quirk.ImpregnationFetish) ||
 | 
					                cummer.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) ||
 | 
				
			||||||
                cummer.Has(Quirk.Breeder))
 | 
					                cummer.HasQuirk(QuirkUtility.Quirks.Breeder))
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (cummer.relations.OpinionOf(Pawn) <= -25)
 | 
					                if (cummer.relations.OpinionOf(Pawn) <= -25)
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
| 
						 | 
					@ -1788,7 +1788,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            if (IsDangerDay)
 | 
					            if (IsDangerDay)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (Pawn.Has(Quirk.Breeder) || Pawn.Has(Quirk.ImpregnationFetish))
 | 
					                if (Pawn.HasQuirk(QuirkUtility.Quirks.Breeder) || Pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer);
 | 
					                    Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetish, cummer);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
| 
						 | 
					@ -1811,7 +1811,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            else
 | 
					            else
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                if (Pawn.Has(Quirk.Breeder) || Pawn.Has(Quirk.ImpregnationFetish))
 | 
					                if (Pawn.HasQuirk(QuirkUtility.Quirks.Breeder) || Pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish))
 | 
				
			||||||
                {
 | 
					                {
 | 
				
			||||||
                    Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer);
 | 
					                    Pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.CameInsideFFetishSafe, cummer);
 | 
				
			||||||
                }
 | 
					                }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -23,11 +23,11 @@ namespace RJW_Menstruation
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (is_discovered ||
 | 
					            if (is_discovered ||
 | 
				
			||||||
                !xxx.is_human(pawn) ||
 | 
					                !xxx.is_human(pawn) ||
 | 
				
			||||||
                pawn.Has(Quirk.Breeder) ||
 | 
					                pawn.HasQuirk(QuirkUtility.Quirks.Breeder) ||
 | 
				
			||||||
                (pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) ||
 | 
					                (pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Spouse) ||
 | 
				
			||||||
                x.def.Equals(PawnRelationDefOf.Fiance))) != null)
 | 
					                x.def.Equals(PawnRelationDefOf.Fiance))) != null)
 | 
				
			||||||
                return;
 | 
					                return;
 | 
				
			||||||
            if (pawn.Has(Quirk.ImpregnationFetish) || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null)
 | 
					            if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || pawn.relations?.DirectRelations?.Find(x => x.def.Equals(PawnRelationDefOf.Lover)) != null)
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild);
 | 
					                pawn.needs.mood.thoughts.memories.TryGainMemory(VariousDefOf.UnwantedPregnancyMild);
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -31,7 +31,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
            List<Hediff> pawnparts = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
 | 
					            List<Hediff> pawnparts = Genital_Helper.get_PartsHediffList(pawn, Genital_Helper.get_genitalsBPR(pawn));
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            HediffComp_Menstruation comp;
 | 
					            HediffComp_Menstruation comp;
 | 
				
			||||||
            if (pawn.Has(Quirk.ImpregnationFetish) || partner.Has(Quirk.ImpregnationFetish) || partner.IsInEstrus())
 | 
					            if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.IsInEstrus())
 | 
				
			||||||
                comp = partner.GetFertileMenstruationComp();
 | 
					                comp = partner.GetFertileMenstruationComp();
 | 
				
			||||||
            else comp = partner.GetRandomMenstruationComp();
 | 
					            else comp = partner.GetRandomMenstruationComp();
 | 
				
			||||||
            if (comp == null) return true;
 | 
					            if (comp == null) return true;
 | 
				
			||||||
| 
						 | 
					@ -102,7 +102,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
 | 
					            if (partner.IsAnimal() && !Configurations.EnableAnimalCycle) return true;
 | 
				
			||||||
            HediffComp_Menstruation comp;
 | 
					            HediffComp_Menstruation comp;
 | 
				
			||||||
            if (pawn.Has(Quirk.ImpregnationFetish) || partner.Has(Quirk.ImpregnationFetish) || partner.IsInEstrus())
 | 
					            if (pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || partner.IsInEstrus())
 | 
				
			||||||
                comp = partner.GetFertileMenstruationComp();
 | 
					                comp = partner.GetFertileMenstruationComp();
 | 
				
			||||||
            else comp = partner.GetRandomMenstruationComp();
 | 
					            else comp = partner.GetRandomMenstruationComp();
 | 
				
			||||||
            if (comp == null)
 | 
					            if (comp == null)
 | 
				
			||||||
| 
						 | 
					@ -179,7 +179,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
        {
 | 
					        {
 | 
				
			||||||
            // Awkward, but it'll have to do
 | 
					            // Awkward, but it'll have to do
 | 
				
			||||||
            Pawn pawn = props.pawn;
 | 
					            Pawn pawn = props.pawn;
 | 
				
			||||||
            if (__result == 0 || !pawn.Has(Quirk.ImpregnationFetish) || !props.hasPartner()) return;
 | 
					            if (__result == 0 || !pawn.HasQuirk(QuirkUtility.Quirks.ImpregnationFetish) || !props.hasPartner()) return;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            // Check if the existing code would have added the count
 | 
					            // Check if the existing code would have added the count
 | 
				
			||||||
            Pawn partner = props.partner;
 | 
					            Pawn partner = props.partner;
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
							
								
								
									
										33
									
								
								1.4/source/RJW_Menstruation/RJW_Menstruation/QuirkUtility.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										33
									
								
								1.4/source/RJW_Menstruation/RJW_Menstruation/QuirkUtility.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
					@ -0,0 +1,33 @@
 | 
				
			||||||
 | 
					using rjw;
 | 
				
			||||||
 | 
					using Verse;
 | 
				
			||||||
 | 
					
 | 
				
			||||||
 | 
					namespace RJW_Menstruation
 | 
				
			||||||
 | 
					{
 | 
				
			||||||
 | 
					    public static class QuirkUtility
 | 
				
			||||||
 | 
					    {
 | 
				
			||||||
 | 
					        // All quirks used in Menstruation
 | 
				
			||||||
 | 
					        public enum Quirks
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            Breeder,
 | 
				
			||||||
 | 
					            ImpregnationFetish,
 | 
				
			||||||
 | 
					            Messy,
 | 
				
			||||||
 | 
					            Teratophile,
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					        public static bool HasQuirk(this Pawn pawn, Quirks quirk)
 | 
				
			||||||
 | 
					        {
 | 
				
			||||||
 | 
					            switch (quirk)
 | 
				
			||||||
 | 
					            {
 | 
				
			||||||
 | 
					                case Quirks.Breeder:
 | 
				
			||||||
 | 
					                    return pawn.Has(Quirk.Breeder);
 | 
				
			||||||
 | 
					                case Quirks.ImpregnationFetish:
 | 
				
			||||||
 | 
					                    return pawn.Has(Quirk.ImpregnationFetish);
 | 
				
			||||||
 | 
					                case Quirks.Messy:
 | 
				
			||||||
 | 
					                    return pawn.Has(Quirk.Messy);
 | 
				
			||||||
 | 
					                case Quirks.Teratophile:
 | 
				
			||||||
 | 
					                    return pawn.Has(Quirk.Teratophile);
 | 
				
			||||||
 | 
					                default:
 | 
				
			||||||
 | 
					                    return false;
 | 
				
			||||||
 | 
					            }
 | 
				
			||||||
 | 
					        }
 | 
				
			||||||
 | 
					    }
 | 
				
			||||||
 | 
					}
 | 
				
			||||||
| 
						 | 
					@ -77,6 +77,7 @@
 | 
				
			||||||
    <Compile Include="Patch\GC_Patch.cs" />
 | 
					    <Compile Include="Patch\GC_Patch.cs" />
 | 
				
			||||||
    <Compile Include="Patch\Gizmo_Patch.cs" />
 | 
					    <Compile Include="Patch\Gizmo_Patch.cs" />
 | 
				
			||||||
    <Compile Include="PregnancyCommon.cs" />
 | 
					    <Compile Include="PregnancyCommon.cs" />
 | 
				
			||||||
 | 
					    <Compile Include="QuirkUtility.cs" />
 | 
				
			||||||
    <Compile Include="Recipe_Surgery.cs" />
 | 
					    <Compile Include="Recipe_Surgery.cs" />
 | 
				
			||||||
    <Compile Include="StatParts.cs" />
 | 
					    <Compile Include="StatParts.cs" />
 | 
				
			||||||
    <Compile Include="UI\Dialog_HybridCustom.cs" />
 | 
					    <Compile Include="UI\Dialog_HybridCustom.cs" />
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
| 
						 | 
					@ -86,7 +86,7 @@ namespace RJW_Menstruation
 | 
				
			||||||
            {
 | 
					            {
 | 
				
			||||||
                res = 0.0f;
 | 
					                res = 0.0f;
 | 
				
			||||||
            }
 | 
					            }
 | 
				
			||||||
            if (pawn.Has(Quirk.Messy)) res *= Rand.Range(4.0f, 8.0f);
 | 
					            if (pawn.HasQuirk(QuirkUtility.Quirks.Messy)) res *= Rand.Range(4.0f, 8.0f);
 | 
				
			||||||
 | 
					
 | 
				
			||||||
            return res;
 | 
					            return res;
 | 
				
			||||||
        }
 | 
					        }
 | 
				
			||||||
| 
						 | 
					
 | 
				
			||||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue