body_shape 12 KB

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