Bladeren bron

Implemented Kevin suggestions for cleaner code.

Mike Greene 5 jaren geleden
bovenliggende
commit
83103e472e
5 gewijzigde bestanden met toevoegingen van 105 en 37 verwijderingen
  1. 6 3
      glife.qproj
  2. 31 9
      locations/castSpell.qsrc
  3. 41 0
      locations/spellTeleport.qsrc
  4. 4 14
      locations/treeCircActs.qsrc
  5. 23 11
      locations/treeCircle.qsrc

+ 6 - 3
glife.qproj

@@ -1099,8 +1099,11 @@
 	</Folder>
 	<Location name="LBZhouse"/>
 	<Location name="BanSexType"/>
-	<Location name="castSpell"/>
-	<Location name="treeCircle"/>
-	<Location name="treeCircActs"/>
+	<Folder name="Magic">
+		<Location name="castSpell"/>
+		<Location name="spellTeleport"/>
+		<Location name="treeCircle"/>
+		<Location name="treeCircActs"/>
+	</Folder>
 	</Structure>
 </QGen-project>

+ 31 - 9
locations/castSpell.qsrc

@@ -19,21 +19,43 @@ spellDiff['glamour'] = 30
 spellSuccess = 0
 
 if spellKnown[$ARGS[0]] = 1:
+	!Make a Skill Check to see if the Spell succeeds
+	spellRoll = pcs_splcstng - spellDiff[$ARGS[0]] - (pcs_horny/5) + rand(1,100)
+	if spellRoll > 50:
+		!Critical Success
+		spellSuccess = 2
+		splcstng_exp += rand(1,spellDiff[$ARGS[0]]) + rand(0,5)
+	elseif spellRoll > 10:
+		!Success
+		spellSuccess = 1
+		splcstng_exp += rand(1,spellDiff[$ARGS[0]])
+	elseif spellRoll > -20:
+		!Failure
+		spellSuccess = 0
+		splcstng_exp += rand(1,spellDiff[$ARGS[0]]) / 2
+	else:
+		!Critical Failure
+		spellSuccess = -1
+		splcstng_exp += rand(1,spellDiff[$ARGS[0]]) / 2
+	end
+	killvar 'spellRoll'
+
 	!Incur the costs of casting the spell
-	pcs_manna -= spellMana[$ARGS[0]]
+	if spellSuccess = 2:
+		manaCost = spellMana[$ARGS[0]] / 2
+	elseif spellSuccess = -1:
+		manaCost = spellMana[$ARGS[0]] * 2
+	else:
+		manaCost = spellMana[$ARGS[0]]
+	end
+	pcs_manna -= manaCost
 	!pcs_willpwr -= spellWill[$ARGS[0]]
-	arouseVal = spellMana[$ARGS[0]] / 50
+	arouseVal = manaCost / 50
 	gs 'arousal', 'voyeur', arouseVal
 	minut -= arouseVal
 	killvar 'arouseVal'
+	killvar 'manaCost'
 
-	!Make a Skill Check to see if the Spell succeeds
-	if pcs_splcstng - pcs_horny + rand(1,100) > spellDiff[$ARGS[0]]:
-		spellSuccess = 1
-		splcstng_exp += spellDiff[$ARGS[0]]
-	else:
-		splcstng_exp += spellDiff[$ARGS[0]] / 2
-	end
 end
 
 minut += spellTime[$ARGS[0]]

+ 41 - 0
locations/spellTeleport.qsrc

@@ -0,0 +1,41 @@
+#spellTeleport
+! Do the stuff of a Teleport
+!	ARGS[0] = the Target Location
+
+$NewLocation = $ARGS[0]
+
+:RandLocLoop
+$randomLoc = $tpLocations[rand(0,arrsize($tpLocations) - 1)]
+if $randomLoc = $NewLocation or $randomLoc = $EntryPoint:
+	jump 'RandLocLoop'
+end
+
+didItWork = func("castSpell", "teleport")
+
+if didItWork > 0:
+	*nl
+	"The blur you see just outside the ring seems to shift."
+	wait 1000
+	if $treeCircArg[$NewLocation] = "":
+		gt $treeCircLoc[$NewLocation]
+	else:
+		gt $treeCircLoc[$NewLocation], $treeCircArg[$NewLocation]
+	end
+elseif didItWork < 0:
+	*nl
+	"The blur you see just outside the ring seems to shift.  Something did not go right!"
+	wait 1000
+	if $treeCircArg[$randomLoc] = "":
+		gt $treeCircLoc[$randomLoc]
+	else:
+		gt $treeCircLoc[$randomLoc], $treeCircArg[$randomLoc]
+	end
+else:
+	'You feel drained, but the energy fizzles out and nothing happens'
+end
+
+killvar '$randomLoc'
+killvar '$NewLocation'
+killvar didItWork
+
+-- spellTeleport ---------------------------------

