Quellcode durchsuchen

[changed] The redoing of stamina to actaully mean something. I'm waithing for the tears of the players.

bgkjdgbizgblzdgbr vor 1 Jahr
Ursprung
Commit
64271e6016

+ 5 - 4
locations/city_park.qsrc

@@ -121,12 +121,11 @@ if $ARGS[0] = 'start':
 		end
 	end
 
-	if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour > 5 and hour < 23 and parkrunday ! daystart:
-		if pcs_energy >= 5:
+	if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour > 5 and hour < 23:
+		if pcs_energy >= 5 and pcs_stam >= stammax / 5:
 			act 'Go for a run in the park (1:00)':
 				*clr & cla
 				menu_off = 1
-				parkrunday = daystart
 				gs 'exercise', 'tier1', 60, 'run'
 				'<center><b><font color="maroon">Park</font></b></center>'
 				'<center><img <<$set_imgh>> src="images/locations/shared/park/parkbeg.jpg"></center>'
@@ -180,8 +179,10 @@ if $ARGS[0] = 'start':
 					end
 				end
 			end
-		else
+		elseif pcs_stam >= stammax / 5:
 			act 'Go for a run in the park (1:00)': '<br><font color="red">You are so hungry you cannot face going for a run.</font>'
+		else
+			act 'Go for a run in the park (1:00)': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to go for a run.</font>'
 		end
 	elseif hour > 5 and hour < 23 and parkrunday ! daystart:
 		'You could go for a run in the park if you were wearing sports clothes and shoes.'

+ 4 - 2
locations/crossfit_north_box.qsrc

@@ -34,7 +34,7 @@ if $ARGS[0] = 'box':
 		end
 	end
 
-	if pcs_energy >= 20:
+	if pcs_energy >= 20 and pcs_stam >= stammax / 5:
 		act 'Start the exercise':
 			menu_off = 1
 			if last_crossfit_workout = daystart:
@@ -83,8 +83,10 @@ if $ARGS[0] = 'box':
 				end
 			end
 		end
-	else
+	elseif pcs_stam >= stammax / 5:
 		act 'Start the exercise': '<br><font color="red">You feel too hungry to do this exercise now.</font>'
+	else
+		act 'Start the exercise': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to do this exercise.</font>'
 	end
 end
 

+ 5 - 3
locations/danceclass.qsrc

@@ -9,7 +9,7 @@ gs 'themes', 'indoors'
 '<center><img <<$set_imgh>> src="images/locations/city/citycenter/gym/dance/danceclass.jpg"></center>'
 'A big, open room with good lighting and huge mirrors, perfect for improving your dance skills.'
 
-if pcs_energy >= 10:
+if pcs_energy >= 10 and pcs_stam >= stammax / 5:
 	act 'Modern dance class (0:30)':
 		*clr & cla
 		gs 'exercise', 'tier2', 30, 'agil', 'stren', 'danc'
@@ -71,9 +71,11 @@ if pcs_energy >= 10:
 			act 'Pole dance class (0:30)': '<br><font color="red">You don''t have enough energy to use this action.</font>'
 		end
 	end
-else
+elseif pcs_stam >= stammax / 5:
 	*nl
-	'You are so hungry you can''t even bring yourself to look at the activities available'
+	'You are so hungry you can''t even bring yourself to look at the activities available.'
+else
+	'You are to exhausted you can''t even bring yourself to look at the activities available. Recover your stamina before trying to dance.'
 end
 
 act 'Leave':gt 'fit', 'dressing_room'

+ 5 - 4
locations/exercise.qsrc

@@ -528,7 +528,7 @@ if $ARGS[0] = 'tier1':
 	end
 
 	gs 'exercise', 'get_sport_clothes_exercise_bonus'
-	pcs_stam -= (mult * (10 - sport_clothes_exercise_bonus)) / 2
+	pcs_stam -= (5*mult * (10 - sport_clothes_exercise_bonus)) / 2
 
 	gs 'sweat', 'add', (3*mult)
 	fat -= (4 + mult/2)
@@ -576,7 +576,7 @@ if $ARGS[0] = 'tier2':
 	end
 
 	gs 'exercise', 'get_sport_clothes_exercise_bonus'
-	pcs_stam -= (mult * (10 - sport_clothes_exercise_bonus))
+	pcs_stam -= 5*mult * (10 - sport_clothes_exercise_bonus)
 
 	gs 'sweat', 'add', (10*mult)
 	fat -= (3 + mult/2)
@@ -624,7 +624,7 @@ if $ARGS[0] = 'tier3':
 	end
 
 	gs 'exercise', 'get_sport_clothes_exercise_bonus'
-	pcs_stam -= (3*mult * (10 - sport_clothes_exercise_bonus)) / 2
+	pcs_stam -= (15*mult * (10 - sport_clothes_exercise_bonus)) / 2
 
 	gs 'sweat', 'add', (15*mult)
 	fat -= (2 + mult/2)
@@ -672,7 +672,7 @@ if $ARGS[0] = 'tier4':
 	end
 
 	gs 'exercise', 'get_sport_clothes_exercise_bonus'
