# femcyc

!{Hourly reduction in semen potency}
!{First it sets the array index to the first index, then it checks to be sure the array tracking the age is less than 200 hours. If it is 200 hours old, it kills that index, which should shift the index up. If it is less than 200 hours old, it sets a current potency drop. The drop is 2x or 3x regularly, but during ovulation it is only 1x, to represent the better environment from fertile cervical mucus.}
ctemp = 0
ctemp[1] = 0
ctemp[2] = 0
cumarrtemp = 0
:cummarrpdloop
if cumarrage[cumarrtemp] < 190 and cumarrcpt[cumarrtemp] > 0:
	CumPDrop = cumarrcpt[cumarrtemp] / (200 - cumarrage[cumarrtemp])
	if ovulate <= 0:
		Temprand = rand(0,3)
		if temprand <= 0:
			CumPDrop = CumPDrop*3
		elseif temprand = 1:
			CumPDrop = CumPDrop*2
		end
	end
	cumarrcpt[cumarrtemp] -= CumPDrop
	cumarrage[cumarrtemp] += 1
	cumarrtemp += 1
	arrmodtmp = arrsize('$cumarrnam')
	if arrmodtmp > cumarrtemp:
		jump 'cummarrpdloop'
	end
else
	KILLVAR 'cumarrcpt',cumarrtemp
	KILLVAR 'cumarrppt',cumarrtemp
	KILLVAR '$cumarrnam',cumarrtemp
	KILLVAR 'cumarrage',cumarrtemp
	KILLVAR 'cumarrdel',cumarrtemp
	KILLVAR 'cumarrkno',cumarrtemp
	KILLVAR 'cumarrcon',cumarrtemp    
	arrmodtmp = arrsize('$cumarrnam')
	if arrmodtmp > cumarrtemp:
		jump 'cummarrpdloop'
	end
end

