Browse Source

[changed] minor `exp_gain` refactor

LinaHirata 6 months ago
parent
commit
065b6e414f
1 changed files with 51 additions and 43 deletions
  1. 51 43
      locations/exp_gain.qsrc

+ 51 - 43
locations/exp_gain.qsrc

@@ -1,54 +1,62 @@
 # exp_gain
 !2022/08/07
 
-!gosup that exp gain is run through to be able to modify exp gain by conditions of the player character
+! gosub that exp gain is run through to be able to modify exp gain by conditions of the player character
+
+! use: gs 'exp_gain', 'skill', exp
+! example: gs 'exp_gain', 'photoskl', rand(1,2)
+! example: gs 'exp_gain', $ARGS[2], rand(3,5)
 
-!Modify exp gain if Sveta does not get enough sleep.
 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_traits['new_again'] > 0: ARGS[1] *= 2
-		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
+!!	Prevents EXP gain for stren_plus if its 50 or higher and Sveta ISNT using steroids
+	if $ARGS[0] = 'stren_plus' and stren_plus_lvl >= 50 and steroid_dose = 0:
+		exit
+	end
+
+!!	Traits:
+!!	- New Again
+	if pcs_traits['new_again'] > 0: ARGS[1] *= 2
+
+!!	Stats:
+!!	- Exhaustion (lack of sleep and stamina)
+	if pcs_stam <= 0:
+		if pcs_condition['lack_of_sleep'] >= 20:
+			ARGS[1] /= 8
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			ARGS[1] /= 4
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			ARGS[1] = ARGS[1] * 3 / 8
+		elseif pcs_condition['lack_of_sleep'] >= 2:
+			ARGS[1] = ARGS[1] * 9 / 20
 		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"
-			else
-				dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>"
-			end
+			ARGS[1] /= 2
+		end
+	elseif pcs_stam < stammax / 5:
+		if pcs_condition['lack_of_sleep'] >= 20:
+			ARGS[1] = ARGS[1] * 3 / 16
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			ARGS[1] = ARGS[1] * 3 / 8
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			ARGS[1] = ARGS[1] * 9 / 16
+		elseif pcs_condition['lack_of_sleep'] >= 2 and ARGS[1] > 1:
+			ARGS[1] = ARGS[1] * 27 / 40
+		elseif ARGS[1] > 1:
+			ARGS[1] = ARGS[1] * 3 / 4
+		end
+	else
+		if pcs_condition['lack_of_sleep'] >= 20:
+			ARGS[1] /= 4
+		elseif pcs_condition['lack_of_sleep'] >= 10:
+			ARGS[1] /= 2
+		elseif pcs_condition['lack_of_sleep'] >= 5:
+			ARGS[1] = ARGS[1] * 3 / 4
+		elseif pcs_condition['lack_of_sleep'] >= 2 and ARGS[1] > 1:
+			ARGS[1] = ARGS[1] * 9 / 10
 		end
 	end
+
+!!	EXP Assignment
+	dynamic "<<$ARGS[0]>>_exp += <<ARGS[1]>>"
 end
 
 --- exp_gain ---------------------------------