# body_structure


!	Get the bmi-strength class
!	bs_class = func('body_structure', 'get_class', pcs_bmi, strenbuf)
if $ARGS[0] = 'get_class':
	!	bmi
	if ARGS[1] < 16:
		result = 0
	elseif ARGS[1] < 19:
		result = 100
	elseif ARGS[1] < 22:
		result = 200
	elseif ARGS[1] < 25:
		result = 300
	elseif ARGS[1] < 30:
		result = 400
	elseif ARGS[1] < 35:
		result = 500
	elseif ARGS[1] < 40:
		result = 600
	elseif ARGS[1] < 45:
		result = 700
	else
		result = 800
	end

	!	strenbuf
	if ARGS[2] <= 5:
		result += 0
	elseif ARGS[2] <= 10:
		result += 1
	elseif ARGS[2] <= 15:
		result += 2
	elseif ARGS[2] <= 25:
		result += 3
	elseif ARGS[2] <= 35:
		result += 4
	elseif ARGS[2] <= 50:
		result += 5
	elseif ARGS[2] <= 70:
		result += 6
	elseif ARGS[2] <= 100:
		result += 7
	elseif ARGS[2] <= 110:
		result += 8
	elseif ARGS[2] <= 120:
		result += 9
	elseif ARGS[2] <= 130:
		result += 10
	elseif ARGS[2] <= 140:
		result += 11
	elseif ARGS[2] <= 150:
		result += 12
	elseif ARGS[2] <= 160:
		result += 13
	elseif ARGS[2] <= 170:
		result += 14
	elseif ARGS[2] <= 180:
		result += 15
	elseif ARGS[2] <= 190:
		result += 16
	else
		result += 17
	end
end


!	Get the bmi description:
!	$bodyVars['bmi_desc'] = func('body_structure', pcs_bmi)
if $ARGS[0] = 'bmi_desc':
	if arrsize('ARGS') = 1: ARGS[1] = pcs_bmi

	bs_temp_bs_class = func('body_structure', 'get_class', ARGS[1], 30)

	if bs_temp_bs_class < 100:
		$result = 'You are severely underweight.'
	elseif bs_temp_bs_class < 200:
		$result = 'You are underweight'
	elseif bs_temp_bs_class < 300:
		$result = 'You have a normal, healthy weight.'
	elseif bs_temp_bs_class < 400:
		$result = 'You have a normal, healthy weight.'
	elseif bs_temp_bs_class < 500:
		$result = 'You are overweight.'
	elseif bs_temp_bs_class < 600:
		$result = 'You are moderately obese.'
	elseif bs_temp_bs_class < 700:
		$result = 'You are severely obese.'
	elseif bs_temp_bs_class < 800:
		$result = 'You are very severely obese.'
	else
		$result = 'You are morbidly obese.'
	end

	killvar 'bs_temp_bs_class'
end


