code:
# moodlets
!update master "permanent" (situationally derived, constantly refreshed) moodlets

wealth_quality_modifier = master_wealth - brand_reputation - 1
if wealth_quality_modifier > 0: master_moodlet['pos_wealth'] = 100 & master_moodlet['neg_wealth'] = 0
if wealth_quality_modifier = 0: master_moodlet['pos_wealth'] = 0 & master_moodlet['neg_wealth'] = 0
if wealth_quality_modifier < 0: master_moodlet['neg_wealth'] = 100 & master_moodlet['pos_wealth'] = 0

!estate_quality_modifier is calculated in $newloc
if estate_quality_modifier > master_cha + house_mess:
	! partially align with conditions for master_cha to rise in next_day
	master_moodlet['pos_housing'] = 100 & master_moodlet['neg_housing'] = 0
else
	master_moodlet['pos_housing'] = 0
end
if master_cha > min(master_wealth - 1, estate_quality_modifier):
	! match conditions for master_cha to drop in next_day
	if master_cha > estate_quality_modifier: master_moodlet['neg_housing'] = 100 & master_moodlet['pos_housing'] = 0
	if master_cha > master_wealth - 1: master_moodlet['neg_wealth'] = 100 & master_moodlet['pos_wealth'] = 0
else
	master_moodlet['neg_housing'] = 0
end

master_moodlet['pos_house_clean'] = 0
master_moodlet['neg_house_mess'] = 0
if is_home = 1:
	if house_mess = 0: master_moodlet['pos_house_clean'] = 100
	if house_mess > 3: master_moodlet['neg_house_mess'] = 100
end
if master_hygiene > 1: master_moodlet['pos_self_clean'] = 0
if master_hygiene > 3: master_moodlet['neg_dirty'] = 100
if master_hygiene <= 3: master_moodlet['neg_dirty'] = 0

if master_moodlet['pos_satisfied'] < 0: master_moodlet['pos_satisfied'] = 0
if master_excitement > master_moodlet['pos_satisfied']: master_moodlet['neg_boner'] = master_excitement
if master_moodlet['pos_satisfied'] > 2: master_moodlet['neg_boner'] = 0
if master_excitement <= master_moodlet['pos_satisfied']: master_moodlet['neg_boner'] = 0
if master_excitement < -2 and master_libido > 0: master_moodlet['neg_softcore'] = 100
if master_excitement > -3 or master_libido = 0: master_moodlet['neg_softcore'] = 0
if master_excitement = 5 and blazing_counter >= 3:
	master_moodlet['neg_blazing'] = 100
else
	master_moodlet['neg_blazing'] = 0
end

if master_wounds = 0: master_moodlet['neg_wounded'] = 0

if master_energy < 0:
	master_moodlet['pos_energy'] = 0
	master_moodlet['neg_tired'] = 100
elseif master_energy >= master_str and max(master_moodlet['neg_drunk'], master_moodlet['neg_wounded'], master_moodlet['neg_no_koffe'], master_moodlet['neg_no_meth'], master_moodlet['neg_no_opium'], master_moodlet['neg_master_ill']) = 0:
	master_moodlet['pos_energy'] = 100
	master_moodlet['neg_tired'] = 0
else
	master_moodlet['pos_energy'] = 0
	master_moodlet['neg_tired'] = 0
end

master_moodlet['neg_alone'] = 0
master_moodlet['pos_optimism'] = 0
master_moodlet['neg_grumpy'] = 0

if master_moodlet['pos_show'] > 0: master_moodlet['neg_boring'] = 0

if slave_state < CONST_INT['slave_exist'] and assistant_state < CONST_INT['slave_exist']:
	!check < exist instead of = no_slave: dead slaves do not cure loneliness - ImperatorAugustus
	if alone_count > 2: master_moodlet['neg_alone'] = 100 &! alone_count is incremented nightly in next_day if no slave or assistant
else
	alone_count = 0
	!update master moodlets related to slave psy status
	if slave['beauty'] > 2 and slave['expression'] > 3 and slave['status_met'] = 1: master_moodlet['pos_optimism'] = 100
	if assistant['beauty'] > 2 and assistant['expression'] > 3 and assistant['status_met'] = 1: master_moodlet['pos_optimism'] = 100
	if $slave_psy_status = 'broken' or $assistant_psy_status = 'broken': master_moodlet['neg_grumpy'] = 100 & master_moodlet['pos_optimism'] = 0
end

--- moodlets ---------------------------------

repo_name: zaksynack/game

license: unknown


code:
# new_estate
!Initializes a new home or interior

if $estate = 'slum_house':
	bath = 0
	kitchen = 0
	library = 0 &! unused
	dungeon = 0
	boudoir = 0
	barn = 0
	lab = 0
	pen = 0
	stasis_tank = 0
else
	bath = 1
	kitchen = 1
	library = 0 &! unused
	dungeon = iif(estate_cost_dungeon[$estate] = 0, 1, 0) &! new estate includes dungeon?
	boudoir = iif(estate_cost_boudoir[$estate] = 0, 1, 0) &! new estate includes boudoir?
	barn =    iif(estate_cost_barn[$estate] = 0, 1, 0)    &! new estate includes barn?
	lab =     iif(estate_cost_lab[$estate] = 0, 1, 0)     &! new estate includes lab?
	pen =     iif(pet_tentacle > 0, 1, 0) &! transfer fiend if renting a new apartment on the same day
end

! retain access to occupied rentals until forfeit in next_day if living in slums (moving to another rental same day simply transfers slaves to equivalent rental in new residence building; cost difference ignored for current decade)
if prisoner_state > CONST_INT['no_slave']: dungeon = 1 &! if you had a prisoner
if max(farmhand_state, cow_state, harpy_state, pig_state) > CONST_INT['no_slave']: barn = 1 &! if you had any livestock
! fiend pen status transfers with estate changes and will be forfeit at next_day if living in slums

$study = $interior
$bed = $interior
$bath = $interior
$kitchen = $interior
$boudoir = $interior
$lab = $interior
$dungeon = $interior
$barn = $interior

$bg['home_lux'] = $interior_study_large[$interior]

$bg['study'] = $interior_study[$interior]
$place_name['study'] = $estate_study_name[$estate]
$place_location['study'] = $estate_study_location[$estate]
$place_info['study'] = $interior_study_info[$interior]

$bg['bedroom_lux'] = $interior_bed_large[$interior]

$bg['bedroom'] = $interior_bed[$interior]
$place_name['bedroom'] = $estate_bed_name[$estate]
$place_location['bedroom'] = $estate_bed_location[$estate]
$place_info['bedroom'] = $interior_bed_info[$interior]

$bg['bathroom_lux'] = $interior_bath_large[$interior]

$bg['bathroom'] = $interior_bath[$interior]
$place_name['bathroom'] = $estate_bath_name[$estate]
$place_location['bathroom'] = $estate_bath_location[$estate]
$place_info['bathroom'] = $interior_bath_info[$interior]

$bg['dungeon_lux'] = $interior_dungeon_large[$interior]

$bg['dungeon'] = $interior_dungeon[$interior]
$place_name['dungeon'] = $estate_dungeon_name[$estate]
$place_location['dungeon'] = $estate_dungeon_location[$estate]
$place_info['dungeon'] = $interior_dungeon_info[$interior]

$bg['kitchen_lux'] = $interior_kitchen_large[$interior]

$bg['kitchen'] = $interior_kitchen[$interior]
$place_name['kitchen'] = $estate_kitchen_name[$estate]
$place_location['kitchen'] = $estate_kitchen_location[$estate]
$place_info['kitchen'] = $interior_kitchen_info[$interior]

$bg['lab_lux'] = $interior_lab_large[$interior]

$bg['lab'] = $interior_lab[$interior]
$place_name['lab'] = $estate_lab_name[$estate]
$place_location['lab'] = $estate_lab_location[$estate]
$place_info['lab'] = $interior_lab_info[$interior]

$bg['boudoir_lux'] = $interior_boudoir_large[$interior]

$bg['boudoir'] = $interior_boudoir[$interior]
$place_name['boudoir'] = $estate_boudoir_name[$estate]
$place_location['boudoir'] = $estate_boudoir_location[$estate]
$place_info['boudoir'] = $interior_boudoir_info[$interior]

$bg['barn_lux'] = $interior_barn_large

$bg['barn'] = $interior_barn
$place_name['barn'] = $estate_barn_name[$estate]
$place_location['barn'] = $estate_barn_location[$estate]
$place_info['barn'] = $interior_barn_info[$interior]

--- new_estate ---------------------------------


code:
# new_game
!Начало новой игры с предысторией
!$onnewloc = '$newloc'

gs '_layout'
gt 'intro'

--- new_game ---------------------------------


code:
# npc_progress
!Изменения касающиеся населения Рима

!Другие тренеры
n = arrsize('$trainer_id')
i = 0
:training_slaves_loop
	i += 1
	if trainer_slave_training_count[$trainer_id[i]] = -1:
		type_profency[1] = trainer_refferent_rating[$trainer_id[i]]
		type_profency[2] = trainer_pet_rating[$trainer_id[i]]
		type_profency[3] = trainer_nurse_rating[$trainer_id[i]]
		type_profency[4] = trainer_maid_rating[$trainer_id[i]]
		type_profency[5] = trainer_gladiatrix_rating[$trainer_id[i]]
		type_profency[6] = trainer_alchemy_rating[$trainer_id[i]]
		type_profency[7] = trainer_enchanter_rating[$trainer_id[i]]
		type_profency[8] = trainer_artist_rating[$trainer_id[i]]
		type_profency[9] = trainer_concubine_rating[$trainer_id[i]]
		type_profency[10] = trainer_cowSK_rating[$trainer_id[i]]
		ia = 0
		:slave_type_select
		a = 1 + ((day * n * i) mod 10) &! pseudo-rand(1,10)
		ia += 1
			if type_profency[a] > 1:
				$trainer_slave_type[$trainer_id[i]] = $base_slave_type[a]
				x = rand(1,15)
				y = rand(1,3)
				if y = 1: b = type_profency[a] - 1
				if y = 2: b = type_profency[a]
				if y = 3: b = type_profency[a] + 1
				c = b*10
				c += x
				if b > 4: b = 4
				trainer_slave_rank[$trainer_id[i]] = b
				trainer_slave_training_count[$trainer_id[i]] = c
			else
				if ia < 100: jump 'slave_type_select'
			end
	else
		if trainer_slave_training_count[$trainer_id[i]] > 0: trainer_slave_training_count[$trainer_id[i]] -= 1
	end
	if i < n-1: jump 'training_slaves_loop'

