# Cum_Manage

!!
!!	THIS IS A CORE FILE TO GAME MECHANICS. Please edit CAREFULLY, and leave as many comments as possible!!
!!
!!	The comments in this file serve as tutorial to managing cum/sperm during scene writing and game-play. Please read them.
!!	
!!	spafinloc and cum array naming takes precident over other naming schemes. Always import and export variables by their cum array names
!!
!!------------------------------------------------------------------------------------------------------------
!!
!!	Cum Array indices:
!!
!!	cumarrnam : Sperm Owner
!!	cumarrppt : Sperm Potential Potency (max sperm delivery)
!!	cumarrcpt : Sperm Current Potency	(current amount of sperm)
!!	cumarrdel : Sperm "Delivery" (method of *VAGINAL ONLY* acquisition)
!!	cumarrcon :	Contraception typ used
!!	cumarrage : Sperm age in hours
!!	cumarrkno : Did you know/realize who did it?
!!	
!!	
!!	
!!	Values of 'cumarrdel' as defined by the cum_arr:
!!	
!!	cumarrdel = 0 : 'Vaginal intercourse'
!!	cumarrdel = 1 : 'From spatter on labia'
!!	cumarrdel = 2 : 'From the anal area'
!!	cumarrdel = 3 : 'From sperm on clothing'
!!	cumarrdel = 4 : 'From sperm on fingers'
!!	cumarrdel = 5 : 'From sperm on wipes'
!!	cumarrdel = 6 : 'Unknown'
!!	
!!	
!!	
!!	Values of 'cumarrcon' as defined by the cum_arr:
!!	
!!	cumarrcon = 0: 'No contraception used'
!!	cumarrcon = 1: 'You lied about being on the pill'
!!	cumarrcon = 2: 'You were on the pill'
!!	cumarrcon = 3: 'You used a condom'
!!	cumarrcon = 4: 'The condom broke'
!!	cumarrcon = 5: 'The condom slipped off inside you'
!!	cumarrcon = 6: 'The condom was sabotaged by someone else'
!!	cumarrcon = 7: 'You sabotaged the condom'
!!	cumarrcon = 8: 'Precum had sperm in it'
!!	cumarrcon = 9: 'You believe are sterile'
!!
!!	
!!	
!!	Values of 'cumarrkno' as defined by the cum_arr:
!!	
!!	cumarrkno = -2 : 'You were unaware there was sperm in you'
!!	cumarrkno = -1 : 'You do not think that any sperm has gotten into you'
!!	cumarrkno =  0 : 'You know somebody got sperm in you, but you don''t know that person'
!!	cumarrkno =  1 : 'You know who got sperm in you'
!!	
!!
!!	
!!	Locations to be defined by 'spafinloc'
!!
!!	0 = 'In your Vagina'
!!	1 = 'On your labia'
!!	2 = 'On your panties over your vagina'
!!	3 = 'In your anus'
!!	4 = 'On your butt'
!!	5 = 'On your panties over your butt'
!!	6 = 'On your clothes in your groin area'
!!	7 = 'On your clothes'
!!	8 = 'On your back'
!!	9 = 'On your legs'
!!	10 = 'On your arms'
!!	11 = 'On your face'
!!	12 = 'Inside your mouth'
!!	13 = 'On your hands'
!!	14 = 'On your stomach'
!!	15 = 'On your breasts'
!!	16 = 'In your hair'
!!	17 = 'In a condom in your vagina'
!!	
!!	
!!	   
!!------------------------------------------------------------------------------------------------------------


if $ARGS[0] = '':

!!{	Here we define our important variables.}

	if sexvolume <= 0: sexvolume = 40

	if vibratorIN = 1 and spafinloc = 0 and replace_vib = 0: vibratorIN = 0

	if analplugIN = 1 and spafinloc = 3 and replace_analplug = 0: analplugIN = 0

