AppearanceSystem.qsrc 9.4 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319320321322323324325326327328329330331332333334335336337338339340341342343344345346347348349350351352353354355356357358359360361362363364365366367
  1. # AppearanceSystem
  2. if $ARGS[0] = '':
  3. !{
  4. PC's appearance is updated regularly in stat.qsrc.
  5. Note: A huge part of PC's appearance is from base appearance, which is updated once a day. Because it's
  6. a global variable, it does not show in this function in particular, but it's used in 'CalcAppearance'
  7. }
  8. clothingBonus = func('AppearanceSystem', 'CalcClothingBonus')
  9. accessoriesBonus = func('AppearanceSystem', 'CalcAccessoriesBonus', bonusZ, PShoQuality)
  10. groomingBonus = func('AppearanceSystem', 'CalcGroomingBonus')
  11. groomingPenalty = func('AppearanceSystem', 'CalcGroomingPenalty')
  12. stdPenalty = func('AppearanceSystem', 'CalcSTDPenalty')
  13. pcs_apprnc = func('AppearanceSystem', 'CalcAppearance', supnatvnesh)
  14. pcs_hotcat = func('AppearanceSystem', 'ConvertToHotcat', pcs_apprnc)
  15. killvar 'clothingBonus'
  16. killvar 'accessoriesBonus'
  17. killvar 'groomingBonus'
  18. killvar 'groomingPenalty'
  19. end
  20. if $args[0] = 'UpdateBaseAppearance':
  21. !{
  22. Base Appearance is updated once a day at midnight and called from cikl
  23. Base Appearance is calculated from:
  24. vidage, skin, body shape (fat and strength), attributes (endurance and agility)
  25. }
  26. attributeBonus = func('AppearanceSystem', 'CalcAttributeBonus')
  27. skinBonus = pcs_skin / 10
  28. bodyShapeBonus = func('AppearanceSystem', 'SetBodyShapeBonus')
  29. visibleAgePenalty = func('AppearanceSystem', 'CalcVisibleAgePenalty')
  30. teethPenalty = func('AppearanceSystem', 'CalcTeethPenalty')
  31. ! Calculte base appearance
  32. pcs_apprncbase = 30 + skinBonus + bodyShapeBonus + attributeBonus - visibleAgePenalty - teethPenalty + supnatvnesh
  33. end
  34. if $ARGS[0] = 'CalcFaceBonus':
  35. !! Setting Eyelashes bonus
  36. if pcs_lashes <= 0:
  37. eyelashesBonus = 0
  38. elseif pcs_lashes = 1:
  39. eyelashesBonus = 1
  40. elseif pcs_lashes >= 2:
  41. eyelashesBonus = pcs_lashes + 1
  42. end
  43. eyelashesBonus = FUNC('AppearanceSystem', 'AdjustFromBMI', eyelashesBonus)
  44. !! Setting Eye Size bonus
  45. if pcs_eyesize <= 1:
  46. eyeSizeBonus = pcs_eyesize
  47. elseif pcs_eyesize = 2:
  48. eyeSizeBonus = 3
  49. else
  50. eyeSizeBonus = 2
  51. end
  52. eyeSizeBonus = FUNC('AppearanceSystem', 'AdjustFromBMI', eyeSizeBonus)
  53. !! Setting the Lip size bonus
  54. if pcs_lip <= 0:
  55. lipBonus = -2
  56. elseif pcs_lip <= 2:
  57. lipBonus = pcs_lip - 1
  58. else
  59. lipBonus = 3
  60. end
  61. lipBonus = FUNC('AppearanceSystem', 'AdjustFromBMI', lipBonus)
  62. result = eyelashesBonus + eyeSizeBonus + lipBonus
  63. end
  64. if $ARGS[0] = 'CalcAttributeBonus':
  65. tempAttributeBonus = (pcs_agil + pcs_vital) / 5
  66. result = func('AppearanceSystem', 'AdjustFromBMI', tempAttributeBonus)
  67. killvar 'tempAttributeBonus'
  68. end
  69. if $ARGS[0] = 'CalcVisibleAgePenalty':
  70. if vidage < 20: tempAttributePenalty = (5*(20 - vidage) + 1) / 2
  71. result = func('AppearanceSystem', 'AdjustFromBMI', tempAttributePenalty)
  72. killvar 'tempAttributePenalty'
  73. end
  74. if $ARGS[0] = 'CalcTeethPenalty':
  75. if pcs_teeth > 0:
  76. tempAttributePenalty = 10 * pcs_teeth
  77. elseif pcs_teeth = 0:
  78. tempAttributePenalty = 5
  79. else
  80. tempAttributePenalty = 0
  81. end
  82. if pcs_missing_teeth > 0:
  83. tempAttributePenalty += 10 * pcs_missing_teeth
  84. end
  85. result = func('AppearanceSystem', 'AdjustFromBMI', tempAttributePenalty)
  86. killvar 'tempAttributePenalty'
  87. end
  88. if $ARGS[0] = 'SetBodyShapeBonus':
  89. ! Magic uses a different calculation
  90. if dounspell = 1:
  91. bodytipe = pcs_hips - pcs_waist
  92. if bodytipe < 20:
  93. result = 0
  94. elseif bodytipe >= 20 and bodytipe < 25:
  95. result = 2
  96. elseif (bodytipe >= 25 and bodytipe < 30) or bodytipe >=35:
  97. result = 4
  98. elseif bodytipe >= 30 and bodytipe < 35:
  99. result = 8
  100. end
  101. ! Succubus gets maximum appearance bonus
  102. elseif succubusflag > 0:
  103. result = func('body_structure', 'appearance_bonus', 22, 90)
  104. !!Setting the pcs_apprnc bonus based on fat and strength
  105. else
  106. result = func('body_structure', 'appearance_bonus')
  107. !!This modifies bodykoef for high or low pcs_mass['body'] values
  108. if pcs_mass['body'] < 8 or pcs_mass['body'] >= 98:
  109. result -= 8
  110. elseif pcs_mass['body'] < 23 or pcs_mass['body'] >= 83:
  111. result -= 4
  112. end
  113. result -= max(0, bodyVars['vofat'])
  114. end
  115. end
  116. if $ARGS[0] = 'CalcClothingBonus':
  117. if $clothingworntype = 'nude':
  118. if func('pcs_has_attr', 'OR', 'body_bmi_normal', 'body_bmi_overweight'):
  119. ! Healthy and overweight
  120. result = 15
  121. else
  122. result = 0
  123. end
  124. else
  125. if func('pcs_has_attr', 'OR', 'body_bmi_starving', 'body_bmi_underweight'):
  126. !Skinny and severely skinny
  127. tempRevealing = ((400 - PXCloThinness) + (500 - PXCloTopCut) + (400 - PXCloBottomShortness)) / 2
  128. elseif func('pcs_has_attr', 'OR', 'body_bmi_normal', 'body_bmi_overweight'):
  129. !Healthy and overweight
  130. tempRevealing = (PXCloThinness + PXCloTopCut + PXCloBottomShortness)/2
  131. else
  132. !Moderately overweight and above
  133. tempRevealing = ((400 - PXCloThinness) + (500 - PXCloTopCut) + (400 - PXCloBottomShortness)) * 3 / 4
  134. end
  135. result = tempRevealing / 76 * PCloQuality
  136. killvar 'tempRevealing'
  137. end
  138. end
  139. if $ARGS[0] = 'CalcAccessoriesBonus':
  140. coatQualityBonus = ARGS[1] & !! bonusZ
  141. shoesQualityBonus = ARGS[2] & !! PShoQuality
  142. !!bonuses for certain underwear
  143. if $pantyworntype ! 'none':
  144. if PPanQuality => 4:
  145. pantyBonus = PPanQuality - 2
  146. else
  147. pantyBonus = PPanQuality - 1
  148. end
  149. end
  150. if $braworntype ! 'none':
  151. if PBraQuality => 4:
  152. braBonus = PBraQuality - 2
  153. else
  154. braBonus = PBraQuality - 1
  155. end
  156. end
  157. result = coatQualityBonus + shoesQualityBonus + pantyBonus + braBonus
  158. killvar 'coatQualityBonus'
  159. killvar 'shoesQualityBonus'
  160. killvar 'pantyBonus'
  161. killvar 'braBonus'
  162. end
  163. if $ARGS[0] = 'CalcGroomingBonus':
  164. makeupBonus = pcs_makupskl/5 - 5
  165. if pcs_makeup = 0:
  166. makeupBonus = -5
  167. elseif pcs_makeup = 1:
  168. makeupBonus = 0
  169. elseif pcs_makeup = 5:
  170. makeupBonus = 30
  171. elseif pcs_makeup = 6 and bimbolevel >= 2:
  172. makeupBonus += 2 * (bimbolevel - 1)
  173. elseif pcs_makeup = 7:
  174. makeupBonus += pcs_makeupskl / 10 - 50
  175. end
  176. breathBonus = 5 * pcs_breath
  177. result = func('AppearanceSystem', 'AdjustFromBMI', makeupBonus + breathBonus)
  178. killvar 'breathBonus'
  179. killvar 'makeupBonus'
  180. end
  181. if $ARGS[0] = 'CalcGroomingPenalty':
  182. if pcs_lipbalm <= 0: lipBalmPenalty = 5
  183. hairPenalty = (1 - pcs_hairbsh) * 10
  184. !! buzzcut penalty to pcs_apprnc
  185. if pcs_hairlng < 10: buzzCutPenalty = 10
  186. !!Small penalty for not wearing deodorant, if pcs_sweat is low enough
  187. if deodorant_on = 0 or pcs_sweat >= 20: deodorantPenalty = 5
  188. if pcs_sweat < 22:
  189. sweatPenalty = 0
  190. elseif temppcs_sweat < 38:
  191. sweatPenalty = (pcs_sweat - 10) / 4
  192. elseif temppcs_sweat < 54:
  193. sweatPenalty = (pcs_sweat - 10) / 2
  194. else
  195. sweatPenalty = 3 * (pcs_sweat - 10) / 4
  196. end
  197. !Glasses Penalty
  198. if glass = 1: glassesPenalty = 10
  199. !hair color fade penalty
  200. if pcs_haircol ! nathcol:
  201. if dyefade > 0 and dyefade < 7: hairDyePenalty = 5
  202. if dyefade = 0: hairDyePenalty = 15
  203. end
  204. ! Leg hair penalty
  205. legPenalty = max(0, min(3 * (pcs_leghair / 3), 9))
  206. result = sweatPenalty + glassesPenalty + hairDyePenalty + buzzCutPenalty + legPenalty + lipBalmPenalty + hairPenalty + deodorantPenalty
  207. killvar 'buzzCutPenalty'
  208. killvar 'deodorantPenalty'
  209. killvar 'glassesPenalty'
  210. killvar 'hairDyePenalty'
  211. killvar 'hairPenalty'
  212. killvar 'legPenalty'
  213. killvar 'lipBalmPenalty'
  214. killvar 'sweatPenalty'
  215. end
  216. if $ARGS[0] = 'CalcSTDPenalty':
  217. if Orerpes = 1 and pcs_makeup < 4: oralHerpesPenalty = 20
  218. if Sifilis >= 50:
  219. syphilisPenalty = 250
  220. elseif Sifilis >= 21:
  221. syphilisPenalty = rand(150, 200)
  222. end
  223. if $pantyworntype = 'none' and (PCloSkirt > 3 or $clothingworntype = 'nude'):
  224. if GenHerpes = 1:
  225. if Gerpes >= 20:
  226. genitalHerpesPenalty = 250
  227. elseif Gerpes >= 10:
  228. genitalHerpesPenalty = 150
  229. elseif Gerpes >= 5:
  230. genitalHerpesPenalty = 25
  231. end
  232. end
  233. if Triper > 2:
  234. gonorrheaPenalty = rand(150, 200)
  235. end
  236. if Kandidoz > 30:
  237. yeastPenalty = rand(150, 200)
  238. end
  239. end
  240. result = oralHerpesPenalty + genitalHerpesPenalty + syphilisPenalty + gonorrheaPenalty + yeastPenalty
  241. killvar 'oralHerpesPenalty'
  242. killvar 'genitalHerpesPenalty'
  243. killvar 'syphilisPenalty'
  244. killvar 'gonorrheaPenalty'
  245. killvar 'yeastPenalty'
  246. end
  247. if $ARGS[0] = 'CalcAppearance':
  248. superNaturalBonus = ARGS[1] & !! supnatvnesh
  249. temp_apprnc = pcs_apprncbase + clothingBonus + accessoriesBonus + groomingBonus - groomingPenalty - stdPenalty
  250. !Any super natural bonuses are allowed to go above the max scale
  251. result = max(0, min(temp_apprnc, 200)) + superNaturalBonus
  252. killvar 'temp_apprnc'
  253. killvar 'superNaturalBonus'
  254. end
  255. if $ARGS[0] = 'ConvertToHotcat':
  256. if ARGS[1] <= 40:
  257. result = 1
  258. elseif ARGS[1] <= 60:
  259. result = 2
  260. elseif ARGS[1] <= 80:
  261. result = 3
  262. elseif ARGS[1] <= 100:
  263. result = 4
  264. elseif ARGS[1] <= 125:
  265. result = 5
  266. elseif ARGS[1] <= 150:
  267. result = 6
  268. elseif ARGS[1] <= 165:
  269. result = 7
  270. elseif ARGS[1] <= 180:
  271. result = 8
  272. elseif ARGS[1] <= 199:
  273. result = 9
  274. else
  275. result = 10
  276. end
  277. end
  278. if $ARGS[0] = 'AdjustFromBMI':
  279. tempValue = ARGS[1] & !!value to be adjusted
  280. temp_bs_class = func('body_structure', 'get_class')
  281. if temp_bs_class < 100:
  282. !! severely underweight
  283. result = tempValue * 50 / 100
  284. elseif temp_bs_class < 200:
  285. !! underweight
  286. result = tempValue * 95 / 100
  287. elseif temp_bs_class < 400:
  288. !! healthy weight
  289. !! normal bonus
  290. result = tempValue
  291. elseif temp_bs_class < 500:
  292. !! overweight
  293. result = tempValue * 95 / 100
  294. elseif temp_bs_class < 600:
  295. !! moderately obese
  296. result = tempValue * 80 / 100
  297. elseif temp_bs_class < 700:
  298. !! severely obese
  299. result = tempValue * 55 / 100
  300. elseif temp_bs_class < 800:
  301. !! very severely obese
  302. result = tempValue * 50 / 100
  303. else
  304. !!morbidly obese
  305. result = tempValue * 40 / 100
  306. end
  307. killvar 'tempValue'
  308. killvar 'temp_bs_class'
  309. end
  310. --- AppearanceSystem ---------------------------------