!Старая схема
notes_count = 0
i = 0
:loop
	rr = rand (0,10)
	i += 1
	if i = 1: $npc_id = 'брина_рыжая'
	if i = 2: $npc_id = 'менхантер'
	if i = 3: $npc_id = 'kagami_san'
	if i = 4: $npc_id = 'madame_jofre'
	if i = 5: $npc_id = 'azura'
	if i = 6: $npc_id = 'servilia_quinta'
	if i = 7: $npc_id = 'estelindel'
	if i = 8: $npc_id = 'barman'
	if i = 9: $npc_id = 'uncle_bo'
	if i = 10: $npc_id = 'poison'
	if i = 11: $npc_id = 'moneylender'
	if i = 12: $npc_id = 'лао_ван'
	if i = 13: $npc_id = 'sergant'
	fundsup_base = rand (1,25)
	fundsup = fundsup_base * demand_rating[$npc_id]
	npc_money[$npc_id] = common_price[demand_rating[$npc_id]] + fundsup
	if no_slave_count[$npc_id] > 0: no_slave_count[$npc_id] -= 1
	train_slave_count[$npc_id] -= 1
	if no_slave_count[$npc_id] <= 0:
		buy_slave = rand (1,buying_temp[$npc_id])
		if buy_slave = 1:
			no_slave_count[$npc_id] = count_size[$npc_id] + rr
		end
		if buy_slave >= 2 and buy_slave <= 2:
			no_slave_count[$npc_id] = npc_contract_time[$npc_id] + count_size[$npc_id] + rr
			train_slave_count[$npc_id] = 10
		end
	end
	if train_slave_count[$npc_id] > 0 and $train_contract[$npc_id] ! '':
		notes_count += 1
		$guild_board[notes_count] = $train_contract[$npc_id]
		$contractor_id[notes_count] = $npc_id
	end
	if i < 13: jump 'loop'

npc_money['mistress_angelika'] = 200000

--- npc_progress ---------------------------------


code:
# plastics
gs '_layout'
copyarr '$special_image', '$fullimage'

if txt = 0:
	dynamic $replace($plastics_get_image_range, "dyn"+"slave", $plastics_target)
	txt = txt_count
	dynamic $plastics_hair_color_range, -1
	max_txt = txt - 1
	txt = min_txt
	dynamic $plastics_hair_color_range, 1
	min_txt = txt
end

$text[txt] = '  [Doctor]
- Choose wisely. We can no longer change her appearance again - too likely to cause irreversible damage.'

*p '
<img src="content\pic\bg\<<$bg[$place]>>.png">
'
*p '
<<$text[txt]>>
'

$info_bar = ''
*p '

<<$place_name[$place]>>
'
*nl '<<$place_location[$place]>>
'
*nl 'Information for consideration:
'
*p '
<<$place_info[$place]>>

'

*p '
<<$info_bar>>
'
if $special_image[txt] ! '':
	*p '
<img src="content\pic\<<$special_image[txt]>>.png">
'
end

if txt > min_txt:
	addobj ''
else
	addobj ''
end
if txt <= max_txt:
	addobj ''
	$text[] = '   ' &! make the forward button return to this location
end

$text_display = ''
dynamic $hospital_options[32]
*p '
<<$text_display>>
'

--- plastics ---------------------------------


code:
# prison_cell
$return_lock = 'prison_cell'
$place = "dungeon"
gs '_layout'

dynamic $replace($newloc_update_slave, 'dyn'+'slave', 'prisoner')

dynamic $prisoner_pass_out
dynamic $master_pass_out &! master should be last

prisoner_mood_plus = iif(prisoner['mood'] < 0, 5 - prisoner['mood'], prisoner['mood'])

if prisoner_state = CONST_INT['no_slave']:
	$prisoner_info_text = $cage_empty
elseif $prisoner_info_text = '':
	if prisoner_state = CONST_INT['slave_exist']:
		if prisoner['prison_food_type'] = 3 and prisoner['fat'] < 5 and prisoner['fat'] > prisoner['orig_fat']:
			$prisoner_info_text = '  <<$prisoner_name>> is really packing on the weight. She tries to resist the bowl of cookies, but locked in a cell with them, the temptation is too strong. She gorges herself on them all day long, hating how fat she is becoming and hating that she does not have the willpower to stop.'
		elseif prisoner['prison_food_type'] = 3 and prisoner['fat'] = 5 and prisoner['orig_fat'] < 5:
			$prisoner_info_text = '  When you put her in this cell, <<$prisoner_name>> <<$prisoner_fat_txt[prisoner['orig_fat']]>>. Now she is an enormous, corpulent pig. She is so fat that it is difficult for her to move, so it only takes a couple of cookies a day to keep her at this weight. She has very low self-esteem.'
		elseif prisoner['prison_food_type'] = 3 and prisoner['fat'] = 5:
			$prisoner_info_text = '  <<$prisoner_name>> is an enormous, obese pig. She is so fat that it is difficult for her to move, so it only takes a couple of cookies a day to keep her at this weight. She has very low self-esteem.'
		else
			dynamic $replace("$prisoner_info_text = '<<$psy_status[$prisoner_psy_status]>>'", 'dyn'+'slave', 'prisoner') &! evaluate delayed sub-expressions with substitution
		end
	elseif prisoner_state = CONST_INT['slave_faint']:
		$prisoner_info_text = '  <<$prisoner_name>> is exhausted and moans quietly. She is clearly in a very bad condition. You have to give her a rest or even medical assistance.'
	elseif prisoner_state = CONST_INT['slave_dead']:
		$prisoner_info_text = '  <<$prisoner_name>> is dead. Her lifeless corpse is lying on the floor.'
	else
		$prisoner_info_text = '  ERROR, prisoner_state = <<prisoner_state>> is not recognized, please report this.'
	end
end

*p '
<img src="content\pic\bg\<<$bg[$place]>>.png">
'
if prisoner_state = CONST_INT['slave_exist'] and nsfw = 0:
	! conscious state only - do not display prisoner full image (which appears conscious) when fainted - ImperatorAugustus
	if prisoner['prison_food_type'] = 3 and prisoner['fat'] = 5:
		$bg_path = 'scene/slave_fat'
		g = rand(1, picMax['slave_fat'])
		if g > 1: $bg_path += '_' + $str(g)
		*p '
<img src="content\pic\<<$bg_path>>.png">
'
	else
		*p func('display_fullimage', 'prisoner', 'bg')
	end
end
!*p '
<<$text>>
'

if prisoner_state ! CONST_INT['no_slave']:
	if slave_state = CONST_INT['no_slave']:
		*p '

'
	else
		*p '

'
	end
elseif slave_state > CONST_INT['no_slave']:
	*p '

'
end

if prisoner_state = CONST_INT['slave_exist']:
	*p '
<img src = "<<$prisoner[''ava'']>>.png">
'
	*p '
Energy <<$prisoner_energy_stars>>'
		$tooltip_text = func('$addon', 'no_rate_full_grade_tooltip_text', 'mood', prisoner['mood'], 1)
		*nl '<a class="tooltip-left" tooltip-data="<<$tooltip_text>>" href="EXEC: msg $mood_chart"><<$mood[prisoner_mood_plus]>>'
		$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'hygiene', prisoner['hygiene'], -1)
		*nl '<a class="tooltip-left" tooltip-data="<<$tooltip_text>>" href = "EXEC: msg $hygiene_chart"><<$personal_hygiene[prisoner["hygiene"]]>>'
		*nl ' <<iif(prisoner["calories"] > 0, "+", "")>><<prisoner["calories"]*100>> cal'
		*nl 'Owned for: <<prisoner["age_count"]>> days'
	*p '
'
end

if prisoner_state = CONST_INT['slave_faint']:
	*p '
<img src = "<<$prisoner[''ava_gray'']>>.png">
'
	*p '
Unconscious
'
end

if prisoner_state > CONST_INT['no_slave']:
	$info_bar = 'ATTRIBUTES'
	$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'beauty', prisoner['beauty'], 1)
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $красота_справка & dynamic $msg, $красота_справка_2"><<$beauty[prisoner["beauty"]]>>'
	$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'stamina', prisoner['stamina'], 1)
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $здоровье_справка & dynamic $msg, $здоровье_справка_2"><<$stamina[prisoner["stamina"]]>>'
	$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'sensitivity', prisoner['sensitivity'], 1)
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $чувствительность_справка & dynamic $msg, $чувствительность_справка_2"><<$sensitivity[prisoner["sensitivity"]]>>'
	$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'temper', prisoner['temper'], 1)
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $темперамент_справка & dynamic $msg, $темперамент_справка_2"><<$temper[prisoner["temper"]]>>'
	$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'intellect', prisoner['intellect'], 1)
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $ум_справка & dynamic $msg, $ум_справка_2"><<$intellect[prisoner["intellect"]]>>'
	$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'ego', prisoner['ego'], 1)
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $характер_справка & dynamic $msg, $характер_справка_2"><<$ego[prisoner["ego"]]>>'
	$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'pride', prisoner['pride'], -1)
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $гордыня_справка & dynamic $msg, $гордыня_справка_2"><<$pride[prisoner["pride"]]>>'
	!$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'exotic', prisoner['exotic'], 1)
	!$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $экзотичность_справка & dynamic $msg, $экзотичность_справка_2"><<$exotic[prisoner["exotic"]]>>'
	$tooltip_text = func('$addon', 'prisoner_physique_tooltip_text', 'fat', prisoner['fat'])
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $жыр_справка & dynamic $msg, $жыр_справка_2"><<$fat[prisoner["fat"]]>>'
	!$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'style', prisoner['style'], 1)
	!$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $стиль_справка & dynamic $msg, $стиль_справка_2"><<$style[prisoner["style"]]>>'
	$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'fame', prisoner['fame'], 1)
	$info_bar += '