-	pcs_stam -= (5*mult * (10 - sport_clothes_exercise_bonus))/2
+	pcs_stam -= (25*mult * (10 - sport_clothes_exercise_bonus))/2
 
 	gs 'sweat', 'add', (25*mult)
 	fat -= (1 + mult/2)
@@ -737,5 +737,6 @@ if $ARGS[0] = 'get_sport_clothes_exercise_bonus':
 		sport_clothes_exercise_bonus += 1
 	end
 end
+
 --- exercise ---------------------------------
 

+ 37 - 9
locations/exp_gain.qsrc

@@ -8,16 +8,44 @@ if ARGS[1] > 0:
 	if $ARGS[0] = 'stren_plus' and ARGS[2] = 0 and stren_plus_lvl > 50:
 		!!This is so that exp only is awarded to additional strength if it is high when you use steroids
 	else
-		if pcs_condition['lack_of_sleep'] >= 20:
-			dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>/4"
-		elseif pcs_condition['lack_of_sleep'] >= 10:
-			dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>/2"
-		elseif pcs_condition['lack_of_sleep'] >= 5:
-			dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*3)/4"
-		elseif pcs_condition['lack_of_sleep'] >= 2 and ARGS[1] > 1:
-			dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*9)/10"
+		if pcs_stam <= 0:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>/8"
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>/4"
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*3)/8"
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*9)/20"
+			else
+				dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>/2"
+			end
+		elseif pcs_stam < stammax / 5:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*3)/16"
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*3)/8"
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*9)/16"
+			elseif pcs_condition['lack_of_sleep'] >= 2 and ARGS[1] > 1:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*27)/40"
+			elseif ARGS[1] > 1:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*3)/4"
+			else
+				dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>"
+			end
 		else
-			dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>"
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>/4"
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>/2"
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*3)/4"
+			elseif pcs_condition['lack_of_sleep'] >= 2 and ARGS[1] > 1:
+				dynamic "<<$ARGS[0]>>_exp += (<<ARGS[1]>>*9)/10"
+			else
+				dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>"
+			end
 		end
 	end
 end

+ 18 - 6
locations/fit.qsrc

@@ -153,7 +153,7 @@ if $ARGS[0] = 'dressing_room':
 	end
 
 	if abonement > 0:
-		if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and pcs_stam >= 40:
+		if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich':
 			act 'Go to the gym':
 				cla
 				gt 'fit', 'gym'
@@ -181,15 +181,20 @@ if $ARGS[0] = 'dressing_room':
 				act 'Leave':gt 'fit', 'dressing_room'
 
 			end
-		elseif $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and pcs_stam >= 40 and pcs_energy >= 20:
+		elseif $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and pcs_stam >= stammax / 5 and pcs_energy >= 20:
 			act 'Go to team practice':gt 'beg', 'start'
 			if week = 6 and pcs_run >= 20 and run_comp_day ! daystart:
 				act '<b>Enter competition race</b>':run_comp_day = daystart & gt 'beg1', 'start'
 			end
-		elseif $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and pcs_stam >= 40:
-			act 'Go to team practice': '<br><font color="red">You don''t have enough energy to use this action.</font>'
+		elseif $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and pcs_stam >= stammax / 5:
+			act 'Go to team practice': '<br><font color="red">You feel too hungry to do this.</font>'
 			if week = 6 and pcs_run >= 20 and run_comp_day ! daystart:
-				act '<b>Enter competition race</b>': '<br><font color="red">You don''t have enough energy to use this action.</font>'
+				act '<b>Enter competition race</b>': '<br><font color="red">You feel too hungry to do this.</font>'
+			end
+		elseif $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich':
+			act 'Go to team practice': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
+			if week = 6 and pcs_run >= 20 and run_comp_day ! daystart:
+				act '<b>Enter competition race</b>': '<br><font color="red">You are to exhausted to do this. Recover your stamina before entering the race.</font>'
 			end
 		end
 	end
@@ -344,7 +349,7 @@ if $ARGS[0] = 'gym':
 
 	gs 'fit', 'exercise_end'
 
-	if pcs_energy >= 15:
+	if pcs_energy >= 15 or pcs_stam >= stammax / 5:
 		act 'Aerobics (Burn fat)':
 			cla
 			*clr
@@ -472,6 +477,13 @@ if $ARGS[0] = 'gym':
 			end
 		end
 		act 'Go to the kickboxing gym':gt 'fit', 'kickboxing'
+	elseif pcs_energy >= 15:
+		act 'Aerobics (Burn fat)': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
+		act 'Free weights (Build muscle)': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
+		act 'Cross trainer (endurance)': '<br><font color="red">YYou are to exhausted to do this. Recover your stamina before trying to train.</font>'
+		act 'Tennis practice (agility)': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
+		act 'Tennis practice (reactions)': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
+		act 'Go to the kickboxing gym': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
 	else
 		act 'Aerobics (Burn fat)': '<br><font color="red">You feel too hungry to do this.</font>'
 		act 'Free weights (Build muscle)': '<br><font color="red">You feel too hungry to do this.</font>'