cumarrtemp = 0
if arrsize('sparrvol') > 0:
	:cumspaloop
	!!Succubus absorption (not yet active)
	!{if sparrloc[cumarrtemp] = 0 or sparrloc[cumarrtemp] = 3 or sparrloc[cumarrtemp] = 12:
		sexnutrition += 30*succublvl
		sparrvol[cumarrtemp] -= 30*succublvl
		if sparrvol[cumarrtemp] < 0: sexnutrition += sparrvol[cumarrtemp] & sparrvol[cumarrtemp] = 0
	end}
	if sparrvol[cumarrtemp] > 0:
		sparrtmpv = arrsize('$cumarrnam')
		if sparrloc[cumarrtemp] = 17:
			sparrtmpv = arrpos('$cumarrnam',$sparrnam[cumarrtemp])
			if sparrage[cumarrtemp] < 4:
				cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/5
			elseif sparrage[cumarrtemp] < 10:
				cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/30
			end
		elseif sparrloc[cumarrtemp] = 0:
			sparrtmpv = arrpos('$cumarrnam',$sparrnam[cumarrtemp])
			if sparrage[cumarrtemp] < 4:
				cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/40
			elseif sparrage[cumarrtemp] < 10:
				cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/60
			end
		elseif sparrslc[cumarrtemp] = 1 and sparrage < 5:
			if sparrloc[cumarrtemp] = 1:
				cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]/1000*sparrage[cumarrtemp]/sparrvol[cumarrtemp]
				cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
				$cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
				cumarrage[sparrtmpv] = sparrage[cumarrtemp]
				cumarrdel[sparrtmpv] = 1
				cumarrkno[sparrtmpv] = 0
				cumarrcon[sparrtmpv] = 0
			end
		elseif sparrslc[cumarrtemp] = 3 and sparrage < 5:
			if sparrloc[cumarrtemp] = 2:
				cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]/1000*sparrage[cumarrtemp]/sparrvol[cumarrtemp]
				cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
				$cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
				cumarrage[sparrtmpv] = sparrage[cumarrtemp]
				cumarrdel[sparrtmpv] = 3
				cumarrkno[sparrtmpv] = 0
				cumarrcon[sparrtmpv] = 0
			elseif sparrloc[cumarrtemp] = 4:
				cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]/1000*sparrage[cumarrtemp]/sparrvol[cumarrtemp]
				cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
				$cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
				cumarrage[sparrtmpv] = sparrage[cumarrtemp]
				cumarrdel[sparrtmpv] = 2
				cumarrkno[sparrtmpv] = 0
				cumarrcon[sparrtmpv] = 0
			end
		elseif sparrslc[cumarrtemp] = 5 and sparrage < 5:
			if sparrloc[cumarrtemp] = 3:
				cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]/1000*sparrage[cumarrtemp]/sparrvol[cumarrtemp]
				cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
				$cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
				cumarrage[sparrtmpv] = sparrage[cumarrtemp]
				cumarrdel[sparrtmpv] = 2
				cumarrkno[sparrtmpv] = 0
				cumarrcon[sparrtmpv] = 0
			elseif sparrloc[cumarrtemp] = 5:
				cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]/1000*sparrage[cumarrtemp]/sparrvol[cumarrtemp]
				cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
				$cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
				cumarrage[sparrtmpv] = sparrage[cumarrtemp]
				cumarrdel[sparrtmpv] = 3
				cumarrkno[sparrtmpv] = 0
				cumarrcon[sparrtmpv] = 0
			elseif sparrloc[cumarrtemp] = 6:
				cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]/1000*sparrage[cumarrtemp]/sparrvol[cumarrtemp]
				cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
				$cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
				cumarrage[sparrtmpv] = sparrage[cumarrtemp]
				cumarrdel[sparrtmpv] = 3
				cumarrkno[sparrtmpv] = 0
				cumarrcon[sparrtmpv] = 0
			end
		end
	else
		KILLVAR 'spafinloc',cumarrtemp
		KILLVAR 'sparrage',cumarrtemp
		KILLVAR 'sparrloc',cumarrtemp
		KILLVAR '$sparrnam',cumarrtemp
		KILLVAR 'sparrppt',cumarrtemp
		KILLVAR 'sparridt',cumarrtemp
		KILLVAR 'sparrvol',cumarrtemp
		KILLVAR 'sparrslc',cumarrtemp
		
	end
	if sparrloc[cumarrtemp] = 0 or sparrloc[cumarrtemp] = 3 or sparrloc[cumarrtemp] = 12:sparrvol[cumarrtemp] -= sparrage[cumarrtemp]/2
	if sparrloc[cumarrtemp] = 0 and cumsumvag > 60: sparrslc = 1
	if sparrloc[cumarrtemp] = 3 and cumsumass > 60: sparrslc = 1
	if sparrloc[cumarrtemp] = 17 and sparrage[cumarrtemp] > 48:
		cumcondslip = 1
		health -= 3
		'You feel nauseous.'
		if rand(0,5) < 5: health -= 2
	else
		cumcondslip = 0
	end
	cumsumbod = ctemp
	cumsumvag = ctemp[1]
	cumsumass = ctemp[2]
	if sparrloc[cumarrtemp] ! 0 and sparrloc[cumarrtemp] ! 3 and sparrloc[cumarrtemp] ! 12 and isprok = 0 and sparrage < 5: sparrslc[cumarrtemp] += 1
	sparrage[cumarrtemp] += 1
	cumarrtemp += 1
	if cumarrtemp < arrsize('sparrvol'): jump 'cumspaloop'
	ctemp += sparrvol[cumarrtemp]
	if sparrloc[cumarrtemp] = 0: ctemp[1] += sparrvol[cumarrtemp]
	if sparrloc[cumarrtemp] = 3: ctemp[2] += sparrvol[cumarrtemp]
end

if lactate > 0:
	if lactatemv <= 0:
		lactatemv = 0
		if lactatemm < titK*4 and milkgrowday < daystart:
			lactatemm += 1
			lactatemv += 1
			bgrowday = daystart
		elseif milkgrowday < daystart:
			if rand(0,30) = 0: titK += 1
			milkgrowday = daystart
		end
	elseif lactatemv < lactatemm:
		lactatemv += lactatemm/20
	elseif lactatemv = lactatemm and milkgrowday < daystart:
		milkgrowday = daystart
		lactatemm -= 1
		lactatemv -= 1
		if rand(0,90) = 0: titK -= 1
	elseif lactatemv > lactatemm:
		lactatemv = lactatemm
	end
end

!{Menstruation to Follicular. Verifies that the cycle is in the bloody phase. It then checks to see if you are done bleeding. If you are, it starts the Follicular phase. There is a small chance your follcular phase will be anywhere from a day to 3 days short, done by the random release of a boosted EggRH. Otherwise, it just starts it clean.}
if cycle <= 0:
	if mesec <= 0:
		Cycle = 1
		mesec = 0
		if rand(0,1000) = 1000:
			EggRH = rand(20,80)
		else
			EggRH = 0
		end
		FocH = EggRH
	else
		mesec -= 1
	end