<a class="tooltip-right" tooltip-data="<<$tooltip_text>>" href="EXEC: dynamic $msg, $слава_справка & dynamic $msg, $слава_справка_2"><<$girl_fame[prisoner["fame"]]>>'
	$info_bar += '
TRAITS' + _
	'
<<$prisoner_features_list>>'

	*p '
'
		*nl 'Dry food'
		*nl 'Dog food'
		*nl 'Fiend’s cum'
		*nl 'Cookies'
	*p '
'

	if prisoner['prison_food_type'] = 1:
		*p '

'
	else
		*p '

'
	end
	if prisoner['prison_food_type'] = 0:
		*p '

'
	else
		*p '

'
	end
	if prisoner['prison_food_type'] = 2:
		*p '

'
	else
		*p '

'
	end
	if prisoner['prison_food_type'] = 3:
		*p '

'
	else
		*p '

'
	end

	!prisoner lactation info - Pianocat
	if prisoner['lactation'] > 0:
		*p '
'
			*p '<img src = "<<$master_ava>>">'
			*nl 'Energy <<$master_energy_stars>>'
			$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'hygiene', master_hygiene, -1)
			*nl '<a class="tooltip-left" tooltip-data="<<$tooltip_text>>" href="EXEC: msg $hygiene_chart"><<$personal_hygiene[master_hygiene]>>'
			$tooltip_text = func('$addon', 'no_rate_full_grade_tooltip_text', 'mood', master_mood, 1)
			*nl '<a class="tooltip-left" tooltip-data="<<$tooltip_text>>" href="EXEC: msg $mood_chart"><<$mood[master_mood_plus]>>'
			$tooltip_text = func('$addon', 'no_rate_full_grade_tooltip_text', 'master_excitement', master_excitement, 1)
			*nl '<a class="tooltip-left" tooltip-data="<<$tooltip_text>>" href="EXEC: msg $excitement_chart"><<dyneval($vb_cycle_stat, iif(max(master_moodlet["neg_boner"], master_moodlet["neg_blazing"]) = 0, 5 + master_excitement, 0), $excitement[master_excitement_plus])>>'
			*nl
			*nl 'Cow Status'
			$tooltip_text = func('$addon', 'no_rate_stat_tooltip_text', 'cowSK', prisoner['cowSK'], 1)
			*nl '<div style="display:inline-block;position:relative;" class="tooltip-left" tooltip-data="<<$tooltip_text>>"><<$slave_cowSK[prisoner["cowSK"]]>>
'
			*nl
			*nl '<<$prisoner_boobs>>'
			*nl '<<$slave_lactation[prisoner["lactation"]]>>'
			*p  '<<$impregnation_rate[prisoner["impregnation"]]>>'
		*p '
'
		if master_excitement >= 0:
			*p '

'
		end
		*p '
'
			*p ''
			if prisoner_state = CONST_INT['slave_faint']:
				*p ''
			elseif prisoner['milk_summ'] < 10:
				*p ''
			else
				*p ''
			end
		*p '
'
	end
end

if prisoner_state ! CONST_INT['no_slave']: *p '
<<$info_bar>>
'
! dead prisoners should be displayed, so ! no_slave is correct here - ImperatorAugustus

*p '
<<$prisoner_info_text>>
'

if cheat_no_starve = 0 and prisoner['starvation_warning'] = 1:
	prisoner['starvation_warning'] = 2 &! will be reset in next_day when no longer starving
	msg '   You notice signs of starvation on your prisoner. It seems that the food you are giving her is not enough.'
end

*p '

'

--- prison_cell ---------------------------------


code:
# quest12
!Quest 12
!Post Patrician Quest - Daily Quest Handling - created by crushboss
quest12_day_counter += 1

if quest12_day_counter > 120:
	$quest12 = 'fail'
	$quest12_failreason = 'Sorry slaver, Lord Spectre says you ran out of time. Nothing personal.'
end

!ImperatorAugustus: added more fail conditions and removed checks for active[$quest[12]] ! 2 (this location is only called when active[$quest[12]] = 1)

if felicity = 1 and $quest12 ! 'fail':
	! felicity = 1 is set when Felicity is retrieved from the smugglers
	if (pig_type = 2572 or cow_type = 2572 or harpy_type = 2572):
		$quest12 = 'fail'
		$quest12_failreason = 'Lord Spectre gave you specific instructions, and treating his brother’s ward as livestock was not among them.'
	elseif assistant_type = 2572 or farmhand_type = 2572:
		$quest12 = 'fail'
		$quest12_failreason = 'Lord Spectre gave you specific instructions, and elevating his brother’s ward as your assistant was not among them.'
	elseif prisoner_type = 2572:
		$quest12 = 'fail'
		$quest12_failreason = 'Lord Spectre gave you specific instructions, and keeping his brother’s ward in a prison cell was not among them.'
	elseif (iced_1_type = 2572 or iced_2_type = 2572 or iced_3_type = 2572 or iced_4_type = 2572 or iced_5_type = 2572 or iced_6_type = 2572):
		$quest12 = 'fail'
		$quest12_failreason = 'Lord Spectre gave you specific instructions, and keeping his brother’s ward in a stasis chamber was not among them.'
	elseif slave_type = 2572:
		slave['metabolism'] = 3
		if slave['masochism_xp'] > 20:
			slave['masochism_xp'] = 20
			slave['masochism'] = 0
		end
		if slave['diet_leftovers'] ! 0 or slave['diet_food_type'] ! 2 or slave_already_done_total['1515'] > 0 or slave_already_done_total['1551'] > 0 or slave_already_done_total['1552'] > 0 or slave_already_done_total['1553'] > 0 or slave_already_done_total['1554'] > 0 or slave_already_done_total['1555'] > 0:
			! removed fiend_cum = 0 check - letting her starve has consequences of its own and running out of fiend cum should not be a fail condition - ImperatorAugustus
			! added interaction 1515 (going to a restaurant) and 1551 through 1555 (reward with treats/sweets) - ImperatorAugustus
			$quest12 = 'fail'
			$quest12_failreason = 'It seems you neglected to feed her only fiend cum, slaver.'
		end
		if slave['blowjob_rule'] ! 1 or slave['washes_master_rule'] ! 1:
			$quest12 = 'fail'
			$quest12_failreason = 'It seems you forgot that she’s your washmaid and your alarm clock.'
		end
		if pet_tentacle = 0:
			$quest12 = 'fail'
			$quest12_failreason = 'It seems you don’t have a fiend for her to milk, slaver.'
		elseif slave['tentacle_rule'] ! 1 and tentacle_state = 1:
			$quest12 = 'fail'
			$quest12_failreason = 'It seems you forgot to have her take care of your fiend, slaver.'
		end
		if slave['v_balls_rule'] ! 1 and slave['virginity'] ! 0 and (slave['sub_vaginal'] > 1 or slave_auto_tentacle = 0 or slave['sub_tentacles'] > 0 or slave_already_done_total['1331'] > 0 or slave['sub_dp'] > 0 or slave['sub_tp'] > 0 or slave['sub_gangbang'] > 0 or slave_already_done_total['5414'] > 0 or slave_already_done_total['161'] > 0 or slave_already_done_total['171'] > 0 or slave_already_done_total['1341'] > 0 or slave_already_done_total['5418'] > 0 or slave['sub_threesome'] > 2 or slave['sub_zoosex'] > 0 or slave['sub_bestiality'] > 0 or slave['sub_horse'] > 0 or slave['sub_arachnidSpider'] > 2 or slave['sub_polypusvermin'] > 1 or slave_already_done_total['1486'] > 0 or slave_already_done_total['1487'] > 0):
			$quest12 = 'fail'
			$quest12_failreason = 'Remember? The rule was when you finally put a cock in her, the vaginal balls stay in.'
		end
		if slave['nipple_piercing'] = 1 and $slave['nipplerings'] ! 'nipple_chain':
			$quest12 = 'fail'
			$quest12_failreason = 'Did you forget? You were supposed to get her nipples pierced and have her wear a chain.'
		end
		if slave_state = CONST_INT['slave_faint']:
			$quest12 = 'fail'
			$quest12_failreason = 'Lord Spectre entrusted you to corrupt his brother’s ward, and you put her in a coma? This death is too good for you.'
		end
		!Testing Code - crushboss
		!slave['has_ride_win'] = 7
		!End of Testing code - crushboss
	elseif slave_state < CONST_INT['slave_exist']:
		! no_slave or slave_dead - ImperatorAugustus
		$quest12 = 'fail'
		$quest12_failreason = 'Lord Spectre entrusted you to corrupt his brother’s ward, and you lost her? This death is too good for you.'
	end
end

--- quest12 ---------------------------------


code:
# refresh_database
!Refresh Database - created by crushboss
!This helps the game be more compatible with old save games - not a perfect solution but it helps

killvar 'code_defined' &! do-once reset
killvar 'first_visit' &! do-once reset

!$counter = '$counter' &! realtime update handler
$onobjsel = '$objsel' &! object selector handler
$ongload = '$ongload' &! after load game handler

