femcyc.qsrc 42 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549550551552553554555556557558559560561562563564565566567568569570571572573574575576577578579580581582583584585586587588589590591592593594595596597598599600601602603604605606607608609610611612613614615616617618619620621622623624625626627628629630631632633634635636637638639640641642643644645646647648649650651652653654655656657658659660661662663664665666667668669670671672673674675676677678679680681682683684685686687688689690691692693694695696697698699700701702703704705706707708709710711712713714715716717718719720721722723724725726727728729730731732733734735736737738739740741742743744745746747748749750751752753754755756757758759760761762763764765766767768769770771772773774775776777778779780781782783784785786787788789790791792793794795796797798799800801802803804805806807808809810811812813814815816817818819820821822823824825826827828829830831832833834835836837838839840841842843844845846847848849850851852853854855856857858859860861862863864865866867868869870871872873874875876877878879880881882883884885886887888889890891892893894895896897898899900901902903904905906907908909910911912913914915916917918919920921922923924925926927928929930931932933934935936937938939940941942943944945946947948949950951952953954955956957958959960961962963964965966967968969970971972973974975976977978979980981982983984985986987988989990991992993
  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. !! cyccustom : 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. !! pregspeedcheat : 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. !!cumcondslip = 0
  298. !!cumcondslip_aware = 0
  299. if arrsize('sparrvol') > 0:
  300. :cumspaloop
  301. !!Succubus absorption for internal locations other than womb
  302. if succubusflag = 1:
  303. if sparrloc[cumarrtemp] = 3 or sparrloc[cumarrtemp] = 12:
  304. sexnutrition += 25*succublvl
  305. succubxp += 3
  306. sucabscum = 1
  307. if sparrvol[cumarrtemp] > 0: sparrvol[cumarrtemp] = 0
  308. end
  309. end
  310. !!{if sparrloc[cumarrtemp] = 0 or sparrloc[cumarrtemp] = 3 or sparrloc[cumarrtemp] = 12:
  311. sexnutrition += 30*succublvl
  312. sparrvol[cumarrtemp] -= 30*succublvl
  313. if sparrvol[cumarrtemp] < 0: sexnutrition += sparrvol[cumarrtemp] & sparrvol[cumarrtemp] = 0
  314. end}
  315. !!{ Process spatter until it has volume or is too old in vagina. }
  316. if sparrvol[cumarrtemp] > 0 or (sparrloc[cumarrtemp] = 0 and sparrage[cumarrtemp] < 10):
  317. sparrtmpv = arrsize('$cumarrnam')
  318. if sparrloc[cumarrtemp] = 17:
  319. sparrtmpv = arrpos('cumarrcnt',sparrcnt[cumarrtemp])
  320. if sparrtmpv >= 0:
  321. !!'Found guy id <<sparrtmpv>>'
  322. if sparrage[cumarrtemp] < 4:
  323. cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/5
  324. elseif sparrage[cumarrtemp] < 10:
  325. cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/30
  326. end
  327. end
  328. elseif sparrloc[cumarrtemp] = 0:
  329. sparrtmpv = arrpos('cumarrcnt',sparrcnt[cumarrtemp])
  330. if sparrtmpv >= 0:
  331. !!'Found guy id' & sparrtmpv
  332. if sparrage[cumarrtemp] < 4:
  333. cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/40
  334. elseif sparrage[cumarrtemp] < 10:
  335. cumarrcpt[sparrtmpv] += sparrppt[cumarrtemp]/60
  336. end
  337. end
  338. elseif sparrslc[cumarrtemp] = 1 and sparrage < 5:
  339. if sparrloc[cumarrtemp] = 1:
  340. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  341. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  342. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  343. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  344. cumarrdel[sparrtmpv] = 1
  345. cumarrkno[sparrtmpv] = -1
  346. cumarrcon[sparrtmpv] = 0
  347. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  348. end
  349. elseif sparrslc[cumarrtemp] = 3 and sparrage < 5:
  350. if sparrloc[cumarrtemp] = 2:
  351. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  352. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  353. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  354. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  355. cumarrdel[sparrtmpv] = 3
  356. cumarrkno[sparrtmpv] = -1
  357. cumarrcon[sparrtmpv] = 0
  358. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  359. elseif sparrloc[cumarrtemp] = 4:
  360. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  361. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  362. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  363. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  364. cumarrdel[sparrtmpv] = 2
  365. cumarrkno[sparrtmpv] = -1
  366. cumarrcon[sparrtmpv] = 0
  367. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  368. end
  369. elseif sparrslc[cumarrtemp] = 5 and sparrage < 5:
  370. if sparrloc[cumarrtemp] = 3:
  371. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  372. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  373. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  374. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  375. cumarrdel[sparrtmpv] = 2
  376. cumarrkno[sparrtmpv] = -1
  377. cumarrcon[sparrtmpv] = 0
  378. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  379. elseif sparrloc[cumarrtemp] = 5:
  380. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  381. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  382. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  383. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  384. cumarrdel[sparrtmpv] = 3
  385. cumarrkno[sparrtmpv] = -1
  386. cumarrcon[sparrtmpv] = 0
  387. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  388. elseif sparrloc[cumarrtemp] = 6:
  389. cumarrcpt[sparrtmpv] = sparrppt[cumarrtemp]*sparrvol[cumarrtemp]/sparrage[cumarrtemp]/1000
  390. cumarrppt[sparrtmpv] = sparrppt[cumarrtemp]
  391. $cumarrnam[sparrtmpv] = $sparrnam[cumarrtemp]
  392. cumarrage[sparrtmpv] = sparrage[cumarrtemp]
  393. cumarrdel[sparrtmpv] = 3
  394. cumarrkno[sparrtmpv] = -1
  395. cumarrcon[sparrtmpv] = 0
  396. cumarrcnt[sparrtmpv] = sparrcnt[cumarrtemp]
  397. end
  398. end
  399. if sparrloc[cumarrtemp] = 0 or sparrloc[cumarrtemp] = 3 or sparrloc[cumarrtemp] = 12:
  400. sparrvol[cumarrtemp] -= sparrage[cumarrtemp]/2
  401. if sparrvol[cumarrtemp] < 0:sparrvol[cumarrtemp] = 0
  402. end
  403. if sparrloc[cumarrtemp] = 0 and cumsumvag > 60: sparrslc[cumarrtemp] = 1
  404. if sparrloc[cumarrtemp] = 3 and cumsumass > 60: sparrslc[cumarrtemp] = 1
  405. if sparrloc[cumarrtemp] = 17:
  406. cumcondslip += 1
  407. if sparridt[cumarrtemp] >= 0:
  408. cumcondslip_aware = 1
  409. end
  410. if sparrage[cumarrtemp] > 48:
  411. cumcondslip_aware = 1
  412. if pcs_health > 100: pcs_health -= rand(3,sparrage[cumarrtemp] - 45)
  413. '<br><b><font color="red">You feel nauseous.</font></b>'
  414. end
  415. end
  416. if sparrloc[cumarrtemp] ! 0 and sparrloc[cumarrtemp] ! 3 and sparrloc[cumarrtemp] ! 12 and isprok = 0 and sparrage < 5: sparrslc[cumarrtemp] += 1
  417. sparrage[cumarrtemp] += 1
  418. cumarrtemp += 1
  419. ctemp[0] += sparrvol[cumarrtemp]
  420. if sparrloc[cumarrtemp] = 0: ctemp[1] += sparrvol[cumarrtemp]
  421. if sparrloc[cumarrtemp] = 3: ctemp[2] += sparrvol[cumarrtemp]
  422. else
  423. gs 'cum_cleanup', 'cleandeposit', cumarrtemp
  424. end
  425. if cumarrtemp < arrsize('sparrvol'): jump 'cumspaloop'
  426. cumsumbod = ctemp[0]
  427. cumsumvag = ctemp[1]
  428. cumsumass = ctemp[2]
  429. killvar 'ctemp'
  430. end
  431. !! Breastcycle. Every breast related change with lactation happens in here.
  432. if cheat_NoLactation > 0:
  433. gs 'lact_lib','lactate_optout'
  434. else
  435. gs 'lact_lib','breastcycle'
  436. end
  437. if cycle <= 0:
  438. gs 'femcyc', 'cyc0'
  439. elseif cycle = 1:
  440. gs 'femcyc', 'cyc1'
  441. elseif cycle = 2:
  442. gs 'femcyc', 'cyc2'
  443. elseif cycle = 3:
  444. gs 'femcyc', 'cyc3'
  445. elseif cycle = 4:
  446. gs 'femcyc', 'cyc4'
  447. elseif cycle = 5:
  448. gs 'femcyc', 'preg'
  449. end
  450. stat['safe_day'] = 0
  451. stat['probably_safe_day'] = 0
  452. stat['dangerous_day'] = 0
  453. if cycle > 3:
  454. stat['safe_day'] = 1
  455. elseif cycle = 0 or cycle = 3:
  456. stat['probably_safe_day'] = 1
  457. else
  458. stat['dangerous_day'] = 1
  459. end
  460. !! if cycle = 1 or lastmens >= daystart - 7:
  461. !! this is using real life calendar method of predicting that if your period is day 1 of your cycle:
  462. !! days 1-7 is probably safe for sex
  463. !! days 8-19 is considered to be fertile
  464. !! day 20 until your period is considered safe
  465. !! 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
  466. !! if daylastperiod >= daystart - 7:
  467. !! stat['probably_safe_day'] = 1
  468. !! elseif daylastperiod >= daystart - 19:
  469. !! stat['dangerous_day'] = 1
  470. !! else
  471. !! stat['safe_day'] = 1
  472. !! end
  473. !! other variable hornguy was experimenting with
  474. !! if lastmens >= daystart - 7:
  475. !! elseif lastmens >= daystart - 19:
  476. dynamic $d_cycreport_update
  477. end
  478. !{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.}
  479. if $ARGS[0] = 'cyc0':
  480. if mesec <= 0:
  481. lastmens = daystart
  482. cycle = 1
  483. mesec = 0
  484. if rand(0,1000) = 1000:
  485. EggRH = rand(20,80)
  486. else
  487. EggRH = 0
  488. end
  489. FocH += EggRH
  490. else
  491. mesec -= 1
  492. FocH += 1
  493. end
  494. end
  495. !{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.}
  496. if $ARGS[0] = 'cyc1':
  497. FertEgg = 0
  498. if FocH <= FocH_Max:
  499. if pillcon <= 7000: EggRH += 1
  500. if rand(0,9) = 0: EggRH += 1
  501. FocH += 1
  502. temprand = rand(0,9) - sterileov + tempovbonus
  503. if temprand < 0:
  504. EggRH -= 1
  505. elseif temprand > 9:
  506. EggRH += 1
  507. end
  508. else
  509. !! the setting of the max_time can be here although it can be changed in the future
  510. LutH_Max = rand(312,360) & !! 13-15 days including ovulation
  511. !{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.}
  512. temprand = rand(0,20)
  513. temprand += age/15
  514. temprand -= pillcon/1000
  515. if temprand > 20:
  516. EggRH += 205
  517. temprand = rand(0,20)
  518. temprand += age/15
  519. if temprand > 20: EggRH += 410
  520. end
  521. FocH = 0
  522. lastovulation = daystart
  523. Ovulate = 24 + rand(0,20)
  524. cycle = 2
  525. ferteggage = 0
  526. end
  527. end
  528. !!{Fertilization.}
  529. if $ARGS[0] = 'cyc2':
  530. can_sz = arrsize('$cumarrnam')
  531. if Ovulate > 0 and can_sz > 0 and UnfertEgg > 0:
  532. killvar 'cumtime'
  533. killvar 'cumfthname'
  534. killvar '$wombpotfath'
  535. $cumfthname[0] = 'unknown'
  536. cumtime[0] = 0
  537. can_idx = 0
  538. cum_total = 0
  539. !!{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.}
  540. :FatherCumAnalyze
  541. !! 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.
  542. !! If exists, just increase the amount of cum in the womb.
  543. !! $wombDNA: sperm in womb potent enough to cause pregnancy
  544. !! wombAmount: how potent is the sperm of a guy
  545. !! $wombName: the identifier of the NPC
  546. y = arrsize('$wombDNA')
  547. if arrpos('$wombDNA',$npc_dna[$cumarrnam[can_idx]]) = -1:
  548. !! New guy, create place for him at the end of the array, storing his DNA, sperm amount and name
  549. $wombDNA[y] = $npc_dna[$cumarrnam[can_idx]]
  550. wombAmount[y] = cumarrcpt[can_idx]
  551. $wombName[y] = $cumarrnam[can_idx]
  552. else
  553. !! This DNA is in the womb, but does it belong to the same guy?
  554. x = 0
  555. z = 0
  556. :LocalizeLoop
  557. if $wombDNA[x] = $npc_dna[$cumarrnam[can_idx]] and $wombName[x] = $cumarrnam[can_idx]: wombAmount[x] += cumarrcpt[can_idx] & z = 1
  558. if z = 0 and x < (y - 1):x += 1 & jump 'LocalizeLoop'
  559. killvar 'x'
  560. if z = 0:
  561. !! 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
  562. $wombDNA[y] = $npc_dna[$cumarrnam[can_idx]]
  563. $wombName[y] = $cumarrnam[can_idx]
  564. wombAmount[y] = cumarrcpt[can_idx]
  565. end
  566. killvar 'z'
  567. end
  568. killvar 'y'
  569. if cumarrkno[can_idx] = 1 and arrpos('$wombpotfath', $cumarrnam[can_idx]) < 0:$wombpotfath[arrsize('$wombpotfath')] = $cumarrnam[can_idx]
  570. !! 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.
  571. if cumarrdel[can_idx] = 0 and cumarrkno[can_idx] >= 0:
  572. !! Removed 'instr('14570',str(cumarrcon[can_idx])) > 0 and ' from above if-statement
  573. !! to make each conscious vaginal sex partner eligible for consideration to be the dad if pregnancy happens
  574. !! If guy is recorded already, increase his cumtime, else record him for the first time.
  575. if arrpos('$cumfthname', $cumarrnam[can_idx]) = -1:
  576. $cumfthname[arrsize('$cumfthname')] = $cumarrnam[can_idx]
  577. cumtime[arrsize('$cumfthname')] = 1
  578. else
  579. cumtime[arrpos('$cumfthname', $cumarrnam[can_idx])] += 1
  580. end
  581. end
  582. cum_total += cumarrcpt[can_idx]
  583. can_idx += 1
  584. if can_idx < can_sz: jump 'FatherCumAnalyze'
  585. !! setting the default believed father if there is no difficult choice or there is no choice
  586. if arrsize('$cumfthname') = 2 and cumtime[0] = 0:
  587. $wombpotfath[0] = $cumfthname[1]
  588. elseif arrsize('$cumfthname') = 1:
  589. $wombpotfath[0] = $cumfthname[0]
  590. end
  591. !!{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.}
  592. killvar '$cumfathlotto'
  593. cfw_idx = 0
  594. cfw_sz = arrsize('wombAmount')
  595. :FathLottoLoop
  596. if cfw_idx < cfw_sz and cum_total > 0:
  597. cfl_ct = (wombAmount[cfw_idx] * 100) / cum_total
  598. if cfl_ct < 1: cfl_ct = 1
  599. cfl_idx = arrsize('$cumfathlotto')
  600. :FathLottoAdd
  601. if cfl_ct > 0:
  602. $cumfathlotto[cfl_idx] = $wombName[cfw_idx]
  603. $cumfatherDNA[cfl_idx] = $wombDNA[cfw_idx]
  604. cfl_idx += 1
  605. cfl_ct -= 1
  606. jump 'FathLottoAdd'
  607. end
  608. cfw_idx += 1
  609. jump 'FathLottoLoop'
  610. end
  611. killvar '$wombDNA'
  612. killvar '$wombName'
  613. killvar 'wombAmount'
  614. cfl_sz = arrsize('$cumfathlotto')
  615. egg_idx = 0
  616. egg_sz = UnfertEgg
  617. if cheat_NoPregnancy = 1:egg_idx = egg_sz
  618. :FertLoop
  619. if egg_idx < egg_sz:
  620. !!{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.}
  621. fert_thresh = rand(1,250000)
  622. if pillcon < 0: pillcon = 0
  623. !!fert_thresh += pillcon
  624. if steriletu = 1: fert_thresh += fert_thresh*30
  625. if fert_thresh > 0 and broodcurse > 0: fert_thresh = fert_thresh / 2
  626. if fert_thresh <= cum_total:
  627. lotto_idx = rand(0, cfl_sz-1)
  628. UnfertEgg -= 1
  629. FertEgg += 1
  630. nextbaby = arrsize('$ChildFath')
  631. polkid[nextbaby] = rand(0, 1)
  632. $kidname[nextbaby] = 'unborn'
  633. kidage[nextbaby] = 0
  634. daykid[nextbaby] = 0
  635. monthkid[nextbaby] = 0
  636. yearkid[nextbaby] = 0
  637. Babyptype[nextbaby] = 0
  638. $kid_dna[nextbaby] = func('DNA', 'generate', $pcs_dna, $npc_dna[$cumfathlotto[lotto_idx]])
  639. $ChildFath[nextbaby] = $cumfathlotto[lotto_idx]
  640. $ChildFathDNA[nextbaby] = $cumfatherDNA[lotto_idx]
  641. hairkid[nextbaby] = rand(0, 3)
  642. eyeskid[nextbaby] = rand(0, 3)
  643. ChildConType[nextbaby] = cumarrcon[nextbaby]
  644. if FertEgg > 1:
  645. $childtype[nextbaby] = 'fraternal twin'
  646. $childtype[nextbaby-1] = 'fraternal twin'
  647. else
  648. $childtype[nextbaby] = ''
  649. end
  650. end
  651. egg_idx += 1
  652. jump 'FertLoop'
  653. end
  654. killvar 'temp'
  655. tempovbonus = 0
  656. end
  657. !!{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.}
  658. if pillcon > 26000 and rand(0,400) ! 0: EggRH = 0
  659. :OviLoop
  660. if EggRH > ((UnfertEgg + FertEgg) * 150):
  661. UnfertEgg += 1
  662. EggRH -= (200 * UnfertEgg)
  663. jump 'OviLoop'
  664. end
  665. if ovulate <= 0:
  666. cycle = 3
  667. UnfertEgg = 0
  668. end
  669. if FertEgg = 1 and ferteggage < 330:
  670. if rand(0,(2000 - age*20)) = 0:
  671. FertEgg += 1
  672. nextbaby = arrsize('$ChildFath')
  673. polkid[nextbaby] = polkid[nextbaby-1]
  674. $kidname[nextbaby] = 'unborn'
  675. kidage[nextbaby] = 0
  676. daykid[nextbaby] = 0
  677. monthkid[nextbaby] = 0
  678. yearkid[nextbaby] = 0
  679. Babyptype[nextbaby] = Babyptype[nextbaby-1]
  680. $ChildFath[nextbaby] = $ChildFath[nextbaby-1]
  681. $ChildFathDNA[nextbaby] = $ChildFathDNA[nextbaby-1]
  682. $kid_dna[nextbaby] = $kid_dna[nextbaby-1]
  683. hairkid[nextbaby] = hairkid[nextbaby-1]
  684. eyeskid[nextbaby] = eyeskid[nextbaby-1]
  685. cumarrcon[nextbaby] = cumarrcon[nextbaby-1]
  686. $childtype[nextbaby] = 'identical twin'
  687. $childtype[nextbaby-1] = 'identical twin'
  688. end
  689. end
  690. ferteggage += 1
  691. Ovulate -= 1
  692. LutH += 1
  693. end
  694. !{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.}
  695. !{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.}
  696. !{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.}
  697. if $ARGS[0] = 'cyc3':
  698. if FertEgg = 1 and ferteggage < 330:
  699. if rand(0,(2000 - age*20)) = 0:
  700. FertEgg += 1
  701. nextbaby = arrsize('$ChildFath')
  702. polkid[nextbaby] = polkid[nextbaby-1]
  703. $kidname[nextbaby] = 'unborn'
  704. kidage[nextbaby] = 0
  705. daykid[nextbaby] = 0
  706. monthkid[nextbaby] = 0
  707. yearkid[nextbaby] = 0
  708. Babyptype[nextbaby] = Babyptype[nextbaby-1]
  709. $ChildFath[nextbaby] = $ChildFath[nextbaby-1]
  710. $ChildFathDNA[nextbaby] = $ChildFathDNA[nextbaby-1]
  711. $kid_dna[nextbaby] = $kid_dna[nextbaby-1]
  712. hairkid[nextbaby] = hairkid[nextbaby-1]
  713. eyeskid[nextbaby] = eyeskid[nextbaby-1]
  714. cumarrcon[nextbaby] = cumarrcon[nextbaby-1]
  715. $childtype[nextbaby] = 'identical twin'
  716. $childtype[nextbaby-1] = 'identical twin'
  717. end
  718. end
  719. ferteggage += 1
  720. implant_idx = 0
  721. implant_sz = arrsize('Babyptype')
  722. :implant_loop
  723. if implant_idx < implant_sz:
  724. if Babyptype[implant_idx] = 0 and $ChildFath[implant_idx] ! '':
  725. imp_rand = rand(0,120000)
  726. if ferteggage < 120 and broodcurse <= 0:
  727. imp_rand += 170
  728. imp_rand -= age * 10
  729. if steriletu = 1: imp_rand -= 200
  730. if imp_rand <= 0:
  731. Babyptype[implant_idx] = 2
  732. FertEgg -= 1
  733. babyembryo += 1
  734. PregChem = rand(10,30)
  735. if preg = 0: preg = 1
  736. implant_day = daystart
  737. implant_hour = hour
  738. end
  739. else
  740. imp_rand += sterilewb
  741. imp_rand -= tempwbbonus
  742. if broodcurse > 0 and ferteggage >= 120: imp_rand = 0
  743. if imp_rand <= (1200 - (age * 7)):
  744. Babyptype[implant_idx] = 1
  745. FertEgg -= 1
  746. babyembryo += 1
  747. PregChem = rand(10,30)
  748. if preg = 0: preg = 1
  749. implant_day = daystart
  750. implant_hour = hour
  751. end
  752. tempwbbonus = 0
  753. end
  754. end
  755. implant_idx += 1
  756. jump 'implant_loop'
  757. end
  758. !!{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.}
  759. if LutH > LutH_Max:
  760. rej_idx = 0
  761. rej_sz = arrsize('Babyptype')
  762. :lutcycloop
  763. if rej_idx < rej_sz:
  764. if Babyptype[rej_idx] = 0:
  765. killvar 'polkid',rej_idx
  766. killvar '$kidname',rej_idx
  767. killvar 'kidage',rej_idx
  768. killvar 'daykid',rej_idx
  769. killvar 'monthkid',rej_idx
  770. killvar 'yearkid',rej_idx
  771. killvar 'Babyptype',rej_idx
  772. killvar '$ChildFath',rej_idx
  773. killvar 'hairkid',rej_idx
  774. killvar 'eyeskid',rej_idx
  775. killvar 'cumarrcon',rej_idx
  776. FertEgg -= 1
  777. end
  778. rej_idx += 1
  779. jump 'lutcycloop'
  780. end
  781. LutH = 0
  782. if preg = 1:
  783. cycle = 5
  784. elseif menoage <= age:
  785. killvar '$wombpotfath'
  786. killvar '$cumfthname'
  787. killvar '$cumfthusedname'
  788. killvar 'cumtime'
  789. cycle = 6
  790. else
  791. killvar '$wombpotfath'
  792. killvar '$cumfthname'
  793. killvar '$cumfthusedname'
  794. killvar 'cumtime'
  795. !! the setting of the max_time can be here although it can be changed in the future
  796. FocH_Max = rand(312,360) & !! 13-15 days including menstruation
  797. temprand = rand(0,10)
  798. if pillcon >= 38000 or (pillcon > 0 and rand(1,24) = 1):
  799. EggRH = 0
  800. cycle = 1
  801. mesec = 0
  802. else
  803. cycle = 0
  804. killvar 'abortionbirthdate'
  805. if cyccustom = 1: daylastperiod = daystart
  806. firstmens = daystart
  807. temprand = rand(0,10)
  808. if temprand = 0 and pillcon < 10000:
  809. mesec = rand(104,136) & !! 120
  810. elseif temprand < 9 and pillcon < 15000:
  811. mesec = rand(76,104) & !! 96
  812. elseif pillcon < 20000:
  813. mesec = rand(52,76) & !! 72
  814. else
  815. mesec = rand(44,52) & !! 48
  816. end
  817. end
  818. end
  819. else
  820. if preg = 1:PregChem += 1 + pregspeedcheat
  821. if rand(0,100) < 100: LutH += 1
  822. end
  823. end
  824. !{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.}
  825. if $ARGS[0] = 'cyc4':
  826. if RecovH <= 0:
  827. cycle = 1
  828. if cyccustom = 1:
  829. knowpregloss = 0
  830. knowpregrecover = 0
  831. end
  832. if rand(0,1000) = 1000:
  833. EggRH = rand(20,80)
  834. else
  835. EggRH = 0
  836. end
  837. FocH = EggRH
  838. else
  839. RecovH -= 1
  840. if rand(0,10) = 0: RecovH -= 1
  841. end
  842. end
  843. !{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.}
  844. if $ARGS[0] = 'preg':
  845. if FertEgg = 1 and ferteggage < 330:
  846. if rand(0,(2000 - age*20)) = 0:
  847. babyembryo += 1
  848. PregChem += rand(10,30)
  849. nextbaby = arrsize('$ChildFath')
  850. polkid[nextbaby] = polkid[nextbaby-1]
  851. $kidname[nextbaby] = 'unborn'
  852. kidage[nextbaby] = 0
  853. daykid[nextbaby] = 0
  854. monthkid[nextbaby] = 0
  855. yearkid[nextbaby] = 0
  856. Babyptype[nextbaby] = Babyptype[nextbaby-1]
  857. $ChildFath[nextbaby] = $ChildFath[nextbaby-1]
  858. hairkid[nextbaby] = hairkid[nextbaby-1]
  859. eyeskid[nextbaby] = eyeskid[nextbaby-1]
  860. cumarrcon[nextbaby] = cumarrcon[nextbaby-1]
  861. $childtype[nextbaby] = 'identical twin'
  862. $childtype[nextbaby-1] = 'identical twin'
  863. end
  864. end
  865. PregChem += (1+pregspeedcheat)
  866. temprand = rand(-400,800)
  867. temprand -= (babyembryo-1)*588
  868. if PregChem > 6573 + temprand and preg ! 2:
  869. 'A sharp pain pierces your abdomen, and you feel something flow down your legs. Your water has broken!'
  870. !! switch on lactation if not already active.
  871. if lactation['active'] < 1: func('lact_lib','lact_switch')
  872. $cycreport_txt = 'In labour'
  873. arrmodtmp = arrsize('$ChildFath')
  874. arrmodtmp -= (babyembryo)
  875. :babyfinalpreploop
  876. if arrmodtmp < arrsize('$ChildFath') and daykid[arrmodtmp] = 0:
  877. daykid[arrmodtmp] = 42
  878. !! $wombthfathID is the ID of the character Sveta has chosen as believed father in the cycle menu
  879. !! checking the there is a valid ID that resolves into a name, if yes then applying that ID as believed father
  880. if $npc_usedname[$wombthfathID] ! '':
  881. $ChildThFath[arrmodtmp] = $wombthfathID
  882. else
  883. !! if the ID does not resolve into a name then it is probably some legacy event father
  884. !! like 'A sperm donor' or else 'unknown'. In either case it should not cause issues if all outliers are designated 'unknown'
  885. $ChildThFath[arrmodtmp] = 'unknown'
  886. end
  887. arrmodtmp += 1
  888. jump 'babyfinalpreploop'
  889. end
  890. killvar '$wombpotfath'
  891. killvar '$wombthfath'
  892. preg = 2
  893. pregminut = totminut + 1440
  894. if babyembryo > 1:
  895. 'Your babies are coming...'
  896. else
  897. 'Your baby is coming...'
  898. end
  899. if PregChem < 3885:
  900. 'Way too early!'
  901. elseif PregChem < 5229:
  902. 'Very early!'
  903. elseif PregChem < 6069:
  904. 'Early.'
  905. elseif PregChem > 6959:
  906. 'Late.'
  907. elseif PregChem > 7245:
  908. 'Very late!'
  909. end
  910. 'You need to get to a clinic.'
  911. end
  912. if PregChem > 2203:
  913. if PregChem > 2853 or kid > 0:
  914. if rand(0,7) = 0: dynamic $d_pregmovement
  915. else
  916. if rand(0,500) = 0: dynamic $d_pregmovement
  917. end
  918. end
  919. end
  920. !! Variable error handler for femcyc. Checking if variables are out of range and resets them.
  921. if $ARGS[0] = 'femcyc_errhdl':
  922. if cycle < 0 or cycle > 6: cycle = 0
  923. if rcntorgzmtmp < 0 or rcntorgzmtmp > 1: rcntorgzmtmp = 0
  924. if rcntorgzm < 0 or rcntorgzm > 1: rcntorgzm = 0
  925. if PregChem < 0: PregChem = 0
  926. if preg < 0 or preg > 2: preg = 0
  927. if ferteggage < 0: ferteggage = 0
  928. if EggRH < 0: EggRH = 0
  929. if FocH < 0: FocH = 0
  930. if FertEgg < 0: FertEgg = 0
  931. end
  932. --- femcyc ---------------------------------