body_shape 14 KB

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