!static locations that are not refreshed anywhere else
gs '#static_base' &! no load order dependencies
gs '#static_txt' &! must load after #static_base
gs '#dynamic' &! no load order dependencies
gs '#food_base' &! must load after #static_base
gs '#variative' &! must load after #static_base
gs '#help_msg' &! must load after #static_base and #variative
gs '#item_base' &! no load order dependencies
gs '#masters_base' &! no load order dependencies
gs '#moodlet_base' &! load order no dependencies
gs '#simple_npc' &! before #npc_base until conflicts are resolved (TODO)
gs '#npc_base' &! no load order dependencies
gs '#options' &! no load order dependencies
gs '#place_base' &! no load order dependencies

!locations that are refreshed elsewhere
gs '#estate_base' &! refreshed by Adverto Servili special event
gs '#var_base' &! must load after #static_base, refreshed by main_screen, city_screen, choice_screen, next_day, contains conditional text and subexpressions
gs '#txt' &! must load after #static_base and #var_base, refreshed when slave instances are swapped or cleared, contains conditional text and subexpressions
gs '#txt_2' &! must load after #static_base and #var_base, refreshed when slave instances are swapped or cleared, contains conditional text and subexpressions
gs '#chariots_base' &! refreshed by $ride_start before each race
gs '#quest_base' &! refreshed by master_stat when viewing master objectives tab

!fight engine
gs '#тексты_движка'
gs '#противники'
gs '#суперудары'
gs '#боевые_предметы'

!sex engine
gs '#sex_texts'
gs '#sex_options'

--- refresh_database ---------------------------------


code:
# ride_interface
!Chariot races

!Check for race completion
if boards = 0 or frame = 0:
	$crash_text = $current_ride
	gt '$ride_finish', 1
end

if wheels = 0 or chassis = 0:
	$crash_text = $current_ride
	gt '$ride_finish', 2
end

if chariot['pony_health'] <= 0:
	$crash_text = $current_ride
	gt '$ride_finish', 3
end

if trace_segment > 12:
	gt '$ride_finish', 4
end

!Determination of the order of riders
killvar '$participant'

i = 0
j = 1
n = arrsize('$rider')
:loop
	if rider_participates[$rider[i]] = 1:
		$participant[j] = $rider[i]
		j += 1
	end
	i +=1
if i < n: jump 'loop'

if $participant[2] = '': $participant[2] = 'crashed'
if $participant[3] = '': $participant[3] = 'crashed'
if $participant[4] = '': $participant[4] = 'crashed'
if $participant[5] = '': $participant[5] = 'crashed'
if $participant[6] = '': $participant[6] = 'crashed'

e = 0
:loop2
	i = 1
	:loop3
		s = i + 1
		if s > 6: s = 6

		if speed_points[$participant[i]] < speed_points[$participant[i+1]]:
			$temp = $participant[i]
			$participant[i] = $participant[i+1]
			$participant[i+1] = $temp
		end
		i +=1
	if i < 6-e: jump 'loop3'

	e +=1
if e < n+1: jump 'loop2'

!Information about the latest actions of the player and opponents
if trace_segment = 1:
	$current_ride = ''
	$future_ride = $trace_forward_description['ride_start']
end

if trace_segment = 2:
	$future_ride = $trace_forward_description[$trace[2]]
end

$ride_flow = ''
$ride_flow += '<<$current_ride>>

'

if trace_segment = 1:
	$ride_flow += '<<$trace_name[$trace[1]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[1]]>> -> '
end

if trace_segment = 2:
	$ride_flow += '<<$trace_name[$trace[2]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[2]]>> -> '
end

if trace_segment = 3:
	$ride_flow += '<<$trace_name[$trace[3]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[3]]>> -> '
end

if trace_segment = 4:
	$ride_flow += '<<$trace_name[$trace[4]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[4]]>> -> '
end

if trace_segment = 5:
	$ride_flow += '<<$trace_name[$trace[5]]>>  ->'
else
	$ride_flow += '<<$trace_name[$trace[5]]>> -> '
end

if trace_segment = 6:
	$ride_flow += '<<$trace_name[$trace[6]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[6]]>> -> '
end

if trace_segment = 7:
	$ride_flow += '<<$trace_name[$trace[7]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[7]]>> -> '
end

if trace_segment = 8:
	$ride_flow += '<<$trace_name[$trace[8]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[8]]>> -> '
end

if trace_segment = 9:
	$ride_flow += '<<$trace_name[$trace[9]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[9]]>> -> '
end

if trace_segment = 10:
	$ride_flow += '<<$trace_name[$trace[10]]>> -> '
else
	$ride_flow += '<<$trace_name[$trace[10]]>> -> '
end

if trace_segment = 11:
	$ride_flow += '<<$trace_name[$trace[11]]>> ->'
else
	$ride_flow += '<<$trace_name[$trace[11]]>> -> '
end

if trace_segment = 12:
	$ride_flow += '<<$trace_name[$trace[12]]>>'
else
	$ride_flow += '<<$trace_name[$trace[12]]>>'
end

$ride_flow += '

<<$future_ride>>

'

!new CSS for ride pic
if nsfw = 0:*p '

'
*p '
<<$ride_flow>>
'

!new CSS for ride var
if ui_style = 2:
	*p '
SPEED: <<chariot["speed"]>> км/ч'
	*nl 'HANDLING: <<chariot["maneuverability_effective"]>> (I<<chariot["inertia"]>>)'
	*nl 'ENDURANCE: <<chariot["pony_health"]>>
'
	*nl '<<$frame[frame]>>'
	*nl '<<$boards[boards]>>'
	*nl '<<$chassis[chassis]>>'
	*nl '<<$wheels[wheels]>>
'
else
	*p '
SPEED: <<chariot["speed"]>> км/ч'
	*nl 'HANDLING: <<chariot["maneuverability_effective"]>> (I<<chariot["inertia"]>>)'
	*nl 'ENDURANCE: <<chariot["pony_health"]>>
'
	*nl '<<$frame[frame]>>'
	*nl '<<$boards[boards]>>'
	*nl '<<$chassis[chassis]>>'
	*nl '<<$wheels[wheels]>>
'
end

!new CSS for ride var
if ui_style = 2:
	*p '
'
else
	*p '
'
end
*nl 'Crack whip
'
*nl 'Manage reins
'
*nl 'Draw reins
'

*p '
<img src = "<<$rider_ava[$participant[1]]>>">
'
*p '
<img src = "<<$rider_ava[$participant[2]]>>">
'
*p '
<img src = "<<$rider_ava[$participant[3]]>>">
'
*p '
<img src = "<<$rider_ava[$participant[4]]>>">
'
*p '
<img src = "<<$rider_ava[$participant[5]]>>">
'
*p '
<img src = "<<$rider_ava[$participant[6]]>>">
'

*p '
<<$rider_name[$participant[1]]>> (<<rider_structure[$participant[1]]>>)
'
*p '
<<$rider_name[$participant[2]]>> (<<rider_structure[$participant[2]]>>)
'
*p '
<<$rider_name[$participant[3]]>> (<<rider_structure[$participant[3]]>>)
'
*p '
<<$rider_name[$participant[4]]>> (<<rider_structure[$participant[4]]>>)
'
*p '
<<$rider_name[$participant[5]]>> (<<rider_structure[$participant[5]]>>)
'
*p '
<<$rider_name[$participant[6]]>> (<<rider_structure[$participant[6]]>>)
'

*p '
Winning points: <<speed_points[$participant[1]]>>
'
*p '
Winning points: <<speed_points[$participant[2]]>>
'
*p '
Winning points: <<speed_points[$participant[3]]>>
'
*p '
Winning points: <<speed_points[$participant[4]]>>
'
*p '
Winning points: <<speed_points[$participant[5]]>>
'
*p '
Winning points: <<speed_points[$participant[6]]>>
'

$toplay = 'ride' & dynamic $play_music

if ui_style = 2:
	if sound_on = 1:
		*p '

'
	else
		*p '

'
	end
else
	if sound_on = 1:
		*p '

'
	else
		*p '

'
	end
end
--- ride_interface ---------------------------------


code:
# ride_next
!Processing of the next section of the race route
chariot['max_speed'] = (slave['temper'] + chariot['pony_health']*3) - chariot['weight']
if slave['age'] ! CONST_INT['loli_age']: chariot['max_speed'] = chariot['max_speed']*2
if slave['age'] = CONST_INT['loli_age']: chariot['max_speed'] = ((chariot['max_speed']*3)/2)
chariot['acceleration'] = chariot['max_speed']/4
if chariot['acceleration'] < 1: chariot['acceleration'] = 1
chariot['inertia'] = max(1, (chariot['speed'] * chariot['weight'])/25)
! do not reset maneuverability here, allowing it to accumulate with "draw reins" so completing races with an inadequate pony is possible - ImperatorAugustus

! whip lash
if args = 1:
	if chariot['speed'] <= chariot['acceleration']:
		chariot['speed'] += chariot['acceleration']*2
	else
		chariot['speed'] += chariot['acceleration']
	end
	chariot['maneuverability_effective'] = max(0, chariot['maneuverability'] - chariot['inertia']) / 2
end

! manage the reins
if args = 2:
	chariot['speed'] -= 1
	chariot['maneuverability_effective'] = 1 + (max(1, chariot['maneuverability'] - chariot['inertia']) * 2) / 3
end

! draw reins (lower speed lowers inertia, which makes subsequent manage reins more effective)
if args = 3:
	chariot['speed'] -= chariot['acceleration']
	chariot['maneuverability_effective'] += 1
end

if chariot['speed'] > chariot['max_speed']: chariot['speed'] = chariot['max_speed']
if chariot['speed'] <= 0: chariot['speed'] = 1

if $trace[trace_segment] = 'ride_start':
	if args = 1:
		$current_ride = $trace_pass_description['ride_start']
	else
		$current_ride = $trace_fail_description['ride_start']
	end
	dynamic $race_startline[$participant[1]]
	dynamic $race_startline[$participant[2]]
	dynamic $race_startline[$participant[3]]
	dynamic $race_startline[$participant[4]]
	dynamic $race_startline[$participant[5]]
	dynamic $race_startline[$participant[6]]
