1
0
Просмотр исходного кода

Merge remote-tracking branch 'KeyMasterOfGozer/master'

KevinSmarts 5 лет назад
Родитель
Сommit
fc3d976634
2 измененных файлов с 115 добавлено и 104 удалено
  1. 57 69
      locations/fight.qsrc
  2. 58 35
      locations/spell.qsrc

+ 57 - 69
locations/fight.qsrc

@@ -55,6 +55,7 @@ if $ARGS[0] = 'initFight':
 	killvar 'opp_dambonus'
 	killvar 'opp_init'
 	killvar 'opp_stun'
+	killvar 'opp_timer'
 
 	!! Clear any allies from previous battle
 	i = arrsize('pcs_health')
@@ -100,6 +101,7 @@ if $ARGS[0] = 'clearPCSArray':
 	killvar 'pcs_dambonus', i
 	killvar 'pcs_init', i
 	killvar 'pcs_stun', i
+	killvar 'pcs_timer', i
 
 	killvar 'i'
 end
@@ -194,27 +196,20 @@ if $ARGS[0] = 'start':
 
 	*pl func('cleanHTML',$HTMLText)
 
-	pcs_timer[0] = 100 - pcs_react
-	if pcs_health[1] > 0:
-		pcs_timer[1] = 100 - pcs_react[1]
-	else
-		pcs_timer[1] = 100
-	end
-	if pcs_health[2] > 0:
-		pcs_timer[2] = 100 - pcs_react[2]
-	else
-		pcs_timer[2] = 100
-	end
-	opp_timer[0] = 100 - opp_react[0]
-	if opp_health[1] > 0:
-		opp_timer[1] = 100 - opp_react[1]
-	else
-		opp_timer[1] = 100
+	i=0
+	:PCSTimerInit
+	if i < arrsize('pcs_health'):
+		pcs_timer[i] = 100 - pcs_react[i]
+		i +=1
+		jump 'PCSTimerInit'
 	end
-	if opp_health[2] > 0:
-		opp_timer[2] = 100 - opp_react[2]
-	else
-		opp_timer[2] = 100
+
+	i=0
+	:OppTimerInit
+	if i < arrsize('opp_health'):
+		opp_timer[i] = 100 - opp_react[i]
+		i +=1
+		jump 'OppTimerInit'
 	end
 
 	act 'Engage': gt 'fight', 'main'
@@ -224,57 +219,50 @@ if $ARGS[0] = 'start':
 	killvar 'i'
 end
 
+if $ARGS[0] = 'findActiveTimer':
+!! Find the participant with the lowest Timer
+!	These values are passed back via two global variables.
+!
+!	$fightTimType = 'player' or 'opponent' depending on which group has the lowest member
+!	fightTimNum = the array number of the lowest participant
+
+	$fightTimType = 'player'
+	fightTimNum = 0
+	!! set this to high so that everyone will be lower.
+	fightTimLow = 99999
+
+	!! Find lowest of pcs participants
+	i = 0
+	:LowTimerLoop1
+	if i < arrsize('pcs_timer'):
+		if pcs_timer[i] < fightTimLow:
+			fightTimLow = pcs_timer[i]
+			fightTimNum = i
+		end
+		i += 1
+		jump 'LowTimerLoop1'
+	end
+
+	!!Find if any Opponents have lower than best PCS
+	i = 0
+	:LowTimerLoop2
+	if i < arrsize('opp_timer'):
+		if opp_timer[i] < fightTimLow:
+			fightTimLow = opp_timer[i]
+			fightTimNum = i
+			$fightTimType = 'opponent'
+		end
+		i += 1
+		jump 'LowTimerLoop2'
+	end
+
+	killvar 'i'
+end
+
 if $ARGS[0] = 'main':
 	gs 'fight', 'result_check'
