code:
# #static_base
! database for static variables and utility functions that can be loaded at game start and never refreshed

! audio playlist (must use forward slashes, otherwise close command will not find the track)
$music['ride'] = 'content/snd/race_master.wav'
$music['arena'] = 'content/snd/fight_arena.wav'
$music['girl'] = 'content/snd/fight_girl.wav'
$music['fight'] = 'content/snd/fight_master.wav'
$music['home'] = 'content/snd/home.wav'
$music['badmood'] = 'content/snd/home_badmood.wav'
$music['goodmood'] = 'content/snd/home_goodmood.wav'
$music['verybadmood'] = 'content/snd/home_verybadmood.wav'
$music['verygoodmood'] = 'content/snd/home_verygoodmood.wav'
$music['city'] = 'content/snd/city.wav'
$music['honor'] = 'content/snd/city_honor.wav'
$music['poor'] = 'content/snd/city_poor.wav'
$music['citizen'] = 'content/snd/city_citizen.wav'
$music['night'] = 'content/snd/night.wav'
$music['fog'] = 'content/snd/fog.wav'
$music['mainscreen'] = 'content/snd/mainscreen.wav'
$music['nostalgic'] = 'content/snd/patrician_credits.wav'
$music['vatican'] = 'content/snd/vatican.wav'
$music['citadel'] = 'content/snd/citadel.wav'
$music['palace'] = 'content/snd/palace.wav'
$music['spires'] = 'content/snd/spires.wav'
$music['tower'] = 'content/snd/tower.wav'

!general and custom colors
!red
$_font_col[0] = ''
!blue
$_font_col[6] = ''
!light green
$_font_col[9] = ''
!green
$_font_col[10] = ''
!black
$_font_col[11] = ''
!silver
$_font_col[12] = ''

!colors for stats
$_font_col_stat[0] =  ''
$_font_col_stat[1] =  '' &! was FF0066
$_font_col_stat[2] =  '' &! was EA0090
$_font_col_stat[3] =  '' &! was FF4FBB
$_font_col_stat[4] =  '' &! was 6B0084
$_font_col_stat[5] =  '' &! was 0000A5
$_font_col_stat[6] =  '' &! was 0000D8
$_font_col_stat[7] =  '' &! was 006599
$_font_col_stat[8] =  '' &! was 009FEF
$_font_col_stat[9] =  '' &! was 006600
$_font_col_stat[10] = ''

!colors for ranks
$_font_col_rank[0] =  ''
$_font_col_rank[1] =  ''
$_font_col_rank[2] =  ''
$_font_col_rank[3] =  ''
$_font_col_rank[4] =  ''
$_font_col_rank[5] =  ''
$_font_col_rank[6] =  ''
$_font_col_rank[7] =  ''
$_font_col_rank[8] =  ''
$_font_col_rank[9] =  ''
$_font_col_rank[10] = ''

!colors for skills
$_font_col_skill[0] = ''
$_font_col_skill[1] = ''
$_font_col_skill[2] = ''
$_font_col_skill[3] = ''
$_font_col_skill[4] = ''
$_font_col_skill[5] = ''
$_font_col_skill[6] = '' &! was C49600

$_font_closer = ''

!TODO: добить замены во всем файле
$vb_cycle = {
	$result = $_font_col[args[0]] + $args[1] + $_font_closer
}

$vb_cycle_stat = {
	$result = $_font_col_stat[args[0]] + $args[1] + $_font_closer
}

$vb_cycle_rank = {
	$result = $_font_col_rank[args[0]] + $args[1] + $_font_closer
}

$vb_cycle_skill = {
	$result = $_font_col_skill[args[0]] + $args[1] + $_font_closer
}

! Replacement for consecutive colors with the same name
$vb_full_cycle = {
	$_arr_name = $args[0]
	_max_iter = args[1]
	$_caption = $args[2]
	$_tmp = ''

	_counter = 0
:_vb_full_cycle_loop
		!dynamic "<<$_arr_name>>[<<_counter>>] = dyneval($vb_cycle_skill, <<_counter>>, <<$_caption>>)"
		$_tmp = dyneval($vb_cycle_skill, _counter, $_caption)
		dynamic "<<$_arr_name>>[<<_counter>>] = $_tmp"
		_counter += 1
	if _counter <= _max_iter: jump '_vb_full_cycle_loop'

	killvar '$_arr_name'
	killvar '_max_iter'
	killvar '$_caption'
	killvar '_counter'
	killvar '$_tmp'
}
! dynamic $vb_full_cycle, '$slave_petting', 5, 'Петтинг'

!-----Replacement for font copypaste-----

! Constants table that replace the magic numbers
!Replacement for slave\assistant age etc.
!TODO: заменить в коде числа [0-2] на CONST_INT[?]
CONST_INT['young_age'] = 0
CONST_INT['loli_age'] = 1
CONST_INT['milf_age'] = 2

! age_code is used by generate_stock to interpret $special_age optional override
age_code['young'] = CONST_INT['young_age']
age_code['loli'] = CONST_INT['loli_age']
age_code['milf'] = CONST_INT['milf_age']

! $age is used by display_pic function to construct image path
$age[age_code['young']] = 'young'
$age[age_code['loli']] = 'loli'
$age[age_code['milf']] = 'milf'

!Replacement for slave\assistant status (slave_state)
!TODO: заменить в коде числа [0-3] на CONST_INT[?]
!changed dead state to negative to allow checking state > 0 for exists or fainted - ImperatorAugustus
!many places in code were checking for 'no_exist' instead of 'no_slave', did a mass-replace - ImperatorAugustus
CONST_INT['slave_dead'] = -1
CONST_INT['no_slave'] = 0
CONST_INT['slave_exist'] = 1
CONST_INT['slave_faint'] = 2

!MAIN CODE
!Оставлена старая замена, пока лень ковырять

!gladiator weapon
$style_wpn['retiarius'] = 'трезубец'
$style_wpn['flagrius'] = 'пилохлыст'
$style_wpn['dimacherus'] = 'бастард'
$style_wpn['hoplomachus'] = 'гладиус'
$style_wpn['kimerian'] = 'грейтекс'

$style_freehand['retiarius'] = ''
$style_freehand['flagrius'] = ''
$style_freehand['dimacherus'] = 'гладиус'
$style_freehand['hoplomachus'] = ''
$style_freehand['kimerian'] = ''

$armor['retiarius'] = 'без_брони' &! without armor
$armor['flagrius'] = 'полудоспех' &! combined armor
$armor['dimacherus'] = 'комбез' &! aramid suit
$armor['hoplomachus'] = 'эльчуга' &! elven chainmail
$armor['kimerian'] = 'без_брони' &! without armor

$gt_spm['retiarius'] = 'бросок_сети'
$gt_spm['flagrius'] = 'серейтор'
$gt_spm['dimacherus'] = 'ножницы'
$gt_spm['hoplomachus'] = 'толчок_щитом'
$gt_spm['kimerian'] = 'удар_с_разворота'

!fiend vars
semen_gain[0] = 12  &! daily
semen_gain[1] = 18  &! daily (+6)
semen_gain[2] = 24  &! daily (+6)
semen_gain[3] = 64  &! every other day (32/day, +8)
semen_gain[4] = 126 &! every third day (42/day, +10)

tentacle_grow[0] = 12
tentacle_grow[1] = 24
tentacle_grow[2] = 40
tentacle_grow[3] = 60
tentacle_grow[4] = 999999

tentacle_death[0] = -5
tentacle_death[1] = -10
tentacle_death[2] = -10
tentacle_death[3] = -10
tentacle_death[4] = -25

$tentacle_state[0] = ''
$tentacle_state[1] = dyneval($vb_cycle, 0, 'Crave')
$tentacle_state[2] = dyneval($vb_cycle, 10, 'Satisfied')

!lillimerge: added fiend names
$tentacle_chart = 'FIEND MATURITY
'
$tentacle_name[0] = dyneval($vb_cycle_skill, 1, 'Rear Gripper')    & $tentacle_chart += $tentacle_name[0]+'
'
$tentacle_name[1] = dyneval($vb_cycle_skill, 2, 'Dark Juvenile')   & $tentacle_chart += $tentacle_name[1]+'
'
$tentacle_name[2] = dyneval($vb_cycle_skill, 3, 'Tentacle Beast')  & $tentacle_chart += $tentacle_name[2]+'
'
$tentacle_name[3] = dyneval($vb_cycle_skill, 4, 'Kraken')          & $tentacle_chart += $tentacle_name[3]+'
'
$tentacle_name[4] = dyneval($vb_cycle_skill, 5, 'Leviathan')       & $tentacle_chart += $tentacle_name[4]+''

!training cost
$coach_price[0] = '5 sparks'
$coach_price[1] = '5 sparks'
$coach_price[2] = '10 sparks'
$coach_price[3] = '15 sparks'
$coach_price[4] = '20 sparks'
$coach_price[5] = '25 sparks'

coach_price[0] = 5
coach_price[1] = 5
coach_price[2] = 10
coach_price[3] = 15
coach_price[4] = 20
coach_price[5] = 25

$school_price[0] = '2 sparks'
$school_price[1] = '2 sparks'
$school_price[2] = '5 sparks'
$school_price[3] = '7 sparks'
$school_price[4] = '10 sparks'
$school_price[5] = '12 sparks'

school_price[0] = 2
school_price[1] = 2
school_price[2] = 5
school_price[3] = 7
school_price[4] = 10
school_price[5] = 12

$specialisation[1] = 'refferent'
$specialisation[2] = 'pet'
$specialisation[3] = 'servant'
$specialisation[4] = 'witchdoctor'
$specialisation[5] = 'gladiatrix'
$specialisation[6] = 'artist'
$specialisation[7] = 'concubine'

$large_money_sound = 'content\snd\purse.wav'
$small_money_sound = 'content\snd\coins.wav'

!define rebell for psy-status (negative is treated as obedient but without enthusiasm, positive is treated as disobedient)
rebell['arrogant'] = 2
rebell['broken'] = -100
rebell['depresive'] = -1
rebell['docile'] = -1
rebell['frightened'] = -2
rebell['hateful'] = 4
rebell['horny'] = 0
rebell['hysteric'] = 3
rebell['lachrymose'] = -1
rebell['obedient'] = 0
rebell['optimistic'] = 0
rebell['reluctant'] = 0
rebell['resistant'] = 3
rebell['servile'] = 0
rebell['soft'] = 0

