瀏覽代碼

Merge remote-tracking branch 'Milky_boobs/master'

KevinSmarts 5 年之前
父節點
當前提交
f723f9ec31
共有 1 個文件被更改,包括 81 次插入2 次删除
  1. 81 2
      locations/lact_lib.qsrc

+ 81 - 2
locations/lact_lib.qsrc

@@ -344,6 +344,86 @@ if $ARGS[0] = 'show_breast_stat':
 	'lactation[''breastmv''] = <<lactation[''breastmv'']>>'
 end
 
+!!	milk production function
+if $ARGS[0] = 'prod_milk':
+	!!	function for Svetas milk production. Milk production will cost stamina, hydration, and hunger. this function is used in breastcycle
+	!!	func('lact_lib','prod_milk',milkamount)
+	!!	result = produced breast milk amount in ml*1000
+	!!	ARGS[1] = Requested milk production amount produced in ml*1000. Usually should be the lactaterate.
+	!!	If Sveta has salo <= 15, she will not produce breast milk as she is basically starving and her body will shut down everything that is causing too much energy consumption.
+	if lactation['active'] > 0 and salo > 15:
+		!!	checking how much hydration, stamina and hunger is needed to produce x amount of breast milk
+		!!	checking if enough stamina and hydra is available
+		if (ARGS[1]/10000) < pcs_stam and (ARGS[1]/10000) < pcs_hydra:
+			!!	full requested milk amount can be produced. substracting from stamina, hydration energy.
+			if (ARGS[1]/10000) < 1:
+				pcs_stam -= 1
+				pcs_hydra -= 1
+			else
+				pcs_stam -= (ARGS[1]/10000)
+				pcs_hydra -= (ARGS[1]/10000)
+			end
+			if pcs_stam < 1: pcs_stam = 1
+			if pcs_hydra < 1: pcs_hydra = 1
+			if (ARGS[1]/9000) < pcs_energy:
+				if (ARGS[1]/9000) < 1:
+					pcs_energy -= 1
+				else
+					pcs_energy -= (ARGS[1]/9000)
+					if pcs_energy < 1: pcs_energy = 1
+				end
+				result = ARGS[1]
+			else
+				!!	If energy is too low, milk will be produced but there is a chance that salo will shrink.
+				pcs_energy = 1
+				if rand(0,100) > 95: salo -= 1
+				if pain['breasts'] < 20: pain['breasts'] += 1
+				result = ARGS[1]
+			end
+		elseif pcs_stam <= 0 or pcs_hydra <= 0:
+			!!	if sveta has not enough hydration or stamina, no milk is produced.
+			result = 0
+		else
+			if (pcs_stam*10000) < (pcs_hydra*10000):
+				temp_var = (pcs_stam*10000)
+				pcs_stam = 1
+				if (ARGS[1]/10000) < pcs_hydra:
+					pcs_hydra -= (ARGS[1]/10000)
+				else
+					pcs_hydra = 1
+				end
+			else
+				temp_var = (pcs_hydra*10000)
+				pcs_hydra = 1
+				if (ARGS[1]/10000) < pcs_stam:
+					pcs_stam -= (ARGS[1]/10000)
+				else
+					pcs_stam = 1
+				end
+			end
+			if (temp_var/9000) < pcs_energy:
+				if (temp_var/9000) < 1:
+					pcs_energy -= 1
+				else
+					pcs_energy -= (temp_var/9000)
+					if pcs_energy < 1: pcs_energy = 1
+				end
+			else
+				!!	If energy is too low, milk will be produced but there is a chance that salo will shrink.
+				pcs_energy = 1
+				if rand(0,100) > 95: salo -= 1
+				if pain['breasts'] < 20: pain['breasts'] += 1
+			end
+			if pcs_energy < 1: pcs_energy = 1
+			if pcs_hydra < 1: pcs_hydra = 1
+			if pcs_stam < 1: pcs_stam = 1
+			result = temp_var			
+		end
+	else
+		result = 0
+	end	
+end
+
 !!	Lactation On/Off switch function
 if $ARGS[0] = 'lact_switch':
 	!!	Usage
@@ -486,10 +566,9 @@ if $ARGS[0] = 'breastcycle':
 		end
 		!!	Filling lactaterate into svetas breast every hour
 		if lactation['breastmv'] < lactation['breastmm'] and lactation['lactaterate'] > 50:
-			lactation['breastmv'] += lactation['lactaterate']
+			lactation['breastmv'] += func('lact_lib','prod_milk',lactation['lactaterate'])
 			if lactation['breastmv'] > lactation['breastmm']: lactation['breastmv'] = lactation['breastmm']
 		end
-		
 	end
 	if lactation['milkgrowday'] < daystart:
 		func('lact_lib','BreastGrowth')