-	if pcs_timer[0] < opp_timer[0] and pcs_timer[0] < opp_timer[1] and pcs_timer[0] < opp_timer[2] and pcs_timer[0] < pcs_timer[1] and pcs_timer[0] < pcs_timer[2]:
-		if opp_health[0] > 0: opp_timer[0] -= pcs_timer[0]
-		if opp_health[1] > 0: opp_timer[1] -= pcs_timer[0]
-		if opp_health[2] > 0: opp_timer[2] -= pcs_timer[0]
-		if pcs_health[1] > 0: pcs_timer[1] -= pcs_timer[0]
-		if pcs_health[2] > 0: pcs_timer[2] -= pcs_timer[0]
-		pcs_timer[0] = 0
-		gt 'fight', 'player', 0
-	elseif pcs_timer[1] < opp_timer[0] and pcs_timer[1] < opp_timer[1] and pcs_timer[1] < opp_timer[2] and pcs_timer[1] < pcs_timer[0] and pcs_timer[1] < pcs_timer[2]:
-		if opp_health[0] > 0: opp_timer[0] -= pcs_timer[1]
-		if opp_health[1] > 0: opp_timer[1] -= pcs_timer[1]
-		if opp_health[2] > 0: opp_timer[2] -= pcs_timer[1]
-		if pcs_health[0] > 0: pcs_timer[0] -= pcs_timer[1]
-		if pcs_health[2] > 0: pcs_timer[2] -= pcs_timer[1]
-		pcs_timer[1] = 0
-		gt 'fight', 'player', 1
-	elseif pcs_timer[2] < opp_timer[0] and pcs_timer[2] < opp_timer[1] and pcs_timer[2] < opp_timer[2] and pcs_timer[2] < pcs_timer[1] and pcs_timer[2] < pcs_timer[0]:
-		if opp_health[0] > 0: opp_timer[0] -= pcs_timer[2]
-		if opp_health[1] > 0: opp_timer[1] -= pcs_timer[2]
-		if opp_health[2] > 0: opp_timer[2] -= pcs_timer[2]
-		if pcs_health[0] > 0: pcs_timer[0] -= pcs_timer[2]
-		if pcs_health[1] > 0: pcs_timer[1] -= pcs_timer[2]
-		pcs_timer[2] = 0
-		gt 'fight', 'player', 2
-	elseif opp_timer[0] < opp_timer[1] and opp_timer[0] < opp_timer[2] and opp_timer[0] < pcs_timer[0] and opp_timer[0] < pcs_timer[1] and opp_timer[0] < pcs_timer[2]:
-		if opp_health[1] > 0: opp_timer[1] -= opp_timer[0]
-		if opp_health[2] > 0: opp_timer[2] -= opp_timer[0]
-		if pcs_health[0] > 0: pcs_timer[0] -= opp_timer[0]
-		if pcs_health[1] > 0: pcs_timer[1] -= opp_timer[0]
-		if pcs_health[2] > 0: pcs_timer[2] -= opp_timer[0]
-		opp_timer[0] = 0
-		gt 'fight', 'opponent', 0
-	elseif opp_timer[1] < opp_timer[0] and opp_timer[1] < opp_timer[2] and opp_timer[1] < pcs_timer[0] and opp_timer[1] < pcs_timer[1] and opp_timer[1] < pcs_timer[2]:
-		if opp_health[0] > 0: opp_timer[0] -= opp_timer[1]
-		if opp_health[2] > 0: opp_timer[2] -= opp_timer[1]
-		if pcs_health[0] > 0: pcs_timer[0] -= opp_timer[1]
-		if pcs_health[1] > 0: pcs_timer[1] -= opp_timer[1]
-		if pcs_health[2] > 0: pcs_timer[2] -= opp_timer[1]
-		opp_timer[1] = 0
-		gt 'fight', 'opponent', 1
-	elseif opp_timer[2] < opp_timer[0] and opp_timer[2] < opp_timer[1] and opp_timer[2] < pcs_timer[0] and opp_timer[2] < pcs_timer[1] and opp_timer[2] < pcs_timer[2]:
-		if opp_health[0] > 0: opp_timer[0] -= opp_timer[2]
-		if opp_health[1] > 0: opp_timer[1] -= opp_timer[2]
-		if pcs_health[0] > 0: pcs_timer[0] -= opp_timer[2]
-		if pcs_health[1] > 0: pcs_timer[1] -= opp_timer[2]
-		if pcs_health[2] > 0: pcs_timer[2] -= opp_timer[2]
-		opp_timer[2] = 0
-		gt 'fight', 'opponent', 2
-	end
+	gs 'fight', 'findActiveTimer'
+	gt 'fight', $fightTimType, fightTimNum
 end
 
 if $ARGS[0] = 'printStats':