end

if $trace[trace_segment] = 'straight':
	if args = 1 or cheat_easy_race ! 0:
		$current_ride = $trace_pass_description['straight']
	else
		$current_ride = $trace_fail_description['straight']
	end
	dynamic $race_straight[$participant[1]]
	dynamic $race_straight[$participant[2]]
	dynamic $race_straight[$participant[3]]
	dynamic $race_straight[$participant[4]]
	dynamic $race_straight[$participant[5]]
	dynamic $race_straight[$participant[6]]
end

if $trace[trace_segment] = 'curve':
	diff = 1 + ((48271 * (day + trace_segment)) mod 65537)/(65537/5) &! pseudo-rand(1,5)
	if cheat_easy_race ! 0:
		diff = chariot['maneuverability_effective']
	end
	if chariot['maneuverability_effective'] < diff: $current_ride = $trace_fail_description['curve'] & dynamic $damage_frame & chariot['speed'] -= 3
	if chariot['maneuverability_effective'] >= diff: $current_ride = $trace_pass_description['curve']
	dynamic $race_curve[$participant[1]]
	dynamic $race_curve[$participant[2]]
	dynamic $race_curve[$participant[3]]
	dynamic $race_curve[$participant[4]]
	dynamic $race_curve[$participant[5]]
	dynamic $race_curve[$participant[6]]
end

if $trace[trace_segment] = 'russian_road':
	$current_ride = $trace_pass_description['russian_road']
	diff = 2 + ((48271 * (day + trace_segment)) mod 65537)/(65537/5) &! pseudo-rand(2,6)
	safe_speed = 10 + ((48271 * (day + trace_segment)) mod 65537)/(65537/6) &! pseudo-rand(10,15)
	if chariot['maneuverability_effective'] < diff and cheat_easy_race = 0: $current_ride = $trace_fail_description['russian_road'] & chariot['pony_health'] -= 1
	if chariot['speed'] > safe_speed and cheat_easy_race = 0: $current_ride = $trace_fail_description['russian_road'] & dynamic $damage_wheels
	dynamic $race_russianroad[$participant[1]]
	dynamic $race_russianroad[$participant[2]]
	dynamic $race_russianroad[$participant[3]]
	dynamic $race_russianroad[$participant[4]]
	dynamic $race_russianroad[$participant[5]]
	dynamic $race_russianroad[$participant[6]]
end

if $trace[trace_segment] = 'dragon_teeth':
	if args = 2 or cheat_easy_race ! 0:
		$current_ride = $trace_pass_description['dragon_teeth']
	else
		$current_ride = $trace_fail_description['dragon_teeth']
		chariot['pony_health'] -= 2
	end
	dynamic $race_dragonteeth[$participant[1]]
	dynamic $race_dragonteeth[$participant[2]]
	dynamic $race_dragonteeth[$participant[3]]
	dynamic $race_dragonteeth[$participant[4]]
	dynamic $race_dragonteeth[$participant[5]]
	dynamic $race_dragonteeth[$participant[6]]
end

if $trace[trace_segment] = 'concrete_jungle':
	diff = 1 + ((48271 * (day + trace_segment)) mod 65537)/(65537/7) &! pseudo-rand(1,7)
	if cheat_easy_race ! 0:
		diff = chariot['maneuverability_effective']
	end
	if chariot['maneuverability_effective'] >= diff:
		$current_ride = $trace_pass_description['concrete_jungle']
	else
		$current_ride = $trace_fail_description['concrete_jungle']
		dynamic $chariot_crash
	end
	dynamic $race_concrete[$participant[1]]
	dynamic $race_concrete[$participant[2]]
	dynamic $race_concrete[$participant[3]]
	dynamic $race_concrete[$participant[4]]
	dynamic $race_concrete[$participant[5]]
	dynamic $race_concrete[$participant[6]]
end

if $trace[trace_segment] = 'bladestrings':
	diff = 3 + ((48271 * (day + trace_segment)) mod 65537)/(65537/3) &! pseudo-rand(3,5)
	if chariot['maneuverability_effective'] > diff or cheat_easy_race ! 0:
		$current_ride = $trace_pass_description['bladestrings']
	else
		if slave['age'] = CONST_INT['loli_age']:
			$current_ride = '  Due to the short height of your girl harnessed to the chariot, you can safely pass a string-blade at any speed: they are stretched at the neck height of an adult woman and just whistle over your heads, without causing any harm. But for your opponents this section will not be easy to overcome!'
		else
			$current_ride = $trace_fail_description['bladestrings']
			dynamic $pony_death
		end
	end
	dynamic $race_bladestrings[$participant[1]]
	dynamic $race_bladestrings[$participant[2]]
	dynamic $race_bladestrings[$participant[3]]
	dynamic $race_bladestrings[$participant[4]]
	dynamic $race_bladestrings[$participant[5]]
	dynamic $race_bladestrings[$participant[6]]
end

if $trace[trace_segment] = 'ride_finish':
	if args = 1 or cheat_easy_race ! 0:
		$current_ride = $trace_pass_description['ride_finish']
	else
		$current_ride = $trace_fail_description['ride_finish']
	end
	dynamic $race_finishline[$participant[1]]
	dynamic $race_finishline[$participant[2]]
	dynamic $race_finishline[$participant[3]]
	dynamic $race_finishline[$participant[4]]
	dynamic $race_finishline[$participant[5]]
	dynamic $race_finishline[$participant[6]]
end

rider_structure['master'] = 100
if rider_structure[$participant[1]] <= 0: rider_participates[$participant[1]] = 0
if rider_structure[$participant[2]] <= 0: rider_participates[$participant[2]] = 0
if rider_structure[$participant[3]] <= 0: rider_participates[$participant[3]] = 0
if rider_structure[$participant[4]] <= 0: rider_participates[$participant[4]] = 0
if rider_structure[$participant[5]] <= 0: rider_participates[$participant[5]] = 0
if rider_structure[$participant[6]] <= 0: rider_participates[$participant[6]] = 0

speed_points['master'] += chariot['speed']

$future_ride = $trace_forward_description[$trace[trace_segment_next]]

trace_segment += 1
trace_segment_next = trace_segment + 1

gt 'ride_interface'

--- ride_next ---------------------------------


code:
# sex_addup
!reset
sex["climax_force"] = 0

!minimal
if sex['girl_energy'] < 1:
	sex['girl_excitement'] -= 1
	sex['girl_attention'] -= 1
	sex['climax_buildup'] += sex['girl_energy']
	sex['girl_energy'] = 0
end

if sex['girl_nympho'] < 0: sex['girl_excitement'] -= 1 &! Frigid

if sex['girl_openmind'] < 1: sex['girl_openmind'] = 1
if sex['girl_pain'] < 1: sex['girl_pain'] = 1
if sex['girl_attention'] < 1: sex['girl_attention'] = 1
if sex['girl_excitement'] < 1: sex['girl_excitement'] = 1

if sex["climax_buildup"] < 0: sex["climax_buildup"] = 0
if sex["cum_buildup"] < 0: sex["cum_buildup"] = 0

if sex['girl_newness'] < -10: sex['girl_newness'] = -10

if sex["pc_excitement"] < -20: sex["pc_excitement"] = -20

!Chimera Gem modifiers - crushboss
if chimera_gem_on = 1:
	sex["cum_buildup"] += master_excitement
	sex['pc_boner'] = master_excitement
	pc_boner_plus = master_excitement
end

!maximal
if sex['girl_openmind'] > 5: sex['girl_openmind'] = 5
if sex['girl_pain'] > 5: sex['girl_pain'] = 5
if sex['girl_attention'] > 5: sex['girl_attention'] = 5
if sex['girl_excitement'] > 5: sex['girl_excitement'] = 5
if sex['girl_newness'] > 20: sex['girl_newness'] = 20

!Counting all modifiers
sex["pc_excitement_state"] = 0
if sex['pc_boner'] <= 0: sex["pc_excitement"] = 0
if sex["pc_excitement"] >= 5: sex["pc_excitement_state"] = 1
if sex["pc_excitement"] >= 10: sex["pc_excitement_state"] = 2
if sex["pc_excitement"] >= 25: sex["pc_excitement_state"] = 3
if sex["pc_excitement"] >= 50: sex["pc_excitement_state"] = 4
if sex["pc_excitement"] >= 100: sex["pc_excitement_state"] = 5

sex["pc_energy_state"] = 0
if sex["pc_energy"] >= 5: sex["pc_energy_state"] = 1
if sex["pc_energy"] >= 10: sex["pc_energy_state"] = 2
if sex["pc_energy"] >= 25: sex["pc_energy_state"] = 3
if sex["pc_energy"] >= 50: sex["pc_energy_state"] = 4
if sex["pc_energy"] >= 100: sex["pc_energy_state"] = 5

sex["pc_interest_state"] = 0
if sex["pc_interest"] >= 5: sex["pc_interest_state"] = 1
if sex["pc_interest"] >= 10: sex["pc_interest_state"] = 2
if sex["pc_interest"] >= 25: sex["pc_interest_state"] = 3
if sex["pc_interest"] >= 50: sex["pc_interest_state"] = 4
if sex["pc_interest"] >= 100: sex["pc_interest_state"] = 5

sex["girl_energy_state"] = 0
if sex["girl_energy"] >= 5: sex["girl_energy_state"] = 1
if sex["girl_energy"] >= 10: sex["girl_energy_state"] = 2
if sex["girl_energy"] >= 25: sex["girl_energy_state"] = 3
if sex["girl_energy"] >= 50: sex["girl_energy_state"] = 4
if sex["girl_energy"] >= 100: sex["girl_energy_state"] = 5