!	Get the appearance bonus
!	Appearance_bonus = func('body_structure', 'appearance_bonus', pcs_bmi, strenbuf, succubusflag)
if $ARGS[0] = 'appearance_bonus':
	if arrsize('ARGS') = 1: ARGS[1] = pcs_bmi
	if arrsize('ARGS') = 2: ARGS[2] = strenbuf
	if arrsize('ARGS') = 3: ARGS[3] = succubusflag
	if ARGS[3] = 1: ARGS[2] = 90

	bs_temp_bs_class = func('body_structure', 'get_class', ARGS[1], ARGS[2])

	if bs_temp_bs_class < 100:
		!	starving: bmi < 16
		result = -10
	elseif bs_temp_bs_class < 200:
		!	underweight: 16 <= bmi < 16
		result = 25
	elseif bs_temp_bs_class < 300:
		!	slender: 19 <= bmi < 21
		result = 50
	elseif bs_temp_bs_class < 400:
		!	healthy: 21 <= bmi < 25
		result = 50
	elseif bs_temp_bs_class < 500:
		!	overweight: 26 <= bmi < 30
		result = 25
	elseif bs_temp_bs_class < 600:
		!	moderately obese: 30 <= bmi < 35
		result = 10
	elseif bs_temp_bs_class < 700:
		!	severely obese: 35 <= bmi < 40
		result = -15
	elseif bs_temp_bs_class < 800:
		!	very severely obese: 40 <= bmi < 45
		result = -40
	else
		!	morbidly obese: 45 <= bmi
		result = -80
	end

	bs_temp_bs_class = bs_temp_bs_class mod 100

	if bs_temp_bs_class = 0:
		!	0 <= strenbuf <= 5
		result -= 30
	elseif bs_temp_bs_class = 1:
		!	5 < strenbuf <= 10
		result -= 20
	elseif bs_temp_bs_class = 2:
		!	10 < strenbuf <= 15
		result -= 15
	elseif bs_temp_bs_class = 3:
		!	15 < strenbuf <= 25
		result -= 10
	elseif bs_temp_bs_class = 4:
		!	25 < strenbuf <= 35
		result -= 5
	elseif bs_temp_bs_class = 5:
		!	35 < strenbuf <= 50
		result += 0
	elseif bs_temp_bs_class = 6:
		!	50 < strenbuf <= 70
		result += 5
	elseif bs_temp_bs_class = 7:
		!	70 < strenbuf <= 100
		result += 10
	elseif bs_temp_bs_class = 8:
		!	100 < strenbuf <= 110
		result += 5
	elseif bs_temp_bs_class = 9:
		!	110 < strenbuf <= 120
		result += 0
	elseif bs_temp_bs_class = 10:
		!	120 < strenbuf <= 130
		result -= 5
	elseif bs_temp_bs_class = 11:
		!	130 < strenbuf <= 140
		result -= 15
	elseif bs_temp_bs_class = 12:
		!	140 < strenbuf <= 150
		result -= 30
	elseif bs_temp_bs_class = 13:
		!	150 < strenbuf <= 160
		result -= 45
	elseif bs_temp_bs_class = 14:
		!	160 < strenbuf <= 170
		result -= 60
	elseif bs_temp_bs_class = 15:
		!	170 < strenbuf <= 180
		result -= 75
	elseif bs_temp_bs_class = 16:
		!	180 < strenbuf <= 190
		result -= 100
	else
		!	190 < strenbuf <= 200
		result -= 130
	end

	killvar 'bs_temp_bs_class'
end