+ 58 - 35
locations/spell.qsrc

@@ -8,9 +8,28 @@
 !		0  = Failure			-> Spell doesn''t work, probably just fizzles out
 !		-1 = Critical Failure	-> Spell backfires.  Something bad (not terrible) should happen
 !	$ARGS[n >= 2] = Any extra parameters needed by the spell
+!
+!	For Combat Spells:
+!	$ARGS[2] = Target Type ('opp','pcs')
+!	 ARGS[3] = Target party member number
+!	 ARGS[4] = Caster party member number
 
 SuccessValue = $ARGS[1]
 
+! ARGS for Combat Spells if Applicable
+$TargetType = $ARGS[2]
+if $TargetType = 'pcs':
+	$CasterType = 'opp'
+elseif $TargetType = 'opp':
+	$CasterType = 'pcs'
+else
+	$CasterType = 'pcs'
+	$TargetType = 'pcs'
+end
+TargetNumber = ARGS[3]
+CasterNumber = ARGS[3]
+
+
 if $ARGS[0] = 'teleport':
 	! Do the stuff of a Teleport
 	!	ARGS[1] = Success/Failure level
@@ -421,10 +440,10 @@ end
 if $ARGS[0] = 'energo':
 	! defence = absorbs damage before health begins to be removed
 	if SuccessValue > 0:
-		defence += (100 * SuccessValue)
+		dynamic '<<$CasterType>>_shield[<<CasterNumber>>] += (100 * SuccessValue)'
 		'<b><font color = green>An energy shield materializes around you, protecting you from your enemies.</font></b>'
 	elseif SuccessValue < 0:
-		defenceV += 100
+		dynamic '<<$TargetType>>_shield[<<TargetNumber>>] += 100'
 		'<b><font color = red>The spell backfires! An energy shield materializes around your enemy, protecting him from you.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -445,7 +464,7 @@ end
 
 if $ARGS[0] = 'heal':
 	if SuccessValue > 0:
-		pcs_health += (400 * SuccessValue)
+		dynamic 'pcs_health += (400 * SuccessValue)'
 		'<b><font color = green>Your body surges with life. You feel much stronger.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -469,7 +488,7 @@ end
 
 if $ARGS[0] = 'scaldingtouch':
 	if SuccessValue > 0:
-		damTip = 250 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 250 * SuccessValue
 		'<b><font color = green>Flames spring from your hands.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -479,7 +498,7 @@ end
 
 if $ARGS[0] = 'burninghands':
 	if SuccessValue > 0:
-		damTip = 2500 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 2500 * SuccessValue
 		'<b><font color = green>A torrent of flames jets from your hands.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -501,12 +520,12 @@ end
 
 if $ARGS[0] = 'firestorm':
 	if SuccessValue > 0:
-		damTip = 4250 + (2000 * SuccessValue)
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 4250 + (2000 * SuccessValue)
 		bonusSh = 100
 		'<b><font color = green>Uncountable glowing embers steak down upon your foes.</font></b>'
 	elseif SuccessValue < 0:
-		damTip = 2000
-		pcs_health -= 200
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 2000
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 200
 		bonusSh = 100
 		'<b><font color = red>The spell backfires! Uncountable glowing embers steak down upon the battlefield burning everyone.</font></b>'
 	else
@@ -529,11 +548,11 @@ end
 
 if $ARGS[0] = 'shock':
 	if SuccessValue > 0:
