femcyc.qsrc 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993994
  1. # femcyc
  2. !!
  3. !! THIS IS A CORE FILE TO GAME MECHANICS. Please edit CAREFULLY, and leave as many comments as possible!!
  4. !!
  5. !!------------------------------------------------------------------------------------------------------------
  6. !! femcyc documentation
  7. !!------------------------------------------------------------------------------------------------------------
  8. !!
  9. !! The femcyc functions try to reproduce a realistic mentruation cycle as well as the proper
  10. !! pregnancy of Sveta and the mostly realistic semen absorption/decay cycle.
  11. !! The below will explain every variable in use as well as every function and the general construct.
  12. !! The femcyc is a highly complex and confusing collection of calculations. So if you do not understand
  13. !! it, it is best to leave it alone.
  14. !!
  15. !!------------------------------------------------------------------------------------------------------------
  16. !!
  17. !! $ChildFath : array for names of the childs biological father. This should be the absolute truth, not readily available information for the characters.
  18. !! $ChildFathDNA : array for the DNA of the childs father
  19. !! $ChildThFath : array for the IDs of the childs believed father (can be different from the biological father and should be in form of ID ie. 'A34' or 'unknown' if Sveta has no idea) Do not use for pregnancy events as it is only updated when going to labor. This is probably the variable you want to work with when doing paternity tests, or if father reacts to physical traits not matching despite Sveta claiming they are the dad.
  20. !! arrpos('$ChildThFath', 'A34') >= 0 can be used to test if the person 'A34' (Kolka, for example) has already had a child with you
  21. !! $childtype : child type. single child, fraternal twin, identical twin ...
  22. !! $cumfthname : Array of IDs of the possible fathers (conscious acts) 'unknown' if otherwise empty
  23. !! $cycreport_txt : Text for the current menstruation cycle. e.g. In labour.
  24. !! $d_cycreport_update : Dynamic variable to update cycle report
  25. !! $d_pregmovement : Dynamic variable for kid movement
  26. !! $kid_dna : DNA of the baby/kid
  27. !! $kidname : Name of the baby/kid
  28. !! $npc_dna : npc DNA
  29. !! $pcs_dna : Svetas DNA
  30. !! $wombDNA : sperm in womb potent enough to cause pregnancy
  31. !! $wombName : the identifier of the NPC
  32. !! $wombpotfath : the array of IDs of the potential fathers
  33. !! $wombthfath : The name of the person Sveta believes to be the father of ongoing pregnancy, updated from the cycle menu decision.
  34. !! $wombthfathID : The ID of the person Sveta believes to be the father of ongoing pregnancy, updated from the cycle menu decision. - Might be best variable for pregnancy events with the dad
  35. !! arrpos('$wombpotfath', 'A34') >= 0 can be used to test if the person 'A34' (Kolka, for example) is in the list of potential fathers
  36. !! arrmodtmp : temp array used in pregnancy progression
  37. !! babyembryo : used during implant phase. if the fertegg successfully nests, babyembryo is +1. BabyEmbryo is for how many unborn babies are inside Sveta.
  38. !! Babyptype : pregnancy type of unborn babies. they might be unimplanted 0, healthy 1, or Ectopic 2.
  39. !! broodcurse : some modifier for fertility - brood curse
  40. !! can_idx : candidate index - the index for the possible father
  41. !! can_sz : has array size of cumarrnam[], used to check if there is cum in the womb.
  42. !! cfl_ct : cum father lotto counter. used in a loop
  43. !! cfl_idx : cum father lotto index. used as index for arrays.
  44. !! cfl_sz : cum father lotto size. used for the size of the array
  45. !! cfw_idx : used for the sperm lotto. Index for the father
  46. !! cfw_sz : used for the sperm lotto. amount of semen in womb
  47. !! ChildConType : Contraceptives used during conception. e.g. condom slipped off or sveta was on a pill.
  48. !! ctemp : temporay array for cum ammount
  49. !! cum_total : how many amounts of cum are in svetas womb
  50. !! cumarr_idx : cum array index, used to identify how much cum is stored in the cum arrays
  51. !! cumarrtemp : another temp var for cum arrays
  52. !! cumcondslip : Introduced in Cum_Manage.qsrc. Did the condom slip off?
  53. !! cumcondslip_aware : is Sveta aware it slipped?
  54. !! cumfatherDNA[] : used to figure out the DNA of the father in the sperm lotto
  55. !! cumfathlotto[] : used to figure out the name of the father in the sperm lotto
  56. !! cumpdrop : used for calculation of drop in cum current potential
  57. !! cumsumass : sum of cum on ass
  58. !! cumsumbod : sum of cum on body
  59. !! cumsumvag : sum of cum on vagina
  60. !! cumtime[] : array to store how many times someone came in Sveta. More cumtime means more possibility to be the father.
  61. !! cheatVars['track_period'] : custom cycle flag variable. Either 0 or 1. Activates custom cycle reports during pregnancy.
  62. !! cycle : current state of svetas cycle, can be 0 to 5. 0 to 4 are usual mentruation cycles including fertilization. 5 is for the status 'pregnant'.
  63. !! daykid : Birthday of the baby/kid
  64. !! daylastperiod : daylastperiod is for Svetas knowledge on when she began her last period
  65. !! egg_idx : egg index. There could be more than one egg in Svetas womb, so the eggs have an index
  66. !! egg_sz : var to store amount of unfertilized eggs
  67. !! EggRH : The egg release counter. The level of egg release that Sveta has for her ovulation event. 150 generates a single egg, higher amounts might release more.
  68. !! eyeskid : Eye color of the child
  69. !! fert_thresh : the threshold of an egg to be fertilized. Modified by being on contraceptives and negative factors.
  70. !! FertEgg : How many unimplanted eggs Sveta has in her. These are possible babies, but they die 330 hours after ovulation if they do not implant.
  71. !! ferteggage : fertile egg age. used to check age of the egg (in hours). Time since the ovulation event. They last 330 and die if not implanted.
  72. !! firstmens : The first day that Sveta bled during her last cycle. this is different than daylastperiod because this is the actual date, while daylastperiod is when Svetlana remembers it being.
  73. !! FocH : FocH is for how many hours of Foccular cycle Sveta has gone through in her current fertility cycle. Focular starts at the end of her Luteal and contains the bleeding period in Svetkas cycle.
  74. !! FocH_Max : maximum Follicular time (in hours)
  75. !! hairkid : Hair color of the child
  76. !! imp_rand : randomizer variable used during egg implantation phase
  77. !! implant_day : day the egg was implanted
  78. !! implant_hour : hour the egg was implanted
  79. !! implant_idx : implant index used for array indexing, used in implantation phase
  80. !! implant_sz : implant array size, used in implantation phase
  81. !! isprok : used for menstruation bleeding flagging. can be 0 or 1.
  82. !! kid : Kid counter variable
  83. !! kidage : Age of the baby/child
  84. !! knowpregloss : knowpregloss is for Svetas knowledge that she lost a baby. 1 is for an abortion, 2 is for a miscarrage.
  85. !! knowpregrecover : knowpregrecover is for Svetas knowledge that she just gave birth.
  86. !! lactation[] : The lactation array. More on that in lact_lib
  87. !! lastmens : timestamp of last menstruation. The last day that Sveta bled during her last cycle.
  88. !! lastovulation : used to store the last ovulation date
  89. !! lotto_idx : lotto index. Used to randomly pick a sperm.
  90. !! LutH : How many hours of Luteal cycle Sveta has gone through in her current fertility cycle.
  91. !! LutH_Max : maximum Luteal time (in hours)
  92. !! menoage : The age Svetas will be when she goes through menopause.
  93. !! mesec : variable for menstruation. How many hours of bleeding Sveta has left in her current fertility cycle.
  94. !! monthkid : birth month of the kid
  95. !! nextbaby : index for babies.
  96. !! Ovulate : Ovulate is the amount of hours remaining in Svetas ovulation period of her current fertility cycle.
  97. !! pillcon : variable for contraceptive pills to prevent pregnancy. More on that below.
  98. !! polkid : Sex of the baby/kid. 0 = female, 1 = male
  99. !! preg : Pregnancy flag. 0 = not pregnant, 1 = pregnant, 2 = delivery
  100. !! PregChem : Progress of the pregnancy in hours.
  101. !! pregminut : total minutes + 1440 minutes. The time Sveta has from the first uterine contraction to labour. Usually Sveta dies during labour if this time is surpassed.
  102. !! cheatVars['preg_speed'] : Cheat variable for faster pregnancies.
  103. !! rcntorgzm : determine wether Sveta had an orgasm withhin the last hour or not (1 or 0)
  104. !! rcntorgzmtmp : temp variable to rewrite to rcntorgzm
  105. !! RecovH : Recovery counter in hours. RecovH is the amount of recover hours before Svetas fertility cycle resets after having a baby.
  106. !! rej_idx : egg rejection array index. used during luteal phase to loop through any eggs not implanted.
  107. !! rej_sz : egg rejection array size. used during luteal phase to loop through any eggs not implanted.
  108. !! sexnutrition : succubus sex nutrition
  109. !! sparrtmpv : temp var for spatter arrays for temporary array index tracking
  110. !! sterileov : sterile ovulation. used for negative effects on ovulation.
  111. !! steriletu : sterilized through tubal ligation procedure. Usually smaller than 0 when sterile.
  112. !! sterilewb : sterile womb. Womb damage. Used for negative impact in the womb.
  113. !! sucabscum : was cum absorbed by succubus? (1 or 0)
  114. !! succublvl : succubus level (obviously)
  115. !! succubusflag : used for succubus story arc. If Sveta is a succubus, the sperm will be absorbed
  116. !! succubxp : succubus experience
  117. !! succycletmp : succubus cycle temp var. Used during sperm absorption function.
  118. !! tempovbonus : temp var for ovulation bonus. Fertility bonus.
  119. !! temprand : used as temp var for randomizer
  120. !! tempwbbonus : temp variable for womb bonus during egg implant function
  121. !! totminut : total minutes variable, used by various functions
  122. !! UnfertEgg : UnfertEgg is how many unfertilized eggs Sveta has in her for fertilization during her Ovulation period. Unfertilized eggs are removed at the end of her Ovulation period.
  123. !! wombAmount : how potent is the sperm of a guy
  124. !! x : used as temp for a loop
  125. !! y : used as temp for a loop
  126. !! yearkid : Birth year of the baby/kid
  127. !! z : used as temp for a loop
  128. !!
  129. !! Cum Array indices (taken from Cum_Manage.qsrc):
  130. !!
  131. !! $cumarrnam : Sperm Owner
  132. !! cumarrppt : Sperm Potential Potency (max sperm delivery)
  133. !! cumarrcpt : Sperm Current Potency (current amount of sperm)
  134. !! cumarrdel : Sperm "Delivery" (method of *VAGINAL ONLY* acquisition)
  135. !! cumarrcon : Contraception typ used
  136. !! cumarrage : Sperm age in hours
  137. !! cumarrkno : Did you know/realize who did it?
  138. !! cumarrcnt : Unique identifier of the exact which time the MC has had this sperm incident occur.
  139. !!
  140. !! Spatter Array indices (taken from Cum_Manage.qsrc):
  141. !!
  142. !! sparrloc : Location of the sperm, as per cumarrdel
  143. !! $sparrnam : Spatter Owner
  144. !! sparrppt : Spatter Potential Potency (Used to increase potency if you do not clean yourself out)
  145. !! sparridt : Did you know/realize who did it?
  146. !! sparrvol : Volume of the spatter. 40 is average.
  147. !! sparrslc : Spread status of the spatter. High volume can spread the contaminant from it is starting place.
  148. !! sparrcnt : Unique identifier of the exact which time the MC has had this spatter incident occur.
  149. !!
  150. !! Values of 'cumarrdel' as defined by the cum_arr (taken from Cum_Manage.qsrc):
  151. !!
  152. !! cumarrdel = 0 : 'Vaginal intercourse'
  153. !! cumarrdel = 1 : 'From spatter on labia'
  154. !! cumarrdel = 2 : 'From the anal area'
  155. !! cumarrdel = 3 : 'From sperm on clothing'
  156. !! cumarrdel = 4 : 'From sperm on fingers'
  157. !! cumarrdel = 5 : 'From sperm on wipes'
  158. !! cumarrdel = 6 : 'Unknown'
  159. !!
  160. !! Values of 'cumarrcon' as defined by the cum_arr (taken from Cum_Manage.qsrc):
  161. !!
  162. !! cumarrcon = 0: 'No contraception used'
  163. !! cumarrcon = 1: 'You lied about being on the pill'
  164. !! cumarrcon = 2: 'You were on the pill'
  165. !! cumarrcon = 3: 'You used a condom'
  166. !! cumarrcon = 4: 'The condom broke'
  167. !! cumarrcon = 5: 'The condom slipped off inside you'
  168. !! cumarrcon = 6: 'The condom was sabotaged by someone else'
  169. !! cumarrcon = 7: 'You sabotaged the condom'
  170. !! cumarrcon = 8: 'Precum had sperm in it'
  171. !! cumarrcon = 9: 'You believe are sterile'
  172. !!
  173. !! Values of 'cumarrkno' as defined by the cum_arr (taken from Cum_Manage.qsrc):
  174. !!
  175. !! cumarrkno = -2 : 'You were unaware there was sperm in you'
  176. !! cumarrkno = -1 : 'You do not think that any sperm has gotten into you'
  177. !! cumarrkno = 0 : 'You know somebody got sperm in you, but you don''t know that person'
  178. !! cumarrkno = 1 : 'You know who got sperm in you'
  179. !!
  180. !! Setting for no STD checks
  181. !!
  182. !! cumnostd = 1 : No risk of STD, resets at end of file so must be used for all related cum_management calls
  183. !!
  184. !! 0 = 'In your Vagina'
  185. !! 1 = 'On your labia'
  186. !! 2 = 'On your panties over your vagina'
  187. !! 3 = 'In your anus'
  188. !! 4 = 'On your butt'
  189. !! 5 = 'On your panties over your butt'
  190. !! 6 = 'On your clothes in your groin area'
  191. !! 7 = 'On your clothes'
  192. !! 8 = 'On your back'
  193. !! 9 = 'On your legs'
  194. !! 10 = 'On your arms'
  195. !! 11 = 'On your face'
  196. !! 12 = 'Inside your mouth'
  197. !! 13 = 'On your hands'
  198. !! 14 = 'On your stomach'
  199. !! 15 = 'On your breasts'
  200. !! 16 = 'In your hair'
  201. !! 17 = 'In a condom in your vagina'
  202. !!------------------------------------------------------------------------------------------------------------
  203. !! important values for pillcon
  204. !!------------------------------------------------------------------------------------------------------------
  205. !! at 7000 pillcon sveta will begin slowing down the build up of hormone to release eggs - see cyc1
  206. !! at 20000 pillcon sveta will very rarely even build up hormone to release eggs but its random so it can still happen anyways - see cyc1 and cyc2
  207. !! at 26000 pillcon sveta only has a 1/400 chance of even releasing an egg at all even if she does build up enough hormone - see cyc2
  208. !! at 38000 pillcon sveta no longer has periods at all and cannot get pregnant anymore -- see cyc3
  209. !!------------------------------------------------------------------------------------------------------------
  210. !! Functions
  211. !!------------------------------------------------------------------------------------------------------------
  212. !! Default :
  213. !! - Hourly reduction in semen potency and semen absorption.
  214. !! - Hourly call for the breastcycle, managing lactation and changes in the breasts.
  215. !! - Hourly call of Svetas cycle via cycle variable.
  216. !!
  217. !! cyc0:
  218. !! - Handles actions from Menstruation to Follicular.
  219. !!
  220. !! cyc1:
  221. !! - Handles actions from Follicular to Ovulation.
  222. !!
  223. !! cyc2:
  224. !! - Handles actions for the Fertilization.
  225. !!
  226. !! cyc3:
  227. !! - handles actions from Luteal to Menstration or Pregnancy.
  228. !!
  229. !! cyc4:
  230. !! - handles actions from (post pregnancy) Recovery to Follicular..
  231. !!
  232. !! preg:
  233. !! - handles actions for the Pregnancy Progression.
  234. !!------------------------------------------------------------------------------------------------------------
  235. !! I have to initialize the variables somewhere, maybe in preCUST?
  236. if Luth_Max = 0: LutH_Max = rand(312,360) & !! 13-15 days including ovulation
  237. if Foch_Max = 0: FocH_Max = rand(312,360) & !! 13-15 days including menstruation
  238. if $ARGS[0] = '':
  239. !! calling the variable error handler, fixing variables here.
  240. gs 'femcyc', 'femcyc_errhdl'
  241. !{Hourly reduction in semen potency}
  242. !{First it sets the array index to the first index, then it checks to be sure the array tracking the age is less than 144 hours. If it is 144 hours old, it kills that index, which should shift the index up. If it is less than 144 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.}
  243. !{144 hours was selected due to that being approximately the maximum amount of time sperm is viable in the womb (120 would be more accurate, but there is leeway). PLEASE DO NOT CHANGE IT.}
  244. !{The potency drop may seem small in game-time, but is meant to be a reasonable approximation to real life. Avoid unprotected sex within 5 days of ovulation if you want to mitigate your risk.}
  245. !{the 'rcntorgzm' variable is set to determine whether Sveta has orgasmed within the last hour. If she has, a small potency boost for the guys she has slept with in that hour.}
  246. if rcntorgzm = 1:
  247. if rcntorgzmtmp = 1: rcntorgzm = 0 & rcntorgzmtmp = 0
  248. if rcntorgzmtmp = 0: rcntorgzmtmp = 1
  249. end
  250. cumarr_idx = 0
  251. :cumarrloop
  252. if cumarr_idx < arrsize('$cumarrnam'):
  253. if cumarrcpt[cumarr_idx] > 0 and cumarrage[cumarr_idx] < 144:
  254. if rcntorgzm = 1 and cumarrcpt[cumarr_idx] < cumarrppt[cumarr_idx] and cumarrage[cumarr_idx] < 1: cumarrcpt[cumarr_idx] += cumarrppt[cumarr_idx] / 12
  255. cumpdrop = cumarrcpt[cumarr_idx] / (144 - cumarrage[cumarr_idx])
  256. if cycle ! 2: cumpdrop += cumpdrop * rand(0, 2)
  257. cumarrcpt[cumarr_idx] -= cumpdrop
  258. if cumarrcpt[cumarr_idx] <= 0:
  259. gs 'cum_cleanup', 'cleanwomb', cumarr_idx
  260. else
  261. cumarrage[cumarr_idx] += 1
  262. cumarr_idx += 1
  263. end
  264. else
  265. gs 'cum_cleanup', 'cleanwomb', cumarr_idx
  266. end
  267. jump 'cumarrloop'
  268. end
  269. !!Succubus absorption of sperm in womb
  270. if succubusflag = 1:
  271. if arrsize('cumarrppt') > 0:
  272. succycletmp = 0
  273. :sucvagabs
  274. if cumarrdel[succycletmp] = 0:
  275. if cumarrcpt[succycletmp] > 10000:
  276. sexnutrition += 30 * succublvl
  277. succubxp += 3
  278. elseif cumarrcpt[succycletmp] < 3000 and cumarrcpt[succycletmp] > 1000:
  279. sexnutrition += 5 * succublvl
  280. succubxp += 2
  281. elseif cumarrcpt[succycletmp] =< 1000:
  282. sexnutrition += succublvl
  283. else
  284. sexnutrition += 25 * succublvl
  285. succubxp += 3
  286. end
  287. gs 'cum_cleanup', 'cleanwomb', succycletmp
  288. sucabscum = 1
  289. else
  290. succycletmp += 1
  291. end
  292. if succycletmp < arrsize('cumarrppt'): jump 'sucvagabs'
  293. end
  294. killvar 'succycletmp'
  295. end
  296. cumarrtemp = 0
  297. if arrsize('sparrvol') > 0:
  298. :cumspaloop
  299. !!Succubus absorption for internal locations other than womb
  300. if succubusflag = 1:
  301. if sparrloc[cumarrtemp] = 3 or sparrloc[cumarrtemp] = 12:
  302. sexnutrition += 25*succublvl
  303. succubxp += 3
  304. sucabscum = 1
  305. if sparrvol[cumarrtemp] > 0: sparrvol[cumarrtemp] = 0
  306. end
  307. !!{if sparrloc[cumarrtemp] = 0 or sparrloc[cumarrtemp] = 3 or sparrloc[cumarrtemp] = 12:
  308. sexnutrition += 30*succublvl
  309. sparrvol[cumarrtemp] -= 30*succublvl
  310. if sparrvol[cumarrtemp] < 0: sexnutrition += sparrvol[cumarrtemp] & sparrvol[cumarrtemp] = 0
  311. end}
  312. end
  313. !!{ Process spatter until it has volume or is too old in vagina. }
  314. if (sparrvol[cumarrtemp] > 0 or (sparrloc[cumarrtemp] = 0 and sparrage[cumarrtemp] < 10) and $sparrnam[cumarrtemp] ! ''):
  315. sparrtmpv = arrsize('$cumarrnam')
  316. if sparrloc[cumarrtemp] = 17:
  317. sparrtmpv = arrpos('cumarrcnt',sparrcnt[cumarrtemp])
  318. if sparrtmpv >= 0:
  319. !!'Found guy id <<sparrtmpv>>'
  320. if sparrage[cumarrtemp] < 4:
  321. cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/5
  322. elseif sparrage[cumarrtemp] < 10:
  323. cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/30
  324. end
  325. end
  326. elseif sparrloc[cumarrtemp] = 0:
  327. sparrtmpv = arrpos('cumarrcnt',sparrcnt[cumarrtemp])
  328. if sparrtmpv >= 0:
  329. !!'Found guy id' & sparrtmpv
  330. if sparrage[cumarrtemp] < 4:
  331. cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/40
  332. elseif sparrage[cumarrtemp] < 10:
  333. cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/60
  334. end
  335. end
  336. elseif sparrslc[cumarrtemp] = 1 and sparrage[cumarrtemp] < 5:
  337. if sparrloc[cumarrtemp] = 1:
  338. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  339. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  340. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  341. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  342. cumarrdel[sparrtmpv] = 1
  343. cumarrkno[sparrtmpv] = -1
  344. cumarrcon[sparrtmpv] = 0
  345. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  346. end
  347. elseif sparrslc[cumarrtemp] = 3 and sparrage[cumarrtemp] < 5:
  348. if sparrloc[cumarrtemp] = 2:
  349. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  350. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  351. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  352. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  353. cumarrdel[sparrtmpv] = 3
  354. cumarrkno[sparrtmpv] = -1
  355. cumarrcon[sparrtmpv] = 0
  356. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  357. elseif sparrloc[cumarrtemp] = 4:
  358. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  359. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  360. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  361. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  362. cumarrdel[sparrtmpv] = 2
  363. cumarrkno[sparrtmpv] = -1
  364. cumarrcon[sparrtmpv] = 0
  365. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  366. end
  367. elseif sparrslc[cumarrtemp] = 5 and sparrage[cumarrtemp] < 5:
  368. if sparrloc[cumarrtemp] = 3:
  369. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  370. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  371. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  372. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  373. cumarrdel[sparrtmpv] = 2
  374. cumarrkno[sparrtmpv] = -1
  375. cumarrcon[sparrtmpv] = 0
  376. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  377. elseif sparrloc[cumarrtemp] = 5:
  378. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  379. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  380. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  381. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  382. cumarrdel[sparrtmpv] = 3
  383. cumarrkno[sparrtmpv] = -1
  384. cumarrcon[sparrtmpv] = 0
  385. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  386. elseif sparrloc[cumarrtemp] = 6:
  387. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  388. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  389. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  390. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  391. cumarrdel[sparrtmpv] = 3
  392. cumarrkno[sparrtmpv] = -1
  393. cumarrcon[sparrtmpv] = 0
  394. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  395. end
  396. end
  397. if sparrloc[cumarrtemp] = 0 or sparrloc[cumarrtemp] = 3 or sparrloc[cumarrtemp] = 12:
  398. sparrvol[cumarrtemp] -= sparrage[cumarrtemp]/2
  399. if sparrvol[cumarrtemp] < 0:sparrvol[cumarrtemp] = 0
  400. end
  401. if sparrloc[cumarrtemp] = 0 and cumsumvag > 60: sparrslc[cumarrtemp] = 1
  402. if sparrloc[cumarrtemp] = 3 and cumsumass > 60: sparrslc[cumarrtemp] = 1
  403. if sparrloc[cumarrtemp] = 17:
  404. cumcondslip += 1
  405. if sparridt[cumarrtemp] >= 0:
  406. cumcondslip_aware = 1
  407. end
  408. if sparrage[cumarrtemp] > 48:
  409. cumcondslip_aware = 1
  410. if pcs_health > 100: pcs_health -= rand(3,sparrage[cumarrtemp] - 45)
  411. '<br><b><font color="red">You feel nauseous.</font></b>'
  412. end
  413. end
  414. if sparrloc[cumarrtemp] ! 0 and sparrloc[cumarrtemp] ! 3 and sparrloc[cumarrtemp] ! 12 and sparrage < 5: sparrslc[cumarrtemp] += 1
  415. sparrage[cumarrtemp] += 1
  416. ctemp[0] += sparrvol[cumarrtemp]
  417. if sparrloc[cumarrtemp] = 0: ctemp[1] += sparrvol[cumarrtemp]
  418. if sparrloc[cumarrtemp] = 3: ctemp[2] += sparrvol[cumarrtemp]
  419. else
  420. gs 'cum_cleanup', 'cleandeposit', cumarrtemp
  421. end
  422. if cumarrtemp < arrsize('sparrvol'): cumarrtemp += 1 & jump 'cumspaloop'
  423. cumsumbod = ctemp[0]
  424. cumsumvag = ctemp[1]
  425. cumsumass = ctemp[2]
  426. killvar 'ctemp'
  427. killvar 'sparrtmpv'
  428. killvar 'cumarrtemp'
  429. end
  430. !! Breastcycle. Every breast related change with lactation happens in here.
  431. if cheatVars['no_lactation'] > 0:
  432. gs 'lact_lib','lactate_optout'
  433. else
  434. gs 'lact_lib','breastcycle'
  435. end
  436. if cycle <= 0:
  437. gs 'femcyc', 'cyc0'
  438. elseif cycle = 1:
  439. gs 'femcyc', 'cyc1'
  440. elseif cycle = 2:
  441. gs 'femcyc', 'cyc2'
  442. elseif cycle = 3:
  443. gs 'femcyc', 'cyc3'
  444. elseif cycle = 4:
  445. gs 'femcyc', 'cyc4'
  446. elseif cycle = 5:
  447. gs 'femcyc', 'preg'
  448. end
  449. stat['safe_day'] = 0
  450. stat['probably_safe_day'] = 0
  451. stat['dangerous_day'] = 0
  452. if cycle > 3:
  453. stat['safe_day'] = 1
  454. elseif cycle = 0 or cycle = 3:
  455. stat['probably_safe_day'] = 1
  456. else
  457. stat['dangerous_day'] = 1
  458. end
  459. !! if cycle = 1 or lastmens >= daystart - 7:
  460. !! this is using real life calendar method of predicting that if your period is day 1 of your cycle:
  461. !! days 1-7 is probably safe for sex
  462. !! days 8-19 is considered to be fertile
  463. !! day 20 until your period is considered safe
  464. !! this is not checking against the actual code of how fertility works in this game because i can''t figure it out. but that''s the risk you take for using the calendar method instead of real birth control :P - hornguy6
  465. !! if daylastperiod >= daystart - 7:
  466. !! stat['probably_safe_day'] = 1
  467. !! elseif daylastperiod >= daystart - 19:
  468. !! stat['dangerous_day'] = 1
  469. !! else
  470. !! stat['safe_day'] = 1
  471. !! end
  472. !! other variable hornguy was experimenting with
  473. !! if lastmens >= daystart - 7:
  474. !! elseif lastmens >= daystart - 19:
  475. dynamic $d_cycreport_update
  476. end
  477. !{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.}
  478. if $ARGS[0] = 'cyc0':
  479. if mesec <= 0:
  480. lastmens = daystart
  481. cycle = 1
  482. mesec = 0
  483. if rand(0,1000) = 1000:
  484. EggRH = rand(20,80)
  485. else
  486. EggRH = 0
  487. end
  488. FocH += EggRH
  489. else
  490. mesec -= 1
  491. FocH += 1
  492. end
  493. end
  494. !{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.}
  495. if $ARGS[0] = 'cyc1':
  496. FertEgg = 0
  497. if FocH <= FocH_Max:
  498. if pillcon <= 7000: EggRH += 1
  499. if rand(0,9) = 0: EggRH += 1
  500. FocH += 1
  501. temprand = rand(0,9) - sterileov + tempovbonus
  502. if temprand < 0:
  503. EggRH -= 1
  504. elseif temprand > 9:
  505. EggRH += 1
  506. end
  507. else
  508. !! the setting of the max_time can be here although it can be changed in the future
  509. LutH_Max = rand(312,360) & !! 13-15 days including ovulation
  510. !{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.}
  511. temprand = rand(0,20)
  512. temprand += age/15
  513. temprand -= pillcon/1000
  514. if temprand > 20:
  515. EggRH += 205
  516. temprand = rand(0,20)
  517. temprand += age/15
  518. if temprand > 20: EggRH += 410
  519. end
  520. FocH = 0
  521. lastovulation = daystart
  522. Ovulate = 24 + rand(0,20)
  523. cycle = 2
  524. ferteggage = 0
  525. end
  526. end
  527. !!{Fertilization.}
  528. if $ARGS[0] = 'cyc2':
  529. can_sz = arrsize('$cumarrnam')
  530. if Ovulate > 0 and can_sz > 0 and UnfertEgg > 0:
  531. killvar 'cumtime'
  532. killvar 'cumfthname'
  533. killvar '$wombpotfath'
  534. $cumfthname[0] = 'unknown'
  535. cumtime[0] = 0
  536. can_idx = 0
  537. cum_total = 0
  538. !!{Compute array of unique fathers known to PC and another two arrays of unique total fathers and their individual sperm totals from all entries in cumarrcpt for that father. Also tally all cum present.}
  539. :FatherCumAnalyze
  540. !! If the current DNA is new (no occurence in the womb array), it is added to the end of $wombDNA array, and added the amount of cum to the end of cumamount array.
  541. !! If exists, just increase the amount of cum in the womb.
  542. !! $wombDNA: sperm in womb potent enough to cause pregnancy
  543. !! wombAmount: how potent is the sperm of a guy
  544. !! $wombName: the identifier of the NPC
  545. y = arrsize('$wombDNA')
  546. if arrpos('$wombDNA',$npc_dna[$cumarrnam[can_idx]]) = -1:
  547. !! New guy, create place for him at the end of the array, storing his DNA, sperm amount and name
  548. $wombDNA[y] = $npc_dna[$cumarrnam[can_idx]]
  549. wombAmount[y] = cumarrcpt[can_idx]
  550. $wombName[y] = $cumarrnam[can_idx]
  551. else
  552. !! This DNA is in the womb, but does it belong to the same guy?
  553. x = 0
  554. z = 0
  555. :LocalizeLoop
  556. if $wombDNA[x] = $npc_dna[$cumarrnam[can_idx]] and $wombName[x] = $cumarrnam[can_idx]: wombAmount[x] += cumarrcpt[can_idx] & z = 1
  557. if z = 0 and x < (y - 1):x += 1 & jump 'LocalizeLoop'
  558. killvar 'x'
  559. if z = 0:
  560. !! Since the DNA and the stored name does not match at the same time, it means this is a twin situation where the twin is not in array, so put him in
  561. $wombDNA[y] = $npc_dna[$cumarrnam[can_idx]]
  562. $wombName[y] = $cumarrnam[can_idx]
  563. wombAmount[y] = cumarrcpt[can_idx]
  564. end
  565. killvar 'z'
  566. end
  567. killvar 'y'
  568. if cumarrkno[can_idx] = 1 and arrpos('$wombpotfath', $cumarrnam[can_idx]) < 0:$wombpotfath[arrsize('$wombpotfath')] = $cumarrnam[can_idx]
  569. !! If the guy is a known/possible element (PC know about the sex, it was actual sex, condom/pill was not used or condom was broken, etc.), he can be considered as father.
  570. if cumarrdel[can_idx] = 0 and cumarrkno[can_idx] >= 0:
  571. !! Removed 'instr('14570',str(cumarrcon[can_idx])) > 0 and ' from above if-statement
  572. !! to make each conscious vaginal sex partner eligible for consideration to be the dad if pregnancy happens
  573. !! If guy is recorded already, increase his cumtime, else record him for the first time.
  574. if arrpos('$cumfthname', $cumarrnam[can_idx]) = -1:
  575. $cumfthname[arrsize('$cumfthname')] = $cumarrnam[can_idx]
  576. cumtime[arrsize('$cumfthname')] = 1
  577. else
  578. cumtime[arrpos('$cumfthname', $cumarrnam[can_idx])] += 1
  579. end
  580. end
  581. cum_total += cumarrcpt[can_idx]
  582. can_idx += 1
  583. if can_idx < can_sz: jump 'FatherCumAnalyze'
  584. !! setting the default believed father if there is no difficult choice or there is no choice
  585. if arrsize('$cumfthname') = 2 and cumtime[0] = 0:
  586. $wombpotfath[0] = $cumfthname[1]
  587. elseif arrsize('$cumfthname') = 1:
  588. $wombpotfath[0] = $cumfthname[0]
  589. end
  590. !!{Create lotto of potential fathers based on each potential fathers sperm as a percentage of the total. The higher percentage of sperm from a given father, the more lotto entries he will have.}
  591. killvar '$cumfathlotto'
  592. cfw_idx = 0
  593. cfw_sz = arrsize('wombAmount')
  594. :FathLottoLoop
  595. if cfw_idx < cfw_sz and cum_total > 0:
  596. cfl_ct = (wombAmount[cfw_idx] * 100) / cum_total
  597. if cfl_ct < 1: cfl_ct = 1
  598. cfl_idx = arrsize('$cumfathlotto')
  599. :FathLottoAdd
  600. if cfl_ct > 0:
  601. $cumfathlotto[cfl_idx] = $wombName[cfw_idx]
  602. $cumfatherDNA[cfl_idx] = $wombDNA[cfw_idx]
  603. cfl_idx += 1
  604. cfl_ct -= 1
  605. jump 'FathLottoAdd'
  606. end
  607. cfw_idx += 1
  608. jump 'FathLottoLoop'
  609. end
  610. killvar '$wombDNA'
  611. killvar '$wombName'
  612. killvar 'wombAmount'
  613. cfl_sz = arrsize('$cumfathlotto')
  614. egg_idx = 0
  615. egg_sz = UnfertEgg
  616. if cheatVars['no_pregnancy'] = 1: egg_idx = egg_sz
  617. :FertLoop
  618. if egg_idx < egg_sz:
  619. !!{fert_thresh is the chance this specific egg is fertilized. Its modified by being on the pill, being sterilized, the brood curse, and so on. If it computes to less than the cum total calculated above, the egg is fertilized by a father randomly drawn from the lotto array.}
  620. fert_thresh = rand(1,250000)
  621. if pillcon < 0: pillcon = 0
  622. !!fert_thresh += pillcon
  623. if steriletu = 1: fert_thresh += fert_thresh*30
  624. if fert_thresh > 0 and broodcurse > 0: fert_thresh = fert_thresh / 2
  625. if fert_thresh <= cum_total:
  626. lotto_idx = rand(0, cfl_sz-1)
  627. UnfertEgg -= 1
  628. FertEgg += 1
  629. nextbaby = arrsize('$ChildFath')
  630. polkid[nextbaby] = rand(0, 1)
  631. $kidname[nextbaby] = 'unborn'
  632. kidage[nextbaby] = 0
  633. daykid[nextbaby] = 0
  634. monthkid[nextbaby] = 0
  635. yearkid[nextbaby] = 0
  636. Babyptype[nextbaby] = 0
  637. $kid_dna[nextbaby] = func('DNA', 'generate', $pcs_dna, $npc_dna[$cumfathlotto[lotto_idx]])
  638. $ChildFath[nextbaby] = $cumfathlotto[lotto_idx]
  639. $ChildFathDNA[nextbaby] = $cumfatherDNA[lotto_idx]
  640. hairkid[nextbaby] = rand(0, 3)
  641. eyeskid[nextbaby] = rand(0, 3)
  642. ChildConType[nextbaby] = cumarrcon[nextbaby]
  643. if FertEgg > 1:
  644. $childtype[nextbaby] = 'fraternal twin'
  645. $childtype[nextbaby-1] = 'fraternal twin'
  646. else
  647. $childtype[nextbaby] = ''
  648. end
  649. end
  650. egg_idx += 1
  651. jump 'FertLoop'
  652. end
  653. killvar 'temp'
  654. tempovbonus = 0
  655. end
  656. !!{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.}
  657. if pillcon > 26000 and rand(0,400) ! 0: EggRH = 0
  658. :OviLoop
  659. if EggRH > ((UnfertEgg + FertEgg) * 150):
  660. UnfertEgg += 1
  661. EggRH -= (200 * UnfertEgg)
  662. jump 'OviLoop'
  663. end
  664. if ovulate <= 0:
  665. cycle = 3
  666. UnfertEgg = 0
  667. end
  668. if FertEgg = 1 and ferteggage < 330:
  669. if rand(0,(2000 - age*20)) = 0:
  670. FertEgg += 1
  671. nextbaby = arrsize('$ChildFath')
  672. polkid[nextbaby] = polkid[nextbaby-1]
  673. $kidname[nextbaby] = 'unborn'
  674. kidage[nextbaby] = 0
  675. daykid[nextbaby] = 0
  676. monthkid[nextbaby] = 0
  677. yearkid[nextbaby] = 0
  678. Babyptype[nextbaby] = Babyptype[nextbaby-1]
  679. $ChildFath[nextbaby] = $ChildFath[nextbaby-1]
  680. $ChildFathDNA[nextbaby] = $ChildFathDNA[nextbaby-1]
  681. $kid_dna[nextbaby] = $kid_dna[nextbaby-1]
  682. hairkid[nextbaby] = hairkid[nextbaby-1]
  683. eyeskid[nextbaby] = eyeskid[nextbaby-1]
  684. cumarrcon[nextbaby] = cumarrcon[nextbaby-1]
  685. $childtype[nextbaby] = 'identical twin'
  686. $childtype[nextbaby-1] = 'identical twin'
  687. end
  688. end
  689. ferteggage += 1
  690. Ovulate -= 1
  691. LutH += 1
  692. end
  693. !{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.}
  694. !{If there is an ectopic pregnancy, it sets the first unborn baby in the array to this. Ectopic pregnancies occur when the fertilized egg implants "too early" after fertlization (and therefore in the fallopian tube). The risk is higher with age, but this is also a common complication with certain forms of birth control, notably tubal ligation. 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.}
  695. !{Otherwise, it adds your womb sterility factor to the imp_rand. Then it checks if your imp_rand 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.}
  696. if $ARGS[0] = 'cyc3':
  697. if FertEgg = 1 and ferteggage < 330:
  698. if rand(0,(2000 - age*20)) = 0:
  699. FertEgg += 1
  700. nextbaby = arrsize('$ChildFath')
  701. polkid[nextbaby] = polkid[nextbaby-1]
  702. $kidname[nextbaby] = 'unborn'
  703. kidage[nextbaby] = 0
  704. daykid[nextbaby] = 0
  705. monthkid[nextbaby] = 0
  706. yearkid[nextbaby] = 0
  707. Babyptype[nextbaby] = Babyptype[nextbaby-1]
  708. $ChildFath[nextbaby] = $ChildFath[nextbaby-1]
  709. $ChildFathDNA[nextbaby] = $ChildFathDNA[nextbaby-1]
  710. $kid_dna[nextbaby] = $kid_dna[nextbaby-1]
  711. hairkid[nextbaby] = hairkid[nextbaby-1]
  712. eyeskid[nextbaby] = eyeskid[nextbaby-1]
  713. cumarrcon[nextbaby] = cumarrcon[nextbaby-1]
  714. $childtype[nextbaby] = 'identical twin'
  715. $childtype[nextbaby-1] = 'identical twin'
  716. end
  717. end
  718. ferteggage += 1
  719. implant_idx = 0
  720. implant_sz = arrsize('Babyptype')
  721. :implant_loop
  722. if implant_idx < implant_sz:
  723. if Babyptype[implant_idx] = 0 and $ChildFath[implant_idx] ! '':
  724. imp_rand = rand(0,120000)
  725. if ferteggage < 120 and broodcurse <= 0:
  726. imp_rand += 170
  727. imp_rand -= age * 10
  728. if steriletu = 1: imp_rand -= 200
  729. if imp_rand <= 0:
  730. Babyptype[implant_idx] = 2
  731. FertEgg -= 1
  732. babyembryo += 1
  733. PregChem = rand(10,30)
  734. if preg = 0: preg = 1
  735. implant_day = daystart
  736. implant_hour = hour
  737. end
  738. else
  739. imp_rand += sterilewb
  740. imp_rand -= tempwbbonus
  741. if broodcurse > 0 and ferteggage >= 120: imp_rand = 0
  742. if imp_rand <= (1200 - (age * 7)):
  743. Babyptype[implant_idx] = 1
  744. FertEgg -= 1
  745. babyembryo += 1
  746. PregChem = rand(10,30)
  747. if preg = 0: preg = 1
  748. implant_day = daystart
  749. implant_hour = hour
  750. end
  751. tempwbbonus = 0
  752. end
  753. end
  754. implant_idx += 1
  755. jump 'implant_loop'
  756. end
  757. !!{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.}
  758. if LutH > LutH_Max:
  759. rej_idx = 0
  760. rej_sz = arrsize('Babyptype')
  761. :lutcycloop
  762. if rej_idx < rej_sz:
  763. if Babyptype[rej_idx] = 0:
  764. killvar 'polkid',rej_idx
  765. killvar '$kidname',rej_idx
  766. killvar 'kidage',rej_idx
  767. killvar 'daykid',rej_idx
  768. killvar 'monthkid',rej_idx
  769. killvar 'yearkid',rej_idx
  770. killvar 'Babyptype',rej_idx
  771. killvar '$ChildFath',rej_idx
  772. killvar 'hairkid',rej_idx
  773. killvar 'eyeskid',rej_idx
  774. killvar 'cumarrcon',rej_idx
  775. FertEgg -= 1
  776. end
  777. rej_idx += 1
  778. jump 'lutcycloop'
  779. end
  780. LutH = 0
  781. if preg = 1:
  782. cycle = 5
  783. elseif menoage <= age:
  784. killvar '$wombpotfath'
  785. killvar '$cumfthname'
  786. killvar '$cumfthusedname'
  787. killvar 'cumtime'
  788. cycle = 6
  789. else
  790. killvar '$wombpotfath'
  791. killvar '$cumfthname'
  792. killvar '$cumfthusedname'
  793. killvar 'cumtime'
  794. !! the setting of the max_time can be here although it can be changed in the future
  795. FocH_Max = rand(312,360) & !! 13-15 days including menstruation
  796. temprand = rand(0,10)
  797. if pillcon >= 38000 or (pillcon > 0 and rand(1,24) = 1):
  798. EggRH = 0
  799. cycle = 1
  800. mesec = 0
  801. else
  802. cycle = 0
  803. killvar 'abortionbirthdate'
  804. if cheatVars['track_period'] = 1: daylastperiod = daystart
  805. firstmens = daystart
  806. temprand = rand(0,10)
  807. if temprand = 0 and pillcon < 10000:
  808. mesec = rand(104,136) & !! 120
  809. elseif temprand < 9 and pillcon < 15000:
  810. mesec = rand(76,104) & !! 96
  811. elseif pillcon < 20000:
  812. mesec = rand(52,76) & !! 72
  813. else
  814. mesec = rand(44,52) & !! 48
  815. end
  816. end
  817. end
  818. else
  819. if preg = 1: PregChem += (1 + cheatVars['preg_speed'])
  820. if rand(0,100) < 100: LutH += 1
  821. end
  822. end
  823. !{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.}
  824. if $ARGS[0] = 'cyc4':
  825. if RecovH <= 0:
  826. cycle = 1
  827. if cheatVars['track_period'] = 1:
  828. knowpregloss = 0
  829. knowpregrecover = 0
  830. end
  831. if rand(0,1000) = 1000:
  832. EggRH = rand(20,80)
  833. else
  834. EggRH = 0
  835. end
  836. FocH = EggRH
  837. else
  838. RecovH -= 1
  839. if rand(0,10) = 0: RecovH -= 1
  840. end
  841. end
  842. !{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.}
  843. if $ARGS[0] = 'preg':
  844. if FertEgg = 1 and ferteggage < 330:
  845. if rand(0,(2000 - age*20)) = 0:
  846. babyembryo += 1
  847. PregChem += rand(10,30)
  848. nextbaby = arrsize('$ChildFath')
  849. polkid[nextbaby] = polkid[nextbaby-1]
  850. $kidname[nextbaby] = 'unborn'
  851. kidage[nextbaby] = 0
  852. daykid[nextbaby] = 0
  853. monthkid[nextbaby] = 0
  854. yearkid[nextbaby] = 0
  855. Babyptype[nextbaby] = Babyptype[nextbaby-1]
  856. $ChildFath[nextbaby] = $ChildFath[nextbaby-1]
  857. hairkid[nextbaby] = hairkid[nextbaby-1]
  858. eyeskid[nextbaby] = eyeskid[nextbaby-1]
  859. cumarrcon[nextbaby] = cumarrcon[nextbaby-1]
  860. $childtype[nextbaby] = 'identical twin'
  861. $childtype[nextbaby-1] = 'identical twin'
  862. end
  863. end
  864. PregChem += (1 + cheatVars['preg_speed'])
  865. temprand = rand(-400,800)
  866. temprand -= (babyembryo-1)*588
  867. if PregChem > 6573 + temprand and preg ! 2:
  868. 'A sharp pain pierces your abdomen, and you feel something flow down your legs. Your water has broken!'
  869. !! switch on lactation if not already active.
  870. if lactation['active'] < 1: func('lact_lib','lact_switch')
  871. $cycreport_txt = 'In labour'
  872. arrmodtmp = arrsize('$ChildFath')
  873. arrmodtmp -= (babyembryo)
  874. :babyfinalpreploop
  875. if arrmodtmp < arrsize('$ChildFath') and daykid[arrmodtmp] = 0:
  876. daykid[arrmodtmp] = 42
  877. !! $wombthfathID is the ID of the character Sveta has chosen as believed father in the cycle menu
  878. !! checking the there is a valid ID that resolves into a name, if yes then applying that ID as believed father
  879. if $npc_usedname[$wombthfathID] ! '':
  880. $ChildThFath[arrmodtmp] = $wombthfathID
  881. else
  882. !! if the ID does not resolve into a name then it is probably some legacy event father
  883. !! like 'A sperm donor' or else 'unknown'. In either case it should not cause issues if all outliers are designated 'unknown'
  884. $ChildThFath[arrmodtmp] = 'unknown'
  885. end
  886. arrmodtmp += 1
  887. jump 'babyfinalpreploop'
  888. end
  889. killvar '$wombpotfath'
  890. killvar '$wombthfath'
  891. preg = 2
  892. pregminut = totminut + 1440
  893. if babyembryo > 1:
  894. 'Your babies are coming...'
  895. else
  896. 'Your baby is coming...'
  897. end
  898. if PregChem < 3885:
  899. 'Way too early!'
  900. elseif PregChem < 5229:
  901. 'Very early!'
  902. elseif PregChem < 6069:
  903. 'Early.'
  904. elseif PregChem > 6959:
  905. 'Late.'
  906. elseif PregChem > 7245:
  907. 'Very late!'
  908. end
  909. 'You need to get to a clinic.'
  910. end
  911. if PregChem > 2203:
  912. if PregChem > 2853 or kid > 0:
  913. if rand(0,7) = 0: dynamic $d_pregmovement
  914. else
  915. if rand(0,500) = 0: dynamic $d_pregmovement
  916. end
  917. end
  918. end
  919. !! Variable error handler for femcyc. Checking if variables are out of range and resets them.
  920. if $ARGS[0] = 'femcyc_errhdl':
  921. if cycle < 0 or cycle > 6: cycle = 0
  922. if rcntorgzmtmp < 0 or rcntorgzmtmp > 1: rcntorgzmtmp = 0
  923. if rcntorgzm < 0 or rcntorgzm > 1: rcntorgzm = 0
  924. if PregChem < 0: PregChem = 0
  925. if preg < 0 or preg > 2: preg = 0
  926. if ferteggage < 0: ferteggage = 0
  927. if EggRH < 0: EggRH = 0
  928. if FocH < 0: FocH = 0
  929. if FertEgg < 0: FertEgg = 0
  930. end
  931. --- femcyc ---------------------------------