!{Follicular to Ovulation. It checks to see if you are on the Follicular phase. If you are, it checks to see if you are ready to ovulate. If you arent, it increases your ovulation ticker by 1, then gives a random chance to increase it again. Then it checks to see if you have ovarian problems, and if you do, decreases your ovulation ticker. When all that is done, it checks to see if you have any birth control chemical, and if its above a certain amount, it reduces your ovulation ticker.}
elseif cycle = 1:
	if FocH <= 150:
		EggRH +=1
		FocH +=1
		if rand(0,1) = 1: EggRH += 1
		temprand = rand(0,1000)
		temprand -= sterileov
		if temprand <= 0: EggRH -= 1
		if pillcon > 7000: EggRH -= 1
	else
!{If you are ready to ovulate, it creates a chance to double ovulate. That chance is increased by your age. Then it does the same for a triple ovulation. Then it sets the ovulation tag, ovulation hour count, and begins a ticker for the life of the eggs.}
		Temprand = rand(0,20)
		Temprand += age/15
		Temprand -= pillcon/1000
		if temprand > 20:
			EggRH += 205
			Temprand = rand(0,20)
			Temprand += age/15
			if temprand > 20: EggRH += 410
		end
		FocH = 0
		Ovulate = 24 + rand(0,20)
		Cycle = 2
		ferteggage = 0
	end
elseif cycle = 2:
!{Fertilization. It checks if you are ovulating and that there is cum in the cum array. Then it sets a random flag with a chance of 25*10000. (1 in 25 chance.) It then overlays that chance with the concentration of pill chemical in your blood, initializing it if it is in the negatives for some reason. It begins at the beginning of the cum array, and starts the processing. The check should be done with the same number. It is checking the oldest first. Their sperm should already be in the best position, even though it is unhealty by comparison. Then it moves down to the fresher stuff. The first sperm to have the potency above the threshold gets to fertilize. So a custom potency of a million is a sure pregnancy.}
	arrmodtmp = arrsize('$cumarrnam')
	if Ovulate > 0 and arrmodtmp > 0:
		Temprand = rand(1,250000)
		if pillcon < 0: pillcon = 0
		Temprand += pillcon
		if steriletu = 1: Temprand += Temprand*30
		cumarrtemp = 0
		:cumloop
!{Here it verifies there is unfertilized eggs. If there are, it checks the current index potency against the current threshold. If it fails, it goes up one in the index, checks to verify it hasnt reached the end, then starts a new check. if it succeeds, it checks to see if it is a second or greater part of a litter, if it isnt, then it cleans up the array containing a list of the potential fathers, then sets the list to contain people your MC should know are potential fathers for the baby. It does this by evaluating the cum array, the potential fathers variable. It does this independently of the main loop evaluating the array for pregnancy.}
		if UnfertEgg > 0:
			if TempRand < cumarrcpt[cumarrtemp]:
				if fertegg = 0:
					KILLVAR '$wombpotfath'
					$wombthfath = 'Unknown'
					$wombpotfath[0] = 'Unknown'
					FathpotAdd = 1
					Fathpotcheck = 0
					arrmodtmp = arrsize('$cumarrnam')
					:potfathaddLoop
					if arrmodtmp > Fathpotcheck:
						if cumarrkno[Fathpotcheck] = 1:
							$wombpotfath[Fathpotadd] = $cumarrnam[Fathpotcheck]
							Fathpotadd += 1
						end
						Fathpotcheck += 1
						Jump 'potfathaddloop'
					end
				end
