body_shape.qsrc 16 KB

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