!!!!!utility function to append sequentially number-indexed elements from a source array to a target array
! for example, assume a[0] = 5, a[1] = 10, arrsize('a') = 2, b[0] = 15, b[1] = 20: after appending 'b' to 'a', a[2] will be 20 and a[3] will be 25)
! syntax: dynamic $array_append, '$target_array', '$source_array', [# start index in source array], [# number of elements to copy: arrsize($source_array) - start index by default]
! unlike copyarr which copies both the numeric and string form of an array, if you want to append 'b' to 'a' and '$b' to '$a' with this function, you must call it twice
$array_append = {
	$array_append_target_array = $args[0]
	$array_append_source_array = $args[1]
	array_append_num_to_copy = args[3]
	array_append_iterator = args[2]
	if (array_append_num_to_copy <= 0): array_append_num_to_copy = arrsize($array_append_source_array) - array_append_iterator
	if array_append_iterator < array_append_num_to_copy:
		:array_append_loop
			dynamic "<<$array_append_target_array>>[] = <<$array_append_source_array>>[<<array_append_iterator>>]"
			array_append_iterator += 1
		if array_append_iterator < array_append_num_to_copy: jump 'array_append_loop'
	end
	killvar '$array_append_target_array'
	killvar '$array_append_source_array'
	killvar 'array_append_num_to_copy'
	killvar 'array_append_iterator'
}

!!!!!categorize slave types in lists so we can use loops to apply effects to groups of them at once (for use with $do_for_each_slave_in_list in #dynamic)

!!!categories without overlap (each listed slave type appears in only one category):

! characters that can leave home with the master
killvar '$mobile_slave_characters'
$mobile_slave_characters[] = 'slave'
$mobile_slave_characters[] = 'assistant'

!characters that are imprisoned (prisoner) are a special case

! characters that are confined in the barn
killvar '$livestock_slave_characters'
$livestock_slave_characters[] = 'cow'
$livestock_slave_characters[] = 'pig'
$livestock_slave_characters[] = 'harpy'

! characters that are stored in stasis
killvar '$iced_slave_characters'
$iced_slave_characters[] = 'iced_1'
$iced_slave_characters[] = 'iced_2'
$iced_slave_characters[] = 'iced_3'
$iced_slave_characters[] = 'iced_4'
$iced_slave_characters[] = 'iced_5'
$iced_slave_characters[] = 'iced_6'

!!!overlapping combinations of the above categories (note: copyarr overwrites the target variable so it cannot be used to concatenate arrays)

!characters whose personal screens can be directly accessed from the main screen
killvar '$main_screen_slave_characters'
$main_screen_slave_characters[] = 'slave'
$main_screen_slave_characters[] = 'assistant'
$main_screen_slave_characters[] = 'prisoner'
$main_screen_slave_characters[] = 'cow'

!slaves in management roles
killvar '$assistant_slave_characters'
$assistant_slave_characters[] = 'assistant'
$assistant_slave_characters[] = 'farmhand'

!livestock plus farmhand
killvar '$barn_slave_characters'
copyarr '$barn_slave_characters', '$livestock_slave_characters'
$barn_slave_characters[] = 'farmhand'

!all except iced, livestock and prisoner
killvar '$unconfined_slave_characters'
copyarr '$unconfined_slave_characters','$mobile_slave_characters'
$unconfined_slave_characters[] = 'farmhand'

!all except iced
killvar '$unfrozen_slave_characters'
copyarr '$unfrozen_slave_characters','$main_screen_slave_characters'
$unfrozen_slave_characters[] = 'farmhand'
$unfrozen_slave_characters[] = 'harpy'
$unfrozen_slave_characters[] = 'pig'

!all
killvar '$all_slave_characters'
copyarr '$all_slave_characters', '$unfrozen_slave_characters'
dynamic $array_append, '$all_slave_characters', '$iced_slave_characters' &! using helper function to append because copyarr overwrites the target array

!!!!!utility function to loop through a list of slave types and run a specified dynamic function on each of them
! the dynamic function code can use dynslave as a generic slave variable/prefix, which will be replaced by each value from the list
! example usage:  dynamic $do_for_each_slave_in_list, '$next_day_forgotten_rewards', '$unfrozen_slave_characters' &! all except iced
!  will run dynamic $replace($next_day_forgotten_rewards, 'dynslave', 'slave'), dynamic $replace($next_day_forgotten_rewards, 'dynslave', 'assistant'), etc.
$do_for_each_slave_in_list = {
	!uncomment next line for troubleshooting
	if debug = 1: msg "$do_for_each_slave_in_list '<<$args[0]>>', '<<$args[1]>>'"
	do_for_each_slave_in_list_count = arrsize($args[1])
	if do_for_each_slave_in_list_count > 0:
		do_for_each_slave_in_list_index = 0
		:do_for_each_slave_in_list_loop
			dynamic "
				dynamic $replace(<<$args[0]>>, 'dynslave', <<$args[1]>>[do_for_each_slave_in_list_index]), <<$args[1]>>[do_for_each_slave_in_list_index] &! replace dynslave and pass as $args[0]
			"
			do_for_each_slave_in_list_index += 1
		if do_for_each_slave_in_list_index < do_for_each_slave_in_list_count: jump 'do_for_each_slave_in_list_loop'
	end
}

!!!!! define "object classes" with groups of associated "variables" and "methods" that can be initialized, cleared, updated, and swapped with equivalent groups of variables with a common instance name (e.g., slave, iced_2)
!killvar '$archetypes'
!$archetypes[] = 'playable'
!$archetypes[] = 'place'
!$archetypes[] = 'item'
!$archetypes[] = 'npc'

!killvar '$playable_types'
!$playable_types[] = 'master' &! "inherits" from playable
!$playable_types[] = 'slave' &! "inherits" from playable

!! lists of associated variables ('instance' in the names will be substituted with a unique name for each instance of the object)
!! here we are listing discrete variables (not individual properties/fields/indices) that collectively represent a single unique instance of an object type
!! discrete variables should be minimized in favor of properties on instance variables, because copyarr and killall make it easy to rename or clear arrays
!! however, here are some good reasons to use discrete variables:
!! 1. to represent child arrays (inventory, for example) because QSP does not support nested arrays (multiple dimensions or arrays of arrays)
!! 2. for performance (storing frequently-accessed data in a separate var avoids searching through a long array of strings for a given index)

killvar '$playable_vars'
$playable_vars[] = 'instance'            &! e.g., 'master' or 'slave'
$playable_vars[] = 'instance_state'      &! e.g., 'master_state' or 'slave_state'                                       &! number var, frequently accessed
$playable_vars[] = '$instance_name'      &! e.g., '$master_name' or '$slave_name'                                       &! string var, frequently accessed
$playable_vars[] = '$instance_ava'       &! e.g., '$master_ava' or '$slave_ava'                                         &! string var, frequently accessed

$playable_vars[] = 'instance_type'       &! e.g., 'master_type' or 'slave_type'                                         &! number var, not frequently accessed, make this a property
$playable_vars[] = 'instance_rate'       &! e.g., 'master_rate' or 'slave_rate'                                         &! array var, each string index corresponds to an attribute, with a number as the value
$playable_vars[] = 'instance_inventory'  &! e.g., 'master_inventory' or 'slave_inventory'                               &! array var, each string index corresponds to an item type, with a count as the value

killvar '$master_vars'
copyarr '$master_vars', '$playable_vars' &! $master_vars inherits from $playable_vars

$masters_vars[] = 'instance_mood'                     &! 'master_mood' array var, each string index corresponds to a moodlet name, with a number as the value (remaining duration)

killvar '$slave_vars'
copyarr '$slave_vars', '$playable_vars' &! $slave_vars inherits from $playable_vars

$slave_vars[] = '$instance_psy_basic'                 &! TODO: not an array type, make this a property
$slave_vars[] = '$instance_psy_status'                &! TODO: not an array type, make this a property
$slave_vars[] = '$instance_world'                     &! TODO: not an array type, make this a property
$slave_vars[] = '$instance_world_description'         &! TODO: not an array type, make this a property
$slave_vars[] = '$instance_family'                    &! TODO: not an array type, make this a property
$slave_vars[] = '$instance_family_description'        &! TODO: not an array type, make this a property
$slave_vars[] = '$instance_occupation'                &! TODO: not an array type, make this a property
$slave_vars[] = '$instance_occupation_description'    &! TODO: not an array type, make this a property

$slave_vars[] = 'instance_already_done_today'         &! instance-specific version of already_done_today    &! array var, each index corresponds to an interaction id, with a count as the value
$slave_vars[] = 'instance_already_done_total'         &! replaced 'already_done_curslave'                   &! array var, each index corresponds to an interaction id, with a count as the value
$slave_vars[] = 'instance_already_done_recent'        &! new in 2.2                                         &! array var, each index corresponds to an interaction id, with a count as the value
$slave_vars[] = 'instance_already_sex_today'          &! replaced 'today_sex_curslave'                      &! array var, each index corresponds to an interaction id, with a count as the value
$slave_vars[] = 'instance_already_sex_total'          &! replaced 'already_sex_curslave'                    &! array var, each index corresponds to an interaction id, with a count as the value

$slave_vars[] = 'interaction_instance'                &! per-slave-instance reset-for-each-interaction keys &! array var, each string index corresponds to a "key" name, with an integer value

!swap two slave instances together with all associated variables
!call with: dynamic $swap_slave_instances, 'instance1', 'instance2'  where each instance is e.g., 'slave', 'iced_1', 'prisoner', 'farmhand', etc.

$swap_slave_instances = {
	_counter = arrsize('$slave_vars')
	:_swap_slave_instance_loop
		_counter -= 1
		$from_var = $replace($slave_vars[_counter], 'instance', $args[0])
		$to_var = $replace($slave_vars[_counter], 'instance', $args[1])
		! from -> _temp
		killvar '_temp'
		copyarr '_temp', $from_var
		! to   -> from
		killvar $from_var
		copyarr $from_var, $to_var
		! temp -> to
		killvar $to_var
		copyarr $to_var, '_temp'
	if _counter > 0: jump '_swap_slave_instance_loop'

	killvar '$from_var'
	killvar '$to_var'
	killvar '_temp'
	killvar '_counter'

	! update strings that may contain if statements or subexpressions referring to these slave instances
	dynamic $replace($update_slave_features_list, 'dyn'+'slave', $args[0])
	dynamic $replace($update_slave_features_list, 'dyn'+'slave', $args[1])
	gs '#var_base'
	gs '#txt'   &! after #var_base
	gs '#txt_2' &! after #var_base
}

$clear_slave_instance = {
	_counter = arrsize('$slave_vars')
	:_clear_slave_instance_loop
		_counter -= 1
		killvar $replace($slave_vars[_counter], 'instance', $args[0])
	if _counter > 0: jump '_clear_slave_instance_loop'
	killvar '_counter'

	dynamic "
		$<<$args[0]>>['wpn'] = 'безоружный' &! fists
		$<<$args[0]>>['right_wpn'] = 'безоружный' &! fists
		$<<$args[0]>>['left_wpn'] = 'безоружный' &! fists
		$<<$args[0]>>['armor'] = 'без_брони' &! without armor
		$<<$args[0]>>['cloth'] = 'голая' &! naked
	"

	! update strings that may contain if statements or subexpressions referring to the cleared slave instance
	gs '#var_base'
	gs '#txt'   &! after #var_base
	gs '#txt_2' &! after #var_base
end
}

!!!!! core game function to refresh characteristics (attributes, skills) from associated rate counters and enforce upper and lower bounds - called by $newloc and generate_stock
$dyn_calc_slave_attrs = {
	if dynslave_state > CONST_INT['no_slave']:

		!Continuous field dependence (primary value is computed from rate variable, which represents continuous -- i.e., complete -- range of primary value)
		!Temporary rate will be added/subtracted (e.g., dynslave_rate['temp_beauty'], dynslave_rate['temp_exotic'], dynslave_rate['temp_style'])
		i = 0
		n = arrsize('$cont_atr')
		:slave_cont_loop
			if dynslave_rate[$cont_atr[i]] < cont_atr_min: dynslave_rate[$cont_atr[i]] = cont_atr_min &! zero is lower bound for rate
			if dynslave_rate[$cont_atr[i]] > cont_atr_max: dynslave_rate[$cont_atr[i]] = cont_atr_max &! 200 is upper bound for rate
			rate = dynslave_rate[$cont_atr[i]] + dynslave_rate['temp_' + $cont_atr[i]]
			dynslave[$cont_atr[i]] = 0
			if rate >= cont_atr_threshold[1]: dynslave[$cont_atr[i]] = 1
			if rate >= cont_atr_threshold[2]: dynslave[$cont_atr[i]] = 2
			if rate >= cont_atr_threshold[3]: dynslave[$cont_atr[i]] = 3
			if rate >= cont_atr_threshold[4]: dynslave[$cont_atr[i]] = 4
			if rate >= cont_atr_threshold[5]: dynslave[$cont_atr[i]] = 5
			i += 1
		if i < n: jump 'slave_cont_loop'

		! Linked stats - high physique (fat) imposes a cap on endurance (stamina)
		if dynslave['fat'] > 3 and dynslave['stamina'] >= 4: dynslave['stamina'] = 4 & dynslave_rate['stamina'] = min(dynslave_rate['stamina'], 0)

		!Discrete, field independence (stats - range and interpretation of rate variable depends on current primary value)
		i = 0
		n = arrsize('$indep_atr')
		:slave_independent_loop
			!ImperatorAugustus: enforce [0,5] range for primary value
			if dynslave[$indep_atr[i]] < 0: dynslave[$indep_atr[i]] = 0
			if dynslave[$indep_atr[i]] > 5: dynslave[$indep_atr[i]] = 5
			rate = dynslave_rate[$indep_atr[i]]
			if dynslave[$indep_atr[i]] = 0:
				if rate <= indep_atr_min_threshold[0]: dynslave_rate[$indep_atr[i]] = indep_atr_min_threshold[0]
				if rate >= indep_atr_max_threshold[0]: dynslave[$indep_atr[i]] += 1 & dynslave_rate[$indep_atr[i]] = 0
			elseif dynslave[$indep_atr[i]] = 1:
				if rate <= indep_atr_min_threshold[1]: dynslave[$indep_atr[i]] -= 1 & dynslave_rate[$indep_atr[i]] = 0
				if rate >= indep_atr_max_threshold[1]: dynslave[$indep_atr[i]] += 1 & dynslave_rate[$indep_atr[i]] = 0
			elseif dynslave[$indep_atr[i]] = 2:
				if rate <= indep_atr_min_threshold[2]: dynslave[$indep_atr[i]] -= 1 & dynslave_rate[$indep_atr[i]] = 0
				if rate >= indep_atr_max_threshold[2]: dynslave[$indep_atr[i]] += 1 & dynslave_rate[$indep_atr[i]] = 0
			elseif dynslave[$indep_atr[i]] = 3:
				if rate <= indep_atr_min_threshold[3]: dynslave[$indep_atr[i]] -= 1 & dynslave_rate[$indep_atr[i]] = 0
				if rate >= indep_atr_max_threshold[3]: dynslave[$indep_atr[i]] += 1 & dynslave_rate[$indep_atr[i]] = 0
			elseif dynslave[$indep_atr[i]] = 4:
				if rate <= indep_atr_min_threshold[4]: dynslave[$indep_atr[i]] -= 1 & dynslave_rate[$indep_atr[i]] = 0
				if rate >= indep_atr_max_threshold[4]: dynslave[$indep_atr[i]] += 1 & dynslave_rate[$indep_atr[i]] = 0
			elseif dynslave[$indep_atr[i]] = 5:
				if rate <= indep_atr_min_threshold[5]: dynslave[$indep_atr[i]] -= 1 & dynslave_rate[$indep_atr[i]] = 0
				if rate >  indep_atr_max_threshold[5]: dynslave_rate[$indep_atr[i]] = indep_atr_max_threshold[5]
			end
			i += 1
		if i < n: jump 'slave_independent_loop'

		!Discrete, field semi-dependence (non-sexual skills - rate threshold for increase or decrease depends on current skill level and whether there is an affinity)
		i = 0
		n = arrsize('$dep_atr')
		:slave_dependent_loop
			!ImperatorAugustus: enforce [0,5] range for primary value
			if dynslave[$dep_atr[i]] < 0: dynslave[$dep_atr[i]] = 0
			if dynslave[$dep_atr[i]] > 5: dynslave[$dep_atr[i]] = 5
			!Rate thresholds required to level skill up or down
			srd1 = 5
			srd2 = 10
			srd3 = 20
			srd4 = 40
			!Check for affinity (zero or negative affinity increases rate threshold required to increase or decrease primary level)
			affinity[$dep_atr[i]] = dynslave[$dep_atr[i]+'_affinity']
			if affinity[$dep_atr[i]] <= 0:
				slave_rm = dynslave[$dep_atr[i]]
				srd1 += slave_rm/2
				srd2 += slave_rm
				srd3 += slave_rm*2
				srd4 += slave_rm*3
			end
			!ImperatorAugustus:  fixed a long-standing bug where assistant was using slave skill affinity instead of assistant skill affinity
			!The main calculation of discrete, semi-dependent (skills)
			rate = dynslave_rate[$dep_atr[i]]
			if dynslave[$dep_atr[i]] = 0:
				if rate < 0:      dynslave[$dep_atr[i]] = 0 & dynslave_rate[$dep_atr[i]] = 0
				if rate >= srd1:  dynslave[$dep_atr[i]] = 1 & dynslave_rate[$dep_atr[i]] = 0
			elseif dynslave[$dep_atr[i]] = 1:
				if rate <= -srd1: dynslave[$dep_atr[i]] = 0 & dynslave_rate[$dep_atr[i]] = 0
				if rate >= srd1:  dynslave[$dep_atr[i]] = 2 & dynslave_rate[$dep_atr[i]] = 0
			elseif dynslave[$dep_atr[i]] = 2:
				if rate <= -srd2: dynslave[$dep_atr[i]] = 1 & dynslave_rate[$dep_atr[i]] = 0
				if rate >= srd2:  dynslave[$dep_atr[i]] = 3 & dynslave_rate[$dep_atr[i]] = 0
			elseif dynslave[$dep_atr[i]] = 3:
				if rate <= -srd3: dynslave[$dep_atr[i]] = 2 & dynslave_rate[$dep_atr[i]] = 0
				if rate >= srd3:  dynslave[$dep_atr[i]] = 4 & dynslave_rate[$dep_atr[i]] = 0
			elseif dynslave[$dep_atr[i]] = 4:
				if rate <= -srd4: dynslave[$dep_atr[i]] = 3 & dynslave_rate[$dep_atr[i]] = 0
				if rate >= srd4:  dynslave[$dep_atr[i]] = 5 & dynslave_rate[$dep_atr[i]] = 0
			elseif dynslave[$dep_atr[i]] = 5:
				if rate < -srd4:  dynslave[$dep_atr[i]] = 4 & dynslave_rate[$dep_atr[i]] = 0
				if rate > 10:     dynslave[$dep_atr[i]] = 5 & dynslave_rate[$dep_atr[i]] = 10
			end
			i += 1
		if i < n: jump 'slave_dependent_loop'

		!Discrete, field semi-dependence (sexual skills - does not use rate thresholds, for now just enforce upper and lower bounds [0,5])
		i = 0
		n = arrsize('$sex_atr')
		:slave_sex_subskill_loop
			if dynslave[$sex_atr[i]] < 0:
				dynslave[$sex_atr[i]] = 0
			elseif dynslave[$sex_atr[i]] > 5:
				dynslave[$sex_atr[i]] = 5
			end
			i += 1
		if i < n: jump 'slave_sex_subskill_loop'

		!Linked sex skills
		dynslave['sub_hug'] = max(dynslave['sub_hug'], min(1, dynslave['sub_paizuri']), min(1, dynslave['sub_vaginal'])) &! rubbing rises to D- if paizuri or vaginal is at least D-
		dynslave['sub_hj'] =  max(dynslave['sub_hj'], min(2, dynslave['petting'])) &! handjob rises to D- and C- together with petting category
		dynslave['sub_fj'] =  max(dynslave['sub_fj'], min(2, dynslave['petting'])) &! footjob rises to D- and C- together with petting category
		dynslave['petting'] = (dynslave['sub_hj'] + dynslave['sub_fj'] + dynslave['sub_hug'] + dynslave['sub_paizuri'])/4

		dynslave['sub_bj'] = max(dynslave['sub_bj'], min(3, max(dynslave['sub_dt'], dynslave['sub_bukkake'] - 2, dynslave['orgy']))) &! blowjob rises up to B+ with deepthroat, bukkake (lagging two levels), group sex
		dynslave['sub_tongue'] = max(dynslave['sub_tongue'], min(3, dynslave['oral'])) &! licking rises to D-, C-, B+ together with oral category
		dynslave['oral'] = (dynslave['sub_kiss'] + dynslave['sub_tongue'] + dynslave['sub_bj'] + dynslave['sub_dt'] + dynslave['sub_asslik'])/5

		dynslave['sub_vaginal'] =  max(dynslave['sub_vaginal'],  min(2, dynslave['sub_fisting'])) &! vaginal rises with vaginal fisting up to C-
		dynslave['sub_anal'] =     max(dynslave['sub_anal'],     min(2, dynslave['anal_stretch'])) &! anal rises with anal fisting up to C-
		dynslave['sub_vaginal'] =  max(dynslave['sub_vaginal'],  min(3, max(dynslave['sub_dp'], dynslave['sub_tp'], dynslave['sub_gangbang']))) &! vaginal rises with group sex up to B+
		dynslave['sub_anal'] =     max(dynslave['sub_anal'],     min(3, max(dynslave['sub_dp'], dynslave['sub_tp'], dynslave['sub_gangbang']))) &! anal rises with group sex up to B+
		dynslave['sub_fisting'] =  max(dynslave['sub_fisting'],  min(2, dynslave['sub_vaginal'])) &! fisting rises to D- and C- together with vaginal
		dynslave['anal_stretch'] = max(dynslave['anal_stretch'], min(2, dynslave['sub_anal'])) &! anal fisting rises to D- and C- together with anal
		dynslave['penetration'] = (dynslave['sub_vaginal'] + dynslave['sub_anal'] + dynslave['sub_fisting'] + dynslave['anal_stretch'])/4

		!Vagina type becoming 'developed' if sub_fisting > 3 - Pianocat (added check for restored hymen and raised threshold - ImperatorAugustus)
		if dynslave['sub_fisting'] > 3 and dynslave['virginity'] = 2: dynslave['virginity'] = 3

		dynslave['sub_exhibit'] = max(dynslave['sub_exhibit'], min(1, dynslave['sub_humiliation'])) &! exhibitionism rises to D- when humiliation is D- or higher
		dynslave['sub_humiliation'] = max(dynslave['sub_humiliation'], min(1, dynslave['sub_exhibit'])) &! humiliation rises to D- when exhibitionism is D- or higher
		dynslave['sub_dildo'] = max(dynslave['sub_dildo'], iif(dynslave['sub_vaginal'] > 0, 2, 0)) &! dildo skips to C- when vaginal is D- or higher
		dynslave['sub_masturbation'] = max(dynslave['sub_masturbation'], min(1, dynslave['sub_exhibit'] - 2), min(3, dynslave['sub_dildo'])) &! masturbation rises to D- when exhibitionism is B+ or higher and rises with dildo to B+
		dynslave['sub_seduce'] = max(dynslave['sub_seduce'], min(2, dynslave['sub_exhibit'] - 1)) &! seduction rises with exhibitionism up to C- (lagging by 1)
		dynslave['roleplay'] = (dynslave['sub_seduce'] + dynslave['sub_masturbation'] + dynslave['sub_dildo'] + dynslave['sub_exhibit'] + dynslave['sub_humiliation'])/5

		dynslave['sub_mazo'] = max(dynslave['sub_mazo'], min(3, dynslave['sub_selfpain'])) &! masochism rises to D-, C-, B+ with self-torture
		dynslave['sub_selfpain'] = max(dynslave['sub_selfpain'], min(1, dynslave['sub_mazo'])) &! self-torture rises to D- if masochism is at least D-
		dynslave['sub_piss'] = max(dynslave['sub_piss'], min(2, dynslave['sub_kopro'] - 3)) &! golden shower rises with coprophagia, but lags by three levels (not higher than C-)
		dynslave['fetishism'] = (dynslave['sub_enema'] + dynslave['sub_mazo'] + dynslave['sub_selfpain'] + dynslave['sub_piss'] + dynslave['sub_kopro'])/5

		dynslave['sub_tp'] = max(dynslave['sub_tp'], min(3, dynslave['sub_gangbang'])) &! triple penetration rises with gangbang up to B+
		dynslave['sub_dp'] = max(dynslave['sub_dp'], dynslave['sub_tp']) &! double penetration rises with triple penetration and gangbang (implicitly)
		dynslave['sub_bukkake'] = max(dynslave['sub_bukkake'], min(3, dynslave['sub_bj']/3 + dynslave['sub_hj']/3 + dynslave['sub_tongue']/3)) &! bukkake rises when blowjob is B+, handjob is B+, licking is B+, but none of these can raise bukkake above B+ overall
		dynslave['orgy'] = (dynslave['sub_threesome'] + dynslave['sub_dp'] + dynslave['sub_tp'] + dynslave['sub_gangbang'] + dynslave['sub_bukkake'])/5

		dynslave['sub_polypusvermin'] = max(dynslave['sub_polypusvermin'], min(2, dynslave['sub_tentacles'])) &! sea tentacle mating rises with fiend milking up to C- (but not vice versa) - ImperatorAugustus
		dynslave['xenophily'] = (dynslave['sub_arachnidspider'] + dynslave['sub_polypusvermin'] + dynslave['sub_zoosex'] + dynslave['sub_bestiality'] + dynslave['sub_horse'] + dynslave['sub_tentacles'])/6

	end &! end of slave conscious/fainted check
}

$set_obedience_difficulty = {
	if dynslave_state > CONST_INT['no_slave']:
		! state check includes fainted - ImperatorAugustus

		if difficulty_setting = 1:
			!Easy
			if game_difficulty ! 0 or demo_game = 1: skill_adv_mul = 2 &! 2x training speed with easy obedience difficulty unless easy custom game which has a menu option for it (added in 2.3.1) - ImperatorAugustus
			dynslave['obedience_difficulty'] = 2
			slave_obedience_bonus += 4 &! not dynslave is correct here - ImperatorAugustus
			! *_obedience_bonus is used in $newloc, $slave_price and $assistant_rank_stats -ImperatorAugustus
			if overnight_rules_count < 3: overnight_rules_count = 3
			! overnight_rules_count is used only in next_day -ImperatorAugustus
			if dynslave['daily_reward_count'] > 2: dynslave['daily_reward_count'] = 2
			if dynslave['daily_punishment_count'] > 2: dynslave['daily_punishment_count'] = 2
			if dynslave['spoil'] > 3: dynslave['spoil'] = 3 & dynslave_rate['spoil'] = 10
			if dynslave['angst'] > 3: dynslave['angst'] = 3 & dynslave_rate['angst'] = 10
		elseif difficulty_setting = 0:
			!Normal
			if game_difficulty ! 0: skill_adv_mul = 1 &! 1x training speed with normal obedience difficulty unless easy custom game which has a menu option for it (added in 2.3.1) - ImperatorAugustus
			dynslave['obedience_difficulty'] = 4
			if overnight_rules_count = 2: overnight_rules_count = 3
			! overnight_rules_count is used only in next_day -ImperatorAugustus
			if dynslave['daily_reward_count'] = 3: dynslave['daily_reward_count'] = 2
			if dynslave['daily_punishment_count'] = 3: dynslave['daily_punishment_count'] = 2
		elseif difficulty_setting = 2:
			!Difficult/Hardcore
			if game_difficulty ! 0: skill_adv_mul = 1 &! 1x training speed with hardcore obedience difficulty unless easy custom game which has a menu option for it (added in 2.3.1) - ImperatorAugustus
			! disabled daily obedience increase and fixed obedience difficulty at 14 for 0 devotion, 10 for 1 devotion, 6 for 2 or more devotion - ImperatorAugustus
			! this removes how long you have owned the slave as a factor, and replaces it with an obedience increase at 1 devotion (equivalent to obedience after one decade in the old formula)
			! this tracks with the old formula that reduced obedience difficulty down to a minimum of 6 (see commented code below) so the net gameplay effect is to emphasize devotion vs. time
			dynslave['obedience_difficulty'] = 14 - min(8, 4 * dynslave['moral'])
			!if dynslave['age_count'] = 0: dynslave['obedience_difficulty'] = 14
			!if dynslave['age_count'] = 1: dynslave['obedience_difficulty'] = 13
			!if dynslave['age_count'] = 2: dynslave['obedience_difficulty'] = 12
			!if dynslave['age_count'] = 3: dynslave['obedience_difficulty'] = 11
			!if dynslave['age_count'] = 4: dynslave['obedience_difficulty'] = 10
			!if dynslave['age_count'] = 5: dynslave['obedience_difficulty'] = 9
			!if dynslave['age_count'] = 6: dynslave['obedience_difficulty'] = 8
			!if dynslave['age_count'] = 7: dynslave['obedience_difficulty'] = 7
			!if dynslave['age_count'] >= 8: dynslave['obedience_difficulty'] = 6

			!Obedience difficult daily decrease - crushboss
			!if slave_state = CONST_INT['slave_exist'] and difficulty_setting = 2:
			!	if slave['moral'] > 2 and slave['obedience_difficulty'] > 6: slave['obedience_difficulty'] = 6
			!	if slave['obedience_difficulty'] > 6:
			!		slave['obedience_difficulty'] -= 1
			!	elseif slave['obedience_difficulty'] < 6:
			!		slave['obedience_difficulty'] += 1
			!	end
			!end
		end

	end &! end of conscious/fainted check
}

$update_slave_energy_stars = {
	if dynslave_state > CONST_INT['no_slave']:

		$dynslave_energy_stars = ''
		! if energy exceeds cap and a half star is missing, refill it
		if dynslave['energy'] > dynslave['stamina'] and dynslave['half_action'] = 1: dynslave['half_action'] = 0
		! transfer bonus energy stars (negative half_actions) to normal energy stars
		if dynslave['half_action'] < 0 and dynslave['energy'] < dynslave['stamina']:
			dynslave['energy'] += (-1 * dynslave['half_action']) / 2
			dynslave['half_action'] = dynslave['half_action'] MOD 2 - max(0, dynslave['energy'] - dynslave['stamina'])*2
		end
		! consume spent half actions (positive half_actions)
		:_process_slave_half_actions_loop
			if dynslave['half_action'] > 1: dynslave['half_action'] -= 2 & dynamic $replace($dynamic_energy_drop, 'dyn'+'slave', 'dynslave')
			if dynslave['half_action'] > 1: jump '_process_slave_half_actions_loop'
		! clamp value
		dynslave['energy'] = max(-5, min(dynslave['stamina'], dynslave['energy']))
		! update exhausted moodlet state, which affects the color of energy stars
		if dynslave['energy'] < 0 or dynslave_already_done_today['exertion'] >= dynslave['stamina']:
			dynslave['neg_exhausted'] = 100
		else
			dynslave['neg_exhausted'] = 0
		end
		! assemble row of images corresponding to current energy level and exhaustion status
		if dynslave['energy'] = 0:
			if dynslave['half_action'] = 1:
				$dynslave_energy_stars = ''
			elseif dynslave['half_action'] = -1:
				$dynslave_energy_stars = iif(dynslave['neg_exhausted'] = 0, '', '') + ''
			else
				$dynslave_energy_stars = '-'
			end
		else
			if dynslave['energy'] < 0:
				for i = 1 to (5 + dynslave['energy']) step 1: $dynslave_energy_stars += iif(i = (5 + dynslave['energy']) and dynslave['half_action'] = 1, '', '')
				for i = 1 to (-1 * dynslave['energy']) step 1: $dynslave_energy_stars += iif(i = 1 and (dynslave['half_action'] MOD 2) = -1, '', '')
			else
				for i = 1 to (dynslave['energy'] + max(0, dynslave['half_action']/-2)) step 1: $dynslave_energy_stars += iif(i = dynslave['energy'] and dynslave['half_action'] = 1, iif(dynslave['neg_exhausted'] = 0, '', ''), iif(dynslave['neg_exhausted'] = 0, '', ''))
				if (dynslave['half_action'] MOD 2) = -1:
					$dynslave_energy_stars += iif(dynslave['neg_exhausted'] = 0, '', '')
					if (5 - dynslave['energy'] - max(0, dynslave['half_action']/-2)) > 1: for i = 2 to (5 - dynslave['energy'] - max(0, dynslave['half_action']/-2)) step 1: $dynslave_energy_stars += ''
				elseif (5 - dynslave['energy'] - max(0, dynslave['half_action']/-2)) > 0:
					for i = 1 to (5 - dynslave['energy'] - max(0, dynslave['half_action']/-2)) step 1: $dynslave_energy_stars += ''
				end
			end
		end
		! display blue stars for night energy saved up from rest rewards during the day, to be spent at night (rules) or carried over to the next day (amount capped by endurance)
		if dynslave['well_rested'] > 0:
			$dynslave_energy_stars += ' '
			for i = 1 to dynslave['well_rested'] step 1: $dynslave_energy_stars += ''
		end

	end &! end of conscious or fainted state check
}

$recalc_slave_mood = {
	!this dynamic function should be executed with dynamic $replace($recalc_slave_mood, 'dynslave', 'ACTUAL SLAVE VARIABLE NAME')
	!recalculates mood and constructs an array of mood description strings from active moodlets, item mood bonuses and mood rate
	if dynslave_state ! CONST_INT['no_slave']:
		dynslave['mood'] = 0
		killvar '$dynslave_mood_list'
		ndex = 1 &! index into above variable (first moodlet description will be added at index 1)

		if $dynslave_psy_status = 'broken': jump 'recalc_slave_mood_psy_broken' &! mind-broken slaves are always calm - ImperatorAugustus

		! apply worn clothing mood bonuses/penalties ($recalc_equipment_bonuses can change which moodlets are active, so run it first)
		dynamic $replace($recalc_equipment_bonuses, 'dyn'+'slave', 'dynslave') &! split the first to protect from earlier $replace
		dynslave['mood'] += worn_bonus['mood'] &! mood bonus can be positive, negative or zero as sum of all applicable item effects

		!mood rate was being reset every time - changed to re-apply on each refresh and clear in next_day - ImperatorAugustus
		dynslave['mood'] += (dynslave_rate['mood'] + worn_bonus['mood_rate']) / 10 &! note: mood rate can be negative

		n = arrsize('$slave_good_mood')
		i = 0 &! moods start from index 0
		:recalc_slave_mood_loop1
			$curmod = $slave_good_mood[i]
			if dynslave[$curmod] > 0:
				dynamic "$dynslave_mood_list[ndex] = '" + $replace($mood_description[$curmod], 'dyn'+'slave', 'dynslave') + "'" &! evaluate the subexpressions
				dynslave['mood'] += 1
				ndex += 1
			end
			i += 1
		if i < n: jump 'recalc_slave_mood_loop1'

		n = arrsize('$slave_bad_mood')
		i = 0 &! moods start from index 0
		:recalc_slave_mood_loop2
			$curmod = $slave_bad_mood[i]
			if dynslave[$curmod] > 0:
				dynamic "$dynslave_mood_list[ndex] = '" + $replace($mood_description[$curmod], 'dyn'+'slave', 'dynslave') + "'" &! evaluate the subexpressions
				dynslave['mood'] -= 1
				ndex += 1
			end
			i += 1
		if i < n: jump 'recalc_slave_mood_loop2'

		if arrsize('$dynslave_mood_list') < 1:
			!pos_ is the default moodlet
			dynamic "$dynslave_mood_list[1] = '" + $replace($mood_description['pos_'], 'dyn'+'slave', 'dynslave') + "'" &! evaluate the subexpressions
		end

		if dynslave['pos_clothes'] = -100 and dynslave['mood'] > 1: dynslave['mood'] -= 1 &! pos_clothes moodlet does not contribute to raising mood above Hopeful - ImperatorAugustus

		slave_psy_hardness = max (dynslave['ego'], dynslave['temper'], dynslave['spoil'], dynslave['pride']) + dynslave['courage']
		if dynslave['angst'] > dynslave['temper'] and dynslave['mood'] > 0:
			! cap mood at 0 (calm) when angst exceeds temperament
			dynslave['mood'] = 0
			$dynslave_mood_list[] = '  [<<$dynslave_name>>]
- I feel too much despair to hope for anything good.'
		elseif dynslave['angst'] > 0 and dynslave['mood'] > (2 - dynslave['angst']/2):
			! cap mood between 0 (calm) and +2 (optimistic) when angst is non-zero but less than or equal to temperament
			dynslave['mood'] = (2 - dynslave['angst']/2)
			if dynslave['neg_angst'] = 0: dynamic "$dynslave_mood_list[] = '" + $replace($mood_description['neg_angst'], 'dyn'+'slave', 'dynslave') + "'" &! evaluate the subexpressions
		elseif dynslave['obedience'] < slave_psy_hardness and dynslave['mood'] > 2:
			! cap mood at +2 if obedience is less than slave_psy_hardness (when fear is zero, devotion is non-zero, but obedience is still low)
			dynslave['mood'] = 2
			if dynslave['neg_fear'] = 0: $dynslave_mood_list[] = '  [<<$dynslave_name>>]
- Even now, thoughts of various horrors do not go out of my head.'
		elseif dynslave['fear'] >= dynslave['moral'] and dynslave['mood'] > 3:
			! cap mood at +3 (pleased) if fear matches or exceeds devotion (including when both are zero)
			! fear is not mitigated by masochism or abuse attitude because fear reflects anticipation of _effective_ future punishment
			dynslave['mood'] = 3
			if dynslave['neg_fear'] = 0: $dynslave_mood_list[] = '  [<<$dynslave_name>>]
- Even now, thoughts of various horrors do not go out of my head.'
		end

		! keep mood within [-5, +5] range
		dynslave['mood'] = max(-5, min(5, dynslave['mood']))

		:recalc_slave_mood_psy_broken
		if $dynslave_psy_status = 'broken':
			!neg_ is the mindbroken moodlet
			$curmod = $replace($mood_description['neg_'], 'dyn'+'slave', 'dynslave') &! split the first to protect from earlier $replace
			dynamic "$dynslave_mood_list[1] = '<<$curmod>>'" &! evaluate the subexpressions
		end
	end
}

$newloc_update_slave = {
	if dynslave_state > CONST_INT['no_slave']:

		!refresh equipment bonuses (here we are interested in style bonuses, exoticism bonuses and moodlets - learn_bonus is handled in interaction and daily_bonus is handled in next_day)
		dynamic $replace($recalc_equipment_bonuses, 'dyn'+'slave', 'dynslave') &! protect from earlier replace, defined in #item_base

		!exotic and style
		if dynslave['age'] = CONST_INT['loli_age']:
			dynslave['epilation'] = 100
			if dynslave['makeup'] = 0 and dynslave['beauty'] > 1: dynslave['makeup'] = 2 &! natural beauty (on par with tattoo makeup)
		end

		!characteristic alignment for slave - crushboss
		if dynslave['ill'] < 0: dynslave['ill'] = 0
		if dynslave['ill'] > 7: dynslave['ill'] = 7
		if dynslave['issues'] < 0: dynslave['issues'] = 0
		if dynslave['issues'] > 5: dynslave['issues'] = 5
		if dynslave['rehabilitation'] < 0: dynslave['rehabilitation'] = 0
		if dynslave['rehabilitation'] > 30: dynslave['rehabilitation'] = 30
		if dynslave['metabolism'] < 1: dynslave['metabolism'] = 1
		if dynslave['metabolism'] > 5: dynslave['metabolism'] = 5

		if dynslave['pregnant'] = 0 and dynslave['parasite'] = 0: dynslave['pregnant_revealed'] = 0

		!check for 'sleep in cells' rule without dungeon and change it to 'sleep on floor' - ImperatorAugustus
		if dynslave['sleep_condition'] = -2 and dungeon = 0: dynslave['sleep_condition'] = -1

		!IMPACTS ON BEAUTY (temp_beauty rate is refreshed constantly)
		dynslave_rate['temp_beauty'] = 0 - cont_atr_threshold[dynslave['scars']] - cont_atr_threshold[dynslave['bruises']]
		if dynslave['fat'] = 0 or dynslave['fat'] = 4: dynslave_rate['temp_beauty'] -= dynslave_rate['beauty'] / 2
		if dynslave['fat'] = 5: dynslave_rate['temp_beauty'] -= (4 * dynslave_rate['beauty']) / 5

		!IMPACTS ON STYLE (temp style rate is refreshed constantly)
		dynslave_rate['temp_style'] = (dynslave['grace']*cont_atr_threshold[2]) - cont_atr_threshold[dynslave['hygiene']]
		if dynslave['makeup'] > 1: dynslave_rate['temp_style'] += 10
		if dynslave['makeup'] > 0: dynslave_rate['temp_style'] += 10
		if dynslave['makeup'] = 0: dynslave_rate['temp_style'] -= 10
		if dynslave['perfume'] > 0: dynslave_rate['temp_style'] += 20
		if dynslave['perfume'] = 0: dynslave_rate['temp_style'] -= 10
		if dynslave['manicure'] > 0: dynslave_rate['temp_style'] += 10
		if dynslave['manicure'] = 0: dynslave_rate['temp_style'] -= 10
		if dynslave['epilation'] > 0: dynslave_rate['temp_style'] += 10
		if dynslave['epilation'] = 0: dynslave_rate['temp_style'] -= 10
		if dynslave['hairstyle'] < 1 and dynslave['wig'] > 0: dynslave['hairstyle'] = 1
		if dynslave['hairstyle'] > 0: dynslave_rate['temp_style'] += 10
		if dynslave['hairstyle'] = 0: dynslave_rate['temp_style'] -= 10

		dynslave['st_count'] = 0
		if dynslave['st_plus'] >= 1: dynslave['st_count'] = 1 & dynslave_rate['temp_style'] += 10
		if dynslave['st_plus'] >= 3: dynslave['st_count'] = 2 & dynslave_rate['temp_style'] += 10
		if dynslave['st_plus'] >= 6: dynslave['st_count'] = 3 & dynslave_rate['temp_style'] += 20
		if dynslave['st_plus'] >= 9: dynslave['st_count'] = 4 & dynslave_rate['temp_style'] += 20
		if dynslave['st_plus'] >= 13: dynslave['st_count'] = 5 & dynslave_rate['temp_style'] += 30

		!counters for anatomy tab
		dynslave['grace_count'] = 0
		if dynslave['grace'] = 1: dynslave['grace_count'] = 1
		if dynslave['grace'] = -1: dynslave['grace_count'] = 2

		dynslave['makeup_count'] = 0
		if dynslave['perfume'] > 0: dynslave['makeup_count'] += 1
		if dynslave['manicure'] > 0: dynslave['makeup_count'] += 1
		if dynslave['epilation'] > 0: dynslave['makeup_count'] += 1

		!IMPACTS ON EXOTICISM
		dynslave_rate['temp_exotic'] = 0
		dynslave['piercings'] = dynslave['ear_piercing'] + dynslave['nose_piercing'] + dynslave['nostril_piercing'] + dynslave['tongue_piercing'] + dynslave['tongue_split'] + dynslave['scarification'] + dynslave['nipple_piercing'] + dynslave['belly_piercing'] + dynslave['clit_piercing'] &! [0, 9]
		if dynslave['piercings'] >= 1: dynslave['piercing_count'] = 1 & dynslave_rate['temp_exotic'] += 5
		if dynslave['piercings'] >= 3: dynslave['piercing_count'] = 2 & dynslave_rate['temp_exotic'] += 5
		if dynslave['piercings'] >= 5: dynslave['piercing_count'] = 3 & dynslave_rate['temp_exotic'] += 10
		if dynslave['piercings'] >= 7: dynslave['piercing_count'] = 4 & dynslave_rate['temp_exotic'] += 20
		if dynslave['piercings'] >= 9: dynslave['piercing_count'] = 5 & dynslave_rate['temp_exotic'] += 40

		dynslave['ex_count'] = 0
		if dynslave['ex_plus'] >= 1: dynslave['ex_count'] = 1 & dynslave_rate['temp_exotic'] += 5
		if dynslave['ex_plus'] >= 2: dynslave['ex_count'] = 2 & dynslave_rate['temp_exotic'] += 5
		if dynslave['ex_plus'] >= 3: dynslave['ex_count'] = 3 & dynslave_rate['temp_exotic'] += 10
		if dynslave['ex_plus'] >= 6: dynslave['ex_count'] = 4 & dynslave_rate['temp_exotic'] += 20
		if dynslave['ex_plus'] >= 9: dynslave['ex_count'] = 5 & dynslave_rate['temp_exotic'] += 40

		!if dynslave['scars'] = 1 or dynslave['scars'] = 2: dynslave_rate['temp_exotic'] += 10 &! level one and level two scarring increase exoticism but also lower beauty (TODO)

		! update stats after setting temp rate variables
		dynamic $replace($dyn_calc_slave_attrs, 'dyn'+'slave', 'dynslave') &! protect from earlier replace

		! update slave moodlets (after $dyn_calc_slave_attrs updates stats levels)
		if dynslave['beauty'] = 0 and (dynslave['bruises'] > 0 or dynslave['scars'] > 0):
			dynslave['neg_ugly'] = 100
		else
			dynslave['neg_ugly'] = 0
		end

		dynslave['neg_slave_mess'] = 0
		if house_mess > 3 and arrpos('$mobile_slave_characters', 'dynslave') ! -1: dynslave['neg_slave_mess'] = 100

		if dynslave['hygiene'] > 1: dynslave['pos_slave_clean'] = 0
		if dynslave['hygiene'] > 3: dynslave['neg_slave_dirty'] = 100
		if dynslave['hygiene'] < 4: dynslave['neg_slave_dirty'] = 0

		dynslave['neg_horny'] = 0
		a = (dynslave['pos_orgasm'] + dynslave['ego'] + dynslave['pride'] + dynslave['temper'] + dynslave['sensitivity'])/3
		if dynslave['nymphomania'] = 0 and dynslave['arousal'] > 0 and a < dynslave['arousal']:
			dynslave['neg_horny'] = 100
		elseif dynslave['nymphomania'] > 1 and dynslave['arousal'] > 0:
			dynslave['neg_horny'] = 100
		elseif dynslave['nymphomania'] < 0:
			dynslave['neg_horny'] = 0
		end
		a = 0

		if ($dynslave['cloth'] = 'голая' or $dynslave['cloth'] = 'пусто') and ('dynslave' ! 'cow' or dynslave['cowSK'] < 3):
			if dynslave['sub_exhibit'] < dynslave['ego']: dynslave['neg_naked'] = 100
		else
			dynslave['neg_naked'] = 0
		end

		! sanity check for inapplicable moodlets
		if dynslave['wounds'] = 0: dynslave['neg_slave_wounded'] = 0
		if dynslave['ill'] = 0: dynslave['neg_slave_ill'] = 0
		if dynslave['angst'] = 0: dynslave['neg_angst'] = 0
		if cheat_no_starve = 1 or (dynslave['days_without_food'] = 0 and dynslave['fat'] > 0): dynslave['neg_hungry'] = 0
		if dynslave['spoil'] = 0 or max(dynslave['neg_hungry'], dynslave['neg_starvation'], dynslave['neg_raped'], dynslave['neg_defloration'], dynslave['neg_angst']) > 0: dynslave['neg_spoil'] = 0
		if rebell[$dynslave_psy_status] > 0: dynslave['pos_moral'] = 0

		! update mood after updating moodlets, before checking mood when updating psy status below
		dynamic $replace($recalc_slave_mood, 'dyn'+'slave', 'dynslave') &! protect from earlier replace

		!Psychological status of slave
		! reluctant, arrogant, hateful, resistant, lachrymose, soft, servile, frightened, obedient, broken, depresive, horny, hysteric, optimistic, docile
		slave_psy_hardness = max(dynslave['ego'], dynslave['temper'], dynslave['spoil'], dynslave['pride'])
		slave_psy_hardness += dynslave['courage']
		courage = slave_psy_hardness
		if dynslave['mood'] > 0: courage += dynslave['mood']
		if dynslave['courage'] = 2:
			courage = 100
			dynslave['fear'] = 0 &! moronic slaves are impossible to frighten
		end

		max_motivation = max(dynslave['fear'],dynslave['moral'],dynslave['custom'],dynslave['rational'],dynslave['instinct'],dynslave['spoil'],dynslave['angst'],dynslave['arousal'])
		sanity = dynslave['ego'] + dynslave['temper'] + dynslave['pride']

																						$dynslave_psy_status = $dynslave_psy_basic &! use baseline psy status if nothing overrides
		if dynslave['moral'] > 0 and $dynslave_psy_basic = 'lachrymose':				$dynslave_psy_status = 'soft' &! with non-zero devotion, soft replaces lachrymose
		if dynslave['mood'] < 0:
			if $dynslave_psy_basic = 'optimistic':										$dynslave_psy_status = 'soft' &! when mood is negative, soft replaces optimistic
			if dynslave['moral'] < 2:
				if dynslave['temper'] >= max(4, max_motivation):						$dynslave_psy_status = 'hateful' &! high attributes override baseline (pride > ego > temper)
				if dynslave['ego'] >= max(4, max_motivation):							$dynslave_psy_status = 'resistant'
				if dynslave['pride'] >= max(4, max_motivation):							$dynslave_psy_status = 'arrogant'
			else
				if dynslave['temper'] >= max(4, max_motivation):						$dynslave_psy_status = 'hysteric' &! high attributes override baseline (pride > ego > temper)
				if dynslave['ego'] >= max(4, max_motivation):							$dynslave_psy_status = 'docile'
				if dynslave['pride'] >= max(4, max_motivation):							$dynslave_psy_status = 'soft'
			end
		elseif rebell[$dynslave_psy_basic] ! 0:
																						$dynslave_psy_status = 'reluctant' &! baseline replacement
																						! when mood is not negative, reluctant replaces arrogant/depresive/docile/frightened/hateful/hysteric/lachrymose/resistant
		end
		if sanity < 3 and no_mindbreak ! 1:
																						$dynslave_psy_status = 'broken' &! must first raise nature (ego) to restore a broken slave - ImperatorAugustus
			dynslave['pride'] = 0 & dynslave_rate['pride'] = 0
			dynslave['temper'] = 0 &  dynslave_rate['temper'] = 0
			dynslave['fear'] = 0 & dynslave_rate['fear'] = 0
			dynslave['rational'] = 0 & dynslave_rate['rational'] = 0
			dynslave['instinct'] = 0 & dynslave_rate['instinct'] = 0
			dynslave['custom'] = 5 & dynslave_rate['custom'] = 0
			dynslave['spoil'] = 0 & dynslave_rate['spoil'] = 0
			dynslave['moral'] = 0 & dynslave_rate['moral'] = 0
		elseif dynslave['fear'] = max_motivation and dynslave['fear'] >= courage:
																						$dynslave_psy_status = 'frightened'
		elseif dynslave['mood'] < 2 and (dynslave['angst'] > dynslave['temper']/3 or dynslave['mood'] = -5):
																						$dynslave_psy_status = 'depresive'
			if dynslave['sensitivity'] >= 4 and dynslave['mood'] < -1:					$dynslave_psy_status = 'lachrymose'
		elseif dynslave['obedience'] >= slave_psy_hardness/2:
			! custom or instinct as max motivation inherit psy status from above
			if dynslave['spoil'] > max(1, dynslave['fear'], (dynslave['moral']+1)/2):
																						$dynslave_psy_status = 'hysteric'
			elseif dynslave['mood'] >= 0:
				if dynslave['fear']     = max_motivation:								$dynslave_psy_status = 'docile'
				if dynslave['rational'] = max_motivation  or dynslave['moral'] > 1:		$dynslave_psy_status = 'obedient'
				if dynslave['moral']    = max_motivation  or dynslave['moral'] > 3:		$dynslave_psy_status = 'servile'
				if dynslave['spoil']   >= (1 + dynslave['moral'])/2:					$dynslave_psy_status = 'docile'
				if dynslave['arousal']  = max_motivation and dynslave['moral'] > 0:		$dynslave_psy_status = 'horny'
			end
		end

		!for master moodlets
		if $dynslave_psy_status = 'horny' or $dynslave_psy_status = 'servile' or $dynslave_psy_status = 'obedient':
			dynslave['status_met'] = 1
		else
			dynslave['status_met'] = 0
		end

		!Calculate slave traits, rank, and stats - crushboss
		!Calculate slave price (includes obedience calculation)
		dynamic $replace($update_slave_price, 'dyn'+'slave', 'dynslave') &! protect from earlier replace

	end &! end of slave conscious/fainted check
}

!!!!! core game location $slave_price converted to dynamic function, called from $slave_price location
$update_slave_price = {
	if dynslave_state ! CONST_INT['no_slave']:
		!Variable Reset - crushboss

		!GLOBALS
		killvar 'slave_specialisation'
		dynslave['obedience'] = 0 &! re-calculated below
		slave_obedience_bonus = 0 &! modified by $set_obedience_difficulty
		slaveprice = 0 &! used in slave_auction_sell (when you sell your slave to Farid)
		haggling_limit = 0 &! used in slave_auction_pass (when you or an NPC buy a slave from Farid during the daily auction)
		relative_rating = 0 &! used in slave_sell_chek
		!dynslave['sex_sum'] &! used in #dynamic, debug_info, interaction_city, slave_stat
		rating = 0 &! used in slave_sell_chek, interaction_city, interaction_result_city, guild, demo_intro
		$rating_help = ''
		!is_stock is intentionally not reset here so it can be set by the caller

		!LOCALS
		slave_mood_bonus = 0
		slave_nature = 0
		slave_fear_bonus = 0
		slave_obedience_penalty = 0
		attribute_sum = 0
		max_skill = 0
		max_sex = 0
		skill_sum = 0
		maxsum = 0
		slave_base_price = 0

		!Price for slave - improved - crushboss
		if dynslave['stamina'] < 2: slave_base_price -= 20
		if dynslave['stamina'] < 3: slave_base_price -= 40
		if dynslave['stamina'] > 2: slave_base_price += 10
		if dynslave['stamina'] > 3: slave_base_price += 20
		if dynslave['stamina'] > 4: slave_base_price += 30
		if dynslave['base_beauty'] < 1: slave_base_price -= 160
		if dynslave['base_beauty'] < 2: slave_base_price -= 80
		if dynslave['base_beauty'] < 3: slave_base_price -= 40
		if dynslave['base_beauty'] > 2: slave_base_price += 20
		if dynslave['base_beauty'] > 3: slave_base_price += 40
		if dynslave['base_beauty'] > 4: slave_base_price += 80
		if dynslave['fat'] < 1: slave_base_price -= 20
		if dynslave['fat'] = 1: slave_base_price += 20
		if dynslave['fat'] = 2: slave_base_price += 15
		if dynslave['fat'] > 2: slave_base_price -= 5
		if dynslave['fat'] > 3: slave_base_price -= 10
		if dynslave['fat'] > 4: slave_base_price -= 160
		if dynslave['scars'] > 0: slave_base_price -= 5
		if dynslave['scars'] > 1: slave_base_price -= 10
		if dynslave['scars'] > 2: slave_base_price -= 20
		if dynslave['scars'] > 4: slave_base_price -= 40
		if dynslave['bruises'] > 1: slave_base_price -= 5
		if dynslave['bruises'] > 2: slave_base_price -= 10
		if dynslave['bruises'] > 3: slave_base_price -= 15
		if dynslave['bruises'] > 4: slave_base_price -= 30
		if dynslave['style'] > 0: slave_base_price += 5
		if dynslave['style'] > 1: slave_base_price += 10
		if dynslave['style'] > 2: slave_base_price += 20
		if dynslave['style'] > 3: slave_base_price += 40
		if dynslave['style'] > 4: slave_base_price += 80
		if dynslave['exotic'] > 0: slave_base_price += 20
		if dynslave['exotic'] > 1: slave_base_price += 30
		if dynslave['exotic'] > 2: slave_base_price += 40
		if dynslave['exotic'] > 3: slave_base_price += 60
		if dynslave['exotic'] > 4: slave_base_price += 80
		if dynslave['sensitivity'] < 2: slave_base_price -= 20
		if dynslave['sensitivity'] < 3: slave_base_price -= 20
		if dynslave['sensitivity'] > 3: slave_base_price += 20
		if dynslave['sensitivity'] > 4: slave_base_price += 20
		if dynslave['intellect'] < 2: slave_base_price -= 40
		if dynslave['intellect'] < 3: slave_base_price -= 40
		if dynslave['intellect'] > 3: slave_base_price += 40
		if dynslave['intellect'] > 4: slave_base_price += 40
		if dynslave['temper'] < 2: slave_base_price -= 45
		if dynslave['temper'] < 3: slave_base_price -= 45
		if dynslave['temper'] > 2: slave_base_price += 20
		if dynslave['temper'] > 3: slave_base_price += 30
		if dynslave['temper'] > 4: slave_base_price += 40
		if dynslave['ego'] < 2: slave_base_price -= 80
		if dynslave['ego'] < 3: slave_base_price -= 40
		if dynslave['ego'] > 2: slave_base_price += 20
		if dynslave['ego'] > 3: slave_base_price += 40
		if dynslave['ego'] > 4: slave_base_price += 80
		if dynslave['pride'] < 1: slave_base_price += 20
		if dynslave['pride'] < 2: slave_base_price += 20
		if dynslave['pride'] < 3: slave_base_price += 20
		if dynslave['pride'] > 3: slave_base_price -= 30
		if dynslave['pride'] > 4: slave_base_price -= 30
		if dynslave['virginity'] < 2: slave_base_price += 20
		if dynslave['grace'] = 1: slave_base_price += 10
		if dynslave['grace'] = -1: slave_base_price -= 10
		if dynslave['dexterity'] > 0: slave_base_price += 10
		if dynslave['dexterity'] < 0: slave_base_price -= 10
		if dynslave['fame'] > 0: slave_base_price += 10
		if dynslave['fame'] > 1: slave_base_price += 20
		if dynslave['fame'] > 2: slave_base_price += 30
		if dynslave['fame'] > 3: slave_base_price += 40
		if dynslave['fame'] > 4: slave_base_price += 80

		! make sure slaves are valued at least as much in the market as at the butcher to prevent arbitrage - ImperatorAugustus
		dynamic $replace($dyn_meat_evaluation, 'dyn'+'slave', 'dynslave')
		if slave_base_price < max(20, meat_price): slave_base_price = max(20, meat_price)

		!Calculate slave price
		slaveprice = (slave_base_price*3)/2 &! global variable, used when selling to Farid
		if slaveprice < 30: slaveprice = 30

		haggling_limit = slave_base_price/3 &! global variable, used for stock - ImperatorAugustus

		!Attribute Calculation for Rating
		attribute_sum = dynslave['stamina']
		attribute_sum += dynslave['sensitivity']
		attribute_sum += dynslave['temper']
		attribute_sum += dynslave['intellect']
		attribute_sum += dynslave['ego']
		attribute_sum -= dynslave['pride']

		!Skill Calculation for Rating
		skill_sum = dynslave['expression']
		if dynslave['expression'] >= 5: max_skill += 1
		skill_sum += dynslave['pet']
		if dynslave['pet'] >= 5: max_skill += 1
		skill_sum += dynslave['dressage']
		if dynslave['dressage'] >= 5: max_skill += 1
		skill_sum += dynslave['cowSK']
		if dynslave['cowSK'] >= 5: max_skill += 1
		skill_sum += dynslave['nurse']
		if dynslave['nurse'] >= 5: max_skill += 1
		skill_sum += dynslave['service']
		if dynslave['service'] >= 5: max_skill += 1
		skill_sum += dynslave['cook']
		if dynslave['cook'] >= 5: max_skill += 1
		skill_sum += dynslave['gladiatrix']
		if dynslave['gladiatrix'] >= 5: max_skill += 1
		skill_sum += dynslave['alchemy']
		if dynslave['alchemy'] >= 5: max_skill += 1
		skill_sum += dynslave['enchanter']
		if dynslave['enchanter'] >= 5: max_skill += 1
		skill_sum += dynslave['art']
		if dynslave['art'] >= 5: max_skill += 1
		skill_sum += dynslave['music']
		if dynslave['music'] >= 5: max_skill += 1
		skill_sum += dynslave['calisthenics']
		if dynslave['calisthenics'] >= 5: max_skill += 1
		skill_sum += dynslave['secretary']
		if dynslave['secretary'] >= 5: max_skill += 1

		!Calculate maxed sex skills
		dynslave['sex_sum'] = dynslave['oral']
		if dynslave['oral'] >= 5: max_sex += 1
		dynslave['sex_sum'] += dynslave['penetration']
		if dynslave['penetration'] >= 5: max_sex += 1
		dynslave['sex_sum'] += dynslave['petting']
		if dynslave['petting'] >= 5: max_sex += 1
		dynslave['sex_sum'] += dynslave['orgy']
		if dynslave['orgy'] >= 5: max_sex += 1
		dynslave['sex_sum'] += dynslave['xenophily']
		if dynslave['xenophily'] >= 5: max_sex += 1
		dynslave['sex_sum'] += dynslave['fetishism']
		if dynslave['fetishism'] >= 5: max_sex += 1
		dynslave['sex_sum'] += dynslave['roleplay']
		if dynslave['roleplay'] >= 5: max_sex += 1

		maxsum = max_skill + max_sex

		!Calculate slave obedience - crushboss
		dynamic $replace($set_obedience_difficulty, 'dyn'+'slave', 'dynslave')
		slave_obedience_bonus += dynslave['meekness'] + seed_obedience_bonus[dynslave_type] &! get obedience bonus from current json for backward compatibility
		if dynslave['courage'] = 2: slave_obedience_penalty += 6
		if dynslave['courage'] = 1: slave_obedience_penalty += 4
		if dynslave['courage'] = -1: slave_obedience_bonus += dynslave['fear']
		if dynslave['age'] = CONST_INT['loli_age']: slave_obedience_bonus += 2
		if dynslave['age'] = CONST_INT['young_age']: slave_obedience_bonus += 1
		! Calculate mood bonus for obedience
		if dynslave['mood'] > 0: slave_mood_bonus = 1 + (dynslave['mood']/2)
		! Calculate fear bonus for obedience
		if dynslave['fear'] > 0:
			slave_nature = (dynslave['pride'] + dynslave['temper'] + dynslave['ego'] + dynslave['intellect'])
			if slave_nature < 11:
				slave_fear_bonus = (dynslave['fear']*2)
			elseif slave_nature = 11:
				slave_fear_bonus = (dynslave['fear']*2) + 1
			elseif slave_nature = 12:
				slave_fear_bonus = (dynslave['fear']*2) + 2
			elseif slave_nature = 13:
				slave_fear_bonus = (dynslave['fear']*2) + 3
			elseif slave_nature = 14:
				slave_fear_bonus = (dynslave['fear']*2) + 4
			elseif slave_nature > 14:
				slave_fear_bonus = (dynslave['fear']*2) + 5
			end
		end
		! Obedience is sum of positive factors (first line) offset by negative factors (second line)
		dynslave['obedience'] = slave_obedience_bonus + slave_mood_bonus + slave_fear_bonus + (dynslave['moral']*4) + (dynslave['instinct']*2) + dynslave['custom'] + dynslave['rational'] + (1 + dynslave['angst'])/2 - _
			(dynslave['obedience_difficulty']/2) - slave_obedience_penalty - (dynslave['spoil']*2) - dynslave['pride'] - dynslave['temper'] - dynslave['ego'] - dynslave['intellect']
		if $dynslave_psy_status = 'broken': dynslave['obedience'] = 100

		!Calculate Slave Rating
		if 'dynslave' = 'stock': is_stock = 1 &! stock ratings are based purely on attribute_sum and the greater of beauty or fame, ignoring skills, obedience and stamina

		if     attribute_sum < 6  or ( is_stock = 0 and (skill_sum < 5                                                          or dynslave['obedience'] < 1 or dynslave['stamina'] < 2) ) or (dynslave['beauty'] < 1 and dynslave['fame'] < 1):
			rating = 0 &! F-
		elseif attribute_sum < 8  or ( is_stock = 0 and (skill_sum < 10                                                         or dynslave['obedience'] < 5) ):
			rating = 1 &! D-
		elseif attribute_sum < 10 or ( is_stock = 0 and (skill_sum < 15 or dynslave['sex_sum'] < 2                              or dynslave['obedience'] < 6) )                            or (dynslave['beauty'] < 2 and dynslave['fame'] < 2):
			rating = 2 &! D+
		elseif attribute_sum < 12 or ( is_stock = 0 and (skill_sum < 18 or dynslave['sex_sum'] < 4                                  or dynslave['moral'] < 1 or dynslave['stamina'] < 3) ):
			rating = 3 &! C-
		elseif attribute_sum < 13 or ( is_stock = 0 and (skill_sum < 20 or dynslave['sex_sum'] < 8  or max_skill < 2 or max_sex < 1 or dynslave['moral'] < 2) )                            or (dynslave['beauty'] < 3 and dynslave['fame'] < 3):
			rating = 4 &! C+
		elseif attribute_sum < 14 or ( is_stock = 0 and (skill_sum < 22 or dynslave['sex_sum'] < 10                                 or dynslave['moral'] < 3) ):
			rating = 5 &! B-
		elseif attribute_sum < 15 or ( is_stock = 0 and (skill_sum < 24 or dynslave['sex_sum'] < 15 or max_skill < 3 or max_sex < 2 or dynslave['moral'] < 4) )                            or (dynslave['beauty'] < 4 and dynslave['fame'] < 4):
			rating = 6 &! B+
		elseif attribute_sum < 16 or ( is_stock = 0 and (skill_sum < 26 or dynslave['sex_sum'] < 18) ):
			rating = 7 &! A-
		elseif attribute_sum < 18 or ( is_stock = 0 and (skill_sum < 28 or dynslave['sex_sum'] < 20 or max_skill < 4 or max_sex < 3 or dynslave['moral'] < 5) )                            or (dynslave['beauty'] < 5 and dynslave['fame'] < 5):
			rating = 8 &! A+
		elseif attribute_sum < 20 or ( is_stock = 0 and (skill_sum < 30 or dynslave['sex_sum'] < 25 or max_skill < 5 or max_sex < 4) ):
			rating = 9 &! S-
		else
			rating = 10 &! S+
		end

		!Rating adjustments
		if rating < 0: rating = 0
		if rating > 10: rating = 10

		!ImperatorAugustus: Adjust price based on actual rating, from 20% at F- (or stock) to full value at S+
		!Provides a reason to train slaves acquired from patrolling the Border of the Fogs (previously the sale price for an F- slave with excellent stats could exceed 800 sparks)
		!Provides a reason to train high-potential slaves to the highest tier for sale by auction
		if rating = 0 or is_stock = 1:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 20/100) &! F-
		elseif rating = 1:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 25/100) &! D-
		elseif rating = 2:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 30/100) &! D+
		elseif rating = 3:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 40/100) &! C-
		elseif rating = 4:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 45/100) &! C+
		elseif rating = 5:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 50/100) &! B-
		elseif rating = 6:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 55/100) &! B+
		elseif rating = 7:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 70/100) &! A-
		elseif rating = 8:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 75/100) &! A+
		elseif rating = 9:
			slaveprice = max(30, (meat_price*3)/2, slaveprice * 90/100) &! S-
		end

		killvar 'is_stock'

		!Populate rating tooltip info - crushboss
		$rating_help = 'To Do:
'

		if rating = 0:
	!F-
			if dynslave['beauty'] < 1 and dynslave['fame'] < 1: $rating_help += '- <<$dynslave_name>> is either not beautiful enough or famous enough to rank higher
'
			if dynslave['obedience'] < 1: $rating_help += '- <<$dynslave_name>> needs to learn obedience
'
			if skill_sum < 5: $rating_help += '- Teach this slave some common skills
'
			if attribute_sum < 6: $rating_help += '- Develop this slave’s basic attributes
'
			if dynslave['stamina'] < 2: $rating_help += '- <<$dynslave_name>> has low stamina and cannot rank higher or be sold to many customers
'
		elseif rating = 1:
	!D-
			if dynslave['obedience'] < 5: $rating_help += '- <<$dynslave_name>> needs to be more obedient
'
			if skill_sum < 10: $rating_help += '- Teach this slave some common skills
'
			if attribute_sum < 8: $rating_help += '- Further develop this slave’s basic attributes
'
		elseif rating = 2:
	!D+
			if dynslave['beauty'] < 2 and dynslave['fame'] < 2: $rating_help += '- <<$dynslave_name>> is either not beautiful enough or famous enough to rank higher
'
			if dynslave['obedience'] < 6: $rating_help += '- <<$dynslave_name>> needs to be more obedient
'
			if dynslave['sex_sum'] < 2: $rating_help += '- Improve this slave’s sexual skills
'
			if skill_sum < 15: $rating_help += '- Improve this slave’s common skills
'
			if attribute_sum < 10: $rating_help += '- Further develop this slave’s basic attributes
'
		elseif rating = 3:
	!C-
			if dynslave['stamina'] < 3: $rating_help += '- <<$dynslave_name>> has low stamina and cannot rank higher or be sold to many customers
'
			if dynslave['sex_sum'] < 4: $rating_help += '- Further improve this slave’s sexual skills
'
			if skill_sum < 18: $rating_help += '- Further improve this slave’s common skills
'
			if attribute_sum < 12: $rating_help += '- Further develop this slave’s basic attributes
'
			if dynslave['moral'] < 1: $rating_help += '- Encourage a strong sense of loyalty in this slave
'
		elseif rating = 4:
	!C+
			if dynslave['beauty'] < 3 and dynslave['fame'] < 3: $rating_help += '- <<$dynslave_name>> is either not beautiful enough or famous enough to rank higher
'
			if dynslave['sex_sum'] < 8: $rating_help += '- Further improve this slave’s sexual skills
'
			if skill_sum < 20: $rating_help += '- Further improve this slave’s common skills
'
			if attribute_sum < 13: $rating_help += '- Further develop this slave’s basic attributes
'
			if dynslave['moral'] < 2: $rating_help += '- Encourage a stronger sense of loyalty in this slave
'
			if max_skill < 2: $rating_help += '- <<$dynslave_name>> should master a total of 2 common skills
'
			if max_sex < 1: $rating_help += '- <<$dynslave_name>> should master 1 sexual skill
'
		elseif rating = 5:
	!B-
			if dynslave['sex_sum'] < 10: $rating_help += '- Further improve this slave’s sexual skills
'
			if skill_sum < 22: $rating_help += '- Further improve this slave’s common skills
'
			if attribute_sum < 14: $rating_help += '- Further develop this slave’s basic attributes
'
			if dynslave['moral'] < 3: $rating_help += '- Encourage a stronger sense of loyalty in this slave
'
		elseif rating = 6:
	!B+
			if dynslave['beauty'] < 4 and dynslave['fame'] < 4: $rating_help += '- <<$dynslave_name>> is either not beautiful enough or famous enough to rank higher
'
			if dynslave['sex_sum'] < 15: $rating_help += '- Further improve this slave’s sexual skills
'
			if skill_sum < 24: $rating_help += '- Further improve this slave’s common skills
'
			if attribute_sum < 15: $rating_help += '- Further develop this slave’s basic attributes
'
			if dynslave['moral'] < 4: $rating_help += '- Encourage a stronger sense of loyalty in this slave
'
			if max_skill < 3: $rating_help += '- <<$dynslave_name>> should master a total of 3 common skills
'
			if max_sex < 2: $rating_help += '- <<$dynslave_name>> should master a total of 2 sexual skills
'
		elseif rating = 7:
	!A-
			if attribute_sum < 16: $rating_help += '- Further develop this slave’s basic attributes
'
			if dynslave['sex_sum'] < 18: $rating_help += '- Further improve this slave’s sexual skills
'
			if skill_sum < 26: $rating_help += '- Further improve this slave’s common skills
'
		elseif rating = 8:
	!A+
			if dynslave['beauty'] < 5 and dynslave['fame'] < 5: $rating_help += '- <<$dynslave_name>> is either not beautiful enough or famous enough to rank higher
'
			if dynslave['sex_sum'] < 20: $rating_help += '- Further improve this slave’s sexual skills
'
			if skill_sum < 28: $rating_help += '- Further improve this slave’s common skills
'
			if attribute_sum < 18: $rating_help += '- Further develop this slave’s basic attributes
'
			if dynslave['moral'] < 5: $rating_help += '- Develop absolute loyalty in this slave
'
			if max_skill < 4: $rating_help += '- <<$dynslave_name>> should master a total of 4 common skills
'
			if max_sex < 3: $rating_help += '- <<$dynslave_name>> should master a total of 3 sexual skills
'
		elseif rating = 9:
	!S-
			if dynslave['sex_sum'] < 25: $rating_help += '- Perfect this slave’s sexual skills
'
			if skill_sum < 30: $rating_help += '- Perfect this slave’s common skills
'
			if attribute_sum < 20: $rating_help += '- Fully develop this slave’s basic attributes
'
			if max_skill < 5: $rating_help += '- <<$dynslave_name>> should master a total of 5 common skills
'
			if max_sex < 4: $rating_help += '- <<$dynslave_name>> should master a total of 4 sexual skills
'
		elseif rating = 10:
	!S+
			$rating_help += '- <<iif(is_stock = 0, "Maximum slave rating achieved!
- ", "")>><<$dynslave_name>> is truly a masterpiece!'
		end

		if $dynslave_psy_status = 'broken': $rating_help += '- This slave’s spirit is broken. Most customers will not purchase a slave in this condition.'

		$rating_help += '
' &! closes font size tag

		!Specialization calculation - overhauled - crushboss (converted to grades from B+ to S+ instead of pass/fail - ImperatorAugustus)
		dynslave['specialization_count'] = 0
		slave_specialisation['none'] = 1
		relative_rating = (rating/2)
		slave_specialisation['artist'] = min(dynslave['art'], dynslave['music'], dynslave['calisthenics'])
		if slave_specialisation['artist'] > 2:
			dynslave['specialization_count'] += 1
		else
			slave_specialisation['artist'] = 0
		end
		slave_specialisation['refferent'] = min(dynslave['secretary'], dynslave['expression'])
		if slave_specialisation['refferent'] > 2:
			dynslave['specialization_count'] += 1
		else
			slave_specialisation['refferent'] = 0
		end

		slave_specialisation['pet'] = min(dynslave['pet'], dynslave['dressage'])
		if slave_specialisation['pet'] > 2:
			dynslave['specialization_count'] += 1
		else
			slave_specialisation['pet'] = 0
		end
		slave_specialisation['cowSK'] = dynslave['cowSK']
		if slave_specialisation['cowSK'] > 2:
			dynslave['specialization_count'] += 1
		else
			slave_specialisation['cowSK'] = 0
		end
		slave_specialisation['servant'] = min(dynslave['service'], dynslave['cook'])
		if slave_specialisation['servant'] > 2:
			dynslave['specialization_count'] += 1
		else
			slave_specialisation['servant'] = 0
		end
		slave_specialisation['witchdoctor'] = min(dynslave['nurse'], dynslave['alchemy'], dynslave['enchanter'])
		if slave_specialisation['witchdoctor'] > 2:
			dynslave['specialization_count'] += 1
		else
			slave_specialisation['witchdoctor'] = 0
		end
		slave_specialisation['gladiatrix'] = min(dynslave['gladiatrix'], dynslave['stamina'], dynslave['ego'], dynslave['temper'])
		if slave_specialisation['gladiatrix'] > 2:
			dynslave['specialization_count'] += 1
		else
			slave_specialisation['gladiatrix'] = 0
		end
		slave_specialisation['concubine'] = min(dynslave['oral'], dynslave['penetration'], dynslave['petting'], dynslave['roleplay'])
		if slave_specialisation['concubine'] > 2:
			dynslave['specialization_count'] += 1
		else
			slave_specialisation['concubine'] = 0
		end

		!Prestige bonus - prestige measures factors that cannot be ignored regardless of the buyers reason for purchasing the slave.
		!Arena championships and skilled in multiple areas show an exceptional, above-and-beyond trophy-slave.
		!There is already fame, but it does a poor job of tracking accomplishments, just public opinion of the slave.
		!Prestige bonus is more designed for singular trophies - Frobozz

		dynslave['prestige'] = 0 &! currently ranges from 0 to 25, treated as a bonus to charm in guild auctions

		if dynslave['arena_level'] > 8:
			dynslave['prestige'] += iif(dynslave['age'] = CONST_INT['loli_age'], 6, 4) &! arena grand champion
		elseif dynslave['arena_level'] > 4:
			dynslave['prestige'] += iif(dynslave['age'] = CONST_INT['loli_age'], 4, 2) &! arena champion
		end
		if dynslave['has_ride_win'] > 6:
			dynslave['prestige'] += 4 &! racing grand champion
		elseif dynslave['has_ride_win'] > 3:
			dynslave['prestige'] += 2 &! racing champion
		end
		if dynslave['virginity'] < 2 and dynslave['rehabilitation'] = 0: dynslave['prestige'] += 1
		if dynslave['specialization_count'] > 3: dynslave['prestige'] += (dynslave['specialization_count'] - 3) &! up to 5 (servant, assistant, witchdoctor, gladiatrix, artist, ponygirl, concubine, cow)
		if dynslave['nymphomania'] > 0 and dynslave['nymphomania_revealed'] > 0: dynslave['prestige'] += 1      &! nympho
		if dynslave['nymphomania'] < 0 and dynslave['nymphomania_revealed'] > 0: dynslave['prestige'] -= 2      &! frigid
		if dynslave['masochism'] > 0 and dynslave['masochism_revealed'] > 0: dynslave['prestige'] += 1          &! accustomed to pain or masochist
		if dynslave['masochism'] < 0 and dynslave['masochism_revealed'] > 0: dynslave['prestige'] -= 1          &! afraid of pain
		if dynslave['exhibitionism'] = 2 and dynslave['exhibitionism_revealed'] > 0: dynslave['prestige'] += 1  &! exhibitionist
		if dynslave['exhibitionism'] < 0 and dynslave['exhibitionism_revealed'] > 0: dynslave['prestige'] -= 1  &! shy
		if dynslave['perversion'] = 2 and dynslave['perversion_revealed'] > 0: dynslave['prestige'] += 1        &! perverted
		if dynslave['perversion'] < 0 and dynslave['perversion_revealed'] > 0:                                  &! purist
			if dynslave['virginity'] < 2 and dynslave['rehabilitation'] = 0:
				dynslave['prestige'] += 2
			else
				dynslave['prestige'] += 1
			end
		end
		if dynslave['homosexualism'] = 1 and dynslave['homosexualism_revealed'] > 0: dynslave['prestige'] += 1  &! bisexual
		if dynslave['homosexualism'] < 0 and dynslave['homosexualism_revealed'] > 0: dynslave['prestige'] -= 1  &! homophobic
		if dynslave['meekness'] > 0 and dynslave['meekness_revealed'] > 0: dynslave['prestige'] += 1            &! disciplined
		if dynslave['selfesteem'] > 0 and dynslave['selfesteem_revealed'] > 0: dynslave['prestige'] += 1        &! megalomania
		if dynslave['compassion'] > 0 and dynslave['compassion_revealed'] > 0: dynslave['prestige'] += 1        &! merciful

		!Charm calculation
		if dynslave['fat'] = 0: relative_fat = 6
		if dynslave['fat'] = 1: relative_fat = -1
		if dynslave['fat'] = 2: relative_fat = 0
		if dynslave['fat'] = 3: relative_fat = 3
		if dynslave['fat'] = 4: relative_fat = 6
		if dynslave['fat'] = 5: relative_fat = 10

		charm_from_aura = dynslave['moral'] - dynslave['angst']*2 - dynslave['spoil']
		charm = dynslave['style']*3 + dynslave['exotic']*2 + charm_from_aura + brand_reputation*2 + dynslave['fame']*2 - relative_fat - dynslave['scars']*3 - dynslave['bruises']*3
		if charm < 0: charm = 0

		if charm < 6:   $charm_stat = dyneval($vb_cycle_skill, 0, 'Charm')
		if charm >= 6:  $charm_stat = dyneval($vb_cycle_skill, 1, 'Charm') &! discerning buyers require D- charm ( 6+) at D-/D+ rating       (1-2)
		if charm >= 12: $charm_stat = dyneval($vb_cycle_skill, 2, 'Charm') &! discerning buyers require C- charm (12+) at C-/C+ rating       (3-4)
		if charm >= 18: $charm_stat = dyneval($vb_cycle_skill, 3, 'Charm') &! discerning buyers require B+ charm (18+) at B-/B+ rating       (5-6)
		if charm >= 24: $charm_stat = dyneval($vb_cycle_skill, 4, 'Charm') &! discerning buyers require A+ charm (24+) at A-/A+ rating       (7-8)
		if charm >= 38: $charm_stat = dyneval($vb_cycle_skill, 5, 'Charm') &! discerning buyers require S+ charm (38+) at S-/S+ rating       (9-10)

		! D- style, F- exotic, F- charm_from_aura (0 devotion, no despair, no spoil), C- brand_reputation, F- fame and S+ relative_fat = 1*3 + 0*2 + 0 + 2 + 0*2 - (-1)  = 6  (D- charm)
		! C- style, F- exotic, D- charm_from_aura (1 devotion, no despair, no spoil), C- brand_reputation, F- fame and B+ relative_fat = 2*3 + 0*2 + 1 + 2 + 0*2 - 3     = 6  (D- charm)
		! C- style, D- exotic, C- charm_from_aura (2 devotion, no despair, no spoil), C- brand_reputation, F- fame and A+ relative_fat = 2*3 + 1*2 + 2 + 2 + 0*2 - 0     = 12 (C- charm)
		! B+ style, F- exotic, B+ charm_from_aura (3 devotion, no despair, no spoil), B+ brand_reputation, B+ fame and B+ relative_fat = 3*3 + 0*2 + 3 + 3 + 3*2 - 3     = 18 (B+ charm)
		! B+ style, B+ exotic, B+ charm_from_aura (3 devotion, no despair, no spoil), B+ brand_reputation, B+ fame and B+ relative_fat = 3*3 + 3*2 + 3 + 3 + 3*2 - 3     = 24 (A+ charm)
		! S+ style, A+ exotic, S+ charm_from_aura (5 devotion, no despair, no spoil), B+ brand_reputation, B+ fame and S+ relative_fat = 5*3 + 4*2 + 5 + 3 + 3*2 - (-1)  = 38 (S+ charm)
		! S+ style, A+ exotic, A+ charm_from_aura (4 devotion, no despair, no spoil), A+ brand_reputation, B+ fame and S+ relative_fat = 5*3 + 4*2 + 4 + 4 + 3*2 - (-1)  = 38 (S+ charm)
		! S+ style, B+ exotic, S+ charm_from_aura (5 devotion, no despair, no spoil), S+ brand_reputation, B+ fame and S+ relative_fat = 5*3 + 3*2 + 5 + 5 + 3*2 - (-1)  = 38 (S+ charm)

	end &! end of slave conscious/fainted check
}

$check_slave_for_revealed_traits = {
	if dynslave_state > CONST_INT['no_slave']:
		!Check for habit - slave
		if dynslave['masochism_xp'] > 50 and dynslave['masochism'] = 0: dynslave['masochism'] = 1 &! Accustomed to Pain (cannot replace Afraid of Pain, can grow into Masochist)
		if dynslave['masochism_xp'] > 100 and dynslave['masochism'] = 1: dynslave['masochism'] = 2 &! Masochist (replaces Accustomed to Pain, cannot replace Afraid of Pain)
		if dynslave['exhibitionism_xp'] > 75 and dynslave['exhibitionism'] < 2: dynslave['exhibitionism'] = 2 &! Exhibitionist (can replace opposite Shy)
		if dynslave['nymphomania_xp'] > 200 and dynslave['nymphomania'] < 1: dynslave['nymphomania'] = 1 &! Nymphomaniac (can replace opposite Frigid)
		if dynslave['perversion_xp'] > 150 and dynslave['perversion'] < 2: dynslave['perversion'] = 2 &! Pervert (can replace opposite Purist)
		if dynslave['lesbian_xp'] > 50 and dynslave['homosexualism'] = 0: dynslave['homosexualism'] = 1 &! Bi-sexual (cannot replace Homophobic or Lesbian)
		if dynslave['abuse_xp'] > 50 and dynslave['abuse_attitude'] = 0: dynslave['abuse_attitude'] = 2 &! Psi-masochist (cannot replace Hysteric)
		if dynslave['darkness_xp'] > 50 and dynslave['darkness_attitude'] = 0: dynslave['darkness_attitude'] = 2 &! Darkness Child (cannot replace Nyctophobia)
		if dynslave['blood_xp'] > 50 and dynslave['blood_attitude'] = 0: dynslave['blood_attitude'] = 2 &! Bloodthirsty (cannot replace Hemophobia)
		if dynslave['fire_xp'] > 50 and dynslave['fire_attitude'] = 0: dynslave['fire_attitude'] = 2 &! Pyromania (cannot replace Pyrophobia)
		if dynslave['water_xp'] > 50 and dynslave['water_attitude'] = 0: dynslave['water_attitude'] = 2 &! Water Child (cannot replace Hydrophobia)
		if dynslave['vermin_xp'] > 50 and dynslave['vermin_attitude'] = 0: dynslave['vermin_attitude'] = 2 &! Arachnophilia (cannot replace Arachnophobia)
		if dynslave['deprivation_xp'] > 50 and dynslave['deprivation_attitude'] = 0: dynslave['deprivation_attitude'] = 1 &! Inured to Helplessness (cannot replace Claustrophobia or Loves Helplessness)
		if dynslave['compassion_xp'] > 10 and dynslave['compassion'] = 0: dynslave['compassion'] = 1 &! Merciful (cannot replace Sadist)

		if dynslave['nymphomania_revealed'] = 1 and dynslave['nymphomania'] ! 0:
			if dynslave['nymphomania'] > 0: msg '<<$Нимфоманка>>'
			if dynslave['nymphomania'] < 0: msg '<<$Фригидная>>'
			dynslave['nymphomania_revealed'] = 2
		elseif dynslave['nymphomania'] = 0:
			dynslave['nymphomania_revealed'] = 0
		end
		if dynslave['masochism_revealed'] = 1 and dynslave['masochism'] ! 0:
			if dynslave['masochism'] = 2: msg '<<$Мазохистка>>'
			if dynslave['masochism'] = 1: msg '<<$Привычна_к_боли>>'
			if dynslave['masochism'] = -1: msg '<<$Боится_боли>>'
			dynslave['masochism_revealed'] = 2
		elseif dynslave['masochism'] = 0:
			dynslave['masochism_revealed'] = 0
		end

		if dynslave['exhibitionism_revealed'] = 1 and dynslave['exhibitionism'] ! 0:
			if dynslave['exhibitionism'] = 2: msg '<<$Эксгибиционистка>>'
			if dynslave['exhibitionism'] = -1: msg '<<$Стеснительная>>'
			dynslave['exhibitionism_revealed'] = 2
		elseif dynslave['exhibitionism'] = 0:
			dynslave['exhibitionism_revealed'] = 0
		end

		if dynslave['perversion_revealed'] = 1 and dynslave['perversion'] ! 0:
			if dynslave['perversion'] = 2: msg '<<$Извращенка>>'
			if dynslave['perversion'] = -1: msg '<<$Пуристка>>'
			dynslave['perversion_revealed'] = 2
		elseif dynslave['perversion'] = 0:
			dynslave['perversion_revealed'] = 0
		end

		if dynslave['homosexualism_revealed'] = 1 and dynslave['homosexualism'] ! 0:
			if dynslave['homosexualism'] = 2: msg '<<$Лесбиянка>>'
			if dynslave['homosexualism'] = 1: msg '<<$Бисексуальная>>'
			if dynslave['homosexualism'] = -1: msg '<<$Гомофобка>>'
			dynslave['homosexualism_revealed'] = 2
		elseif dynslave['homosexualism'] = 0:
			dynslave['homosexualism_revealed'] = 0
		end

		if dynslave['abuse_attitude_revealed'] = 1 and dynslave['abuse_attitude'] ! 0:
			if dynslave['abuse_attitude'] = 2: msg '<<$Пси_мазохистка>>'
			if dynslave['abuse_attitude'] = -1: msg '<<$Истеричка>>'
			dynslave['abuse_attitude_revealed'] = 2
		elseif dynslave['abuse_attitude'] = 0:
			dynslave['abuse_attitude_revealed'] = 0
		end

		if dynslave['darkness_attitude_revealed'] = 1 and dynslave['darkness_attitude'] ! 0:
			if dynslave['darkness_attitude'] = 2: msg '<<$Дитя_тьмы>>'
			if dynslave['darkness_attitude'] = -1: msg '<<$Боится_темноты>>'
			dynslave['darkness_attitude_revealed'] = 2
		elseif dynslave['darkness_attitude'] = 0:
			dynslave['darkness_attitude_revealed'] = 0
		end

		if dynslave['blood_attitude_revealed'] = 1 and dynslave['blood_attitude'] ! 0:
			if dynslave['blood_attitude'] = 2: msg '<<$Кровожадная>>'
			if dynslave['blood_attitude'] = -1: msg '<<$Боится_крови>>'
			dynslave['blood_attitude_revealed'] = 2
		elseif dynslave['blood_attitude'] = 0:
			dynslave['blood_attitude_revealed'] = 0
		end

		if dynslave['fire_attitude_revealed'] = 1 and dynslave['fire_attitude'] ! 0:
			if dynslave['fire_attitude'] = 2: msg '<<$Пиромания>>'
			if dynslave['fire_attitude'] = -1: msg '<<$Пирофобия>>'
			dynslave['fire_attitude_revealed'] = 2
		elseif dynslave['fire_attitude'] = 0:
			dynslave['fire_attitude_revealed'] = 0
		end

		if dynslave['water_attitude_revealed'] = 1 and dynslave['water_attitude'] ! 0:
			if dynslave['water_attitude'] = 2: msg '<<$Дитя_воды>>'
			if dynslave['water_attitude'] = -1: msg '<<$Гидрофобия>>'
			dynslave['water_attitude_revealed'] = 2
		elseif dynslave['water_attitude'] = 0:
			dynslave['water_attitude_revealed'] = 0
		end

		if dynslave['vermin_attitude_revealed'] = 1 and dynslave['vermin_attitude'] ! 0:
			if dynslave['vermin_attitude'] = 2: msg '<<$Арахнофилия>>'
			if dynslave['vermin_attitude'] = -1: msg '<<$Арахнофобия>>'
			dynslave['vermin_attitude_revealed'] = 2
		elseif dynslave['vermin_attitude'] = 0:
			dynslave['vermin_attitude_revealed'] = 0
		end

		if dynslave['deprivation_attitude_revealed'] = 1 and dynslave['deprivation_attitude'] ! 0:
			if dynslave['deprivation_attitude'] = 2: msg '<<$Любит_беспомощность>>'
			if dynslave['deprivation_attitude'] = -1: msg '<<$Клаустрофобия>>'
			dynslave['deprivation_attitude_revealed'] = 2
		elseif dynslave['deprivation_attitude'] = 0:
			dynslave['deprivation_attitude_revealed'] = 0
		end

		if dynslave['passion_comfort_revealed'] = 1 and dynslave['passion_comfort'] ! 0:
			if dynslave['passion_comfort'] = 1: msg '<<$Ленивая>>'
			if dynslave['passion_comfort'] = -1: msg '<<$Гиперактивная>>'
			dynslave['passion_comfort_revealed'] = 2
		elseif dynslave['passion_comfort'] = 0:
			dynslave['passion_comfort_revealed'] = 0
		end

		if dynslave['passion_luxury_revealed'] = 1 and dynslave['passion_luxury'] ! 0:
			if dynslave['passion_luxury'] = 1: msg '<<$Любит_роскошь>>'
			if dynslave['passion_luxury'] = -1: msg '<<$Аскетичная>>'
			dynslave['passion_luxury_revealed'] = 2
		elseif dynslave['passion_luxury'] = 0:
			dynslave['passion_luxury_revealed'] = 0
		end

		if dynslave['passion_sweets_revealed'] = 1 and dynslave['passion_sweets'] ! 0:
			if dynslave['passion_sweets'] = 1: msg '<<$Сладкоежка>>'
			if dynslave['passion_sweets'] = -1: msg '<<$Не_любит_сладкое>>'
			dynslave['passion_sweets_revealed'] = 2
		elseif dynslave['passion_sweets'] = 0:
			dynslave['passion_sweets_revealed'] = 0
		end

		if dynslave['passion_fame_revealed'] = 1 and dynslave['passion_fame'] ! 0:
			if dynslave['passion_fame'] = 1: msg '<<$Тщеславная>>'
			if dynslave['passion_fame'] = -1: msg '<<$Хикикомори>>'
			dynslave['passion_fame_revealed'] = 2
		elseif dynslave['passion_fame'] = 0:
			dynslave['passion_fame_revealed'] = 0
		end

		if dynslave['fear'] > 0 and dynslave['courage'] ! 0 and dynslave['courage_revealed'] = 0: dynslave['courage_revealed'] = 1
		if dynslave['courage_revealed'] = 1 and dynslave['courage'] ! 0:
			if dynslave['courage'] = 2: msg '<<$Отмороженая>>'
			if dynslave['courage'] = 1: msg '<<$Храбрая>>'
			if dynslave['courage'] = -1: msg '<<$Трусиха>>'
			dynslave['courage_revealed'] = 2
		elseif dynslave['courage'] = 0:
			dynslave['courage_revealed'] = 0
		end

		if dynslave['metabolism_revealed'] = 1 and dynslave['metabolism'] ! 3:
			if dynslave['metabolism'] = 5: msg '<<$Мощный_метаболизм>>'
			if dynslave['metabolism'] = 4: msg '<<$Хороший_метаболизм>>'
			if dynslave['metabolism'] = 2: msg '<<$Ослабленный_метаболизм>>'
			if dynslave['metabolism'] = 1: msg '<<$Слабый_метаболизм>>'
			dynslave['metabolism_revealed'] = 2
		elseif dynslave['metabolism'] = 3:
			dynslave['metabolism_revealed'] = 0
		end

		if dynslave['sport_affinity_revealed'] = 1 and dynslave['sport_affinity'] ! 0:
			if dynslave['sport_affinity'] = 1: msg '<<$Спортивная>>'
			if dynslave['sport_affinity'] = -1: msg '<<$Апатичная>>'
			dynslave['sport_affinity_revealed'] = 2
		elseif dynslave['sport_affinity'] = 0:
			dynslave['sport_affinity_revealed'] = 0
		end

		if dynslave['expression_affinity_revealed'] = 1 and dynslave['expression_affinity'] ! 0:
			if dynslave['expression_affinity'] > 0: msg '<<$оратор>>'
			dynslave['expression_affinity_revealed'] = 2
		elseif dynslave['expression_affinity'] = 0:
			dynslave['expression_affinity_revealed'] = 0
		end

		if dynslave['pet_affinity_revealed'] = 1 and dynslave['pet_affinity'] ! 0:
			if dynslave['pet_affinity'] > 0: msg '<<$питомец>>'
			dynslave['pet_affinity_revealed'] = 2
		elseif dynslave['pet_affinity'] = 0:
			dynslave['pet_affinity_revealed'] = 0
		end

		if dynslave['dressage_affinity_revealed'] = 1 and dynslave['dressage_affinity'] ! 0:
			if dynslave['dressage_affinity'] > 0: msg '<<$Brony>>'
			dynslave['dressage_affinity_revealed'] = 2
		elseif dynslave['dressage_affinity'] = 0:
			dynslave['dressage_affinity_revealed'] = 0
		end

		if dynslave['cowSK_affinity_revealed'] = 1 and dynslave['cowSK_affinity'] ! 0:
			if dynslave['cowSK_affinity'] > 0: msg '<<$Indolent>>'
			dynslave['cowSK_affinity_revealed'] = 2
		elseif dynslave['cowSK_affinity'] = 0:
			dynslave['cowSK_affinity_revealed'] = 0
		end

		if dynslave['nurse_affinity_revealed'] = 1 and dynslave['nurse_affinity'] ! 0:
			if dynslave['nurse_affinity'] > 0: msg '<<$медсестра>>'
			dynslave['nurse_affinity_revealed'] = 2
		elseif dynslave['nurse_affinity'] = 0:
			dynslave['nurse_affinity_revealed'] = 0
		end

		if dynslave['service_affinity_revealed'] = 1 and dynslave['service_affinity'] ! 0:
			if dynslave['service_affinity'] > 0: msg '<<$горничная>>'
			dynslave['service_affinity_revealed'] = 2
		elseif dynslave['service_affinity'] = 0:
			dynslave['service_affinity_revealed'] = 0
		end

		if dynslave['cook_affinity_revealed'] = 1 and dynslave['cook_affinity'] ! 0:
			if dynslave['cook_affinity'] > 0: msg '<<$кухарка>>'
			dynslave['cook_affinity_revealed'] = 2
		elseif dynslave['cook_affinity'] = 0:
			dynslave['cook_affinity_revealed'] = 0
		end

		if dynslave['gladiatrix_affinity_revealed'] = 1 and dynslave['gladiatrix_affinity'] ! 0:
			if dynslave['gladiatrix_affinity'] > 0: msg '<<$воительница>>'
			dynslave['gladiatrix_affinity_revealed'] = 2
		elseif dynslave['gladiatrix_affinity'] = 0:
			dynslave['gladiatrix_affinity_revealed'] = 0
		end

		if dynslave['enchanter_affinity_revealed'] = 1 and dynslave['enchanter_affinity'] ! 0:
			if dynslave['enchanter_affinity'] > 0: msg '<<$чародейка>>'
			dynslave['enchanter_affinity_revealed'] = 2
		elseif dynslave['enchanter_affinity'] = 0:
			dynslave['enchanter_affinity_revealed'] = 0
		end

		if dynslave['art_affinity_revealed'] = 1 and dynslave['art_affinity'] ! 0:
			if dynslave['art_affinity'] > 0: msg '<<$певица>>'
			dynslave['art_affinity_revealed'] = 2
		elseif dynslave['art_affinity'] = 0:
			dynslave['art_affinity_revealed'] = 0
		end

		if dynslave['music_affinity_revealed'] = 1 and dynslave['music_affinity'] ! 0:
			if dynslave['music_affinity'] > 0: msg '<<$музыкантка>>'
			dynslave['music_affinity_revealed'] = 2
		elseif dynslave['music_affinity'] = 0:
			dynslave['music_affinity_revealed'] = 0
		end

		if dynslave['calisthenics_affinity_revealed'] = 1 and dynslave['calisthenics_affinity'] ! 0:
			if dynslave['calisthenics_affinity'] > 0: msg '<<$танцовщица>>'
			dynslave['calisthenics_affinity_revealed'] = 2
		elseif dynslave['calisthenics_affinity'] = 0:
			dynslave['calisthenics_affinity_revealed'] = 0
		end

		if dynslave['secretary_affinity_revealed'] = 1 and dynslave['secretary_affinity'] ! 0:
			if dynslave['secretary_affinity'] > 0: msg '<<$секретарша>>'
			dynslave['secretary_affinity_revealed'] = 2
		elseif dynslave['secretary_affinity'] = 0:
			dynslave['secretary_affinity_revealed'] = 0
		end

		!if dynslave['memory_revealed'] = 1:
		!	if dynslave['memory'] = 1: msg '<<$Эйдетическая_память>>'
		!	if dynslave['memory'] = -1: msg '<<$Забывчивая>>'
		!	dynslave['memory_revealed'] = 2
		!end

		if dynslave['meekness_revealed'] = 1 and dynslave['meekness'] ! 0:
			if dynslave['meekness'] > 0: msg '<<$Дисциплинированная>>'
			if dynslave['meekness'] < 0: msg '<<$Своенравная>>'
			dynslave['meekness_revealed'] = 2
		elseif dynslave['meekness'] = 0:
			dynslave['meekness_revealed'] = 0
		end

		if dynslave['selfesteem_revealed'] = 1 and dynslave['selfesteem'] ! 0:
			if dynslave['selfesteem'] > 0: msg '<<$Мания_величия>>'
			if dynslave['selfesteem'] < 0: msg '<<$Комплекс_вины>>'
			dynslave['selfesteem_revealed'] = 2
		elseif dynslave['selfesteem'] = 0:
			dynslave['selfesteem_revealed'] = 0
		end

		if dynslave['compassion_revealed'] = 1 and dynslave['compassion'] ! 0:
			if dynslave['compassion'] > 0: msg '<<$Милосердная>>'
			if dynslave['compassion'] < 0: msg '<<$Садистка>>'
			dynslave['compassion_revealed'] = 2
		elseif dynslave['compassion'] = 0:
			dynslave['compassion_revealed'] = 0
		end

		!Fixed message display when slave has Oviparity (egglaying) - for slave and prisoner - crushboss
		if dynslave['pregnant'] > 0 and dynslave['pregnant_revealed'] = 1 and dynslave['vaginal_modification'] ! 4 and dynslave['fertility'] = 0:
			msg '<<$dynslave_name>> is experiencing morning sickness and has not menstruated for a long time. It looks like she’s pregnant!'
			dynslave['pregnant_revealed'] = 2
			if dynslave['fertility_revealed'] = 0: dynslave['fertility_revealed'] = 1
		end

	end &! end of slave conscious/fainted check
}