!!{	Set the cum array temp to the current size of the cum array to add a new entry to the end of file. Then checks to see if you are on the pill. If you are and there is no contraception used, it flags this as a "done with pill" act, which means a pregnancy will be a pill failure.}

	cumarrtemp = arrsize('$cumarrnam')

	if sexcontra = 0 and pillcon > 1000: sexcontra = 2

!{Check for previous deposit, and if it was by the same guy and precum, it sets cumarrtemp back by one}
!	if $cumarrnam[cumarrtemp-1] = $boy and cumarrkno[cumarrtemp-1] = -1:cumarrtemp -= 1 & sexspecpot = cumarrppt[cumarrtemp]

	if cumprecheck = 1:
		cumarrkno[cumarrtemp] = -1
	elseif sexunaware > 0:
		cumarrkno[cumarrtemp] = -2
	elseif sexpartkno = 1:
		cumarrkno[cumarrtemp] = 1
	else
		cumarrkno[cumarrtemp] = 0
	end
	cumarrtemp2 = arrsize('sparrvol')
!!{	Check to see if this is flagged as a preejaculate emmission. All vaginal penetrations that flag this as cumprecheck contain preejaculate. Guidelines for calling it: If your boy is likely to have masterbated, had sex, or otherwise encouraged semen to leak out of their urethra in the last 48 hours, they probably have some fertile preejaculate. If in doubt, let it leak. The chances of pregnancy from it are low, and the MC should have been wearing protection.}
			
	if cumprecheck ! 1:

!!{	Here it checks for vaginal deposit.}

			
		if spafinloc <= 0:
			
!!{	Next it sets the variables in the array. The cumming boys name is first and cum age to 0.
!!	The cum delivery location is set to vaginally, and we check to see if this is an unknowing sex act. 
!!	If it is, it makes it so the MC doesnt know who did it. 
!!	If the boy has a custom specified potency 'sexspecpot', it flags the potency. Otherwise it sets it to the default.
!!	Default potency potential is generated from a random multiplier of sexvolume. 
!!	Sexvolume defaults to 40 (4 mL), but may be overwritten with 'sexvolume'.}

			$cumarrnam[cumarrtemp] = $boy
			cumarrage[cumarrtemp] = 0
			cumarrdel[cumarrtemp] = 0



			if sexspecpot ! 0:
				cumarrppt[cumarrtemp] = sexspecpot

			else
				cumarrppt[cumarrtemp] = sexvolume * rand(250, 300)

			end

!!{	Now it sets up the splatter and actual internal cum. 
!!	First it sets the array to the spatter end of file.	Then it checks for riding bareback. 
!!	If theres a condom, it gives a chance for the condom to fail in general, slip off and remain in the vagina, or break.}
			
			if sexcontra > 2:
				
				if sexcontra = 3:
					temprand = rand(0,1000)
					dick_wid = 3
					
					if $dick_girth = 'skinny': dick_wid = 2
					
					if $dick_girth = 'slim': dick_wid = 3
					
					if $dick_girth = 'well proportioned': dick_wid = 3
					
					if $dick_girth = 'thicker than average': dick_wid = 4
					
					if $dick_girth = 'thick': dick_wid = 4
					
					if $dick_girth = 'massive': dick_wid = 5
					
					if $dick_girth = 'monstrous': dick_wid = 6

					break_thresh = dick_wid * 2
					break_thresh -= vagina / 4
					break_thresh += dick / 4
					slip_thresh = 18 - (dick_wid * 2)
					slip_thresh -= (vagina / 2)
					slip_thresh -= dick / 4

					if break_thresh < 4: break_thresh = 4
					
					if slip_thresh < 1: slip_thresh = 1
					break_thresh += slip_thresh

					if temprand = 0:
						cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/4
						cumarrcon[cumarrtemp] = 3
					
					elseif temprand < slip_thresh:
						cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/200
						cumarrcon[cumarrtemp] = 5
						cumcondslip = 1
						cumcondsanb = cumarrtemp
						sexcontra = 5
						sparrage[cumarrtemp2] = 0
						sparrloc[cumarrtemp2] = 17
						$sparrnam[cumarrtemp2] = $boy
						
						if sexspecpot ! 0:
							sparrppt[cumarrtemp2] = sexspecpot
						
						else
							sparrppt[cumarrtemp2] = sexvolume * rand(250, 300)
						
						end
						
						sparrvol[cumarrtemp2] += sexvolume
						cumsumbod += sexvolume
						cumsumvag += sexvolume
						
						if sexvolume <= 0: sparrvol[cumarrtemp2] += 40 & cumsumbod += 40 & cumsumvag += 40
						
						sparridt[cumarrtemp2] = cumarrkno[cumarrtemp]
						sparrslc[cumarrtemp2] = 0
					
					elseif temprand <= break_thresh:
						cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/2
						cumarrcon[cumarrtemp] = 4
						sexcontra = 4
						sparrage[cumarrtemp2] = 0
						sparrloc[cumarrtemp2] = 0
						$sparrnam[cumarrtemp2] = $boy
						
						if sexspecpot ! 0:
							sparrppt[cumarrtemp2] = sexspecpot
						
						else
							sparrppt[cumarrtemp2] = sexvolume * rand(250, 300)
						
						end
						
						sparrvol[cumarrtemp2] += sexvolume
						cumsumbod += sexvolume
						cumsumvag += sexvolume
						
						if sexvolume <= 0: sparrvol[cumarrtemp2] += 40 & cumsumbod += 40 & cumsumvag += 40
						
						sparridt[cumarrtemp2] = cumarrkno[cumarrtemp]
						sparrslc[cumarrtemp2] = 0
					
					else
						cumarrcpt[cumarrtemp] += 5
						cumarrcon[cumarrtemp] = 3
					
					end	