+ 24 - 23
locations/gadroad.qsrc

@@ -63,33 +63,34 @@ if $ARGS[0] = '':
 	act 'Walk down to the river (0:10)':minut += 10 & gt 'gadriver', 'start'
 	act 'Walk into the woods (0:15)':minut += 15 & gt'gadforest','forest_edge'
 	act 'Walk to the fields (0:10)':minut += 10 & gt'gadfield','field'
-	if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour >= 6 and hour < 22 and gadrunday ! daystart:
-		act 'Go for a run (1:00)':
-			*clr & cla
-			menu_off = 1
-			minut += 60
-			fat -= RAND(5,15)
-			gs 'exp_gain', 'run', RAND(3,6)
-			gs 'sweat', 'add', 20
-			gadrunday = daystart
-			gs'stat'
-
-			if month <= 3 or month >= 11:
-				'<center><img <<$set_imgh>> src="images/locations/gadukino/village/gadbeg4.jpg"></center>'
-			elseif month=9 or month=10 or month=4 or month=5:
-				'<center><img <<$set_imgh>> src="images/locations/gadukino/village/gadbeg3.jpg"></center>'
-			else
-				if strenbuf >= salo:
-					'<center><img <<$set_imgh>> src="images/locations/gadukino/village/gadbeg1.jpg"></center>'
+	if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour >= 6 and hour < 22:
+		if pcs_energy >= 5 and pcs_stam >= stammax / 5:
+			act 'Go for a run (1:00)':
+				*clr & cla
+				menu_off = 1
+				gs 'exercise', 'tier1', 60, 'run'
+
+				if month <= 3 or month >= 11:
+					'<center><img <<$set_imgh>> src="images/locations/gadukino/village/gadbeg4.jpg"></center>'
+				elseif month=9 or month=10 or month=4 or month=5:
+					'<center><img <<$set_imgh>> src="images/locations/gadukino/village/gadbeg3.jpg"></center>'
 				else
-					'<center><img <<$set_imgh>> src="images/locations/gadukino/village/gadbeg2.jpg"></center>'
+					if strenbuf >= salo:
+						'<center><img <<$set_imgh>> src="images/locations/gadukino/village/gadbeg1.jpg"></center>'
+					else
+						'<center><img <<$set_imgh>> src="images/locations/gadukino/village/gadbeg2.jpg"></center>'
+					end
 				end
-			end
-			'You run for an hour enjoying the scenery.'
+				'You run for an hour enjoying the scenery.'
 
-			act 'Finish':gt'gadroad'
+				act 'Finish':gt'gadroad'
+			end
+		elseif pcs_stam >= stammax / 5:
+			act 'Go for a run (1:00)': '<br><font color="red">You are so hungry you cannot face going for a run.</font>'
+		else
+			act 'Go for a run (1:00)': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to go for a run.</font>'
 		end
-	elseif ($clothingworntype ! 'danilovich_outfits' or $shoeworntype ! 'danilovich') and hour >= 6 and hour < 22 and gadrunday ! daystart:
+	elseif ($clothingworntype ! 'danilovich_outfits' or $shoeworntype ! 'danilovich') and hour >= 6 and hour < 22:
 		'You could go for a run here if you were wearing sports clothes and shoes.'
 	end
 end

+ 43 - 26
locations/gdksport.qsrc

@@ -74,37 +74,53 @@ if $ARGS[0] = 'start':
 
 	*nl
 
-	if pcs_stam > 20 and $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour < 18:
+	if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour < 18:
 		if gsAboBeg > 0 and npc_pregtalk['A131'] = 0:
-			if pcs_energy >= 20:
-				act 'Take a track lesson. You have <<gsAboBeg>> lessons remaining': gt 'gdksport', 'racing2'
+			if pcs_stam >= stammax / 5:
+				if pcs_energy >= 20:
+					act 'Take a track lesson. You have <<gsAboBeg>> lessons remaining': gt 'gdksport', 'racing2'
+				else
+					act 'Take a track lesson. You have <<gsAboBeg>> lessons remaining': '<br><font color="red">You feel too hungry to do this.</font>'
+				end
 			else
-				act 'Take a track lesson. You have <<gsAboBeg>> lessons remaining': '<br><font color="red">You feel too hungry to do this.</font>'
+				act 'Take a track lesson. You have <<gsAboBeg>> lessons remaining': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
 			end
 		end
 		if gsAboVolley > 0 and volleysostav = 0 and npc_pregtalk['A69'] = 0:
-			if pcs_energy >= 20:
-				if week ! 5:
-					act 'Take a volleyball lesson. You have <<gsAboVolley>> lessons remaining': gt 'gdksport', 'vball2'
+			if pcs_stam >= stammax / 5:
+				if pcs_energy >= 20:
+					if week ! 5:
+						act 'Take a volleyball lesson. You have <<gsAboVolley>> lessons remaining': gt 'gdksport', 'vball2'
+					else
+						act 'Take a volleyball lesson. You have <<gsAboVolley>> lessons remaining': gt 'gdksport', 'vball3'
+					end
 				else