-		damTip = (150 * SuccessValue)
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 150 * SuccessValue
 		eleSh = 1
 		'<b><font color = green>You build a static electric charge in your hand and zap your opponent.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 50
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 50
 		'<b><font color = red>The spell backfires! You manage to zap yourself with a static charge.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -543,11 +562,11 @@ end
 
 if $ARGS[0] = 'lightning':
 	if SuccessValue > 0:
-		damTip = (1500 * SuccessValue)
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 1500 * SuccessValue
 		eleSh = 1
 		'<b><font color = green>You shoot a lightning bolt from your hand zapping your opponent.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 300
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 300
 		'<b><font color = red>The spell backfires! You manage to zap yourself with lightning.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -569,13 +588,13 @@ end
 
 if $ARGS[0] = '1000birds':
 	if SuccessValue > 0:
-		damTip = 2750 + (1000 * SuccessValue)
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 2750 + (1000 * SuccessValue)
 		bonusSh = 30
 		eleSh = 1
 		'<b><font color = green>You shoot hundreds of small lightning bolts toward your enemy.</font></b>'
 	elseif SuccessValue < 0:
-		damTip = 2000
-		pcs_health -= 200
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 2000
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 200
 		bonusSh = 30
 		eleSh = 1
 		'<b><font color = red>The spell backfires! Hundreds of small lightning bolts curl toward the battlefield shocking everyone.</font></b>'
@@ -598,12 +617,12 @@ end
 
 if $ARGS[0] = 'quicksand':
 	if SuccessValue > 0:
-		damTip = 100 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 100 * SuccessValue
 		eleSh = 5
 		'<b><font color = green>You have trapped your opponent in quicksand.</font></b>'
 	elseif SuccessValue < 0:
-		damTip = 100
-		pcs_health -= 50
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 100
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 50
 		eleSh = 5
 		'<b><font color = red>The spell backfires! You are both trapped in quicksand.</font></b>'
 	else
@@ -631,12 +650,12 @@ end
 
 if $ARGS[0] = 'abyss':
 	if SuccessValue > 0:
-		damTip = 1500 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 1500 * SuccessValue
 		eleSh = 5
 		'<b><font color = green>The Earth opens up beneath your opponents feet, slamming shut damaging him and depriving him of the ability to move.</font></b>'
 	elseif SuccessValue < 0:
-		damTip = 1500
-		pcs_health -= 200
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 1500
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 200
 		eleSh = 5
 		'<b><font color = red>The spell backfires! The Earth opens up beneath your opponents feet, slamming shut damaging him and depriving him of the ability to move.  You are also caught.</font></b>'
 	else
@@ -668,12 +687,12 @@ end
 
 if $ARGS[0] = 'sando':
 	if SuccessValue > 0:
-		damTip = 3000 + (2000 * SuccessValue)
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 3000 + (2000 * SuccessValue)
 		bonusSh = 50
 		eleSh = 5
 		'<b><font color = green>Two huge plates of earth colapse together crushing the enemy and depriving him of the ability to move.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 200
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 200
 		'<b><font color = red>The spell backfires! Two huge plates of earth colapse together with crushing force, but the enemy is missed and you are instead caught.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -683,13 +702,13 @@ end
 
 if $ARGS[0] = 'windgust':
 	if SuccessValue > 0:
-		damTip = 100 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 100 * SuccessValue
 		bonusSh = 50
 		'<b><font color = green>You have created a gust of wind.</font></b>'
 		if klonV > 0:klonV = 0 & '<b><font color = green>Enemy clones are vaporized.</font></b>'
 		if tumanV > 0:tumanV = 0 & '<b><font color = green>Enemy Fog is torn to shreds by the wind.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 50
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 50
 		'<b><font color = red>The spell backfires! You have created a gust of wind, but the enemy is missed and you are instead caught.</font></b>'
 		if klon > 0:klon = 0 & '<b><font color = green>Your clones are vaporized.</font></b>'
 		if tuman > 0:tuman = 0 & '<b><font color = green>Your Fog is torn to shreds by the wind.</font></b>'
