Browse Source

[fix] changed some cheat behaviour. Division by Zero error not possible anymore (except someone manually messes with the variables). Finally replaced the dirty breastshrinking fix with proper logig.

sandra_schulz 5 years ago
parent
commit
e5357db7ba
1 changed files with 9 additions and 12 deletions
  1. 9 12
      locations/lact_lib.qsrc

+ 9 - 12
locations/lact_lib.qsrc

@@ -101,6 +101,7 @@ if $ARGS[0] = 'init_breasttissue' and lactation['breasttissueinitiated'] <= 0:
 	!!	full breastccm would be nbsize + magicf2b + silicone.
 	!!	Getting percentage tissue from breastccm.
 	lactation['breastccm'] = func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone))
+	if lactation['breastccm'] <= 0: lactation['breastccm'] = 1
 	lactation['nbsizepercent'] = (nbsize/(nbsize + magicf2b + silicone))*100
 	lactation['magicf2bpercent'] = (magicf2b/(nbsize + magicf2b + silicone))*100
 	lactation['siliconepercent'] = (silicone/(nbsize + magicf2b + silicone))*100
@@ -243,6 +244,7 @@ end
 if $ARGS[0] = 'breastrecalc':
 	!!	use func('lact_lib','breastrecalc')
 	lactation['breastccm'] = func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone))
+	if lactation['breastccm'] <= 0: lactation['breastccm'] = 1
 	lactation['nbsizepercent'] = (nbsize/(nbsize + magicf2b + silicone))*100
 	lactation['magicf2bpercent'] = (magicf2b/(nbsize + magicf2b + silicone))*100
 	lactation['siliconepercent'] = (silicone/(nbsize + magicf2b + silicone))*100
@@ -291,20 +293,14 @@ if $ARGS[0] = 'breastrecalc':
 	lactation['breastfat'] = lactation['breastuseabletissue'] - lactation['breastglandtissue']
 end
 
-!!	This function fixes some things that are caused by cheats
-if ARGS[0] = 'AntiCheatIssues':
-	!! usage func('lact_lib', 'AntiCheatIssues')
-	if lactation['breasttissueinitiated'] <= 0: func('lact_lib','init_breasttissue')
-	if lactation['breastccm'] <= 0: func('lact_lib','breastrecalc')
-	if lactation['breastccm'] <= 0: lactation['breastccm'] = 1
-	if lactation['active'] > 0 and lactation['alveoliexpandlvl_change'] < lactation['alveoliexpandlvl']: lactation['alveoliexpandlvl_change'] = lactation['alveoliexpandlvl']
-end
-
 !!	This function is used for breastgrowth. When nbsize, magicf2b, silicone, alveolicount or the alveoliexpandlvl are changed the breastccm changes. Everything will be written back to the specific variable
 if $ARGS[0] = 'BreastGrowth':
 	!!	usage func('lact_lib','BreastGrowth')
 	!!	setting everything in here.
-	func('lact_lib','AntiCheatIssues')
+	if lactation['breastccm'] <= 0:
+		lactation['breasttissueinitiated'] = 0
+		func('lact_lib','init_breasttissue')
+	end
 	if lactation['breastccm'] <> func('lact_lib','bsizetoccm',(nbsize + magicf2b + silicone)) or lactation['alveolicount_change'] <> lactation['alveolicount'] or lactation['alveoliexpandlvl_change'] <> lactation['alveoliexpandlvl']:
 		!!	There are general breast growth events that will increase nbsize, magicf2b or silicone. So the breast "contents" have to be recalculated. This is happening here with the breastrecalc function.
 		!!	Now the fun part. Warning, crazy math ahead. I got headaches while doing this, so better not mess with it or you will break everything.
@@ -548,7 +544,7 @@ if $ARGS[0] = 'lact_switch':
 		lactation['nipgrowth'] = 2
 		pcs_nips += lactation['nipgrowth']
 		if lactation['alveoliexpandlvl'] < 10: lactation['alveoliexpandlvl'] = 10
-		if lactation['alveoliexpandlvl_change'] < 10: lactation['alveoliexpandlvl_change'] = 10
+		if lactation['alveoliexpandlvl_change'] < 9: lactation['alveoliexpandlvl_change'] = 9
 		lactation['milkprod_type'] = 1
 	else
 		!!	If lactation is on, the stuff below will switch it off again.
@@ -557,11 +553,12 @@ if $ARGS[0] = 'lact_switch':
 		lactation['breastmv'] = 0
 		lactation['breastmm'] = 0
 		lactation['alveoliexpandlvl'] = 0
-		lactation['alveoliexpandlvl_change'] = 0
+		lactation['alveoliexpandlvl_change'] = 1
 		lactation['prolactinlvl'] = 0
 		if pcs_nips > lactation['nipgrowth']: pcs_nips -= lactation['nipgrowth']
 		lactation['nipgrowth'] = 0
 	end
+	func('lact_lib','breastcycle')
 end
 
 !!	new breast cycle function, will replace the monster lactation function in femcyc