-					act 'Take a volleyball lesson. You have <<gsAboVolley>> lessons remaining': gt 'gdksport', 'vball3'
+					act 'Take a volleyball lesson. You have <<gsAboVolley>> lessons remaining': '<br><font color="red">You feel too hungry to do this.</font>'
 				end
 			else
-				act 'Take a volleyball lesson. You have <<gsAboVolley>> lessons remaining': '<br><font color="red">You feel too hungry to do this.</font>'
+				act 'Take a volleyball lesson. You have <<gsAboVolley>> lessons remaining': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
 			end
 		end
 		if volleysostav > 0:
 			if week ! 6 and volkomday ! daystart:
-				if pcs_energy >= 20:
-					act 'Play with the team': gt 'gdksport', 'vball4'
+				if pcs_stam >= stammax / 5:
+					if pcs_energy >= 20:
+						act 'Play with the team': gt 'gdksport', 'vball4'
+					else
+						act 'Play with the team': '<br><font color="red">You feel too hungry to do this.</font>'
+					end
 				else
-					act 'Play with the team': '<br><font color="red">You feel too hungry to do this.</font>'
+					act 'Play with the team': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to play.</font>'
 				end
 			elseif week = 6 and sorevday ! daystart and hour <= 18:
-				if pcs_energy >= 20:
-					act 'Play in Tournament': gt 'gdksport', 'vball5'
+				if pcs_stam >= stammax / 5:
+					if pcs_energy >= 20:
+						act 'Play in Tournament': gt 'gdksport', 'vball5'
+					else
+						act 'Play in Tournament': '<br><font color="red">You feel too hungry to do this.</font>'
+					end
 				else
-					act 'Play in Tournament': '<br><font color="red">You feel too hungry to do this.</font>'
+					act 'Play in Tournament': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to play.</font>'
 				end
 			elseif week = 6 and sorevday ! daystart and hour > 18:
 				'As you look around, you don''t see anyone from the team. You suddenly realize that there was a tournament game today and you were supposed to be here at 18:00! You missed the bus and the coach is going to be furious!'
@@ -116,16 +132,20 @@ if $ARGS[0] = 'start':
 			end
 		end
 		if gsAboDance > 0 and AlbinaQW['StarletsJoined'] = 0 and npc_pregtalk['A23'] = 0:
-			if pcs_energy >= 20:
-				act 'Take a dance lesson. You have <<gsAboDance>> lessons remaining':
-					if rand(0, 5) = 0:
-						gt 'danceGev'
-					else
-						gt 'gdksport', 'dance2'
+			if pcs_stam >= stammax / 5:
+				if pcs_energy >= 20:
+					act 'Take a dance lesson. You have <<gsAboDance>> lessons remaining':
+						if rand(0, 5) = 0:
+							gt 'danceGev'
+						else
+							gt 'gdksport', 'dance2'
+						end
 					end
+				else
+					act 'Take a dance lesson. You have <<gsAboDance>> lessons remaining': '<br><font color="red">You feel too hungry to do this.</font>'
 				end
 			else
-				act 'Take a dance lesson. You have <<gsAboDance>> lessons remaining': '<br><font color="red">You feel too hungry to do this.</font>'
+				act 'Take a dance lesson. You have <<gsAboDance>> lessons remaining': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to train.</font>'
 			end
 		elseif AlbinaQW['StarletsJoined'] > 0 and AlbinaQW['StarletsShutDown'] = 0 and npc_pregtalk['A23'] = 0 and AlbinaQW['startletsday'] ! daystart:
 			if hour = 15 and starlets_on = 1:
@@ -145,11 +165,8 @@ if $ARGS[0] = 'start':
 				'Tell Albina you want to <a href="exec:gt ''albina_starlets'',''Quit''">quit</a> the Starlets.'
 			end
 		end
-	elseif pcs_stam <= 20:
-		*nl
-		'You are too tired to do any exercise. You need to rest and replenish your stamina.'
 	end
-	
+
 	if deodorant > 0 and deodorant_on = 0:
 		'Your deodorant will last you for <b><<deodorant>></b> more '+iif(deodorant = 1, 'application.', 'applications.')
 		act 'Apply deodorant (0:01)':

+ 385 - 99
locations/grades.qsrc

@@ -127,74 +127,204 @@ end
 
 if $ARGS[0] = 'class_activity':
 !!This adds the point for doing an in class activity that is not modified.