!!{	Next it checks to see if the event is calling specifically for a burst or slipped off condom. 
!!	It treats them the same as if the condom above had a failure.}

				elseif sexcontra = 4:
					cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/2
					cumarrcon[cumarrtemp] = 4
					sparrage[cumarrtemp2] = 0
					sparrloc[cumarrtemp2] = 0
					$sparrnam[cumarrtemp2] = $boy
					
					if sexspecpot ! 0:
						sparrppt[cumarrtemp2] = sexspecpot
					
					else
						sparrppt[cumarrtemp2] = sexvolume * rand(250, 300)
					
					end
					
					sparrvol[cumarrtemp2] += sexvolume
					cumsumbod += sexvolume
					cumsumvag += sexvolume
					
					if sexvolume <= 0: sparrvol[cumarrtemp2] += 40 & cumsumbod += 40 & cumsumvag += 40
					
					sparridt[cumarrtemp2] = cumarrkno[cumarrtemp]
					sparrslc[cumarrtemp2] = 0
				
				elseif sexcontra = 5:
					cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/200
					cumarrcon[cumarrtemp] = 5
					cumcondslip = 1
					cumcondsanb = cumarrtemp
					sparrage[cumarrtemp2] = 0
					sparrloc[cumarrtemp2] = 17
					$sparrnam[cumarrtemp2] = $boy
					
					if sexspecpot ! 0:
						sparrppt[cumarrtemp2] = sexspecpot
					
					else
						sparrppt[cumarrtemp2] = sexvolume * rand(250, 300)
					
					end
					
					sparrvol[cumarrtemp2] += sexvolume
					cumsumbod += sexvolume
					cumsumvag += sexvolume
					
					if sexvolume <= 0: sparrvol[cumarrtemp2] += 40 & cumsumbod += 40 & cumsumvag += 40
					
					sparridt[cumarrtemp2] = cumarrkno[cumarrtemp]
					sparrslc[cumarrtemp2] = 0	

!!{	Next, check for sabotaged condoms. First sabotaged by you, then sabotaged by the guy.
!!	If they were sabotaged, it acts similar to a condom failure, but worse.}

				elseif sexcontra = 6:
					cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/3
					cumarrcon[cumarrtemp] = 6
				
				elseif sexcontra = 7:
					cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/3
					cumarrcon[cumarrtemp] = 7
				
				end					
