body_shape.qsrc 15 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367368369370371372373374375376377378379380381382383384385386387388389390391392393394395396397398399400401402403404405406407408409410411412413414415416417418419420421422423424425426427428429430431432433434435436437438439440441442443444445446447448449450451452453454455456457458459460461462463464465466467468469470471472473474475476477478479480481482483484485486487488489490491492493494495496497498499500501502503504505506507508509510511512513514515516517518519520
  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. if $ARGS[0] = '':
  28. !!This controls the gradual change in stat to -buf
  29. if strenbuf > pcs_stren: strenbuf -= 1
  30. if strenbuf < pcs_stren: strenbuf += 1
  31. if vitalbuf > pcs_vital: vitalbuf -= 1
  32. if vitalbuf < pcs_vital: vitalbuf += 1
  33. if agilbuf > pcs_agil: agilbuf -= 1
  34. if agilbuf < pcs_agil: agilbuf += 1
  35. !!All the ratios were rounded to 2 digits and there are divide 100s at the final calc points
  36. !!Waist to hip ratio
  37. wrtemp = ((2 * vitalbuf + strenbuf + agilbuf) /4)
  38. !! Primary wratio handling
  39. if wrtemp < 11:
  40. wratio = 85 + (11 - (vitalbuf + strenbuf + agilbuf)/3)
  41. elseif wrtemp < 20:
  42. wratio = 85
  43. elseif wrtemp < 35:
  44. wratio = 85 - (wrtemp - 20) / 3
  45. elseif wrtemp < 55:
  46. wratio = 80 - (wrtemp - 35) / 4
  47. elseif wrtemp < 80:
  48. wratio = 75 - (wrtemp - 55) / 5
  49. elseif wrtemp >= 80:
  50. wratio = 70
  51. end
  52. !! High stat value edge case handling
  53. if (vitalbuf + strenbuf + agilbuf) /3 > 100: wratio -= ((vitalbuf + strenbuf)/2 - agilbuf)/5
  54. !! This is the oops and high stat gone overboard handling
  55. if wratio < 65: wratio = 65
  56. killvar 'wrtemp'
  57. !!Setting the pcs_apprnc bonus based on wratio
  58. if wratio >= 85:
  59. bodykoef = 0
  60. elseif wratio >= 80:
  61. bodykoef = 2
  62. elseif wratio >= 75:
  63. bodykoef = 4
  64. elseif wratio >= 70:
  65. bodykoef = 8
  66. else
  67. bodykoef = 4
  68. end
  69. !!For band to waist ratio
  70. brtemp = (2 * strenbuf + vitalbuf + agilbuf) /4
  71. if brtemp < 10:
  72. bratio = 105
  73. elseif brtemp =< 23:
  74. bratio = 106
  75. elseif brtemp =< 80:
  76. bratio = 106 + (brtemp - 23) / 3
  77. else
  78. bratio = 125
  79. end
  80. killvar 'brtemp'
  81. !!For hip to height ratio which is used to set the center point
  82. hrtemp = (2 * agilbuf + vitalbuf + strenbuf) /4
  83. if hrtemp < 35:
  84. hratio = 60
  85. elseif hrtemp < 45:
  86. hratio = 59
  87. elseif hrtemp < 60:
  88. hratio = 58
  89. elseif hrtemp < 80:
  90. hratio = 57
  91. else
  92. hratio = 56
  93. end
  94. killvar 'hrtemp'
  95. !!Salo Handling; the first part is because during a reset fat is not used and should be cleared
  96. if sftrstflag = 1 or cheatNoFat = 1:
  97. fat = 0
  98. else
  99. if fat > (2 + vitalbuf / 25): salo += 1 & fat = 0
  100. if fat < (-2 - (vitalbuf / 10)): salo -= 1 & fat = 0
  101. end
  102. !!This is the salo cap for the weight approximation
  103. if salo > 150: salo = 150
  104. !!This calculates the current salo category; ranges are 20 points, seemed to balance best if the range is x10 the hip devisor
  105. :salocatloop
  106. if salo < 10:
  107. salocatnow = 0
  108. else
  109. salocatnow = 1 + (salo - 10) / 20
  110. end
  111. !!This resets the genetic bust size (genbsize) when the cheat is used to reduce breast size (maybe other things later)
  112. if titreduc = 1:
  113. killvar 'titreduc'
  114. if genbsize > nbsize:
  115. genbsize = 2 + nbsize - nbsize mod 5
  116. end
  117. end
  118. !!This controls the movement of salo to/from bust in order of precedence
  119. if salobustdo = 0 and nbsize < genbsize and salocatnow > 2:
  120. if sftrstflag = 0:'<b>Your breasts seem fuller.</b>'
  121. nbsize += 1
  122. salo -= 3
  123. salobustdo = 1
  124. jump 'salocatloop'
  125. end
  126. if salobustdo = 0 and magf2bdo = 1 and salocatnow > salocatlast and pcs_manna >= mannamax / 2:
  127. if sftrstflag = 0:'<b>Your breasts seem fuller.</b>'
  128. magicf2b += 1
  129. salo -= 3
  130. salobustdo = 1
  131. if magicf2b >= 2 + magtarcup * 5: magf2bdo = 0
  132. if pcs_magik < 20:
  133. pcs_manna -= 2000 / pcs_magik
  134. else
  135. mana -= 100
  136. end
  137. jump 'salocatloop'
  138. end
  139. if salobustdo = 0 and salocatnow < 2 and salocatlast >= 2 and magicf2b > 0:
  140. if sftrstflag = 0:'<b>Your breasts seem to be getting smaller.</b>'
  141. magicf2b -= 1
  142. salo += 3
  143. salobustdo = 1
  144. magf2bdo = 1
  145. jump 'salocatloop'
  146. end
  147. if salobustdo = 0 and salocatnow < 1 and salocatlast >= 1 and nbsize > 0:
  148. if sftrstflag = 0:'<b>Your breasts seem to be getting smaller.</b>'
  149. nbsize -= 1
  150. salo += 3
  151. salobustdo = 1
  152. jump 'salocatloop'
  153. end
  154. !!This sets which image set is to be used when the override is not set
  155. if bdsetlock = 0:
  156. if strenbuf >= 70:
  157. bodset = 2
  158. elseif strenbuf <= 40:
  159. bodset = 0
  160. else
  161. bodset = 1
  162. end
  163. else
  164. bodset = fixbodset
  165. end
  166. !!This is if a Succubus has salo < 1
  167. if succubusflag = 1 and salo < 1:
  168. sucexcess -= 1
  169. salo += 3
  170. end
  171. !!This is if salo is still < 1
  172. if salo < 1:
  173. if fat >= 1:
  174. salo = 1
  175. fat -= 1
  176. elseif fat <= 0 and pcs_stren + pcs_vital > 0:
  177. stren_deg -= 1000
  178. vital_deg -= 1000
  179. salo = 1
  180. else
  181. if Enable_nogameover = 0:
  182. over = 3
  183. gt 'gameover'
  184. exit
  185. else
  186. pl '<font color=red><B>You starved to death, but Cheat Mode keeps you Alive.</B></font>'
  187. salo = 1
  188. end
  189. end
  190. end
  191. killvar 'tempvct' & killvar 'salobustdo'
  192. !!This is the hip calcs, 80 is the center of the current max-min range (10 - 130)
  193. vhtmp = (salo - 80) / 2
  194. if vhips > vhtmp: vhips -= 1
  195. if vhips < vhtmp: vhips += 1
  196. !! Because a reset should be updating hip size instantly (this set is a bit redundant anyway)
  197. if sftrstflag = 1: vhips = vhtmp
  198. if (pcs_hgt * hratio) / 100 + vhips > (pcs_hgt * 72) / 100:
  199. vofat = ((pcs_hgt * hratio) / 100 + vhips - (pcs_hgt * 72) / 100) / 2
  200. vhips -= vofat * 2
  201. end
  202. !!This will trigger the warning notices in the bathing code (the +/- 12 should always be +/- 11 + the max change to salo w/ fat)
  203. if salolast > salo and salo <= 12 + (20 * (salocatnow - 1)): btwarn = 1
  204. if salolast < salo and salo >= (20 * (salocatnow + 1)) - 12: btwarn = 2
  205. !!This will trigger the dream for the option to use magic to increase bust
  206. !!Three nos at the dream will lock it out (1 yes resets the count)
  207. if pcs_magik >= 5 and MagikDostup = 0 and magf2bdo = 0:
  208. if salolast < salo and salo >= (20 * (salocatnow + 1)) - 11 and tits < 10:
  209. if mgf2bnocnt < 3:
  210. magf2bdo = 2
  211. else
  212. magf2bdo = 3 & killvar 'mgf2bnocnt'
  213. end
  214. end
  215. end
  216. !!This is to deal with the possibility that salocatnow changed by more than 1 (fat burners, vitamins, plastic surgery, etc.)
  217. if salocatnow < salocatlast: salocatlast -= 1
  218. if salocatnow > salocatlast: salocatlast += 1
  219. !!This is for use in the warning code and as part of the reset routines
  220. if salolast > salo: salolast -= 1
  221. if salolast < salo: salolast += 1
  222. !!This modifies bodykoef for high or low salo values
  223. if salocatnow = 0 or salocatnow >= 7:
  224. bodykoef -= 8
  225. elseif salocatnow = 1 or salocatnow = 6:
  226. bodykoef -= 4
  227. end
  228. if vofat > 0: bodykoef -= vofat
  229. !!This is to clean up unused variables
  230. killvar 'normbuffpick' & killvar 'nrmbfpckct'
  231. killvar 'vmeat' & killvar 'vfat' & killvar 'Kves' & killvar 'krost'
  232. killvar 'koefvesbt' & killvar 'koefbt'
  233. end
  234. if $ARGS[0] = 'softreset':
  235. !!This is for use in immediately updating shape if something has caused a large change in salo, primarily fat burners and plastic surgery
  236. sftrstflag = 1
  237. :resetloop
  238. if salo ! salolast:
  239. if gmstrtflag = 1: salobustdo = 1
  240. gs 'body_shape'
  241. jump 'resetloop'
  242. end
  243. !!Updates pcs_apprncbase after a reset
  244. gs 'body_shape', 'basebeautycalc', 1
  245. !!Clears the warning and reset status flags if they were set
  246. sftrstflag = 0
  247. btwarn = 0
  248. end
  249. if $ARGS[0] = 'hardreset':
  250. !!This is primarily for canceling out "dounspell" and setting salo to whatever value will result in the current hip size then balancing everything out.
  251. !!Also could be built in as a means to in-game undo "dounspell", other than the cheat.
  252. if dounspell = 1 and dounsplkil > 0:
  253. salo = 12
  254. fat = 0
  255. agilbuf = pcs_agil & strenbuf = pcs_stren & vitalbuf = pcs_vital
  256. salobustdo = 1 & sftrstflag = 1 & normbuffpick = -1
  257. gs 'body_shape'
  258. salo = (pcs_hips * 2) - ((pcs_hgt * hratio) / 50) + 80
  259. if salo < 10:
  260. salocatnow = 0
  261. else
  262. salocatnow = 1 + (salo - 10) / 20
  263. end
  264. salocatlast = salocatnow
  265. salolast = salo
  266. vhtmp = (salo - 80) / 2
  267. vhips = vhtmp
  268. if genbsize = 0 and nbsize > 0:
  269. If nbsize >= 27:
  270. genbsize = 27
  271. else
  272. genbsize = 2 + nbsize - nbsize mod 5
  273. end
  274. elseif genbsize = 0 and nbsize = 0 and silicone >= 20:
  275. genbsize = 12 & nbsize = 12 & silicone -= 10
  276. end
  277. sftrstflag = 0 & normbuffpick = 0 & btwarn = 0 & magf2bdo = 0
  278. killvar 'dounsplkil'
  279. newbdsp = 1
  280. dounspell = 0
  281. gs 'body_shape', 'basebeautycalc', 1
  282. gs 'body_shape'
  283. gs 'stat'
  284. else
  285. 'If you''re seeing this, something odd happened. Please make a bug report that the body shape hard reset improperly fired and what you were doing.'
  286. end
  287. end
  288. if $ARGS[0] = 'initial':
  289. !! Sets the genetic bust size if it was not set in the start routines
  290. if genbsize = 0:
  291. genbsize = 12 & nbsize = 12
  292. else
  293. nbsize = genbsize
  294. end
  295. agilbuf = pcs_agil & strenbuf = pcs_stren & vitalbuf = pcs_vital
  296. normbuffpick = -1 & gmstrtflag = 1
  297. !! Calling soft reset will cause the main code to cycle up to the starting value of salo
  298. gs 'body_shape', 'softreset'
  299. !! This sets/resets the controler variables
  300. salocatlast = salocatnow
  301. normbuffpick = 0 & magf2bdo = 0
  302. killvar 'gmstrtflag'
  303. newbdsp = 1
  304. !! This does all the body shape setting before the first stat call
  305. pcs_hips = (pcs_hgt * hratio) / 100 + vhips
  306. pcs_waist = (pcs_hips * wratio) / 100 + vofat
  307. pcs_band = (pcs_waist * bratio) / 100 + vofat
  308. pcs_bust = (pcs_waist * bratio) / 100 + nbsize + magicf2b + silicone
  309. pcs_cupsize = pcs_bust - pcs_band
  310. if pcs_cupsize <= 5:
  311. tits = 0
  312. $titsize = 'AA cup'
  313. elseif pcs_cupsize <= 10:
  314. tits = 1
  315. $titsize = 'A cup'
  316. elseif pcs_cupsize <= 15:
  317. tits = 2
  318. $titsize = 'B cup'
  319. elseif pcs_cupsize <= 20:
  320. tits = 3
  321. $titsize = 'C cup'
  322. elseif pcs_cupsize <= 25:
  323. tits = 4
  324. $titsize = 'D cup'
  325. elseif pcs_cupsize <= 30:
  326. tits = 5
  327. $titsize = 'E cup'
  328. elseif pcs_cupsize <= 35:
  329. tits = 6
  330. $titsize = 'F cup'
  331. elseif pcs_cupsize <= 40:
  332. tits = 7
  333. $titsize = 'G cup'
  334. elseif pcs_cupsize <= 45:
  335. tits = 8
  336. $titsize = 'H cup'
  337. elseif pcs_cupsize <= 50:
  338. tits = 9
  339. $titsize = 'I cup'
  340. elseif pcs_cupsize <= 55:
  341. tits = 10
  342. $titsize = 'J cup'
  343. else
  344. tits = 11
  345. $titsize = 'K cup'
  346. end
  347. !!pcs_weight: Svetas weight in kg
  348. !!Optimal Weight for a 170cm sveta (BMI: 20.76): 60 salo / 60kg
  349. !!This is an approximation, so that a sveta with a different height has the same BMI for the same salo values.
  350. !!The default height of 170 cm is used as a starting point for the approximation. The BMI deviates by 0.06 for a deviation of 10cm and 0.4 for a deviation of 20cm.
  351. pcs_weight = 30 + salo / 2 + (pcs_hgt - 170) * 7 / 10
  352. !!Do not remove (julzor)
  353. !!This is the old more complex function, but it doesn''t work correctly.
  354. !!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.
  355. !!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
  356. !!pcs_weight = (pcs_hgt * 62 / 170) + (vhips + (vofat * 2)) / 4 + tits
  357. !!BMI Calculation
  358. bmi_calc = 10000 * pcs_weight / (pcs_hgt * pcs_hgt)
  359. !!BMI Descriptions
  360. if bmi_calc < 16:
  361. $bmi_desc = 'You are severely underweight.'
  362. elseif bmi_calc >= 16 and bmi_calc < 19:
  363. $bmi_desc = 'You are underweight'
  364. elseif bmi_calc >= 19 and bmi_calc < 25:
  365. $bmi_desc = 'You have a normal, healthy weight.'
  366. elseif bmi_calc >= 25 and bmi_calc < 30:
  367. $bmi_desc = 'You are overweight.'
  368. elseif bmi_calc >= 30 and bmi_calc < 35:
  369. $bmi_desc = 'You are moderately obese.'
  370. elseif bmi_calc >= 35 and bmi_calc < 40:
  371. $bmi_desc = 'You are severely obese.'
  372. elseif bmi_calc >= 40 and bmi_calc < 45:
  373. $bmi_desc = 'You are very severely obese.'
  374. elseif bmi_calc >= 45:
  375. $bmi_desc = 'You are morbidly obese.'
  376. end
  377. end
  378. !!This is the calculation for the base appearance
  379. if $args[0] = 'basebeautycalc':
  380. !! Setting vidagebonus
  381. vidagebonus = 100
  382. if vidage < 20: vidagebonus = 60 + 2 * vidage
  383. if vidage > 30: vidagebonus = 160 - 2 * vidage
  384. !! Setting Eyelashes bonus
  385. if pcs_lashes <= 0:
  386. pcs_lashes = 0
  387. resnicbonus = 0
  388. elseif pcs_lashes = 1:
  389. resnicbonus = 2
  390. elseif pcs_lashes = 2:
  391. resnicbonus = 5
  392. elseif pcs_lashes = 3:
  393. resnicbonus = 7
  394. elseif pcs_lashes = 4:
  395. resnicbonus = 8
  396. elseif pcs_lashes = 5:
  397. resnicbonus = 10
  398. else
  399. resnicbonus = 0
  400. end
  401. !! Setting Eye Size bonus
  402. if pcs_eyesize = 1:
  403. glarazbonus = 1
  404. elseif pcs_eyesize = 2:
  405. glarazbonus = 3
  406. elseif pcs_eyesize = 3:
  407. glarazbonus = 2
  408. else
  409. glarazbonus = 0
  410. end
  411. !! Setting the Lip size bonus
  412. if pcs_lip = 0:
  413. lipbonus = -2
  414. elseif pcs_lip = 1:
  415. lipbonus = 0
  416. elseif pcs_lip = 2:
  417. lipbonus = 3
  418. elseif pcs_lip = 3:
  419. lipbonus = 5
  420. else
  421. lipbonus = 3
  422. end
  423. !! Preforming the calculation
  424. vneshtemp = vidagebonus * ((pcs_skin * 2 / 5) + (3 * (2 + bodykoef)) + (pcs_agil / 10) + (pcs_vital / 10) + resnicbonus + glarazbonus + lipbonus - (5 * pcs_teeth)) / 100
  425. !! pcs_skin = skin condition, corrected to a 0 to 40 range; bodykoef set in main body_shape; pcs_teeth is missing teeth or cosmetically improved teeth (-1)
  426. !! This is the first limiter
  427. if vneshtemp > 100: vneshtemp = 100
  428. !! This adds the supernatural pcs_apprnc bonus; currently Bimbo and Succubus
  429. vneshtemp += supnatvnesh
  430. !! This is the rate of change limiter
  431. if pcs_apprncbase > vneshtemp:
  432. if pcs_apprncbase - 5 > vneshtemp:
  433. pcs_apprncbase -= 5
  434. elseif pcs_apprncbase - 3 > vneshtemp:
  435. pcs_apprncbase -= 3
  436. else
  437. pcs_apprncbase -= 1
  438. end
  439. elseif pcs_apprncbase < vneshtemp:
  440. if pcs_apprncbase + 5 < vneshtemp:
  441. pcs_apprncbase += 5
  442. elseif pcs_apprncbase + 3 < vneshtemp:
  443. pcs_apprncbase += 3
  444. else
  445. pcs_apprncbase += 1
  446. end
  447. end
  448. !! This is for use when a reset is called for by setting args[1] = 1
  449. if args[1] = 1: pcs_apprncbase = vneshtemp
  450. !! This is to clean up variables only used here
  451. killvar 'vidagebonus'
  452. killvar 'resnicbonus'
  453. killvar 'glarazbonus'
  454. killvar 'lipbonus'
  455. killvar 'vneshtemp'
  456. !! This is to unload old variables
  457. killvar 'CloNaturalBeauty'
  458. killvar 'CloBaseBeauty'
  459. killvar 'skin'
  460. killvar 'bimbobeauty'
  461. end
  462. --- body_shape ---------------------------------