+ 4 - 14
locations/treeCircActs.qsrc

@@ -6,6 +6,8 @@
 !	ARGS[2] = location leaving to	['park']
 !	ARGS[3] = parameter for prev	['start']
 
+
+
 if $EntryPoint = $ARGS[0]:
 	act 'Leave the circle to <<$treeCircName[$ARGS[0]]>>':
 		if $treeCircArg['<<$ARGS[0]>>'] = '':
@@ -16,20 +18,8 @@ if $EntryPoint = $ARGS[0]:
 	end
 else:
 	if canTeleport = 1 and tpKnown[$ARGS[0]] = 1:
-		act 'Will yourself to <<$treeCircName[$ARGS[0]]>>':
-			if func('castSpell', 'teleport') = 1:
-				''
-				'The blur you see just outside the ring seems to shift.'
-				wait 1000
-				if $treeCircArg['<<$ARGS[0]>>'] = '':
-					gt $treeCircLoc['<<$ARGS[0]>>']
-				else:
-					gt $treeCircLoc['<<$ARGS[0]>>'], $treeCircArg['<<$ARGS[0]>>']
-				end
-			else:
-				'You feel drained, but the energy fizzles out and nothing happens'
-			end
-		end
+		$dynAction = "act 'Will yourself to <<$treeCircName[$ARGS[0]]>>': gs 'spellTeleport', '<<$ARGS[0]>>'"
+		dynamic $dynAction
 	end
 end
 

+ 23 - 11
locations/treeCircle.qsrc

@@ -4,6 +4,13 @@
 ! ARGS[0] is your entrance point as those listed below.  If the user doesn''t have the magical ability,
 !		they will only be allowed to leave back from their entry point.
 
+! Locations
+$tpLocations[0] = 'CentralPark'
+$tpLocations[1] = 'PavlovskPark'
+$tpLocations[2] = 'GadForest'
+$tpLocations[3] = 'PushkinPark'
+$tpLocations[4] = 'Village'
+
 ! Build Info Arrays for Locations
 !	treeCircName = The Pretty Name of the Location
 !	treeCircLoc  = The Location to send the user to when leaving Circle
@@ -37,7 +44,7 @@ $EntryPoint = $ARGS[0]
 '<center><img <<$set_imgh>> src="images/locations/shared/park/tree_circle.jpg"></center>'
 
 'The small clearing in the center of the tree circle is two body lengths wide.  The ground is covered with a soft, sponging moss.  Everything is surprisingly visible considering you cna barely see the sky through the overhead cover of leaves and branches.  As you look to the outside of the circle, everything seems to be vague and indistinct.  This makes it hard to comprehend what lies outside the ring.'
-''
+*nl
 
 ! Determine if this user can teleport at all.
 canTeleport = 0
@@ -47,7 +54,7 @@ if spellKnown['teleport'] = 1:
 	if pcs_manna > spellMana['teleport']:
 		canTeleport = 1
 	else:
-		''
+		*nl
 		'You feel too tired to pull off a shift right now.'
 	end
 else:
@@ -59,19 +66,24 @@ end
 tpKnown[$EntryPoint] = 1
 
 ! Setup Actions for locations when applicable
-gs 'treeCircActs', 'CentralPark'
-gs 'treeCircActs', 'PavlovskPark'
-gs 'treeCircActs', 'GadForest'
-gs 'treeCircActs', 'PushkinPark'
-gs 'treeCircActs', 'Village'
+i = 0
+:LocLoop
+if i < ARRSIZE('$tpLocations'):
+	$tpLocations[i]
+	gs 'treeCircActs', $tpLocations[i]
+	i += 1
+	jump 'LocLoop'
+end
+killvar 'i'
 
 act 'Masturbate to clear your head.':
-	''
+	*nl
 	'<center><video autoplay loop src="images/locations/shared/park/tree_masturb.mp4"></center>'
-	''
+	*nl
 	'That''s better!'
-	gs 'arousal', 'masturbate', -100
-	minut += 15
+	orgasm_or = 'yes'
+	gs 'arousal', 'masturbate', 15
+	gs 'arousal', 'end'
 	gs 'stat'
 end