-	if pcs_condition['lack_of_sleep'] >= 20:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
-	elseif pcs_condition['lack_of_sleep'] >= 10:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
-	elseif pcs_condition['lack_of_sleep'] >= 5:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 7'
-	elseif pcs_condition['lack_of_sleep'] >= 2:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 9'
+	if pcs_stam <= 0:
+		if pcs_condition['lack_of_sleep'] >= 20:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 1'
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 3'
+		elseif pcs_condition['lack_of_sleep'] >= 2:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
+		else
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
+		end
+	elseif pcs_stam < stammax / 5:
+		if pcs_condition['lack_of_sleep'] >= 20:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 4'
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 6'
+		elseif pcs_condition['lack_of_sleep'] >= 2:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 8'
+		else
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 9'
+		end
 	else
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 10'
+		if pcs_condition['lack_of_sleep'] >= 20:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 7'
+		elseif pcs_condition['lack_of_sleep'] >= 2:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 9'
+		else
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 10'
+		end
 	end
 end
 
 if $ARGS[0] = 'class_activity_skill':
 !!This adds the point for doing an in class activity modified by a skill.
-	if pcs_condition['lack_of_sleep'] >= 20:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
-	elseif pcs_condition['lack_of_sleep'] >= 10:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/100'
-	elseif pcs_condition['lack_of_sleep'] >= 5:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/100'
-	elseif pcs_condition['lack_of_sleep'] >= 2:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/100'
+	if pcs_stam <= 0:
+		if pcs_condition['lack_of_sleep'] >= 20:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/200'
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/200'
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/200'
+		elseif pcs_condition['lack_of_sleep'] >= 2:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/200'
+		else
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(85+<<ARGS[3]>>))/200'
+		end
+	elseif pcs_stam < stammax / 5:
+		if pcs_condition['lack_of_sleep'] >= 20:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (6*(85+<<ARGS[3]>>))/400'
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (15*(85+<<ARGS[3]>>))/400'
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (21*(85+<<ARGS[3]>>))/400'
+		elseif pcs_condition['lack_of_sleep'] >= 2:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (27*(85+<<ARGS[3]>>))/400'
+		else
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (30*(85+<<ARGS[3]>>))/400'
+		end
 	else
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(85+<<ARGS[3]>>))/100'
+		if pcs_condition['lack_of_sleep'] >= 20:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/100'
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/100'
+		elseif pcs_condition['lack_of_sleep'] >= 2:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/100'
+		else
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(85+<<ARGS[3]>>))/100'
+		end
 	end
 end
 
 if $ARGS[0] = 'class_activity_attributes':
 !!This adds the point for doing an in class activity modified by an attributes.
-	if pcs_condition['lack_of_sleep'] >= 20:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
-	elseif pcs_condition['lack_of_sleep'] >= 10:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/100'
-	elseif pcs_condition['lack_of_sleep'] >= 5:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/100'
-	elseif pcs_condition['lack_of_sleep'] >= 2:
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/100'
-	else
-		dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(50+<<ARGS[3]>>))/100'
-	end
-end
-
-if $ARGS[0] = 'optional_activity':
-!!This adds the point for doing an optional out of class activity that is not modified.
-	if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
+	if pcs_stam <= 0:
 		if pcs_condition['lack_of_sleep'] >= 20:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/200'
 		elseif pcs_condition['lack_of_sleep'] >= 10:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 5'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/200'
 		elseif pcs_condition['lack_of_sleep'] >= 5:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 7'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/200'
 		elseif pcs_condition['lack_of_sleep'] >= 2:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 9'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/200'
 		else
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 10'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(50+<<ARGS[3]>>))/200'
 		end
-	elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
+	elseif pcs_stam < stammax / 5:
 		if pcs_condition['lack_of_sleep'] >= 20:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 1'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (6*(50+<<ARGS[3]>>))/400'
 		elseif pcs_condition['lack_of_sleep'] >= 10:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 2'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (15*(50+<<ARGS[3]>>))/400'
 		elseif pcs_condition['lack_of_sleep'] >= 5:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 3'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (21*(50+<<ARGS[3]>>))/400'
 		elseif pcs_condition['lack_of_sleep'] >= 2:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += 4'
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (27*(50+<<ARGS[3]>>))/400'
+		else
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (30*(50+<<ARGS[3]>>))/400'
+		end
+	else
+		if pcs_condition['lack_of_sleep'] >= 20:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/100'
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/100'
+		elseif pcs_condition['lack_of_sleep'] >= 2:
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/100'
+		else
+			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (10*(50+<<ARGS[3]>>))/100'
+		end
+	end
+end
+
+if $ARGS[0] = 'optional_activity':
+!!This adds the point for doing an optional out of class activity that is not modified.
+	if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
+		if pcs_stam <= 0:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 3'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 4'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 5'
+			end
+		elseif pcs_stam < stammax / 5:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 4'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 6'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 8'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 9'
+			end
+		else
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 5'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 7'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 9'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 10'
+			end
+		end
+	elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
+		if pcs_stam <= 0:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 3'
+			end
+		elseif pcs_stam < stammax / 5:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 3'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 4'
+			end
 		else
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 5'
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 1'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 2'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 3'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 4'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += 5'
+			end
 		end
 	end
 	
@@ -206,28 +336,80 @@ end
 if $ARGS[0] = 'optional_activity_skill':
 !!This adds the point for doing an optional out of class activity modified by a skill.
 	if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