!climax threshold
a = 10 + sex["girl_attention"] - sex['girl_sensitivity'] - slave['temper'] - sex["girl_openmind"]
if a < 1: a = 1
if sex['girl_excitement'] < 3: sex["climax_threshold"] = 100
if sex['girl_excitement'] = 3: sex["climax_threshold"] = a*5
if sex['girl_excitement'] = 4: sex["climax_threshold"] = a*3
if sex['girl_excitement'] >= 5: sex["climax_threshold"] = a*2
if slave["no_orgasm_rule"] > 0 and $sex['partner'] = '': sex["climax_threshold"] += slave["obedience"]

if sex["climax_buildup"] >= sex["climax_threshold"]:
	!clitoral orgasm
	if clitoral_stimulation > 0:
		sex["climax_force"] = 1
		if sex["climax_count"] = 0: sex["climax_count"] = 1
	end

	!deep orgasm
	if sex['girl_excitement'] > 3 and sex['girl_orgasm_type'] > 0 and sex["girl_openmind"] > 3: sex["climax_force"] = 2
	if sex['girl_excitement'] > 3 and sex['girl_orgasm_type'] = 0 and sex["girl_openmind"] > 3:
		sex["climax_force"] = 2
		sex['girl_orgasm_type_change'] = 1
		sex['girl_orgasm_type'] = 1
	end
	!squirt
	if sex['girl_excitement'] >= 5 and sex['girl_orgasm_type'] = 2 and sex["girl_openmind"] > 3: sex["climax_force"] = 3
	if sex['girl_excitement'] >= 5 and sex['girl_orgasm_type'] < 2 and sex["girl_openmind"] >= 5:
		sex["climax_force"] = 3
		sex['girl_orgasm_type_change'] = 2
		sex['girl_orgasm_type'] = 2
	end
	if sex["climax_force"] = 0: sex["climax_buildup"] = sex["climax_threshold"] - 1
end

a = 3 + master_penetration - sex['pc_boner']
if a < 1: a = 1
sex["cum_threshold"] = 5 * a
if sex["pc_excitement_state"] < 2: sex["cum_threshold"] += 20
if sex["pc_excitement_state"] > 3: sex["cum_threshold"] = 4 * a
if sex["pc_excitement_state"] > 4: sex["cum_threshold"] = 2 * a
if chimera_gem_on = 1: sex["cum_threshold"] += 10

b = sex['pc_excitement'] - sex['prev_pc_excitement']
if b >= sex["cum_threshold"]:
	sex_num = 9 &! trigger cum
end
sex['prev_pc_excitement'] = sex['pc_excitement']

--- sex_addup ---------------------------------


code:
# sex_end
!sex end, use modifiers obtained in the process, returns to normal mode
$return_lock = $return_lock_prev

gs 'main_layout'
menu_form = 0
$onnewloc = '' &! sex_initiate sets this to $sex_newloc - ImperatorAugustus

a = 0
if master_excitement > sex['pc_boner']: a = master_excitement - sex['pc_boner']
if a > master_moodlet['pos_satisfied']: master_moodlet['pos_satisfied'] = a
if a > 1 and sex['climax_count'] > 0 and master_str < 4: master_str_rate += 1
if a > 0: master_excitement_rate = sex['pc_boner']*16
a = 0

if $sex_partner = '':
	if sex['nymphomania_revealed'] = 1 and slave['nymphomania_revealed'] = 0: slave['nymphomania_revealed'] = 1
	if sex['masochism_revealed'] = 1 and slave['masochism_revealed'] = 0: slave['masochism_revealed'] = 1
	if sex['darkness_attitude_revealed'] = 1 and slave['darkness_attitude_revealed'] = 0: slave['darkness_attitude_revealed'] = 1
	if sex['deprivation_attitude_revealed'] = 1 and slave['deprivation_attitude_revealed'] = 0: slave['deprivation_attitude_revealed'] = 1
	if sex['perversion_revealed'] = 1 and slave['perversion_revealed'] = 0: slave['perversion_revealed'] = 1

	killvar 'slave_already_sex_total'
	copyarr 'slave_already_sex_total','sex_done_thisperson'
	killvar 'slave_already_sex_today'
	copyarr 'slave_already_sex_today','sex_done_today'

	if deflorated = 1:
		slave['virginity'] = 2
		if is_perv ! 0 and slave['age'] = CONST_INT['loli_age']: master_perv_rate += 10
		if slave['masochism'] ! 2: slave['neg_defloration'] = max(0, 1 + slave['sensitivity'] + slave['pride'] - slave['moral']*2 - slave['arousal'])
		if slave['neg_defloration'] > 0: gs '$mood_drop', 'slave', slave['neg_defloration']
	end
	if sex['climax_count'] > 0:
		if slave['no_orgasm_rule'] > 0:
			interaction_slave['sin_potential'] = max (1, slave['moral'])
			dynamic $sin_gained_now, 'slave'
		end
		slave['nymphomania_xp'] += min(3, (1 + sex['climax_count'])/2)
		slave_rate['arousal'] -= sex['climax_count'] * slave['arousal'] * sex['climax_top']
		slave_rate['temper'] += min(5, sex['climax_count']) &! +1 per orgasm
		if slave['temper'] > slave['pride']: slave_rate['instinct'] += min(5, sex['climax_count'])
		slave['calories'] -= 1 & slave_rate['stamina'] += 1
		!dynamic $slave_energy_drop
	end
	slave['pos_orgasm'] += sex['climax_top'] &! moodlet exponentially decays in next_day -ImperatorAugustus
	slave['orgasm_type'] = sex['girl_orgasm_type_change']
	slave['virtue'] = max(0, sex['base_boner'] - sex['pc_boner'])
	if slave['sententia_veritas'] > 0 and slave['virtue'] > 0: slave['virtue'] += slave['sententia_veritas'] & slave['sententia_veritas'] = 0
	if slave['virtue'] > 5: slave['virtue'] = 5
	slave['newness'] = sex['girl_newness']
end

if $sex_partner = 'assistant':
	if sex['nymphomania_revealed'] = 1 and assistant['nymphomania_revealed'] = 0: assistant['nymphomania_revealed'] = 1
	if sex['masochism_revealed'] = 1 and assistant['masochism_revealed'] = 0: assistant['masochism_revealed'] = 1
	if sex['darkness_attitude_revealed'] = 1 and assistant['darkness_attitude_revealed'] = 0: assistant['darkness_attitude_revealed'] = 1
	if sex['deprivation_attitude_revealed'] = 1 and assistant['deprivation_attitude_revealed'] = 0: assistant['deprivation_attitude_revealed'] = 1
	if sex['perversion_revealed'] = 1 and assistant['perversion_revealed'] = 0: assistant['perversion_revealed'] = 1

	killvar 'assistant_already_sex_total'
	copyarr 'assistant_already_sex_total','sex_done_thisperson'
	killvar 'assistant_already_sex_today'
	copyarr 'assistant_already_sex_today','sex_done_today'

	if deflorated = 1:
		assistant['virginity'] = 2
		assistant['neg_defloration'] = max(0, 1 + assistant['sensitivity'] + assistant['pride'] - assistant['moral']*2 - assistant['arousal'])
		if assistant['neg_defloration'] > 0: gs '$mood_drop', 'assistant', assistant['neg_defloration']
	end
	if sex['climax_count'] > 0:
		!if assistant['no_orgasm_rule'] > 0:
		!	interaction_assistant['sin_potential'] = max (1, assistant['moral'])
		!	dynamic $sin_gained_now, 'assistant' &! TODO: enable if no_orgasm_rule applies to assistant - ImperatorAugustus
		!end
		assistant['nymphomania_xp'] += min(3, (1 + sex['climax_count'])/2)
		assistant_rate['arousal'] -= sex['climax_count'] * assistant['arousal'] * sex['climax_top']
		assistant_rate['temper'] += min(5, sex['climax_count']) &! +1 per orgasm
		if assistant['temper'] > assistant['pride']: assistant_rate['instinct'] += min(5, sex['climax_count'])
		assistant['calories'] -= 1 & assistant_rate['stamina'] += 1
		!dynamic $assistant_energy_drop
	end
	assistant['pos_orgasm'] += sex['climax_top'] &! moodlet exponentially decays in next_day -ImperatorAugustus
	assistant['orgasm_type'] = sex['girl_orgasm_type_change']
	!if assistant['sententia_veritas'] > 0 and assistant['virtue'] > 0: assistant['virtue'] += assistant['sententia_veritas'] & assistant['sententia_veritas'] = 0
	!if assistant['virtue'] > 5: assistant['virtue'] = 5
	assistant['newness'] = sex['girl_newness']
end

$sex_partner = ''
killvar 'sex'
sex_num = 0
gs '$newloc'
gt '<<$return_lock>>'

--- sex_end ---------------------------------


code:
# sex_initiate
!INITIATE SEX STATS WHEN STARTING
sex['girl_virgin'] = 2
master_hygiene_rate += 5
slave_rate['hygiene'] += 5
house_mess_rate += 5
friction_temp = 0
intensity = 1
lube = 0
deflorated = 0
sex['climax_buildup'] = 0
$rise_skill = 'dump'

$return_lock_prev = $return_lock
$return_lock  = 'sex_screen'

killvar 'sex'
killvar 'sex_done_thisperson'
killvar 'sex_done_today'

sex['girl_pain'] = 3
sex['girl_attention'] = 3
sex['girl_openmind'] = 1
sex['girl_excitement'] = 1
$sex['partner'] = $sex_partner

$onnewloc = '$sex_newloc'

!base sex stats for slave