!	Get the body shape image
!	$bodyVars['img'] = func('body_structure', 'body_img', pcs_bmi, strenbuf, succubusflag)
if $ARGS[0] = 'body_img':

	! =======      Pregnant       ======= !
	if bdsetlock = 0 and (knowpreg = 1 or (preg = 1 and (thinkpreg = 1 or PregChem > 3600))):
		if PregChem <= 2687:
			$result = 'images/pc/body/shape/default_preg/0.jpg'
		elseif PregChem <= 6215:
			$result = 'images/pc/body/shape/default_preg/<<((PregChem - 2184)/504)>>.jpg'
		else
			$result = 'images/pc/body/shape/default_preg/8.jpg'
		end
		exit
	end

	if arrsize('ARGS') = 1: ARGS[1] = pcs_bmi
	if arrsize('ARGS') = 2: ARGS[2] = strenbuf
	if arrsize('ARGS') = 3: ARGS[3] = succubusflag
	if ARGS[3] = 1: ARGS[2] = 80

	bs_temp_bs_class = func('body_structure', 'get_class', ARGS[1], ARGS[2])

	if bdsetlock = 1:
		if fixbodset = 0:
			bs_temp_bs_class = 100 * (bs_temp_bs_class / 100) + 4
		elseif fixbodset = 1:
			bs_temp_bs_class = 100 * (bs_temp_bs_class / 100) + 6
		elseif fixbodset = 2:
			bs_temp_bs_class = 100 * (bs_temp_bs_class / 100) + 8
		else
			$result = func('body_structure', 'custom_body_img', bs_temp_bs_class)
			killvar 'bs_temp_bs_class'
			exit
		end
	end


	! =======      starving       ======= !
	! -----           bmi < 16      ----- !
	if bs_temp_bs_class <= 17:
		!	0 <= strenbuf <= 200
		$result = 'images/pc/body/shape/0.jpg'

	! =======     underweight     ======= !
	! -----     16 <= bmi < 19      ----- !
	elseif bs_temp_bs_class <= 105:
		!	0 <= strenbuf <= 50
		$result = 'images/pc/body/shape/default_low/1.jpg'
	elseif bs_temp_bs_class <= 107:
		!	51 <= strenbuf <= 100
		$result = 'images/pc/body/shape/default_mid/1.jpg'
	elseif bs_temp_bs_class <= 117:
		!	101 <= strenbuf <= 200
		$result = 'images/pc/body/shape/default_high/1.jpg'

	! =======       slender       ======= !
	! -----     19 <= bmi < 21      ----- !
	elseif bs_temp_bs_class <= 205:
		!	0 <= strenbuf <= 50
		$result = 'images/pc/body/shape/default_low/2.jpg'
	elseif bs_temp_bs_class <= 207:
		!	51 <= strenbuf <= 100
		$result = 'images/pc/body/shape/default_mid/2.jpg'
	elseif bs_temp_bs_class <= 217:
		!	101 <= strenbuf <= 200
		$result = 'images/pc/body/shape/default_high/2.jpg'

	! =======       healthy       ======= !
	! -----     21 <= bmi < 25      ----- !
	elseif bs_temp_bs_class <= 305:
		!	0 <= strenbuf <= 50
		$result = 'images/pc/body/shape/default_low/3.jpg'
	elseif bs_temp_bs_class <= 307:
		!	51 <= strenbuf <= 100
		$result = 'images/pc/body/shape/default_mid/3.jpg'
	elseif bs_temp_bs_class <= 317:
		!	101 <= strenbuf <= 200
		$result = 'images/pc/body/shape/default_high/3.jpg'

	! =======     overweight      ======= !
	! -----     26 <= bmi < 30      ----- !
	elseif bs_temp_bs_class <= 405:
		!	0 <= strenbuf <= 50
		$result = 'images/pc/body/shape/default_low/4.jpg'
	elseif bs_temp_bs_class <= 407:
		!	51 <= strenbuf <= 100
		$result = 'images/pc/body/shape/default_mid/4.jpg'
	elseif bs_temp_bs_class <= 417:
		!	101 <= strenbuf <= 200
		$result = 'images/pc/body/shape/default_high/4.jpg'

	! =======  moderately obese   ======= !
	! -----     30 <= bmi < 35      ----- !
	elseif bs_temp_bs_class <= 505:
		!	0 <= strenbuf <= 50
		$result = 'images/pc/body/shape/default_low/5.jpg'
	elseif bs_temp_bs_class <= 507:
		!	51 <= strenbuf <= 100
		$result = 'images/pc/body/shape/default_mid/5.jpg'
	elseif bs_temp_bs_class <= 517:
		!	101 <= strenbuf <= 200
		$result = 'images/pc/body/shape/default_high/5.jpg'

	! =======   severely obese    ======= !
	! -----     35 <= bmi < 40      ----- !
	elseif bs_temp_bs_class <= 617:
		!	0 <= strenbuf <= 200
		$result = 'images/pc/body/shape/6.jpg'

	! ======= very severely obese ======= !
	! -----     40 <= bmi < 45      ----- !
	elseif bs_temp_bs_class <= 717:
		!	0 <= strenbuf <= 200
		$result = 'images/pc/body/shape/7.jpg'

	! =======   morbidly obese    ======= !
	! -----     45 <= bmi           ----- !
	else
		!	0 <= strenbuf <= 200
		$result = 'images/pc/body/shape/8.jpg'
	end

	killvar 'bs_temp_bs_class'
end

if $ARGS[0] = 'custom_body_img':
	ARGS[1] = ARGS[1] / 100
	if ARGS[1] = 0 or ARGS[1] >= 6:
		if dyneval('result = imset<<ARGS[1]>>ovr[<<fixbodset>>]') = 0:
			$result = 'images/pc/body/shape/<<ARGS[1]>>.jpg'
			exit
		end
	end
	$result = 'images/pc/body/shape/<<$bodimgsets[((fixbodset * 10) + 9)]>>/<<ARGS[1]>>.jpg'
end