-		if pcs_condition['lack_of_sleep'] >= 20:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 10:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 5:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 2:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/100'
+		if pcs_stam <= 0:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/200'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(85+<<ARGS[4]>>))/200'
+			end
+		elseif pcs_stam < stammax / 5:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (6*(85+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (15*(85+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (21*(85+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (27*(85+<<ARGS[3]>>))/400'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (30*(85+<<ARGS[4]>>))/400'
+			end
 		else
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(85+<<ARGS[4]>>))/100'
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (7*(85+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/100'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(85+<<ARGS[4]>>))/100'
+			end
 		end
 	elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
-		if pcs_condition['lack_of_sleep'] >= 20:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (1*(85+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 10:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 5:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (3*(85+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 2:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (4*(85+<<ARGS[3]>>))/100'
+		if pcs_stam <= 0:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (1*(85+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(85+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (4*(85+<<ARGS[3]>>))/200'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[4]>>))/200'
+			end
+		elseif pcs_stam < stammax / 5:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(85+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (6*(85+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(85+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (12*(85+<<ARGS[3]>>))/400'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (15*(85+<<ARGS[4]>>))/400'
+			end
 		else
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[4]>>))/100'
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (1*(85+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(85+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(85+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (4*(85+<<ARGS[3]>>))/100'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(85+<<ARGS[4]>>))/100'
+			end
 		end
 	end
 
@@ -239,28 +421,80 @@ end
 if $ARGS[0] = 'optional_activity_attribute':
 !!This adds the point for doing an optional out of class activity modified by an attributes.
 	if dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 0 or $ARGS[3] = 'yes':
-		if pcs_condition['lack_of_sleep'] >= 20:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 10:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 5:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 2:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/100'
+		if pcs_stam <= 0:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/200'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(50+<<ARGS[4]>>))/200'
+			end
+		elseif pcs_stam < stammax / 5:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (6*(50+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (15*(50+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (21*(50+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (27*(50+<<ARGS[3]>>))/400'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (30*(50+<<ARGS[4]>>))/400'
+			end
 		else
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(50+<<ARGS[4]>>))/100'
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (7*(50+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/100'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (10*(50+<<ARGS[4]>>))/100'
+			end
 		end
 	elseif dyneval('RESULT = class[''<<$ARGS[1]>>_<<$ARGS[2]>>_use_computer'']') = 1:
-		if pcs_condition['lack_of_sleep'] >= 20:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (1*(50+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 10:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 5:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (3*(50+<<ARGS[3]>>))/100'
-		elseif pcs_condition['lack_of_sleep'] >= 2:
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_weekly_grade_gain''] += (4*(50+<<ARGS[3]>>))/100'
+		if pcs_stam <= 0:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (1*(50+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(50+<<ARGS[3]>>))/200'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (4*(50+<<ARGS[3]>>))/200'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[4]>>))/200'
+			end
+		elseif pcs_stam < stammax / 5:
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(50+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (6*(50+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (9*(50+<<ARGS[3]>>))/400'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (12*(50+<<ARGS[3]>>))/400'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (15*(50+<<ARGS[4]>>))/400'
+			end
 		else
-			dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[4]>>))/100'
+			if pcs_condition['lack_of_sleep'] >= 20:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (1*(50+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 10:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (2*(50+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 5:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (3*(50+<<ARGS[3]>>))/100'
+			elseif pcs_condition['lack_of_sleep'] >= 2:
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (4*(50+<<ARGS[3]>>))/100'
+			else
+				dynamic 'class[''<<$ARGS[1]>>_<<$ARGS[2]>>_optional_weekly_grade_gain''] += (5*(50+<<ARGS[4]>>))/100'
+			end
 		end
 	end
 
@@ -287,28 +521,80 @@ if $ARGS[0] = 'homework':
 		if $class_list_institution[i] = $ARGS[1]:
 			if dyneval ('RESULT = class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_homework'']') = 1:
 				if $ARGS[2] = 'no':
-					if pcs_condition['lack_of_sleep'] >= 20:
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*1*(50+modifier))/100)'
-					elseif pcs_condition['lack_of_sleep'] >= 10:
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*2*(50+modifier))/100)'
-					elseif pcs_condition['lack_of_sleep'] >= 5:
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*3*(50+modifier))/100)'
-					elseif pcs_condition['lack_of_sleep'] >= 2:
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*4*(50+modifier))/100)'
+					if pcs_stam <= 0:
+						if pcs_condition['lack_of_sleep'] >= 20:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*1*(50+modifier))/200)'
+						elseif pcs_condition['lack_of_sleep'] >= 10:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*2*(50+modifier))/200)'
+						elseif pcs_condition['lack_of_sleep'] >= 5:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*3*(50+modifier))/200)'
+						elseif pcs_condition['lack_of_sleep'] >= 2:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*4*(50+modifier))/200)'
+						else
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*5*(50+modifier))/200)'
+						end
+					elseif pcs_stam < stammax / 5:
+						if pcs_condition['lack_of_sleep'] >= 20:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*3*(50+modifier))/400)'
+						elseif pcs_condition['lack_of_sleep'] >= 10:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*6*(50+modifier))/400)'
+						elseif pcs_condition['lack_of_sleep'] >= 5:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*9*(50+modifier))/400)'
+						elseif pcs_condition['lack_of_sleep'] >= 2:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*12*(50+modifier))/400)'
+						else
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*15*(50+modifier))/400)'
+						end	
 					else
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*5*(50+modifier))/100)'
+						if pcs_condition['lack_of_sleep'] >= 20:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*1*(50+modifier))/100)'
+						elseif pcs_condition['lack_of_sleep'] >= 10:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*2*(50+modifier))/100)'
+						elseif pcs_condition['lack_of_sleep'] >= 5:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*3*(50+modifier))/100)'
+						elseif pcs_condition['lack_of_sleep'] >= 2:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*4*(50+modifier))/100)'
+						else
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*(((2-class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_use_computer''])*5*(50+modifier))/100)'
+						end				
 					end
 				else
