mirror of
				https://github.com/amevarashi/RJW-Sexperience.git
				synced 2024-08-14 23:54:08 +00:00 
			
		
		
		
	Rename source folder
This commit is contained in:
		
							parent
							
								
									0a412a0060
								
							
						
					
					
						commit
						a4c046a841
					
				
					 55 changed files with 0 additions and 0 deletions
				
			
		
							
								
								
									
										39
									
								
								Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										39
									
								
								Source/RJWSexperience/Virginity/Recipe_HymenSurgery.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,39 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using System.Collections.Generic;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJWSexperience.Virginity
 | 
			
		||||
{
 | 
			
		||||
	public class Recipe_HymenSurgery : Recipe_Surgery
 | 
			
		||||
	{
 | 
			
		||||
		public override IEnumerable<BodyPartRecord> GetPartsToApplyOn(Pawn pawn, RecipeDef recipe)
 | 
			
		||||
		{
 | 
			
		||||
			if (pawn.gender != Gender.Female)
 | 
			
		||||
				yield break;
 | 
			
		||||
 | 
			
		||||
			BodyPartRecord part = Genital_Helper.get_genitalsBPR(pawn);
 | 
			
		||||
			if (part == null)
 | 
			
		||||
				yield break;
 | 
			
		||||
 | 
			
		||||
			List<Hediff> hediffs = Genital_Helper.get_PartsHediffList(pawn, part);
 | 
			
		||||
			if (Genital_Helper.has_vagina(pawn, hediffs) && !HasHymen(pawn))
 | 
			
		||||
				yield return part;
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public override void ApplyOnPawn(Pawn pawn, BodyPartRecord part, Pawn billDoer, List<Thing> ingredients, Bill bill)
 | 
			
		||||
		{
 | 
			
		||||
			if (billDoer == null)
 | 
			
		||||
				return;
 | 
			
		||||
 | 
			
		||||
			TaleRecorder.RecordTale(TaleDefOf.DidSurgery, new object[]
 | 
			
		||||
			{
 | 
			
		||||
				billDoer,
 | 
			
		||||
				pawn
 | 
			
		||||
			});
 | 
			
		||||
			TraitHandler.AddVirginTrait(pawn);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		private static bool HasHymen(Pawn pawn) => pawn.story?.traits?.GetTrait(VariousDefOf.Virgin)?.Degree > 0;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										10
									
								
								Source/RJWSexperience/Virginity/TraitDegree.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										10
									
								
								Source/RJWSexperience/Virginity/TraitDegree.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,10 @@
 | 
			
		|||
namespace RJWSexperience.Virginity
 | 
			
		||||
{
 | 
			
		||||
	public static class TraitDegree
 | 
			
		||||
	{
 | 
			
		||||
		public const int FemaleDamagedVirgin = -1;
 | 
			
		||||
		public const int MaleVirgin = 0;
 | 
			
		||||
		public const int FemaleAfterSurgery = 1;
 | 
			
		||||
		public const int FemaleVirgin = 2;
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
							
								
								
									
										64
									
								
								Source/RJWSexperience/Virginity/TraitHandler.cs
									
										
									
									
									
										Normal file
									
								
							
							
						
						
									
										64
									
								
								Source/RJWSexperience/Virginity/TraitHandler.cs
									
										
									
									
									
										Normal file
									
								
							| 
						 | 
				
			
			@ -0,0 +1,64 @@
 | 
			
		|||
using RimWorld;
 | 
			
		||||
using rjw;
 | 
			
		||||
using Verse;
 | 
			
		||||
 | 
			
		||||
namespace RJWSexperience.Virginity
 | 
			
		||||
{
 | 
			
		||||
	public static class TraitHandler
 | 
			
		||||
	{
 | 
			
		||||
		private const float hymenSurgeryChance = 0.05f;
 | 
			
		||||
 | 
			
		||||
		public static void GenerateVirginTrait(Pawn pawn)
 | 
			
		||||
		{
 | 
			
		||||
			if (pawn.story?.traits == null)
 | 
			
		||||
				return;
 | 
			
		||||
 | 
			
		||||
			if (pawn.gender == Gender.Female && !pawn.IsVirgin())
 | 
			
		||||
			{
 | 
			
		||||
				if (Rand.Chance(hymenSurgeryChance))
 | 
			
		||||
				{
 | 
			
		||||
					Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true);
 | 
			
		||||
					pawn.story.traits.GainTrait(virgin);
 | 
			
		||||
				}
 | 
			
		||||
				return;
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			AddVirginTrait(pawn);
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public static void AddVirginTrait(Pawn pawn)
 | 
			
		||||
		{
 | 
			
		||||
			if (pawn.story?.traits == null)
 | 
			
		||||
				return;
 | 
			
		||||
 | 
			
		||||
			if (pawn.IsVirgin())
 | 
			
		||||
			{
 | 
			
		||||
				int degree = TraitDegree.MaleVirgin;
 | 
			
		||||
				if (pawn.gender == Gender.Female)
 | 
			
		||||
					degree = TraitDegree.FemaleVirgin;
 | 
			
		||||
				Trait virgin = new Trait(VariousDefOf.Virgin, degree, true);
 | 
			
		||||
				pawn.story.traits.GainTrait(virgin);
 | 
			
		||||
			}
 | 
			
		||||
			else if (pawn.gender == Gender.Female)
 | 
			
		||||
			{
 | 
			
		||||
				Trait virgin = new Trait(VariousDefOf.Virgin, TraitDegree.FemaleAfterSurgery, true);
 | 
			
		||||
				pawn.story.traits.GainTrait(virgin);
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		public static int? RemoveVirginTrait(Pawn pawn)
 | 
			
		||||
		{
 | 
			
		||||
			Trait virgin = pawn.story?.traits?.GetTrait(VariousDefOf.Virgin);
 | 
			
		||||
			if (virgin == null)
 | 
			
		||||
				return null;
 | 
			
		||||
 | 
			
		||||
			int degree = virgin.Degree;
 | 
			
		||||
			if (pawn.gender == Gender.Female && degree > 0 && !pawn.Dead)
 | 
			
		||||
			{
 | 
			
		||||
				FilthMaker.TryMakeFilth(pawn.Position, pawn.Map, ThingDefOf.Filth_Blood, pawn.LabelShort, 1, FilthSourceFlags.Pawn);
 | 
			
		||||
			}
 | 
			
		||||
			pawn.story.traits.RemoveTrait(virgin);
 | 
			
		||||
			return degree;
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue