:: _difficulty
<<set $here = '_difficulty'>>
<<set $ARGS = $location_var[$here]>>
<<if getvar("$difficulty") == 0>>
	<<set $difficulty = 3>>
<</if>>
<<if $location_var[$here][0] == 'setdifficulty'>>
	<<set $difficulty = 3>>
	<<if $location_var[$here][1] == 'easy peasy'>>
		<<set $difficulty = 1>>

	<</if>>
	<<if $location_var[$here][1] == 'relaxed'>>
		<<set $difficulty = 2>>

	<</if>>
	<<if $location_var[$here][1] == 'hardcore'>>
		<<set $difficulty = 4>>

	<</if>>
<</if>>
<!-- !! following function returns the current difficulty-->
<<if $location_var[$here][0] == 'getdifficulty'>>
	<<set $result = 'realistic'>>
	<<if getvar("$difficulty") == 1>>
		<<set $result = 'easy peasy'>>

	<</if>>
	<<if getvar("$difficulty") == 2>>
		<<set $result = 'relaxed'>>

	<</if>>
	<<if getvar("$difficulty") == 4>>
		<<set $result = 'hardcore'>>

	<</if>>
<</if>>
<!-- !! following function returns the basic adjustment for stat gain via exp.-->
<!-- !! hardcore: 80-->
<!-- !! realistic: 60-->
<!-- !! relaxed: 40-->
<!-- !! easy peasy: 20-->
<!-- !! use setup.func('_difficulty','getexpadj')-->
<<if $location_var[$here][0] == 'getexpadj'>>
	<!-- !!Trait ''Everything is new again'', gained from the sg_tg start-->
	<<if $start_type == 'sg_tg' and $time.daystart <= 84>>
		<<set $result = 10 * $difficulty>>
	<<else>>
		<<set $result = 20 * $difficulty>>
	<</if>>
<</if>>
<!-- !! following function adjusts money gain by difficulty.-->
<!-- !! use setup.func('_difficulty','addmoney', x) with x being the base amount (for 'realistic' difficulty)-->
<<if $location_var[$here][0] == 'addmoney'>>
	<<set $finances.cash += ($ARGS[1] * (5 - $difficulty)) / 2>>
<</if>>
<!-- !! following function returns the adjusted money added (e.g. for displaying the correct amount of money earnt in texts)-->
<!-- !! use setup.func('_difficulty','addmoneystring', x) with x being the base amount (for 'realistic' difficulty)-->
<<if $location_var[$here][0] == 'addmoneystring'>>
	<<set $result = ($ARGS[1] * (5 - $difficulty)) / 2>>
<</if>>
<!-- !! following function adjusts money spent by difficulty.-->
<!-- !! use setup.func('_difficulty','spendmoney', x) with x being the base amount (for 'realistic' difficulty)-->
<<if $location_var[$here][0] == 'spendmoney'>>
	<<set $finances.cash -= ($ARGS[1] * ($difficulty + 1)) / 4>>
<</if>>
<!-- !! following function returns the adjusted money spent (e.g. for displaying the correct price in shops)-->
<!-- !! use setup.func('_difficulty','spendmoneystring', x) with x being the base amount (for 'realistic' difficulty)-->
<<if $location_var[$here][0] == 'spendmoneystring'>>
	<<set $result = ($ARGS[1] * ($difficulty + 1)) / 4>>
<</if>>
<!-- !! following function returns the basic adjustment for max_grades.-->
<!-- !! hardcore: (115 * $pc.intelligence)/100-->
<!-- !! realistic: 133-->
<!-- !! relaxed: 155-->
<!-- !! easy peasy: 185-->
<!-- !! use setup.func('_difficulty','getmaxgrades')-->
<<if $location_var[$here][0] == 'getmaxgrades'>>
	<<if getvar("$difficulty") == 1>>
		<<set $max_grades = ($pc.skillLevel("intelligence") * 185) / 100>>

	<</if>>
	<<if getvar("$difficulty") == 2>>
		<<set $max_grades = ($pc.skillLevel("intelligence") * 155) / 100>>

	<</if>>
	<<if getvar("$difficulty") == 3>>
		<<set $max_grades = ($pc.skillLevel("intelligence") * 133) / 100>>

	<</if>>
	<<if getvar("$difficulty") == 4>>
		<<set $max_grades = ($pc.skillLevel("intelligence") * 115) / 100>>

	<</if>>
	<<if getvar("$max_grades") > 100>>
		<<set $max_grades = 100>>

	<</if>>
<</if>>