-					if pcs_condition['lack_of_sleep'] >= 20:
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((2*(50+modifier))/100)'
-					elseif pcs_condition['lack_of_sleep'] >= 10:
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((5*(50+modifier))/100)'
-					elseif pcs_condition['lack_of_sleep'] >= 5:
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((7*(50+modifier))/100)'
-					elseif pcs_condition['lack_of_sleep'] >= 2:
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((9*(50+modifier))/100)'
+					if pcs_stam <= 0:
+						if pcs_condition['lack_of_sleep'] >= 20:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((2*(50+modifier))/200)'
+						elseif pcs_condition['lack_of_sleep'] >= 10:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((5*(50+modifier))/200)'
+						elseif pcs_condition['lack_of_sleep'] >= 5:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((7*(50+modifier))/200)'
+						elseif pcs_condition['lack_of_sleep'] >= 2:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((9*(50+modifier))/200)'
+						else
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((10*(50+modifier))/200)'
+						end
+					elseif pcs_stam < stammax / 5:
+						if pcs_condition['lack_of_sleep'] >= 20:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((6*(50+modifier))/400)'
+						elseif pcs_condition['lack_of_sleep'] >= 10:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((15*(50+modifier))/400)'
+						elseif pcs_condition['lack_of_sleep'] >= 5:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((21*(50+modifier))/400)'
+						elseif pcs_condition['lack_of_sleep'] >= 2:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((27*(50+modifier))/400)'
+						else
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((30*(50+modifier))/400)'
+						end
 					else
-						dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((10*(50+modifier))/100)'
+						if pcs_condition['lack_of_sleep'] >= 20:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((2*(50+modifier))/100)'
+						elseif pcs_condition['lack_of_sleep'] >= 10:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((5*(50+modifier))/100)'
+						elseif pcs_condition['lack_of_sleep'] >= 5:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((7*(50+modifier))/100)'
+						elseif pcs_condition['lack_of_sleep'] >= 2:
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((9*(50+modifier))/100)'
+						else
+							dynamic 'class[''<<$ARGS[1]>>_<<$class_list_name[i]>>_weekly_grade_gain''] += <<ARGS[3]>>*((10*(50+modifier))/100)'
+						end
 					end
 				end
 			end

+ 19 - 16
locations/gschool_grounds.qsrc

@@ -351,24 +351,27 @@ if $ARGS[0] = 'sports':
 
 	act 'Leave the sports field': minut += 1 & gt 'gschool_grounds', 'main'
 
-	if schoolrunday ! daystart and $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich':
-		act 'Go for a run (1 hour)':
-			*clr & cla
-			menu_off = 1
-			gs 'exercise', 'tier1', 60, 'run'
-			fat -= rand(0,4)
-			gs 'sweat', 'add', 5
-			gs 'stat'
-			if month > 2 and month <= 9:
-				'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/grounds/runsummer.jpg"></center>'
-			else
-				'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/grounds/runwinter.jpg"></center>'
-			end
-			'You spend an hour running on the track.'
+	if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich':
+		if pcs_energy >= 5 and pcs_stam >= stammax / 5:
+			act 'Go for a run (1 hour)':
+				*clr & cla
+				menu_off = 1
+				gs 'exercise', 'tier1', 60, 'run'
+				if month > 2 and month <= 9:
+					'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/grounds/runsummer.jpg"></center>'
+				else
+					'<center><img <<$set_imgh>> src="images/locations/pavlovsk/school/grounds/runwinter.jpg"></center>'
+				end
+				'You spend an hour running on the track.'
 
-			act 'Continue': gt 'gschool_grounds', 'sports'
+				act 'Continue': gt 'gschool_grounds', 'sports'
+			end
+		elseif pcs_stam >= stammax / 5:
+			act 'Go for a run (1:00)': '<br><font color="red">You are so hungry you cannot face going for a run.</font>'
+		else
+			act 'Go for a run (1:00)': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to go for a run.</font>'
 		end