@@ -701,13 +720,13 @@ end
 
 if $ARGS[0] = 'pressure':
 	if SuccessValue > 0:
-		damTip = 1000 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 1000 * SuccessValue
 		bonusSh = 100
 		'<b><font color = green>You dramatically raised the air pressure.</font></b>'
 		if klonV > 0:klonV = 0 & '<b><font color = green>Enemy clones are vaporized.</font></b>'
 		if tumanV > 0:tumanV = 0 & '<b><font color = green>Enemy Fog is torn to shreds by the wind.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 200
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 200
 		'<b><font color = red>The spell backfires! You dramatically raised the air pressure, but the enemy is missed and you are instead caught.</font></b>'
 		if klon > 0:klon = 0 & '<b><font color = green>Your clones are vaporized.</font></b>'
 		if tuman > 0:tuman = 0 & '<b><font color = green>Your Fog is torn to shreds by the wind.</font></b>'
@@ -731,13 +750,13 @@ end
 
 if $ARGS[0] = 'vacuumshells':
 	if SuccessValue > 0:
-		damTip = 2500 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 2500 * SuccessValue
 		bonusSh = 100
 		'<b><font color = green>Turbulent spheres of vacuum bombard your enemy. The air is full of whistling sounds as the spheres fly by at high speeds over the battlefield.</font></b>'
 		if klonV > 0:klonV = 0 & '<b><font color = green>Enemy clones are vaporized.</font></b>'
 		if tumanV > 0:tumanV = 0 & '<b><font color = green>Enemy Fog is torn to shreds by the wind.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 200
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 200
 		'<b><font color = red>The spell backfires! Turbulent spheres of vacuum bombard your enemy. The air is full of whistling sounds as the spheres fly by at high speeds over the battlefield, but the enemy is missed and you are instead caught.</font></b>'
 		if klon > 0:klon = 0 & '<b><font color = green>Your clones are vaporized.</font></b>'
 		if tuman > 0:tuman = 0 & '<b><font color = green>Your Fog is torn to shreds by the wind.</font></b>'
@@ -775,11 +794,11 @@ end
 
 if $ARGS[0] = 'leechmana':
 	if SuccessValue > 0:
-		damTip = 100 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 100
 		damTipM = 1000
 		'<b><font color = green>You leech mana from your enemy.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 50
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 50
 		'<b><font color = red>The spell backfires! Ouch!</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -789,11 +808,11 @@ end
 
 if $ARGS[0] = 'flood':
 	if SuccessValue > 0:
-		damTip = 1000 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 1000 * SuccessValue
 		damTipM = 500
 		'<b><font color = green>A surge of water rises towards your enemy.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 100
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 100
 		'<b><font color = red>The spell backfires! A surge of water rises towards your enemy, but missed and hits you.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
@@ -821,13 +840,13 @@ end
 
 if $ARGS[0] = 'sharkrockets':
 	if SuccessValue > 0:
-		damTip = 1500 * SuccessValue
+		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 1500 * SuccessValue
 		damTipM = 2500
 		bonusSh = 50
 		'<b><font color = green>Blobs of Water shaped like sharks fly towards your enemy stiking them.</font></b>'
 		if klonV > 0:klonV = 0 & '<b><font color = green>Enemy clones are eliminated.</font></b>'
 	elseif SuccessValue < 0:
-		pcs_health -= 100
+		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 100
 		'<b><font color = red>The spell backfires! Blobs of Water shaped like sharks fly towards your enemy, but missed and hits you.</font></b>'
 		if klon > 0:klon = 0 & '<b><font color = green>Your clones are eliminated.</font></b>'
 	else
@@ -859,5 +878,9 @@ end
 
 
 killvar 'SuccessValue'
+killvar '$TargetType'
+killvar 'TargetNumber'
+killvar '$CasterType'
+killvar 'CasterNumber'
 --- spell ---------------------------------