!	Get the body description
!	$bodyVars['desc'] = func('body_structure', 'body_desc', pcs_bmi, strenbuf, succubusflag)
if $ARGS[0] = 'body_desc':
	if knowpreg = 1 or (preg = 1 and (thinkpreg = 1 or PregChem > 3600)):
		if PregChem <= 2687:
			$result = 'pregnant, but not showing'
		elseif PregChem <= 3191:
			$result = 'glowing'
		elseif PregChem <= 3695:
			$result = 'starting to show'
		elseif PregChem <= 4199:
			$result = 'clearly showing'
		elseif PregChem <= 4703:
			$result = 'fairly pregnant'
		elseif PregChem <= 5207:
			$result = 'quite pregnant'
		elseif PregChem <= 5711:
			$result = 'very pregnant'
		elseif PregChem <= 6215:
			$result = 'extremely pregnant'
		else
			$result = 'ready to pop'
		end
		exit
	end


	if arrsize('ARGS') = 1: ARGS[1] = pcs_bmi
	if arrsize('ARGS') = 2: ARGS[2] = strenbuf
	if arrsize('ARGS') = 3: ARGS[3] = succubusflag
	if ARGS[3] = 1: ARGS[2] = 80

	bs_temp_bs_class = func('body_structure', 'get_class', ARGS[1], ARGS[2])


	! =======      starving       ======= !
	! -----           bmi < 16      ----- !
	if bs_temp_bs_class <= 17:
		!	0 <= strenbuf <= 200
		$result = 'starving'

	! =======     underweight     ======= !
	! -----     16 <= bmi < 19      ----- !
	elseif bs_temp_bs_class <= 105:
		!	0 <= strenbuf <= 50
		$result = 'underweight'
	elseif bs_temp_bs_class <= 107:
		!	51 <= strenbuf <= 100
		$result = 'slight'
	elseif bs_temp_bs_class <= 117:
		!	101 <= strenbuf <= 200
		$result = 'wiry'

	! =======       slender       ======= !
	! -----     19 <= bmi < 21      ----- !
	elseif bs_temp_bs_class <= 205:
		!	0 <= strenbuf <= 50
		$result = 'slender'
	elseif bs_temp_bs_class <= 207:
		!	51 <= strenbuf <= 100
		$result = 'skinny'
	elseif bs_temp_bs_class <= 217:
		!	101 <= strenbuf <= 200
		$result = 'lean'

	! =======       healthy       ======= !
	! -----     21 <= bmi < 25      ----- !
	elseif bs_temp_bs_class <= 305:
		!	0 <= strenbuf <= 50
		$result = 'healthy'
	elseif bs_temp_bs_class <= 307:
	!		51 <= strenbuf <= 100
		$result = 'toned'
	elseif bs_temp_bs_class <= 317:
		!	101 <= strenbuf <= 200
		$result = 'ripped'

	! =======     overweight      ======= !
	! -----     26 <= bmi < 30      ----- !
	elseif bs_temp_bs_class <= 405:
		!	0 <= strenbuf <= 50
		$result = 'overweight'
	elseif bs_temp_bs_class <= 407:
	!		51 <= strenbuf <= 100
		$result = 'curvy'
	elseif bs_temp_bs_class <= 417:
		!	101 <= strenbuf <= 200
		$result = 'heavy set'

	! =======  moderately obese   ======= !
	! -----     30 <= bmi < 35      ----- !
	elseif bs_temp_bs_class <= 517:
		!	0 <= strenbuf <= 200
		$result = 'moderately obese'

	! =======   severely obese    ======= !
	! -----     35 <= bmi < 40      ----- !
	elseif bs_temp_bs_class <= 617:
		!	0 <= strenbuf <= 200
		$result = 'severely obese'

	! ======= very severely obese ======= !
	! -----     40 <= bmi < 45      ----- !
	elseif bs_temp_bs_class <= 717:
		!	0 <= strenbuf <= 200
		$result = 'very severely obese'

	! =======   morbidly obese    ======= !
	! -----     45 <= bmi           ----- !
	else
		!	0 <= strenbuf <= 200
		$result = 'morbidly obese'
	end

	killvar 'bs_temp_bs_class'
end


--- body_structure ---------------------------------