-	elseif schoolrunday ! daystart and ($clothingworntype ! 'danilovich_outfits' or $shoeworntype ! 'danilovich'):
+	elseif ($clothingworntype ! 'danilovich_outfits' or $shoeworntype ! 'danilovich'):
 		'You could go for a run here if you were wearing sports clothes and shoes.'
 	end
 

+ 9 - 5
locations/pav_park.qsrc

@@ -295,11 +295,15 @@ if $ARGS[0] = 'start':
 			act 'Continue': gt 'pav_park', 'start'
 		end
 	end
-	if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour > 5 and hour < 23 and daybegskver ! daystart and pcs_energy >= 10:
-		act 'Jog through the park (1:00)': gt 'pav_park', 'run'
-	elseif $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour > 5 and hour < 23 and daybegskver ! daystart:
-		act 'Jog through the park (1:00)': '<br><font color="red">You feel too hungry to do this.</font>'
-	elseif ($clothingworntype ! 'danilovich_outfits' or $shoeworntype ! 'danilovich') and hour > 5 and hour < 23 and daybegskver ! daystart:
+	if $clothingworntype = 'danilovich_outfits' and $shoeworntype = 'danilovich' and hour > 5 and hour < 23:
+		if pcs_energy >= 10 and pcs_stam >= stammax / 5:
+			act 'Jog through the park (1:00)': gt 'pav_park', 'run'
+		elseif pcs_stam >= stammax / 5:
+			act 'Jog through the park (1:00)': '<br><font color="red">You feel too hungry to do this.</font>'
+		else
+			act 'Jog through the park (1:00)': '<br><font color="red">You are to exhausted to do this. Recover your stamina before trying to go for a run.</font>'
+		end
+	else
 		'You could jog around the park if you were wearing sports clothes and shoes.'
 	end
 	act 'Sit on the bench': gt 'pav_park', 'sitting_park_bench'

+ 9 - 7
locations/stat.qsrc

@@ -85,10 +85,6 @@ end
 if lernSkill >= 8: gs 'exp_gain', 'intel', 1 & lernSkill = 0
 if lern >= 10: gs 'exp_gain', 'intel', 1 & lern = 0
 
-!! Katja learnign about you sexual experience from other sources because you are a slut.
-if fame['pav_slut'] >= 150 and stat['bj'] > 0 and katjaQW['knows_BJ'] ! 1: katjaQW['knows_BJ'] = 1
-if fame['pav_slut'] >= 250 or preg > 0 and stat['vaginal'] > 0 and katjaQW['knows_sex'] ! 1: katjaQW['knows_sex'] = 1
-
 shameless = guy + stat['bj'] + stat['anal'] + stat['hj'] + ((slutty + gang) * 2)
 moneySUM = money + karta + stolmoney
 cumSUM = cumsumbod/40
@@ -193,7 +189,7 @@ elseif pcs_inhib > 100:
 end
 
 healthmax = (pcs_vital * 10 + pcs_stren * 5)
-stammax = 5 * (2 * pcs_vital + pcs_agil + pcs_stren) / 2
+stammax = (30* (2 * pcs_vital + pcs_agil + pcs_stren) +1000)/ 13
 speed = (2 * (pcs_stren + pcs_agil) + pcs_vital) / 5
 if healthmax < 1: healthmax = 1
 if willpowermax < 50: willpowermax = 50
@@ -452,7 +448,7 @@ if minut >= 60:
 			pcs_energy -= (4 * amphetamineBonus + succublvl/2)
 			pcs_hydra -= (8 * amphetamineBonus + succublvl/2)
 		end
-		pcs_stam += stammax / 10
+		pcs_stam += stammax / 8
 		pcs_sleep -= 4
 		if alko > 0: alko -= 1
 		pcs_willpower_feeder += willpowermax*4
@@ -466,7 +462,6 @@ if minut >= 60:
 			pcs_energy -= (8 * amphetamineBonus + succublvl)
 			pcs_hydra -= (16 * amphetamineBonus + succublvl)
 		end
-		pcs_stam += stammax / 20
 		if InSleepWake <= hour or InSleepWake[1] < daystart:
 			pcs_sleep -= 4
 		end
@@ -495,6 +490,13 @@ if minut >= 60:
 		else
 			pcs_mood['hydredcheck'] = 0
 		end
+		if pcs_stam <= 0:
+			pcs_mood -= 6
+			pcs_sleep -= 5
+		elseif pcs_stam < stammax / 5:
+			pcs_mood -= 3
+		end
+		pcs_stam += stammax / 40
 		pcs_willpower_feeder += willpowermax*4/3
 		pcs_willpwr += pcs_willpower_feeder/100
 		pcs_willpower_feeder = pcs_willpower_feeder mod 100

+ 6 - 0
locations/willpower.qsrc

@@ -102,6 +102,12 @@ if $ARGS[0] = 'calc':
 	elseif pcs_sleep < 30:
 		will_calc += 5
 	end
+!!exhaustion (stamina)
+	if pcs_stam <= 0:
+		will_calc += 10
+	elseif pcs_stam < stammax / 5:
+		will_calc += 5
+	end
 !!hunger
 	if pcs_energy < 5:
 		will_calc += 50