!{It adds a fertilized egg, removes an unfertilized egg, then sets the array index checker to the size of the array of children you have to make sure it is adding to the end of the file. It then sets a temporary flag to determine the sex of your baby. 0 is a girl. Then it calls the babys name unborn. It clears the variable for the age, sets the real fathers name to the name stored in the cum array, then sets the person you think is the father of this baby to "unknown". It then sets a random hair color and random eye color. This was used in the old system in a variable that wasnt ever called from the best of my ability to find. Then it flags the child based on what kind of contraception failed when it was concieved. Useful in several ways.}
				FertEgg += 1
				UnfertEgg -= 1
				Nextbaby = arrsize('$ChildFath')
				Temppolkid = rand(0,1)
				polkid[nextbaby] = Temppolkid
				$kidname[nextbaby] = 'unborn'
				kidage[nextbaby] = 0
				daykid[nextbaby] = 0
				monthkid[nextbaby] = 0
				yearkid[nextbaby] = 0
				Babyptype[nextbaby] = 0
				$ChildFath[nextbaby] = $cumarrnam[cumarrtemp]
				$ChildThFath[nextbaby] = 'unknown'
				hairkid[nextbaby] = rand(0, 3)
				eyeskid[nextbaby] = rand(0, 3)
				ChildConType = cumarrcon[nextbaby]
			else
				cumarrtemp += 1
				arrmodtmp = arrsize('$cumarrnam')
				if cumarrtemp < arrmodtmp:
					Jump 'cumloop'
				end
			end
		end
	end
!{Ovulation to Luteal. It checks to see if you are on the ovulation cycle. If you are, it checks you for your pillcon. If it is high enough, no egg is released. Under high concentrations of pill chemical, ovulation ticks away quicker. Otherwise, it checks to see if your ovulation hormone is high enough, and if it is it gives you an egg and drops a good chunk down on your ovulation hormone. if its still high, it drops another egg. Then it checks your ovulation hours. If its down to 0, it starts the Luteal phase. Otherwise, it adds an hour to the egg age and reduces the ovulation window by an hour.}
	if pillcon > 26000:
		if rand(0,400) ! 1:
			EggRH = 0
		end
		ovulate -= 2
	end
	:OviLoop
	If EggRH > (UnfertEgg * 150):
		Unfertegg += 1
		EggRH -= 200*UnfertEgg
		Jump 'OviLoop'
	end
	If ovulate <= 0:
		cycle = 3
		UnfertEgg = 0
	end
	ferteggage += 1
	Ovulate -= 1
!{Luteal to Menstration or Pregnancy. First it verifies this is the Luteal phase. Then it adds an hour to the age of the eggs. Then if there is a fertized egg, it rolls a random chance. if the egg age is low, it checks for risk of an entopic pregnancy. This is increased with older age and if you have a tubal ligation sterilization.}
elseif cycle = 3:
	ferteggage += 1
	if FertEgg >= 1:
		temprand = rand (0,100000)
		if ferteggage < 120:
			temprand += 170
			temprand -= age*10
			if steriletu = 1: temprand -= 200
!{if there is a entopic pregnancy, it sets the first unborn baby in the array to this. Each egg could be different. It then removes the fertilized egg, adds an embryo, Then it adds some pregnancy hormone if you arent already pregnant, and calls you officially pregnant.}
			if temprand <= 0:
				tempbabyi  = ARRPOS('Babyptype',0)
				Babyptype[tempbabyi] = 2
				FertEgg -= 1
				BabyEmbryo += 1
				PregChem = random(0,30)
				if preg = 0:
					preg = 1
				end
			end
		else
!{Otherwise, it adds your womb sterilie factor to the temprand. Then it checks if your temprand crosses a threshold for implantation. Younger women implant easier. It then sets the next baby to the next unimplanted baby in your kid array. It registers the kid as a normal pregnancy, removes a fertilized egg and adds an embryo. Then it adds some pregnancy hormone if you arent already pregnant, and calls you officially pregnant.}
			temprand += sterilewb
			if temprand <= (1200-(Age*7)):
				tempbabyi  = ARRPOS('Babyptype',0)
				Babyptype[tempbabyi] = 1
				FertEgg -= 1
				BabyEmbryo += 1
				PregChem += rand(0,30)
				if preg = 0:
					preg = 1
				end
			end
		end
	end