$update_slave_features_list = {
	if dynslave_state > CONST_INT['no_slave']:

		!Slave Traits
		$dynslave_features_list = ''
		sanity = dynslave['ego'] + dynslave['temper'] + dynslave['pride']
		if sanity < 3:
			$dynslave_features_list += 'Sanity
'
		elseif sanity < 5:
			$dynslave_features_list += 'Sanity
'
		end
		if dynslave['brand'] = 0:   $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Not Branded")>>
'
		if dynslave['wounds'] > 0:  $dynslave_features_list += '<<$wounds[dynslave[''wounds'']]>>
'
		if dynslave['scars'] > 0:   $dynslave_features_list += '<<$scars[dynslave[''scars'']]>>
'
		if dynslave['bruises'] > 0: $dynslave_features_list += '<<$bruises[dynslave[''bruises'']]>>
'
		if cheat_no_starve = 0 and (master_medic >= 4 or iif('dynslave' = 'cow', farmhand['nurse'], assistant['nurse']) >= 4):
			if dynslave['days_without_food'] = 0 and dynslave['neg_hungry'] > 0:
				$dynslave_features_list += '<<$starvation[1]>>
'
			elseif dynslave['days_without_food'] = 1:
				$dynslave_features_list += '<<$starvation[2]>>
'
			elseif dynslave['days_without_food'] = 2:
				$dynslave_features_list += '<<$starvation[3]>>
'
			elseif dynslave['days_without_food'] = 3 or dynslave['days_without_food'] < 0:
				$dynslave_features_list += '<<$starvation[4]>>
'
			elseif dynslave['days_without_food'] > 3:
				$dynslave_features_list += '<<$starvation[5]>>
'
			end
		end
		if dynslave['rehabilitation'] > 0: $dynslave_features_list += 'Recovery [<<dynslave[''rehabilitation'']>>]
'
		!if dynslave['virginity'] < 2: $dynslave_features_list += 'Virgin
'
		if dynslave['grace'] > 0: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Graceful")>>
'
		if dynslave['grace'] < 0: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Klutzy")>>
'
		if dynslave['dexterity'] > 0: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Dexterous")>>
'
		if dynslave['dexterity'] < 0: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Clumsy")>>
'
		if dynslave['arena_level'] > 4 and dynslave['arena_level'] < 9: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 4, "Arena Champion")>>
'
		if dynslave['arena_level'] > 8: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Arena Grand Champion")>>
'
		if dynslave['has_ride_win'] > 3 and dynslave['has_ride_win'] < 7:
			$dynslave_features_list += '<<dyneval($vb_cycle_skill, 4, "Racing Champion")>>
'
			trophy_racechampion = 1
		end
		if dynslave['has_ride_win'] > 6:
			$dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Racing Grand Champion")>>
'
			trophy_racechampion = 1
			trophy_racegrandchampion = 1
		end
		!These traits are displayed on the slave portrait and don’t need to be duplicated - plus the traits area needed more space - crushboss
		!if dynslave['fertility'] = -2: $dynslave_features_list += 'Immature
'
		!if dynslave['fertility'] = -1:
		!   if dynslave['fertility_revealed'] = 2: $dynslave_features_list += 'Sterile
'
		!end
		!if dynslave['fertility'] = 1:
		!   if dynslave['fertility_revealed'] = 2: $dynslave_features_list += 'Egglaying
'
		!end
		!if dynslave['pregnant'] > 0:
		!   if dynslave['pregnant_revealed'] = 2: $dynslave_features_list += 'Pregnant