!!{	If you have no protection, you get a nice, full load of semen.}

			else
				sparrage[cumarrtemp2] = 0
				sparrloc[cumarrtemp2] = 0
				$sparrnam[cumarrtemp2] = $boy
				
				if sexspecpot ! 0:
					sparrppt[cumarrtemp2] = sexspecpot
				
				else
					sparrppt[cumarrtemp2] = 10000
				
				end
				
				sparrvol[cumarrtemp2] += sexvolume
				cumsumbod += sexvolume
				cumsumvag += sexvolume
				
				if sexvolume <= 0: sparrvol[cumarrtemp2] += 40 & cumsumbod += 40 & cumsumvag += 40
				
				sparridt[cumarrtemp2] = cumarrkno[cumarrtemp]
				sparrslc[cumarrtemp2] = 0
				cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/5*4
				cumarrcon[cumarrtemp] = sexcontra
			
			end

!!{	If you arent getting it in the vagina, and the boy isnt pumping it into a condom, a spatter is made and applied. 
!!	If you arent wearing any panties and it was called to hit your panties, it goes directly to your groin. 
!!	If you are naked and it calls for a clothing strike, it will go to your body instead.}
			
		elseif spafinloc > 0 and sexcontra < 3:
				
			sparrage[cumarrtemp2] = 0
			
			if tanga = 0:
				
				if spafinloc = 2:
					spafinloc = 1
				
				elseif spafinloc = 5: 
					spafinloc = 4
				
				end
			
			end
			
			if $clothingworntype = 'nude':
				
				if spafinloc = 2:
					spafinloc = 1
				
				elseif spafinloc = 5:
					spafinloc = 4
				
				elseif spafinloc = 6:
					
					if rand(0,1) = 0:
						spafinloc = 1
					
					else
						spafinloc = 4
					
					end
				
				elseif spafinloc = 7:
					
					if rand(0,1) = 0:
						spafinloc = 14
					
					else
						spafinloc = 15
					
					end
				
				end
			
			end
			
			sparrloc[cumarrtemp2] = spafinloc
			
			if spafinloc = 12 and swallow >= 10 and rand(0,3) = 0: energy += 2
			
			$sparrnam[cumarrtemp2] = $boy
			
			if sexspecpot ! 0:
				sparrppt[cumarrtemp2] = sexspecpot
			
			else
				sparrppt[cumarrtemp2] = sexvolume * rand(250, 300)
			
			end
			
			sparrvol[cumarrtemp2] += sexvolume
			cumsumbod += sexvolume
			
			if sexvolume <= 0: sparrvol[cumarrtemp2] += 40 & cumsumbod += 40 & cumsumvag += 40
			
			if spafinloc = 3:
				cumsumass += sexvolume
				
				if sexvolume <= 0: cumsumass += 40
			
			end
			
			sparridt[cumarrtemp2] = cumarrkno[cumarrtemp]
			sparrslc[cumarrtemp2] = 0
		
		end
		if cumarrppt[cumarrtemp] < cumarrcpt[cumarrtemp]:cumarrcpt[cumarrtemp] = cumarrppt[cumarrtemp]
		sexpartkno = 0
		sexunaware = 0
		sexspecpot = 0

!!{	And this is the pre ejaculate release talked about above.}
		
	elseif sexcontra < 3 and spafinloc = 0:
		$cumarrnam[cumarrtemp] = $boy
		if sexspecpot ! 0:
			cumarrppt[cumarrtemp] = sexspecpot
		else
			cumarrppt[cumarrtemp] = sexvolume * rand(250, 300)
		end
		cumarrage[cumarrtemp] = 0
		cumarrdel[cumarrtemp] = 0
		cumarrcon[cumarrtemp] = sexcontra
		cumarrcpt[cumarrtemp] += cumarrppt[cumarrtemp]/12
		if cumarrppt[cumarrtemp] < cumarrcpt[cumarrtemp]:cumarrcpt[cumarrtemp] = cumarrppt[cumarrtemp]
	end

	sexspecpot = 0
	cumprecheck = 0
	spafinloc = 0
	sexvolume = 0

	dynamic $din_Update_Condom_Counts
	
	if cumsumass >= 60:
		arrmodtmp = arrpos('sparrloc',3)
		
		if sparrslc[arrmodtmp] <= 0: sparrslc[arrmodtmp] += 1
	
	end
	
	if cumsumvag >= 60:
		arrmodtmp = arrpos('sparrloc',0)
		
		if sparrslc[arrmodtmp] <= 0: sparrslc[arrmodtmp] += 1
	
	end

