1
1

body_shape 13 KB

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