!{Then, it progresses the Luteal phase. It checks to see if you are pregnant. If you are, it ends the cycle and sets preg if your Luteal hormone is at the max as well as cleans out any unimplanted eggs. Otherwise, it just progresses pregnancy chemical and Luteal Hormone. If you arent pregnant, it checks your Luteal hormone. If its at the maximum, it adds 3-5 days of bleeding, clears out your unimplanted eggs, and clears out your Luteal hormone, or ends your cycle if you are past your menopausal age. Otherwise it will just progress the Luteal hormone.}
	if LutH > 300:
		:lutcycloop
		if fertegg > 0:
			tempbabyi = ARRPOS('Babyptype',0)
			KILLVAR 'polkid',tempbabyi
			KILLVAR '$kidname',tempbabyi
			KILLVAR 'kidage',tempbabyi
			KILLVAR 'daykid',tempbabyi
			KILLVAR 'monthkid',tempbabyi
			KILLVAR 'yearkid',tempbabyi
			KILLVAR 'Babyptype',tempbabyi
			KILLVAR '$ChildFath',tempbabyi
			KILLVAR '$ChildThFath',tempbabyi
			KILLVAR 'hairkid',tempbabyi
			KILLVAR 'eyeskid',tempbabyi
			KILLVAR 'cumarrcon',tempbabyi
			fertegg -= 1
			jump 'lutcycloop'
		end
		LutH = 0
		if preg = 1:
			cycle = 5
		elseif menoage <= age:
			KILLVAR '$wombpotfath'
			cycle = 6
		else
			KILLVAR '$wombpotfath'
			temprand = rand(0,10)
			if pillcon < 30000 or temprand = 0: 
				Cycle = 0
				if cyccustom = 1:
					daylastperiod = daystart
				end
				temprand = rand(0,10)
				if temprand = 0:
					mesec = 120
				elseif temprand < 9:
					mesec = 96
				else
					mesec = 72
				end
			else
				FocH = 0
				EggRH = 0
				Cycle = 1
				mesec = 0
			end
		end
	else
		if preg = 1:PregChem += 1
		if rand(0,100) < 100: LutH += 1
	end
!{Recovery to Follicular. It checks to see if you are in the recovery phase after a pregnancy. If you are, it checks to see if you still have recovery hormone. If you dont, it sets you into the follicular phase with a chance of a boosted Egg releasing hormone. Otherwise it decreases your recovery hormone with a chance to decrease it twice.}
elseif cycle = 4:
	if RecovH <= 0:
		Cycle = 1
		if cyccustom = 1:
			knowpregloss = 0
			knowpregrecover = 0
		end
		if rand(0,1000) = 1000:
			EggRH = rand(20,80)
		else
			EggRH = 0
		end
		FocH = EggRH
	else
		RecovH -= 1
		if rand(0,10) = 0:
			RecovH -= 1
		end
	end
!{Pregnancy Progression. It checks to see if you are in the pregnancy phase of a cycle. If you are, it progresses your pregnancy chemical. Then it gives a fluxuation of possible due dates. If you cross the due date threshold, you enter labor, marked by preg = 2. Other milestones will also be placed in here, including body deformations. Right now this is mostly an empty placeholder.}
elseif cycle = 5:
	PregChem += 1
	temprand = rand(-400,800)
	temprand -= (babyembryo-1)*588
	if PregChem > 6573 + temprand and preg ! 2:
		'A sharp pain pierces your abdomen, and you feel something flow down your legs. Your water has broken!'
		$cycreport_txt = 'In labour'
		arrmodtmp =arrsize('$ChildFath')
		arrmodtmp -= (babyembryo+1)
		:babyfinalpreploop
		if arrmodtmp < arrsize('$ChildFath') and daykid[arrmodtmp] = 0:
			daykid[arrmodtmp] = 42
			$ChildThFath[arrmodtmp] = $wombthfath
			arrmodtmp += 1
			jump 'babyfinalpreploop'
		end
		KILLVAR '$wombpotfath'
		KILLVAR '$wombthfath'
		preg = 2
		if babyembryo > 1:
			'Your babies are coming...'
		else
			'Your baby is coming...'
		end
		if PregChem < 3885:
			'Way too early!'
		elseif PregChem < 5229:
			'Very early!'
		elseif PregChem < 6069:
			'Early.'
		elseif PregChem > 6959:
			'Late.'
		elseif PregChem > 7245:
			'Very Late!'
		end
		'You need to get to a clinic.'
	end
	if PregChem > 3887:
		if lactate <= 0:
			'You begin lactating'
			lactate = 1
			lactatemv = 0
			lactatemm = 10
		else
			if lactate < 1: lactate = 1
		end
	end
	if PregChem > 2203:
		if pregchem > 2853 or kid > 0:
			if rand(0,7) = 0: dynamic $d_pregmovement
		else
			if rand(0,500) = 0: dynamic $d_pregmovement
		end
	end
end

dynamic $d_cycreport_update

--- femcyc ---------------------------------