end


if $ARGS[0] = 'cumgather':
	cloc = ARGS[1]
	i = arrpos('sparrloc', cloc)
	
	if i ! -1 and i < arrsize('sparrloc'):
		
		if cloc = 0:
			$part = 'pussy'
		
		elseif cloc = 1:
			$part = 'pussylips'
		
		elseif cloc = 2 or cloc = 5:
			$part = 'your panties'
		
		elseif cloc = 3:
			$part = 'anus'
		
		elseif cloc = 4:
			$part = 'buttocks'
		
		elseif cloc = 6 or cloc = 7:
			$part = 'clothes'
		
		elseif cloc = 8:
			$part = 'back'
		
		elseif cloc = 9:
			$part = 'legs'
		
		elseif cloc = 10:
			$part = 'arms'
		
		elseif cloc = 11:
			$part = 'face'
		
		elseif cloc = 14:
			$part = 'stomach'
		
		elseif cloc = 15:
			$part = 'breasts'
		
		elseif cloc = 16:
			$part = 'hair'
		
		else
			$part = 'unknown'
		
		end
		
		if salfetka > 0:
			salfetka -= 1
			minut += 5
			'You use a wipe to clean the sperm from your <<$part>>.'
			gs 'cum_cleanup', 'cleanloc', cloc
			gs 'stat'
		
		end
	
	end

end


if $ARGS[0] = 'cumeater':
	cloc = ARGS[1]
	i = arrpos('sparrloc', cloc)
	
	if i ! -1 and i < arrsize('sparrloc'):
		spdirtyb = 1
		fbreath = 0
		vaf += 1
		$part = ''
		
		if cloc = 13:
			gs 'cum_cleanup', 'cleanloc', cloc
			'You carefully lick the sperm residue from both hands, enjoying the tart taste of semen.'
		
		else
			
			if cloc = 0:
				$part = 'pussy'
			
			elseif cloc = 1:
				$part = 'pussylips'
			
			elseif cloc = 2 or cloc = 5:
				$part = 'your panties'
				gs 'cum_cleanup', 'cleanloc', 2
				gs 'cum_cleanup', 'cleanloc', 5
			
			elseif cloc = 3:
				$part = 'anus'
			
			elseif cloc = 4:
				$part = 'buttocks'
			
			elseif cloc = 6 or cloc = 7:
				$part = 'clothes'
				gs 'cum_cleanup', 'cleanloc', 6
				gs 'cum_cleanup', 'cleanloc', 7
			
			elseif cloc = 8:
				$part = 'back'
			
			elseif cloc = 9:
				$part = 'legs'
			
			elseif cloc = 10:
				$part = 'arms'
			
			elseif cloc = 11:
				$part = 'face'
			
			elseif cloc = 14:
				$part = 'stomach'
			
			elseif cloc = 15:
				$part = 'breasts'
			
			elseif cloc = 16:
				$part = 'hair'
			
			else
				$part = 'unknown'
			
			end
			
			if rand(0, 1) = 0:
				'You collect a handful of sperm from your <<$part>> in your hand and lick it all up, enjoying the tart taste of semen.'
			
			else
				'You collect the sperm from your <<$part>> with your fingers and lick them, enjoying the tart taste of semen.'
			
			end
			
			gs 'cum_cleanup', 'cleanloc', cloc
		
		end
		
		minut += 5
		gs 'stat'
	
	end

end

--- Cum_Manage ---------------------------------