if $sex_partner = '':
	$sex['girl_ava'] = $slave['ava']
	$sex['girl_name'] = $slave_name

	sex['girl_disgust'] = slave['neg_disgust']
	sex['girl_raped'] = slave['neg_raped']

	sex['girl_calisthenics'] = slave['calisthenics']
	sex['girl_beauty'] = slave['beauty']
	sex['girl_sensitivity'] = slave['sensitivity']
	sex['girl_ego'] = slave['ego']
	sex['girl_temper'] = slave['temper']
	sex['girl_intellect'] = slave['intellect']
	sex['girl_pride'] = slave['pride']

	sex['girl_style'] = slave['style']
	sex['girl_exotic'] = slave['exotic']
	sex['girl_obedience'] = slave['obedience']
	sex['girl_fat'] = slave['fat']
	sex['girl_dirty'] = slave['hygiene']
	sex['girl_probed'] =  slave['probed']
	sex['girl_age'] = slave['age']
	sex['girl_type'] = slave_type

	sex['girl_mood'] =  slave['mood']
	sex['girl_fear'] =  slave['fear']
	sex['girl_habit'] = slave['custom']
	sex['girl_greed'] =  slave['rational']
	sex['girl_taming'] =  slave['instinct']
	sex['girl_spoil'] =  slave['spoil']
	sex['girl_angst'] =  slave['angst']
	sex['girl_moral'] = slave['moral']

	sex['girl_nympho'] = slave['nymphomania']
	sex['girl_perversion'] = slave['perversion']
	sex['girl_masochism'] = slave['masochism']
	sex['girl_deprivation_attitude'] = slave['deprivation_attitude']

	sex['girl_boobs'] = slave['boobs']

	sex['girl_petting'] =  slave['petting']
	sex['girl_sub_hj'] =  slave['sub_hj']
	sex['girl_sub_fj'] =  slave['sub_fj']
	sex['girl_sub_hug'] =  slave['sub_hug']
	sex['girl_sub_paizuri'] =  slave['sub_paizuri']
	sex['girl_oral'] =  slave['probed']
	sex['girl_sub_kiss'] =  slave['sub_kiss']
	sex['girl_sub_tongue'] =  slave['sub_tongue']
	sex['girl_sub_bj'] =  slave['sub_bj']
	sex['girl_sub_dt'] =  slave['sub_dt']
	sex['girl_sub_asslik'] =  slave['sub_asslik']
	sex['girl_penetration'] =  slave['penetration']
	sex['girl_sub_vaginal'] =  slave['sub_vaginal']
	sex['girl_sub_anal'] =  slave['sub_anal']
	sex['girl_sub_fisting'] =  slave['sub_fisting']
	sex['girl_anal_stretch'] =  slave['anal_stretch']
	sex['girl_roleplay'] =  slave['roleplay']
	sex['girl_sub_seduce'] =  slave['sub_seduce']
	sex['girl_sub_masturbation'] =  slave['sub_masturbation']
	sex['girl_sub_dildo'] =  slave['sub_dildo']
	sex['girl_sub_exhibit'] =  slave['sub_exhibit']
	sex['girl_sub_humiliation'] =  slave['sub_humiliation']
	sex['girl_fetishism'] =  slave['fetishism']
	sex['girl_sub_enema'] =  slave['sub_enema']
	sex['girl_sub_mazo'] =  slave['sub_mazo']
	sex['girl_sub_selfpain'] =  slave['sub_selfpain']
	sex['girl_sub_piss'] =  slave['sub_piss']
	sex['girl_sub_kopro'] =  slave['sub_kopro']
	sex['girl_orgy'] =  slave['orgy']
	sex['girl_sub_bukkake'] =  slave['sub_bukkake']
	sex['girl_xenophily'] =  slave['xenophily']

	sex['girl_orgasm_type'] =  slave['orgasm_type']
	if slave['virginity'] < 2: sex['girl_virgin'] = 1
	if slave['virginity'] <= 2: sex['girl_tightness'] += 1
	if slave['virginity'] > 2: sex['girl_tightness'] -= 1
	if sex['girl_age'] = CONST_INT['loli_age']: sex['girl_tightness'] += 1
	if sex['girl_age'] = CONST_INT['milf_age']: sex['girl_tightness'] -= 1

	copyarr 'sex_done_today','slave_already_sex_today'
	copyarr 'sex_done_thisperson','slave_already_sex_total'

	sex['girl_newness'] = slave['newness']

	sex['girl_arousal'] = slave['arousal']
	sex['girl_stamina'] = slave['stamina']
	sex['girl_energy_bonus'] = slave['energy']
	dynamic $slave_energy_drop

	strip = iif($slave['cloth'] = 'голая' or $slave['cloth'] = 'пусто', 1, 0) &! disables striptease option if she is already naked - ImperatorAugustus

	$sex['girl_name'] = $slave_name
end
!for assistant
if $sex_partner = 'assistant':
	$sex['girl_ava'] = $assistant['ava']
	$sex['girl_name'] = $assistant_name

	sex['girl_disgust'] = assistant['neg_disgust']
	sex['girl_raped'] = assistant['neg_raped']

	sex['girl_calisthenics'] = assistant['calisthenics']
	sex['girl_beauty'] = assistant['beauty']
	sex['girl_sensitivity'] = assistant['sensitivity']
	sex['girl_ego'] = assistant['ego']
	sex['girl_temper'] = assistant['temper']
	sex['girl_intellect'] = assistant['intellect']
	sex['girl_pride'] = assistant['pride']

	sex['girl_style'] = assistant['style']
	sex['girl_exotic'] = assistant['exotic']
	sex['girl_obedience'] = assistant['obedience']
	sex['girl_fat'] = assistant['fat']
	sex['girl_dirty'] = assistant['hygiene']
	sex['girl_probed'] =  assistant['probed']
	sex['girl_age'] = assistant['age']
	sex['girl_type'] = assistant_type

	sex['girl_mood'] =  assistant['mood']
	sex['girl_fear'] =  assistant['fear']
	sex['girl_habit'] =  assistant['custom']
	sex['girl_greed'] =  assistant['rational']
	sex['girl_taming'] =  assistant['instinct']
	sex['girl_spoil'] =  assistant['spoil']
	sex['girl_angst'] =  assistant['angst']
	sex['girl_moral'] = assistant['moral']

	sex['girl_nympho'] = assistant['nymphomania']
	sex['girl_perversion'] = assistant['perversion']
	sex['girl_masochism'] = assistant['masochism']
	sex['girl_deprivation_attitude'] = assistant['deprivation_attitude']

	sex['girl_boobs'] = assistant['boobs']

	sex['girl_petting'] =  assistant['petting']
	sex['girl_sub_hj'] =  assistant['sub_hj']
	sex['girl_sub_fj'] =  assistant['sub_fj']
	sex['girl_sub_hug'] =  assistant['sub_hug']
	sex['girl_sub_paizuri'] =  assistant['sub_paizuri']
	sex['girl_oral'] =  assistant['probed']
	sex['girl_sub_kiss'] =  assistant['sub_kiss']
	sex['girl_sub_tongue'] =  assistant['sub_tongue']
	sex['girl_sub_bj'] =  assistant['sub_bj']
	sex['girl_sub_dt'] =  assistant['sub_dt']
	sex['girl_sub_asslik'] =  assistant['sub_asslik']
	sex['girl_penetration'] =  assistant['penetration']
	sex['girl_sub_vaginal'] =  assistant['sub_vaginal']
	sex['girl_sub_anal'] =  assistant['sub_anal']
	sex['girl_sub_fisting'] =  assistant['sub_fisting']
	sex['girl_anal_stretch'] =  assistant['anal_stretch']
	sex['girl_roleplay'] =  assistant['roleplay']
	sex['girl_sub_seduce'] =  assistant['sub_seduce']
	sex['girl_sub_masturbation'] =  assistant['sub_masturbation']
	sex['girl_sub_dildo'] =  assistant['sub_dildo']
	sex['girl_sub_exhibit'] =  assistant['sub_exhibit']
	sex['girl_sub_humiliation'] =  assistant['sub_humiliation']
	sex['girl_fetishism'] =  assistant['fetishism']
	sex['girl_sub_enema'] =  assistant['sub_enema']
	sex['girl_sub_mazo'] =  assistant['sub_mazo']
	sex['girl_sub_selfpain'] =  assistant['sub_selfpain']
	sex['girl_sub_piss'] =  assistant['sub_piss']
	sex['girl_sub_kopro'] =  assistant['sub_kopro']
	sex['girl_orgy'] =  assistant['orgy']
	sex['girl_sub_bukkake'] =  assistant['sub_bukkake']
	sex['girl_xenophily'] =  assistant['xenophily']

	sex['girl_orgasm_type'] =  assistant['orgasm_type']
	if assistant['virginity'] < 2: sex['girl_virgin'] = 1
	if assistant['virginity'] <= 2: sex['girl_tightness'] += 1
	if assistant['virginity'] > 2: sex['girl_tightness'] -= 1
	!fixed variable typo (assistant_['girl_age']) in following lines - ImperatorAugustus
	if assistant['girl_age'] = CONST_INT['loli_age']: sex['girl_tightness'] += 1
	if assistant['girl_age'] = CONST_INT['milf_age']: sex['girl_tightness'] -= 1

	copyarr 'sex_done_today','assistant_already_sex_today'
	copyarr 'sex_done_thisperson','assistant_already_sex_total'

	sex['girl_newness'] = assistant['newness']

	sex['girl_arousal'] = assistant['arousal']
	sex['girl_stamina'] = assistant['stamina']
	sex['girl_energy_bonus'] = assistant['energy']
	dynamic $assistant_energy_drop

	strip = iif($assistant['cloth'] = 'голая' or $assistant['cloth'] = 'пусто', 1, 0) &! disables striptease option if she is already naked - ImperatorAugustus

	$sex['girl_name'] = $assistant_name
end

!The calculated starting sex partner characteristics
!CLIMAX COUNT
if sex['girl_arousal'] > 1: sex['girl_excitement'] += 1
if sex['girl_arousal'] > 3: sex['girl_excitement'] += 1
if sex['girl_arousal'] > 4: sex['girl_excitement'] += 1