'
		!end

		if dynslave['sport_affinity'] = 1:
			if dynslave['sport_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Sportive")>>
'
		end
		if dynslave['sport_affinity'] = -1:
			if dynslave['sport_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Torpid")>>
'
		end
		if dynslave['expression_affinity'] > 0:
			if dynslave['expression_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Orator")>>
'
		end
		if dynslave['pet_affinity'] > 0:
			if dynslave['pet_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Pet Prodigy")>>
'
		end
		if dynslave['dressage_affinity'] > 0:
			if dynslave['dressage_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Brony")>>
'
		end
		if dynslave['cowSK_affinity'] > 0:
			if dynslave['cowSK_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Indolent")>>
'
		end
		if dynslave['nurse_affinity'] > 0:
			if dynslave['nurse_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Expert Nurse")>>
'
		end
		if dynslave['service_affinity'] > 0:
			if dynslave['service_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Expert Maid")>>
'
		end
		if dynslave['cook_affinity'] > 0:
			if dynslave['cook_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Gourmet")>>
'
		end
		if dynslave['gladiatrix_affinity'] > 0:
			if dynslave['gladiatrix_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Gladiatrix")>>
'
		end
		if dynslave['enchanter_affinity'] > 0:
			if dynslave['enchanter_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Enchantress")>>
'
		end
		if dynslave['art_affinity'] > 0:
			if dynslave['art_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Painter at Heart")>>
'
		end
		if dynslave['music_affinity'] > 0:
			if dynslave['music_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Musical Prodigy")>>
'
		end
		!Added two possible outcomes for the Dancer Affinity - crushboss
		if dynslave['calisthenics_affinity'] > 0:
			if (dynslave['nymphomania'] > 0 and dynslave['nymphomania_revealed'] > 0) or (dynslave['perversion'] > 0 and dynslave['perversion_revealed'] > 0):
				if dynslave['calisthenics_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Exotic Dancer")>>
'
			else
				if dynslave['calisthenics_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Ballerina")>>
'
			end
		end
		if dynslave['secretary_affinity'] > 0:
			if dynslave['secretary_affinity_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Secretary")>>
'
		end
		if dynslave['metabolism'] = 5:
			if dynslave['metabolism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Powerful Metabolism")>>
'
		end
		if dynslave['metabolism'] = 4:
			if dynslave['metabolism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 4, "Good Metabolism")>>
'
		end
		if dynslave['metabolism'] = 2:
			if dynslave['metabolism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Weakened Metabolism")>>
'
		end
		if dynslave['metabolism'] = 1:
			if dynslave['metabolism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 1, "Weak Metabolism")>>
'
		end
		if dynslave['nymphomania'] > 0:
			if dynslave['nymphomania_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Nymphomaniac")>>
'
		end
		if dynslave['nymphomania'] < 0:
			if dynslave['nymphomania_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Frigid")>>
'
		end
		if dynslave['masochism'] = 2:
			if dynslave['masochism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Masochist")>>
'
			dynslave['neg_pain'] = 0
		end
		if dynslave['masochism'] = 1:
			if dynslave['masochism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Accustomed to Pain")>>
'
		end
		if dynslave['masochism'] = -1:
			if dynslave['masochism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Afraid of Pain")>>
'
		end
		if dynslave['exhibitionism'] = 2:
			if dynslave['exhibitionism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Exhibitionist")>>
'
			dynslave['neg_naked'] = 0
			dynslave['neg_shame'] = 0
		end
		if dynslave['exhibitionism'] = -1:
			if dynslave['exhibitionism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Shy")>>
'
		end
		if dynslave['perversion'] = 2:
			if dynslave['perversion_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Pervert")>>
'
		end
		if dynslave['perversion'] = -1:
			if dynslave['perversion_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Purist")>>
'
		end
		if dynslave['homosexualism'] = 2:
			if dynslave['homosexualism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Lesbian")>>
'
		end
		if dynslave['homosexualism'] = 1:
			if dynslave['homosexualism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Bisexual")>>
'
		end
		if dynslave['homosexualism'] = -1:
			if dynslave['homosexualism_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Homophobic")>>
'
		end
		if dynslave['courage'] = 2:
			if dynslave['courage_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 1, "Moronic")>>
'
			dynslave['neg_fear'] = 0
		end
		if dynslave['courage'] = 1:
			if dynslave['courage_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Brave")>>
'
		end
		if dynslave['courage'] = -1:
			if dynslave['courage_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Coward")>>
'
		end
		!if dynslave['memory'] = 1:
		!	if dynslave['memory_revealed'] = 2: $dynslave_features_list += 'Eidetic memory
'
		!end
		!if dynslave['memory'] = -1:
		!	if dynslave['memory_revealed'] = 2: $dynslave_features_list += 'Forgetful
'
		!end
		if dynslave['meekness'] > 0:
			if dynslave['meekness_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Disciplined")>>
'
		end
		if dynslave['meekness'] < 0:
			if dynslave['meekness_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 0, "Wayward")>>
'
		end
		if dynslave['selfesteem'] > 0:
			if dynslave['selfesteem_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Megalomania")>>
'
		end
		if dynslave['selfesteem'] < 0:
			if dynslave['selfesteem_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Guilt Complex")>>
'
		end
		if dynslave['compassion'] > 0:
			if dynslave['compassion_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 5, "Merciful")>>
'
		end
		if dynslave['compassion'] < 0:
			if dynslave['compassion_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Sadist")>>
'
		end
		if dynslave['abuse_attitude'] = 2:
			if dynslave['abuse_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Psi-Masochist")>>
'
			dynslave['neg_abuse'] = 0
		end
		if dynslave['abuse_attitude'] = -1:
			if dynslave['abuse_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Hysteric")>>
'
		end
		if dynslave['darkness_attitude'] = 2:
			if dynslave['darkness_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Darkness Child")>>
'
		end
		if dynslave['darkness_attitude'] = -1:
			if dynslave['darkness_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Nyctophobia")>>
'
		end
		if dynslave['blood_attitude'] = 2:
			if dynslave['blood_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Bloodthirsty")>>
'
		end
		if dynslave['blood_attitude'] = -1:
			if dynslave['blood_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Hemophobia")>>
'
		end
		if dynslave['fire_attitude'] = 2:
			if dynslave['fire_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Pyromania")>>
'
		end
		if dynslave['fire_attitude'] = -1:
			if dynslave['fire_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Pyrophobia")>>
'
		end
		if dynslave['water_attitude'] = 2:
			if dynslave['water_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Water Child")>>
'
		end
		if dynslave['water_attitude'] = -1:
			if dynslave['water_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Hydrophobia")>>
'
		end
		if dynslave['vermin_attitude'] = 2:
			if dynslave['vermin_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Arachnophilia")>>
'
		end
		if dynslave['vermin_attitude'] = -1:
			if dynslave['vermin_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Arachnophobia")>>
'
		end
		if dynslave['deprivation_attitude'] = 2:
			if dynslave['deprivation_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 1, "Loves Helplessness")>>
'
		end
		if dynslave['deprivation_attitude'] = 1:
			if dynslave['deprivation_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Inured to Helplessness")>>
'
		end
		if dynslave['deprivation_attitude'] = -1:
			if dynslave['deprivation_attitude_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Claustrophobia")>>
'
		end
		if dynslave['passion_comfort'] = 1:
			if dynslave['passion_comfort_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Lazy")>>
'
		end
		if dynslave['passion_comfort'] = -1:
			if dynslave['passion_comfort_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Hyperactive")>>
'
			dynslave['pos_well_rested'] = 0
		end
		if dynslave['passion_luxury'] = 1:
			if dynslave['passion_luxury_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Sybarite")>>
'
		end
		if dynslave['passion_luxury'] = -1:
			if dynslave['passion_luxury_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Ascetic")>>
'
		end
		if dynslave['passion_sweets'] = 1:
			if dynslave['passion_sweets_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Sweet-tooth")>>
'
		end
		if dynslave['passion_sweets'] = -1:
			if dynslave['passion_sweets_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Dislikes Sweets")>>
'
			dynslave['pos_dessert'] = 0
		end
		if dynslave['passion_fame'] = 1:
			if dynslave['passion_fame_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 3, "Conceited")>>
'
		end
		if dynslave['passion_fame'] = -1:
			if dynslave['passion_fame_revealed'] = 2: $dynslave_features_list += '<<dyneval($vb_cycle_skill, 2, "Hikikomori")>>
'
			dynslave['pos_praise'] = 0
		end

		if len($dynslave_features_list) > 666: $dynslave_features_list = '<<$dynslave_features_list>>'

	end &! end of slave conscious/fainted check
}

$equip_set_manager = {
	if dynslave_state > CONST_INT['no_slave']:

		if $args[0] = 'save':
			if $args[1] ! '':
				$dynslave['equip_set'] = $args[1]
				$args[0] = 'view'
			else
				$dynslave['equip_set'] = $trim(input ('Please enter a name for the current equipment set (name an existing set to replace it)'))
				$args[0] = 'list'
			end
			if $equip_set_name[$dynslave['equip_set']] = '' and arrsize('$equip_set_name') >= 18:
				msg 'You cannot create more equipment sets until you forget one you already have'
			elseif $trim($dynslave['equip_set']) ! '':
				$equip_set_name[$dynslave['equip_set']] = $dynslave['equip_set']
				$equip_set_cloth[$dynslave['equip_set']] = $dynslave['cloth']
				$equip_set_headband[$dynslave['equip_set']] = $dynslave['headband']
				$equip_set_collar[$dynslave['equip_set']] = $dynslave['collar']
				$equip_set_gloves[$dynslave['equip_set']] = $dynslave['gloves']
				$equip_set_boots[$dynslave['equip_set']] = $dynslave['boots']
				$equip_set_ring_left[$dynslave['equip_set']] = $dynslave['ring_left']
				$equip_set_ring_right[$dynslave['equip_set']] = $dynslave['ring_right']
				$equip_set_earrings[$dynslave['equip_set']] = $dynslave['earrings']
				$equip_set_tongue[$dynslave['equip_set']] = $dynslave['tongue']
				$equip_set_nipplerings[$dynslave['equip_set']] = $dynslave['nipplerings']
				$equip_set_navel[$dynslave['equip_set']] = $dynslave['navel']
				$equip_set_clitring[$dynslave['equip_set']] = $dynslave['clitring']
			end
		end

		if $args[0] = 'equip':
			$args[0] = 'list'
			!keep below in sync with item_change.qsrc
			if is_home = 0 and $return_lock ! 'none':
				$return_lock = 'menu_form'
				menu_form = 0
				gs '$city_random_event', 'home' &! check for an event when returning home - ImperatorAugustus
				dynamic $home_sounds &! before is_home = 1
				is_home = 1
			end
			$dynslave['equip_set'] = $args[1]
			if 			 inventory[$equip_set_cloth[$dynslave['equip_set']]]       > 0  or $equip_set_cloth[$dynslave['equip_set']] = 'голая'       or _
				dynslave_inventory[$equip_set_cloth[$dynslave['equip_set']]]       > 0:			$new_item = $equip_set_cloth[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 24, 44) & $return_lock = 'none' & gs 'item_change'
			if 			 inventory[$equip_set_headband[$dynslave['equip_set']]]    > 0  or $equip_set_headband[$dynslave['equip_set']] = 'пусто'    or _
				dynslave_inventory[$equip_set_headband[$dynslave['equip_set']]]    > 0:			$new_item = $equip_set_headband[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 25, 45) & $return_lock = 'none' & gs 'item_change'
			if 			 inventory[$equip_set_collar[$dynslave['equip_set']]]      > 0  or $equip_set_collar[$dynslave['equip_set']] = 'пусто'      or _
				dynslave_inventory[$equip_set_collar[$dynslave['equip_set']]]      > 0:			$new_item = $equip_set_collar[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 27, 47) & $return_lock = 'none' & gs 'item_change'
			if 			 inventory[$equip_set_gloves[$dynslave['equip_set']]]      > 0  or $equip_set_gloves[$dynslave['equip_set']] = 'пусто'      or _
				dynslave_inventory[$equip_set_gloves[$dynslave['equip_set']]]      > 0:			$new_item = $equip_set_gloves[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 28, 48) & $return_lock = 'none' & gs 'item_change'
			if 			 inventory[$equip_set_boots[$dynslave['equip_set']]]       > 0  or $equip_set_boots[$dynslave['equip_set']] = 'пусто'       or _
				dynslave_inventory[$equip_set_boots[$dynslave['equip_set']]]       > 0:			$new_item = $equip_set_boots[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 31, 51) & $return_lock = 'none' & gs 'item_change'
			if 			 inventory[$equip_set_ring_left[$dynslave['equip_set']]]   > 0  or $equip_set_ring_left[$dynslave['equip_set']] = 'пусто'   or _
				dynslave_inventory[$equip_set_ring_left[$dynslave['equip_set']]]   > 0:			$new_item = $equip_set_ring_left[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 32, 52) & $return_lock = 'none' & gs 'item_change'
			if 			 inventory[$equip_set_ring_right[$dynslave['equip_set']]]  > 0  or $equip_set_ring_right[$dynslave['equip_set']] = 'пусто'  or _
				dynslave_inventory[$equip_set_ring_right[$dynslave['equip_set']]]  > 0:			$new_item = $equip_set_ring_right[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 33, 53) & $return_lock = 'none' & gs 'item_change'
			if dynslave['ear_piercing'] ! 0 or $equip_set_earrings[$dynslave['equip_set']] = 'incrusted_earrings' or $equip_set_earrings[$dynslave['equip_set']] = 'пусто':
				if 			 inventory[$equip_set_earrings[$dynslave['equip_set']]]    > 1  or $equip_set_earrings[$dynslave['equip_set']] = 'пусто'    or _
					dynslave_inventory[$equip_set_earrings[$dynslave['equip_set']]]    > 1:			$new_item = $equip_set_earrings[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 26, 46) & $return_lock = 'none' & gs 'item_change', 2
			end
			if dynslave['tongue_piercing'] ! 0:
				if 			 inventory[$equip_set_tongue[$dynslave['equip_set']]]      > 0  or $equip_set_tongue[$dynslave['equip_set']] = 'пусто'      or _
					dynslave_inventory[$equip_set_tongue[$dynslave['equip_set']]]      > 0:			$new_item = $equip_set_tongue[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 35, 55) & $return_lock = 'none' & gs 'item_change'
			end
			if dynslave['nipple_piercing'] ! 0:
				if 			 inventory[$equip_set_nipplerings[$dynslave['equip_set']]] > 1  or $equip_set_nipplerings[$dynslave['equip_set']] = 'пусто' or _
					dynslave_inventory[$equip_set_nipplerings[$dynslave['equip_set']]] > 1:			$new_item = $equip_set_nipplerings[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 29, 49) & $return_lock = 'none' & gs 'item_change', 2
			end
			if dynslave['belly_piercing'] ! 0:
				if 			 inventory[$equip_set_navel[$dynslave['equip_set']]]       > 0  or $equip_set_navel[$dynslave['equip_set']] = 'пусто'       or _
					dynslave_inventory[$equip_set_navel[$dynslave['equip_set']]]       > 0:			$new_item = $equip_set_navel[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 34, 54) & $return_lock = 'none' & gs 'item_change'
			end
			if dynslave['clit_piercing'] ! 0:
				if 			 inventory[$equip_set_clitring[$dynslave['equip_set']]]    > 0  or $equip_set_clitring[$dynslave['equip_set']] = 'пусто'    or _
					dynslave_inventory[$equip_set_clitring[$dynslave['equip_set']]]    > 0:			$new_item = $equip_set_clitring[$dynslave['equip_set']] & slot = iif('dynslave' = 'slave', 30, 50) & $return_lock = 'none' & gs 'item_change'
			end
		end

		if $args[0] = 'forget':
			$args[0] = 'list'
			for i = 0 to arrsize('$equip_set_name'):
				if $equip_set_name[i] = $args[1]:
					killvar '$equip_set_name', i
					killvar '$equip_set_cloth', i
					killvar '$equip_set_headband', i
					killvar '$equip_set_collar', i
					killvar '$equip_set_gloves', i
					killvar '$equip_set_boots', i
					killvar '$equip_set_ring_left', i
					killvar '$equip_set_ring_right', i
					killvar '$equip_set_earrings', i
					killvar '$equip_set_tongue', i
					killvar '$equip_set_nipplerings', i
					killvar '$equip_set_navel', i
					killvar '$equip_set_clitring', i
				end
			end
		end

		if $equip_set_name['Naked'] = '':
			$equip_set_name['Naked']        = 'Naked'
			$equip_set_cloth['Naked']       = 'голая' &! naked
			$equip_set_headband['Naked']    = 'пусто' &! empty
			$equip_set_collar['Naked']      = 'пусто' &! empty
			$equip_set_gloves['Naked']      = 'пусто' &! empty
			$equip_set_boots['Naked']       = 'пусто' &! empty
			$equip_set_ring_left['Naked']   = 'пусто' &! empty
			$equip_set_ring_right['Naked']  = 'пусто' &! empty
			$equip_set_earrings['Naked']    = 'пусто' &! empty
			$equip_set_tongue['Naked']      = 'пусто' &! empty
			$equip_set_nipplerings['Naked'] = 'пусто' &! empty
			$equip_set_navel['Naked']       = 'пусто' &! empty
			$equip_set_clitring['Naked']    = 'пусто' &! empty
		end

		if arrsize('$equip_set_name') = 1:
			$equip_set_name['Maid']            = 'Maid'
			$equip_set_cloth['Maid']           = 'maid_dress'
			$equip_set_headband['Maid']        = 'hijab'
			$equip_set_gloves['Maid']          = 'rubber_gloves'

			$equip_set_name['Cook']            = 'Cook'
			$equip_set_cloth['Cook']           = 'common_apron'
			$equip_set_headband['Cook']        = 'plain_headband'
			$equip_set_gloves['Cook']          = 'rubber_gloves'

			$equip_set_name['Secretary']       = 'Secretary'
			$equip_set_cloth['Secretary']      = 'sailor_foku'
			$equip_set_headband['Secretary']   = 'glasses'

			$equip_set_name['Elocutionist']    = 'Elocutionist'
			$equip_set_cloth['Elocutionist']   = 'ukata'

			$equip_set_name['Nurse']           = 'Nurse'
			$equip_set_cloth['Nurse']          = 'nurse_dress'
			$equip_set_gloves['Nurse']         = 'rubber_gloves'

			$equip_set_name['Enchantress']     = 'Enchantress'
			$equip_set_cloth['Enchantress']    = 'enchanter_robe'
			$equip_set_gloves['Enchantress']   = 'leather_gloves'

			$equip_set_name['Athlete']         = 'Athlete'
			$equip_set_cloth['Athlete']        = 'leotard'
			$equip_set_boots['Athlete']        = 'sneakers'

			$equip_set_name['Gladiatrix']      = 'Gladiatrix'
			$equip_set_cloth['Gladiatrix']     = 'chainmail_bikini'
			$equip_set_collar['Gladiatrix']    = 'spiked_collar'
			$equip_set_gloves['Gladiatrix']    = 'plastic_bracers'
			$equip_set_boots['Gladiatrix']     = 'tabi'

			$equip_set_name['Dancer']          = 'Dancer'
			$equip_set_cloth['Dancer']         = 'bellydance'
			$equip_set_boots['Dancer']         = 'pointes'

			$equip_set_name['Dancer']          = 'Dancer'
			$equip_set_cloth['Dancer']         = 'bellydance'
			$equip_set_boots['Dancer']         = 'pointes'

			$equip_set_name['Pet']             = 'Pet'
			$equip_set_cloth['Pet']            = 'anal_tail'
			$equip_set_headband['Pet']         = 'nekomimi'
			$equip_set_collar['Pet']           = 'dog_collar'
			$equip_set_gloves['Pet']           = 'fluffy_gloves'

			$equip_set_name['Pony']             = 'Pony'
			$equip_set_cloth['Pony']            = 'anal_tail'
			$equip_set_headband['Pony']         = 'pony_plume'
			$equip_set_gloves['Pony']           = 'ponygirl_harness'
			$equip_set_boots['Pony']            = 'hoofed_boots'

			$equip_set_name['Cow']              = 'Cow'
			$equip_set_cloth['Cow']             = 'cow_gear'

			$equip_set_name['Sex']              = 'Sex'
			$equip_set_cloth['Sex']             = 'leather_corset'
			$equip_set_gloves['Sex']            = 'leather_straps'
			$equip_set_boots['Sex']             = 'high_boots'
			$equip_set_nipplerings['Sex']       = 'nipple_chain'

			$equip_set_name['Taming']           = 'Taming'
			$equip_set_cloth['Taming']          = 'deprivation_suit'
			$equip_set_headband['Taming']       = 'crown_of_thorns'
			$equip_set_collar['Taming']         = 'steel_collar'
			$equip_set_gloves['Taming']         = 'leather_straps'
			$equip_set_boots['Taming']          = 'leather_straps'
			$equip_set_tongue['Taming']         = 'heavy_gauge_rings'
			$equip_set_nipplerings['Taming']    = 'nipple_chain'
			$equip_set_navel['Taming']          = 'heavy_gauge_rings'
			$equip_set_clitring['Taming']       = 'heavy_gauge_rings'
		end

		if $args[0] = 'view':
			slot = -1 &! allows us to override $equip_choice
			$equip_choice = 'Go back'
			$equip_choice += '
Viewing Set "<<$args[1]>>"'
			$equip_choice += '
Missing items are marked with (*)'
			$equip_choice += '
Click to clear any occupied slot.'
			$equip_choice += '
<a href="EXEC: dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''save'', ''<<$args[1]>>''">Replace with current equipment'
			$equip_choice += '
'
			$equip_choice += '
<a href="EXEC: $equip_set_cloth[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Clothes: '       + $item_name[$equip_set_cloth[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_cloth[$args[1]], $dynslave['cloth'])
			if $equip_set_cloth[$args[1]] ! $dynslave['cloth']             and _
			   $equip_set_cloth[$args[1]] ! ''                             and _
			   $equip_set_cloth[$args[1]] ! 'голая'                        and _
			   max(inventory[$equip_set_cloth[$args[1]]], dynslave_inventory[$equip_set_cloth[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_headband[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Headgear: '      + $item_name[$equip_set_headband[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_headband[$args[1]], $dynslave['headband'])
			if $equip_set_headband[$args[1]] ! $dynslave['headband']       and _
			   $equip_set_headband[$args[1]] ! ''                          and _
			   $equip_set_headband[$args[1]] ! 'пусто'                     and _
			   max(inventory[$equip_set_headband[$args[1]]], dynslave_inventory[$equip_set_headband[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_collar[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Neck: '          + $item_name[$equip_set_collar[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_collar[$args[1]], $dynslave['collar'])
			if $equip_set_collar[$args[1]] ! $dynslave['collar']           and _
			   $equip_set_collar[$args[1]] ! ''                            and _
			   $equip_set_collar[$args[1]] ! 'пусто'                       and _
			   max(inventory[$equip_set_collar[$args[1]]], dynslave_inventory[$equip_set_collar[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_gloves[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Hands: '         + $item_name[$equip_set_gloves[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_gloves[$args[1]], $dynslave['gloves'])
			if $equip_set_gloves[$args[1]] ! $dynslave['gloves']           and _
			   $equip_set_gloves[$args[1]] ! ''                            and _
			   $equip_set_gloves[$args[1]] ! 'пусто'                       and _
			   max(inventory[$equip_set_gloves[$args[1]]], dynslave_inventory[$equip_set_gloves[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_boots[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Feet: '          + $item_name[$equip_set_boots[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_boots[$args[1]], $dynslave['boots'])
			if $equip_set_boots[$args[1]] ! $dynslave['boots']             and _
			   $equip_set_boots[$args[1]] ! ''                             and _
			   $equip_set_boots[$args[1]] ! 'пусто'                        and _
			   max(inventory[$equip_set_boots[$args[1]]], dynslave_inventory[$equip_set_boots[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_ring_left[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Ring 1: '        + $item_name[$equip_set_ring_left[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_ring_left[$args[1]], $dynslave['ring_left'])
			if $equip_set_ring_left[$args[1]] ! $dynslave['ring_left']     and _
			   $equip_set_ring_left[$args[1]] ! ''                         and _
			   $equip_set_ring_left[$args[1]] ! 'пусто'                    and _
			   max(inventory[$equip_set_ring_left[$args[1]]], dynslave_inventory[$equip_set_ring_left[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_ring_right[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Ring 2: '        + $item_name[$equip_set_ring_right[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_ring_right[$args[1]], $dynslave['ring_right'])
			if $equip_set_ring_right[$args[1]] ! $dynslave['ring_right']   and _
			   $equip_set_ring_right[$args[1]] ! ''                        and _
			   $equip_set_ring_right[$args[1]] ! 'пусто'                   and _
			   max(inventory[$equip_set_ring_right[$args[1]]], dynslave_inventory[$equip_set_ring_right[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_earrings[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Earrings: '      + $item_name[$equip_set_earrings[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_earrings[$args[1]], $dynslave['earrings'], 2)
			if $equip_set_earrings[$args[1]] ! $dynslave['earrings']       and _
			   $equip_set_earrings[$args[1]] ! ''                          and _
			   $equip_set_earrings[$args[1]] ! 'пусто'                     and _
			   max(inventory[$equip_set_earrings[$args[1]]], dynslave_inventory[$equip_set_earrings[$args[1]]]) < 2: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_tongue[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Tongue: '        + $item_name[$equip_set_tongue[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_tongue[$args[1]], $dynslave['tongue'])
			if $equip_set_tongue[$args[1]] ! $dynslave['tongue']           and _
			   $equip_set_tongue[$args[1]] ! ''                            and _
			   $equip_set_tongue[$args[1]] ! 'пусто'                       and _
			   max(inventory[$equip_set_tongue[$args[1]]], dynslave_inventory[$equip_set_tongue[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_nipplerings[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Nipples: '       + $item_name[$equip_set_nipplerings[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_nipplerings[$args[1]], $dynslave['nipplerings'], 2)
			if $equip_set_nipplerings[$args[1]] ! $dynslave['nipplerings'] and _
			   $equip_set_nipplerings[$args[1]] ! ''                       and _
			   $equip_set_nipplerings[$args[1]] ! 'пусто'                  and _
			   max(inventory[$equip_set_nipplerings[$args[1]]], dynslave_inventory[$equip_set_nipplerings[$args[1]]]) < 2: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_navel[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Navel: '         + $item_name[$equip_set_navel[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_navel[$args[1]], $dynslave['navel'])
			if $equip_set_navel[$args[1]] ! $dynslave['navel']             and _
			   $equip_set_navel[$args[1]] ! ''                             and _
			   $equip_set_navel[$args[1]] ! 'пусто'                        and _
			   max(inventory[$equip_set_navel[$args[1]]], dynslave_inventory[$equip_set_navel[$args[1]]]) = 0: $equip_choice += ' (*)'
			$equip_choice += '
<a href="EXEC: $equip_set_clitring[''<<$args[1]>>''] = "" & dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$args[1]>>''">Clitoris: '      + $item_name[$equip_set_clitring[$args[1]]] + dyneval($replace($dyn_aurabound_tooltip, 'dyn'+'slave', 'dynslave'), $equip_set_clitring[$args[1]], $dynslave['clitring'])
			if $equip_set_clitring[$args[1]] ! $dynslave['clitring']       and _
			   $equip_set_clitring[$args[1]] ! ''                          and _
			   $equip_set_clitring[$args[1]] ! 'пусто'                     and _
			   max(inventory[$equip_set_clitring[$args[1]]], dynslave_inventory[$equip_set_clitring[$args[1]]]) = 0: $equip_choice += ' (*)'
		end

		if $args[0] = 'list' or $args[0] = '':
			slot = -1 &! allows us to override $equip_choice
			$equip_choice = 'Save current equipment'
			for i = 0 to arrsize('$equip_set_name'):
				if $equip_set_name[i] ! '':
					$equip_choice += '
<a href="EXEC: dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''equip'',  ''<<$equip_set_name[i]>>''">Equip'
					$equip_choice +=   ', <a href="EXEC: dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''view'',  ''<<$equip_set_name[i]>>''">View'
					$equip_choice += ' or <a href="EXEC: dynamic $replace($equip_set_manager, ''dyn''+''slave'', ''dynslave''), ''forget'', ''<<$equip_set_name[i]>>''">Forget'
					$equip_choice += ' "<<$equip_set_name[i]>>"'
				end
			end
		end

		dynamic $show_item_description_and_image, ''

		dynslave_stat_screen = 2
		$return_lock = 'dynslave_stat'
		gt 'dynslave_stat'

	end
}

--- #static_base ---------------------------------