body_shape.qsrc 16 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520521522523524525526527528529530531532533534535536537538539540541542543544545546547548549
  1. # body_shape
  2. !!vhips = derived from salo in body_shape
  3. !!vhtmp = slows the change to vhips in body_shape
  4. !!wratio = waist to hips ratio set in body_shape
  5. !!bratio = band to waist ratio set in body_shape
  6. !!hratio = hip to height ratio set in body_shape
  7. !!vofat = used as a place to put extra salo at extreme high values (i.e. really, really fat) set in body_shape
  8. !!nbsize = starts at a set genetic bust size, but can be adjusted down if salo drops too low
  9. !!magicf2b = set in body_shape for the fat moved to bust
  10. !!genbsize = the set genetic bust size
  11. !!salocatnow = the current category of salo
  12. !!salocatlast = the previous category of salo
  13. !!magf2bdo = flag for magic bust increase; 0, ready; 1, do it; 2, ask; 3, no
  14. !!mgf2bnocnt = used to count the number of times a bust increase was turned down and stop asking after 3
  15. !!magtarcup = set in the dream code as the target cup size
  16. !!btwarn = used to flag if to display the gaining/losing weight message when bathing
  17. !!salolast = used when doing a soft rest to control the cycling of the main code
  18. !!sftrstflag = used to prevent a code chunk from firing on a soft reset
  19. !!Image set variables
  20. !! bodset = body image and descriptor control variable, used to indicate which image and descriptor set is in use
  21. !! $bodimgsets[x] = body shape descriptors, tens place is the set (using bodset), 0 - 7 the descriptors (using salocatnow), 8 filler, 9 is the folder name
  22. !! bdsetlock = flag to indicate set control override, 0 is use the formula to pick a set, 1 is use a fixed set
  23. !! fixbodset = the identification number of the fixed image set
  24. !! bodsetcnt = the number of sets present
  25. !! imgset6ovr[x] and imgset7ovr[x] = a flag to indicate that an image set (x) has its own image 6 and/or 7
  26. !! extended lash functionality; pcs_lashes = n are: {2, largest natural size}, {3, with temporary false lashes on or basic 2D lash extensions}, {4, with ornate false lashes on or lavish 4D extensions}, {5, with extremely ornate, 6D-style extensions} - xerya
  27. $this = 'body_shape'
  28. if $ARGS[0] = 'RegularUpdate':
  29. if dounspell = 0:
  30. gs $this, 'UpdateBodyMeasurement'
  31. pcs_weight = func($this, 'CalcWeight')
  32. pcs_bmi = func($this, 'CalcBMI')
  33. end
  34. if pcs_skin > 100:
  35. pcs_skin = 100
  36. elseif pcs_skin < 0:
  37. pcs_skin = 0
  38. end
  39. !!Since "musle" is used all over the place
  40. musle = strenbuf
  41. end
  42. if $ARGS[0] = 'DailyUpdate':
  43. !{
  44. Update once a day and called from cikl
  45. }
  46. if dounspell = 1:
  47. if strenbuf > 90:
  48. strenbuf -= 2
  49. elseif strenbuf > 80:
  50. strenbuf -= 1
  51. end
  52. if vitalbuf > 90:
  53. vitalbuf -= 2
  54. elseif vitalbuf > 80:
  55. vitalbuf -= 1
  56. end
  57. if strenbuf > pcs_stren: strenbuf -= 1
  58. if strenbuf < pcs_stren: strenbuf += 1
  59. if vitalbuf > pcs_vital: vitalbuf -= 1
  60. if vitalbuf < pcs_vital: vitalbuf += 1
  61. if agilbuf > pcs_agil: agilbuf -= 1
  62. if agilbuf < pcs_agil: agilbuf += 1
  63. else
  64. gs $this
  65. end
  66. gs $this, 'UpdateBodyImage'
  67. !!---- Calculation of lash extension degradation and false lash removal
  68. if pcs_lashes > 2:
  69. if lashextensionstyle >= 1:
  70. lashextensionduration -= 1
  71. if lashextensionduration >= 1 and lashextensionduration <= 4:
  72. 'It''s time for you to do your maintenance on your lash extensions; you should go to the salon or you risk growing them all out.'
  73. end
  74. if lashextensionduration <= 0:
  75. 'You waited too long to do maintenance on your lash extensions; there''s too little there to notice or work with at this point.'
  76. pcs_lashes = pcs_naturallashes
  77. killvar 'lashextensionstyle'
  78. killvar 'lashextensionduration'
  79. killvar 'lashextensionnew'
  80. end
  81. end
  82. if false_lashes > 0:
  83. false_lashes -= 1
  84. if false_lashes = 0:
  85. 'Your false lashes came off in the night; there''s no recovering them now.'
  86. pcs_lashes = pcs_naturallashes
  87. else
  88. 'Somehow, your lashes managed to stay attached throughout the night. You might be able to get away with wearing them another day straight.'
  89. end
  90. end
  91. end
  92. !! Max. Hair length 600mm, or 60cm, which should be somewhere in the lower back area.
  93. !! Hair grows 1mm each day, it takes 20 months (1 month = 30 days) to regrow the hair from 0.
  94. if pcs_hairlng < 1001 and hairgrowcht = 0:pcs_hairlng += 1
  95. ! Hair colour change
  96. if pcs_haircol ! nathcol:
  97. dyefade -=1
  98. if dyefade < 0: dyefade = 0
  99. end
  100. !!pubic hair colouring
  101. !! pcs_pubecol = natural colour
  102. !! pcs_pubecol[1] = flag for saveupdate
  103. !! pcs_pubecol[2] = actual colour
  104. !! pcs_pubecol[3] = countdown timer for dye
  105. if pcs_pubecol[2] ! pcs_pubecol:
  106. pcs_pubecol[3] -=1
  107. if pcs_pubecol[3] < 0: pcs_pubecol[3] = 0
  108. if pcs_pubecol[3] = 0: pcs_pubecol[2] = pcs_pubecol
  109. end
  110. if pcs_pubes < 2: pcs_pubecol[2] = pcs_pubecol
  111. if hscrunch > 0:
  112. hscrunchrand = rand(1, 100)
  113. if hscrunchrand <= 8:hscrunch -= 1
  114. end
  115. ! Leg and pubes hair growth
  116. if lashair ! 1:
  117. pcs_leghair += 1
  118. !!Pubic hair growth at 1/2 per night
  119. if pcs_pubes['growth'] > 1:
  120. pcs_pubes['growth'] = 0
  121. pcs_pubes += 1
  122. end
  123. pcs_pubes['growth'] += 1
  124. end
  125. if age < 18 and rand (0,2) = 0 and pcs_leghair > 0: pcs_leghair -= 1
  126. end
  127. if $ARGS[0] = '':
  128. !!This controls the gradual change in stat to -buf
  129. if strenbuf > pcs_stren: strenbuf -= 1
  130. if strenbuf < pcs_stren: strenbuf += 1
  131. if vitalbuf > pcs_vital: vitalbuf -= 1
  132. if vitalbuf < pcs_vital: vitalbuf += 1
  133. if agilbuf > pcs_agil: agilbuf -= 1
  134. if agilbuf < pcs_agil: agilbuf += 1
  135. !!All the ratios were rounded to 2 digits and there are divide 100s at the final calc points
  136. !!Waist to hip ratio
  137. wrtemp = ((2 * vitalbuf + strenbuf + agilbuf) /4)
  138. !! Primary wratio handling
  139. if wrtemp < 11:
  140. wratio = 85 + (11 - (vitalbuf + strenbuf + agilbuf)/3)
  141. elseif wrtemp < 20:
  142. wratio = 85
  143. elseif wrtemp < 35:
  144. wratio = 85 - (wrtemp - 20) / 3
  145. elseif wrtemp < 55:
  146. wratio = 80 - (wrtemp - 35) / 4
  147. elseif wrtemp < 80:
  148. wratio = 75 - (wrtemp - 55) / 5
  149. elseif wrtemp >= 80:
  150. wratio = 70
  151. end
  152. !! High stat value edge case handling
  153. if (vitalbuf + strenbuf + agilbuf) /3 > 100: wratio -= ((vitalbuf + strenbuf)/2 - agilbuf)/5
  154. !! This is the oops and high stat gone overboard handling
  155. if wratio < 65: wratio = 65
  156. killvar 'wrtemp'
  157. !!For band to waist ratio
  158. brtemp = (2 * strenbuf + vitalbuf + agilbuf) /4
  159. if brtemp < 10:
  160. bratio = 105
  161. elseif brtemp =< 23:
  162. bratio = 106
  163. elseif brtemp =< 80:
  164. bratio = 106 + (brtemp - 23) / 3
  165. else
  166. bratio = 125
  167. end
  168. killvar 'brtemp'
  169. !!For hip to height ratio which is used to set the center point
  170. hrtemp = (2 * agilbuf + vitalbuf + strenbuf) /4
  171. if hrtemp < 35:
  172. hratio = 60
  173. elseif hrtemp < 45:
  174. hratio = 59
  175. elseif hrtemp < 60:
  176. hratio = 58
  177. elseif hrtemp < 80:
  178. hratio = 57
  179. else
  180. hratio = 56
  181. end
  182. killvar 'hrtemp'
  183. !!Salo Handling; the first part is because during a reset fat is not used and should be cleared
  184. if sftrstflag = 1 or cheatNoFat = 1:
  185. fat = 0
  186. else
  187. if fat > (17 + vitalbuf / 25): salo += 1 & fat = 0
  188. if fat < (-2 - (vitalbuf / 10)): salo -= 1 & fat = 0
  189. end
  190. !!This is the salo cap for the weight approximation
  191. if salo > 250: salo = 250
  192. !!This calculates the current salo category; ranges are 20 points, seemed to balance best if the range is x10 the hip devisor
  193. :salocatloop
  194. if salo < 10:
  195. salocatnow = 0
  196. else
  197. salocatnow = 1 + (salo - 10) / 20
  198. end
  199. !!This resets the genetic bust size (genbsize) when the cheat is used to reduce breast size (maybe other things later)
  200. if titreduc = 1:
  201. killvar 'titreduc'
  202. if genbsize > nbsize:
  203. genbsize = 2 + nbsize - nbsize mod 5
  204. end
  205. end
  206. !!This controls the movement of salo to/from bust in order of precedence
  207. if salobustdo = 0 and nbsize < genbsize and salocatnow > 2:
  208. if sftrstflag = 0:'<b>Your breasts seem fuller.</b>'
  209. nbsize += 1
  210. salo -= 3
  211. salobustdo = 1
  212. jump 'salocatloop'
  213. end
  214. if salobustdo = 0 and magf2bdo = 1 and salocatnow > salocatlast and pcs_mana >= manamax / 2 and magikDostup = 0:
  215. if sftrstflag = 0:'<b>Your breasts seem fuller.</b>'
  216. magicf2b += 1
  217. salo -= 3
  218. salobustdo = 1
  219. if magicf2b >= 2 + magtarcup * 5: magf2bdo = 0
  220. if pcs_magik < 20:
  221. pcs_mana -= 2000 / pcs_magik
  222. else
  223. mana -= 100
  224. end
  225. jump 'salocatloop'
  226. end
  227. if salobustdo = 0 and salocatnow < 2 and salocatlast >= 2 and magicf2b > 0 and magikDostup = 0:
  228. if sftrstflag = 0:'<b>Your breasts seem to be getting smaller.</b>'
  229. magicf2b -= 1
  230. salo += 3
  231. salobustdo = 1
  232. magf2bdo = 1
  233. jump 'salocatloop'
  234. end
  235. if salobustdo = 0 and salocatnow < 1 and salocatlast >= 1 and nbsize > 0:
  236. if sftrstflag = 0:'<b>Your breasts seem to be getting smaller.</b>'
  237. nbsize -= 1
  238. salo += 3
  239. salobustdo = 1
  240. jump 'salocatloop'
  241. end
  242. !!This is if a Succubus has salo < 1
  243. if succubusflag = 1 and salo < 1:
  244. sucexcess -= 1
  245. salo += 3
  246. end
  247. !!This is if salo is still < 1
  248. if salo < 1:
  249. if fat >= 1:
  250. salo = 1
  251. fat -= 1
  252. elseif fat <= 0 and pcs_stren + pcs_vital > 0:
  253. stren_deg -= 1000
  254. vital_deg -= 1000
  255. salo = 1
  256. else
  257. if Enable_nogameover = 0:
  258. over = 3
  259. gt 'gameover'
  260. exit
  261. else
  262. pl '<font color=red><B>You starved to death, but Cheat Mode keeps you Alive.</B></font>'
  263. salo = 1
  264. end
  265. end
  266. end
  267. killvar 'tempvct' & killvar 'salobustdo'
  268. !!This is the hip calcs, 80 is the center of the current max-min range (10 - 130)
  269. vhtmp = (salo - 80) / 2
  270. if vhips > vhtmp: vhips -= 1
  271. if vhips < vhtmp: vhips += 1
  272. !! Because a reset should be updating hip size instantly (this set is a bit redundant anyway)
  273. if sftrstflag = 1: vhips = vhtmp
  274. if (pcs_hgt * hratio) / 100 + vhips > (pcs_hgt * 72) / 100:
  275. vofat = ((pcs_hgt * hratio) / 100 + vhips - (pcs_hgt * 72) / 100) / 2
  276. vhips -= vofat * 2
  277. end
  278. !!This will trigger the warning notices in the bathing code (the +/- 12 should always be +/- 11 + the max change to salo w/ fat)
  279. if salolast > salo and salo <= 12 + (20 * (salocatnow - 1)): btwarn = 1
  280. if salolast < salo and salo >= (20 * (salocatnow + 1)) - 12: btwarn = 2
  281. !!This will trigger the dream for the option to use magic to increase bust
  282. !!Three nos at the dream will lock it out (1 yes resets the count)
  283. if pcs_magik >= 5 and MagikDostup = 0 and magf2bdo = 0:
  284. if salolast < salo and salo >= (20 * (salocatnow + 1)) - 11 and tits < 10:
  285. if mgf2bnocnt < 3:
  286. magf2bdo = 2
  287. else
  288. magf2bdo = 3 & killvar 'mgf2bnocnt'
  289. end
  290. end
  291. end
  292. !!This is to deal with the possibility that salocatnow changed by more than 1 (fat burners, vitamins, plastic surgery, etc.)
  293. if salocatnow < salocatlast: salocatlast -= 1
  294. if salocatnow > salocatlast: salocatlast += 1
  295. !!This is for use in the warning code and as part of the reset routines
  296. if salolast > salo: salolast -= 1
  297. if salolast < salo: salolast += 1
  298. !!Setting the pcs_apprnc bonus based on fat and strength
  299. pcs_bmi = FUNC('body_shape', 'CalcBMI')
  300. !!This is to clean up unused variables
  301. killvar 'normbuffpick' & killvar 'nrmbfpckct'
  302. killvar 'vmeat' & killvar 'vfat' & killvar 'Kves' & killvar 'krost'
  303. killvar 'koefvesbt' & killvar 'koefbt'
  304. end
  305. if $ARGS[0] = 'UpdateBodyMeasurement':
  306. pcs_hips = (pcs_hgt * hratio) / 100 + vhips
  307. pcs_waist = (pcs_hips * wratio) / 100 + vofat
  308. pcs_band = (pcs_waist * bratio) / 100 + vofat
  309. pcs_bust = (pcs_waist * bratio) / 100 + nbsize + magicf2b + silicone
  310. pcs_butt = (pcs_hips / 10) + silicone_butt + butt_cheat
  311. pcs_cupsize = pcs_bust - pcs_band
  312. ! Update tits size
  313. if pcs_cupsize <= 5:
  314. tits = 0
  315. $titsize = 'AA cup'
  316. elseif pcs_cupsize <= 10:
  317. tits = 1
  318. $titsize = 'A cup'
  319. elseif pcs_cupsize <= 15:
  320. tits = 2
  321. $titsize = 'B cup'
  322. elseif pcs_cupsize <= 20:
  323. tits = 3
  324. $titsize = 'C cup'
  325. elseif pcs_cupsize <= 25:
  326. tits = 4
  327. $titsize = 'D cup'
  328. elseif pcs_cupsize <= 30:
  329. tits = 5
  330. $titsize = 'E cup'
  331. elseif pcs_cupsize <= 35:
  332. tits = 6
  333. $titsize = 'F cup'
  334. elseif pcs_cupsize <= 40:
  335. tits = 7
  336. $titsize = 'G cup'
  337. elseif pcs_cupsize <= 45:
  338. tits = 8
  339. $titsize = 'H cup'
  340. elseif pcs_cupsize <= 50:
  341. tits = 9
  342. $titsize = 'I cup'
  343. elseif pcs_cupsize <= 55:
  344. tits = 10
  345. $titsize = 'J cup'
  346. else
  347. tits = 11
  348. $titsize = 'K cup'
  349. end
  350. end
  351. if $ARGS[0] = 'CalcWeight':
  352. !{pcs_weight: Svetas weight in kg
  353. Optimal Weight (170cm): 60kg, 60 salo
  354. This is an approximation, so that a sveta with a different height has the same BMI for the same salo values.
  355. The default height of 170 cm is used as a starting point. The bmi deviates by 0.06 for a deviation of 10cm and 0.4 for a deviation of 20cm.}
  356. result = 30 + salo / 2 + (pcs_hgt - 170) * 7 / 10
  357. !{Do not remove (julzor)
  358. This is the old more complex function, but it doesn''t work correctly.
  359. This variable is actually only used ONCE (except for the BMI calculation), when stripping, to see if you fall off the pole from being too heavy. I am reluctant to touch it, since the math is not explained. Maybe later.
  360. Weight = (height in cm x bottom of average weight in kilos for a 170cm female / 170cm + (hip modifier + 2 x overrun fat)/4 + cup size}
  361. !result = (pcs_hgt * 62 / 170) + (vhips + (vofat * 2)) / 4 + tits
  362. end
  363. if $ARGS[0] = 'UpdateBodyImage':
  364. !Update body image set
  365. if dounspell = 1:
  366. salocatnow = (pcs_hips / 10) - 5
  367. if bdsetlock = 0:
  368. if (knowpreg = 1 or (preg = 1 and thinkpreg = 1) or (preg = 1 and PregChem > 3600)):
  369. bodset = 3
  370. elseif strenbuf >= 70:
  371. bodset = 2
  372. elseif strenbuf <= 40:
  373. bodset = 0
  374. else
  375. bodset = 1
  376. end
  377. else
  378. bodset = fixbodset
  379. end
  380. elseif (knowpreg = 1 or (preg = 1 and thinkpreg = 1) or (preg = 1 and PregChem > 3600)) and bodet ! 3 and bdsetlock = 0:
  381. bodset = 3
  382. elseif preg = 0 and bodset = 3 and bdsetlock = 0:
  383. if strenbuf >= 70:
  384. bodset = 2
  385. elseif strenbuf <= 40:
  386. bodset = 0
  387. else
  388. bodset = 1
  389. end
  390. end
  391. ! Update body description
  392. if (knowpreg = 1 or (preg = 1 and thinkpreg = 1) or (preg = 1 and PregChem > 3600)) and bodset = 3:
  393. if PregChem > 6216:
  394. $body = $bodimgsets[((bodset * 10) + 8)]
  395. elseif PregChem < 2688:
  396. $body = $bodimgsets[(bodset * 10)]
  397. else
  398. $body = $bodimgsets[((bodset * 10)+((PregChem - 2184)/504))]
  399. end
  400. elseif salocatnow <= 7:
  401. $body = $bodimgsets[((bodset * 10) + salocatnow)]
  402. else
  403. $body = $bodimgsets[((bodset * 10) + 7)]
  404. end
  405. end
  406. if $ARGS[0] = 'CalcBMI':
  407. result = 10000 * (30 + salo / 2 + (pcs_hgt - 170) * 7 / 10) / (pcs_hgt * pcs_hgt)
  408. end
  409. if $ARGS[0] = 'softreset':
  410. !!This is for use in immediately updating shape if something has caused a large change in salo, primarily fat burners and plastic surgery
  411. sftrstflag = 1
  412. :resetloop
  413. if salo ! salolast:
  414. if gmstrtflag = 1: salobustdo = 1
  415. gs 'body_shape'
  416. jump 'resetloop'
  417. end
  418. !!Updates pcs_apprncbase after a reset
  419. gs 'AppearanceSystem', 'UpdateBaseAppearnce'
  420. !!Clears the warning and reset status flags if they were set
  421. sftrstflag = 0
  422. btwarn = 0
  423. end
  424. if $ARGS[0] = 'hardreset':
  425. !!This is primarily for canceling out "dounspell" and setting salo to whatever value will result in the current hip size then balancing everything out.
  426. !!Also could be built in as a means to in-game undo "dounspell", other than the cheat.
  427. if dounspell = 1 and dounsplkil > 0:
  428. salo = 12
  429. fat = 0
  430. agilbuf = pcs_agil & strenbuf = pcs_stren & vitalbuf = pcs_vital
  431. salobustdo = 1 & sftrstflag = 1 & normbuffpick = -1
  432. gs 'body_shape'
  433. salo = (pcs_hips * 2) - ((pcs_hgt * hratio) / 50) + 80
  434. if salo < 10:
  435. salocatnow = 0
  436. else
  437. salocatnow = 1 + (salo - 10) / 20
  438. end
  439. salocatlast = salocatnow
  440. salolast = salo
  441. vhtmp = (salo - 80) / 2
  442. vhips = vhtmp
  443. if genbsize = 0 and nbsize > 0:
  444. If nbsize >= 27:
  445. genbsize = 27
  446. else
  447. genbsize = 2 + nbsize - nbsize mod 5
  448. end
  449. elseif genbsize = 0 and nbsize = 0 and silicone >= 20:
  450. genbsize = 12 & nbsize = 12 & silicone -= 10
  451. end
  452. sftrstflag = 0 & normbuffpick = 0 & btwarn = 0 & magf2bdo = 0
  453. killvar 'dounsplkil'
  454. newbdsp = 1
  455. dounspell = 0
  456. gs 'AppearanceSystem', 'UpdateBaseAppearnce'
  457. gs 'body_shape'
  458. gs 'stat'
  459. else
  460. 'If you''re seeing this, something odd happened. Please make a bug report that the body shape hard reset improperly triggered and what you were doing.'
  461. end
  462. end
  463. if $ARGS[0] = 'initial':
  464. !! Sets the genetic bust size if it was not set in the start routines
  465. if genbsize = 0:
  466. genbsize = 12 & nbsize = 12
  467. else
  468. nbsize = genbsize
  469. end
  470. agilbuf = pcs_agil & strenbuf = pcs_stren & vitalbuf = pcs_vital
  471. normbuffpick = -1 & gmstrtflag = 1
  472. !! Calling soft reset will cause the main code to cycle up to the starting value of salo
  473. gs 'body_shape', 'softreset'
  474. !! This sets/resets the controler variables
  475. salocatlast = salocatnow
  476. normbuffpick = 0 & magf2bdo = 0
  477. killvar 'gmstrtflag'
  478. newbdsp = 1
  479. !! This does all the body shape setting before the first stat call
  480. gs $this, 'UpdateBodyMeasurement'
  481. pcs_weight = func($this, 'CalcWeight')
  482. pcs_bmi = func($this, 'CalcBMI')
  483. gs 'body_desc', 'BMI'
  484. end
  485. --- body_shape ---------------------------------