! magnitude of neg_raped moodlet depends on empathy and and days elapsed since - ImperatorAugustus
if sex['girl_raped'] >= 1: sex['girl_attention'] -= 1
if sex['girl_raped'] >= 3: sex['girl_attention'] -= 1
if sex['girl_raped'] >= 5: sex['girl_attention'] -= 1

!STAMINA
if sex['girl_stamina'] <= 0: sex['girl_energy'] = 5
if sex['girl_stamina'] = 1: sex['girl_energy'] = 10
if sex['girl_stamina'] = 2: sex['girl_energy'] = 25
if sex['girl_stamina'] = 3: sex['girl_energy'] = 50
if sex['girl_stamina'] = 4: sex['girl_energy'] = 65
if sex['girl_stamina'] >= 5: sex['girl_energy'] = 75
sex['girl_energy'] += sex['girl_energy_bonus'] * 5

!PAIN

!ATTENTION
if sex['girl_intellect'] < 3: sex['girl_attention'] -= 1
if sex['girl_intellect'] > 3: sex['girl_attention'] += 1

if sex['girl_ego'] < 2: sex['girl_attention'] -= 1
if sex['girl_ego'] > 4: sex['girl_attention'] += 1

if sex['girl_temper'] < 2: sex['girl_attention'] += 1
if sex['girl_temper'] > 4: sex['girl_attention'] -= 1

if sex['girl_spoil'] > 1: sex['girl_attention'] -= 1
if sex['girl_spoil'] >= 5: sex['girl_attention'] -= 1

! magnitude of neg_raped moodlet depends on empathy and and days elapsed since - ImperatorAugustus
if sex['girl_raped'] >= 1: sex['girl_attention'] += 1
if sex['girl_raped'] >= 3: sex['girl_attention'] += 1
if sex['girl_raped'] >= 5: sex['girl_attention'] += 1

! magnitude of neg_disgust moodlet depends on specifics and days elapsed since - ImperatorAugustus
if sex['girl_disgust'] >= 1: sex['girl_attention'] += 1
if sex['girl_disgust'] >= 2: sex['girl_attention'] += 1
if sex['girl_disgust'] >= 3: sex['girl_attention'] += 1

if sex['girl_angst'] > 1: sex['girl_attention'] -= 1
if sex['girl_angst'] > 2: sex['girl_attention'] -= 1
if sex['girl_angst'] > 3: sex['girl_attention'] -= 1
if sex['girl_angst'] > 4: sex['girl_attention'] -= 1

!OPENNESS
if sex['girl_pride'] < master_style: sex['girl_openmind'] += 1
if sex['girl_pride'] < master_hygiene: sex['girl_openmind'] += 1

if sex['girl_fear'] >= 1: sex['girl_openmind'] -= 1
if sex['girl_fear'] >= 2: sex['girl_openmind'] -= 1
if sex['girl_fear'] >= 3: sex['girl_openmind'] -= 1
if sex['girl_fear'] >= 4: sex['girl_openmind'] -= 1
if sex['girl_fear'] >= 5: sex['girl_openmind'] -= 1

! magnitude of neg_raped moodlet depends on empathy and and days elapsed since - ImperatorAugustus
if sex['girl_raped'] >= 1: sex['girl_openmind'] -= 1
if sex['girl_raped'] >= 3: sex['girl_openmind'] -= 1
if sex['girl_raped'] >= 5: sex['girl_openmind'] -= 1

! magnitude of neg_disgust moodlet depends on specifics and days elapsed since - ImperatorAugustus
if sex['girl_disgust'] >= 1: sex['girl_openmind'] -= 1
if sex['girl_disgust'] >= 3: sex['girl_openmind'] -= 1

if sex['girl_taming'] > 1: sex['girl_openmind'] += 1
if sex['girl_taming'] > 4: sex['girl_openmind'] += 1

if sex['girl_moral'] > 1: sex['girl_openmind'] += 1
if sex['girl_moral'] > 2: sex['girl_openmind'] += 1
if sex['girl_moral'] > 3: sex['girl_openmind'] += 1
if sex['girl_moral'] > 4: sex['girl_openmind'] += 1

if sex['girl_spoil'] > 1: sex['girl_openmind'] -= 1
if sex['girl_spoil'] > 4: sex['girl_openmind'] -= 1

if sex['girl_angst'] >= 1: sex['girl_openmind'] -= 1
if sex['girl_angst'] >= 2: sex['girl_openmind'] -= 1
if sex['girl_angst'] >= 3: sex['girl_openmind'] -= 1
if sex['girl_angst'] >= 4: sex['girl_openmind'] -= 1
if sex['girl_angst'] >= 5: sex['girl_openmind'] -= 1

!calculate player sex stats
!ENERGY
if master_str <= 0: sex['pc_energy'] = 5
if master_str = 1: sex['pc_energy'] = 10
if master_str = 2: sex['pc_energy'] = 25
if master_str = 3: sex['pc_energy'] = 50
if master_str = 4: sex['pc_energy'] = 65
if master_str >= 5: sex['pc_energy'] = 75
sex['pc_energy'] += master_energy * 5
if sex['pc_energy'] < 1: sex['pc_energy'] = 1
if chimera_gem_on = 1: sex['pc_energy'] += 25

!CUM BUILDUP
if chimera_gem_on = 1:
	master_excitement = 5
	master_excitement_rate = 200
end

sex['pc_boner'] = master_excitement
sex['base_boner'] = master_excitement
pc_boner_plus = master_excitement

if sex['pc_boner'] <= 0:
	sex['pc_boner'] = 1
	pc_boner_plus = 1
end

!EXCITMENT
if master_excitement <= -5: sex['pc_excitement'] = -25
if master_excitement = -4: sex['pc_excitement'] = -20
if master_excitement = -3: sex['pc_excitement'] = -15
if master_excitement = -2: sex['pc_excitement'] = -10
if master_excitement = -1: sex['pc_excitement'] = -5
if master_excitement = 0: sex['pc_excitement'] = 0
if master_excitement = 1: sex['pc_excitement'] = 5
if master_excitement = 2: sex['pc_excitement'] = 10
if master_excitement = 3: sex['pc_excitement'] = 15
if master_excitement = 4: sex['pc_excitement'] = 20
if master_excitement >= 5: sex['pc_excitement'] = 25

if sex['pc_excitement'] < 0: sex['pc_excitement'] = 0

sex['prev_pc_excitement'] = sex['pc_excitement']

!INTEREST
if chimera_gem_on = 1: sex['pc_interest'] += 25

if sex['girl_beauty'] <= 0: sex['pc_interest'] -= 15
if sex['girl_beauty'] <= 1: sex['pc_interest'] -= 10
if sex['girl_beauty'] >= 3: sex['pc_interest'] += 5
if sex['girl_beauty'] >= 4: sex['pc_interest'] += 10
if sex['girl_beauty'] >= 5: sex['pc_interest'] += 25

if sex['girl_style'] <= 0: sex['pc_interest'] -= 10
if sex['girl_style'] <= 1: sex['pc_interest'] -= 5
if sex['girl_style'] >= 3: sex['pc_interest'] += 5
if sex['girl_style'] >= 4: sex['pc_interest'] += 10
if sex['girl_style'] >= 5: sex['pc_interest'] += 25

if sex['girl_exotic'] >= 1: sex['pc_interest'] += 5
if sex['girl_exotic'] >= 2: sex['pc_interest'] += 10
if sex['girl_exotic'] >= 3: sex['pc_interest'] += 10
if sex['girl_exotic'] >= 4: sex['pc_interest'] += 10
if sex['girl_exotic'] >= 5: sex['pc_interest'] += 15

if sex['girl_fat'] = 1 or sex['girl_fat'] = 2: sex['pc_interest'] += 20
if sex['girl_fat'] >= 3: sex['pc_interest'] -= 5
if sex['girl_fat'] >= 4: sex['pc_interest'] -= 10
if sex['girl_fat'] = 0: sex['pc_interest'] -= 10
if sex['girl_fat'] >= 5: sex['pc_interest'] -= 25

if sex['girl_dirty'] = 0: sex['pc_interest'] += 5
if sex['girl_dirty'] >= 2: sex['pc_interest'] -= 5
if sex['girl_dirty'] >= 3: sex['pc_interest'] -= 10
if sex['girl_dirty'] >= 4: sex['pc_interest'] -= 20
if sex['girl_dirty'] >= 5: sex['pc_interest'] -= 25

if master_mood <= -5: sex['pc_interest'] -= 5
if master_mood <= -4: sex['pc_interest'] -= 5
if master_mood <= -3: sex['pc_interest'] -= 5
if master_mood <= -2: sex['pc_interest'] -= 5
if master_mood <= -1: sex['pc_interest'] -= 5
if master_mood >= 1: sex['pc_interest'] += 5
if master_mood >= 2: sex['pc_interest'] += 5
if master_mood >= 3: sex['pc_interest'] += 5
if master_mood >= 4: sex['pc_interest'] += 5
if master_mood >= 5: sex['pc_interest'] += 5

if sex['pc_boner'] > 1: sex['pc_interest'] += 5
if sex['pc_boner'] > 2: sex['pc_interest'] += 10
if sex['pc_boner'] > 3: sex['pc_interest'] += 15
if sex['pc_boner'] > 4: sex['pc_interest'] += 20

if sex['girl_virginity'] = 1: sex['pc_interest'] += 10
sex['pc_interest'] += sex['girl_newness']

if sex['pc_interest'] < sex['girl_newness']: sex['pc_interest'] = sex['girl_newness']
if sex['pc_interest'] < 1: sex['pc_interest'] = 1

if sex['girl_age'] = CONST_INT['milf_age'] and sex['girl_boobs'] > 1:
	$boob_slosh_sexy = '<<$slave_boobs3_move[sex["girl_boobs"]]>>.'
else
	$boob_slosh_sexy = ''
end

dynamic $master_energy_drop

gs '$sex_newloc'
gt 'sex_screen'

--- sex_initiate ---------------------------------