Răsfoiți Sursa

Added new Fight algorithm that will have NPCs casting spells if needed. Made all Fight components handle arbitrary numbers of Opponents and Allies instead of just max 3.

KeyMasterOfGozer 4 ani în urmă
părinte
comite
88ca05add6

+ 3 - 0
locations/bass.qsrc

@@ -133,6 +133,9 @@ if $ARGS[0] = 'a':
 				opp_health[0] = (opp_vital * 10 + opp_stren * 5)
 				opp_willpwr[0] = 100
 				opp_shoot[0] = 100
+				opp_magik[0] = 1
+				opp_mana[0] = 500
+				$opp_spells[0] = 'leechmana,flood,blister,sharkrockets'
 				fightEnding = 7
 
 				gt 'fight', 'start'

+ 5 - 5
locations/castSpellNPC.qsrc

@@ -1,7 +1,7 @@
 # castSpellNPC
 ! Used for NPCs to cast a spell.
 !
-!    ARGS[0] is the spell being cast
+!   $ARGS[0] is the spell being cast
 !	$ARGS[1] = Target Type ('opp','pcs')
 !	 ARGS[2] = Target party member number
 !	$ARGS[3] = Caster Type ('opp','pcs')
@@ -13,7 +13,7 @@
 
 gs 'spellList'
 
-spellSuccess = 0
+spellSuccess = 1
 
 $SpellID = $ARGS[0]
 $SpellArgs = ""
@@ -31,9 +31,9 @@ end
 killvar 'i'
 
 manaCost = spellMana[$SpellID]
-casterMana = dyneval('result=<<$AGS[3]>>_mana[<<ARGS[4]>>]')
-if casterMana <= manaCost:
-	dynamic '<<$AGS[3]>>_mana[<<ARGS[4]>>] -= <<manaCost>>'
+casterMana = dyneval('result=<<$ARGS[3]>>_mana[<<ARGS[4]>>]')
+if casterMana >= manaCost:
+	dynamic '<<$ARGS[3]>>_mana[<<ARGS[4]>>] -= <<manaCost>>'
 	$SpellExec = "gs 'spell', '<<$SpellID>>', '<<spellSuccess>>', '<<$ARGS[1]>>', <<ARGS[2]>>, <<ARGS[4]>><<$SpellArgs>>"
 	dynamic $SpellExec
 else

+ 3 - 0
locations/dimaRevenge.qsrc

@@ -320,6 +320,9 @@ if ARGS[0] = 3:
 									opp_health[0] = (opp_vital[0] * 10 + opp_stren[0] * 5)
 									opp_willpwr[0] = 100
 									opp_shoot[0] = 100
+									opp_magik[0] = 1
+									opp_mana[0] = 500
+									$opp_spells[0] = 'clone,energo'
 									fightEnding = 10
 
 									gt 'fight', 'start'

+ 200 - 86
locations/fight.qsrc

@@ -25,6 +25,7 @@ opp_shield[0] = (defence): Shielding that absorbs damage before hitpoints.
 opp_dambonus[0] = (magweapbonus): damage added to melee attacks
 opp_init[0] = (initBonus): attack faster/first
 opp_stun[0] = (stunner): make target unable to act for some amount of time
+opp_spells[0] = comma delimited list of spell names
 }
 
 !! Use the above with [1] and [2] for extra opponents
@@ -55,6 +56,7 @@ if $ARGS[0] = 'initFight':
 	killvar 'opp_dambonus'
 	killvar 'opp_init'
 	killvar 'opp_stun'
+	killvar '$opp_spells'
 	killvar 'opp_timer'
 
 	!! Clear any allies from previous battle
@@ -101,6 +103,7 @@ if $ARGS[0] = 'clearPCSArray':
 	killvar 'pcs_dambonus', i
 	killvar 'pcs_init', i
 	killvar 'pcs_stun', i
+	killvar 'pcs_spells', i
 	killvar 'pcs_timer', i
 
 	killvar 'i'
@@ -333,13 +336,13 @@ if $ARGS[0] = 'result_check':
 
 
 !!win/lose conditions
-	if pcs_health <= 0:
+	if func('fight', 'AvailableTargets', 'pcs') = 0:
 		'<b><font color = red> You lost!</font></b>'
 
 		xgt'ender','loss'
 		gt $loc, $metka
 		exit
-	elseif opp_health[0] <= 0:
+	elseif func('fight', 'AvailableTargets', 'opp') = 0:
 		'<b><font color = green><<$boydesc>> You won!</font></b>'
 
 		xgt'ender','win'
@@ -441,117 +444,228 @@ if $ARGS[0] = 'Attack':
 	act 'Next': gt 'fight', 'main'
 end
 
-if $ARGS[0] = 'opponent':
-	gs 'fight', 'statDisplay'
-	if pcs_health[0] > 0 and pcs_health[1] > 0 and pcs_health[2] > 0:
-		TargetNumber = rand(0,2)
-	elseif pcs_health[0] > 0 and pcs_health[1] > 0:
-		TargetNumber = rand(0,1)
-	elseif pcs_health[0] > 0 and pcs_health[2] > 0:
-		if rand(0,1) = 0:
-			TargetNumber = 0
-		else
-			TargetNumber = 2
+!! Make a list of targets that still have health
+!  $ARGS[1] = Target Type ('pcs','opp')
+if $ARGS[0] = 'AvailableTargets':
+	killvar 'fightAvailTarg'
+	i=0
+	:AvailTargetLoop
+	if i < arrsize($ARGS[1]+'_health'):
+		if dyneval('result=<<$ARGS[1]>>_health[<<i>>]') > 0:
+			fightAvailTarg[] = i
 		end
-	elseif pcs_health[1] > 0 and pcs_health[2] > 0:
-		TargetNumber = rand(1,2)
-	elseif pcs_health[0] > 0:
-		TargetNumber = 0
-	elseif pcs_health[1] > 0:
-		TargetNumber = 1
-	else
-		TargetNumber = 2
-	end		
-!!	if opp_magik[0] > 0: gs 'fight', 'opp_spellcast'
-	if rand(0,opp_kick[0]) > 40:
-		gs 'fight', 'Attack', 'Kick', 'pcs', ARGS[2], TargetNumber
-	elseif rand(0,opp_punch[0]) > 40:
-		gs 'fight', 'Attack', 'Hard Punch', 'pcs', ARGS[2], TargetNumber
-	else
-		gs 'fight', 'Attack', 'Jab', 'pcs', ARGS[2], TargetNumber
+		i +=1
+		jump 'AvailTargetLoop'
 	end
+	result = arrsize('fightAvailTarg')
+	killvar 'i'
+	exit
 end
 
-if $ARGS[0] = 'player':
-	gs 'fight', 'statDisplay'
-	if opp_health[0] > 0 and opp_health[1] > 0 and opp_health[2] > 0:
-		TargetNumber = rand(0,2)
-	elseif opp_health[0] > 0 and opp_health[1] > 0:
-		TargetNumber = rand(0,1)
-	elseif opp_health[0] > 0 and opp_health[2] > 0:
-		if rand(0,1) = 0:
-			TargetNumber = 0
-		else
-			TargetNumber = 2
-		end
-	elseif opp_health[1] > 0 and opp_health[2] > 0:
-		TargetNumber = rand(1,2)
-	elseif opp_health[0] > 0:
-		TargetNumber = 0
-	elseif opp_health[1] > 0:
-		TargetNumber = 1
+!! Pick random target from list of targets.  Returns the Target, or -1 if no target.
+!  $ARGS[1] = Target Type ('pcs','opp')
+if $ARGS[0] = 'RandomTarget':
+	if func('fight', 'AvailableTargets', $ARGS[1]) > 0:
+		result = fightAvailTarg[rand(0,arrsize('fightAvailTarg'))-1]
 	else
-		TargetNumber = 2
+		result = -1
 	end
+	exit
+end
+
 
-	if pcs_magik > 0:
-		act 'Cast a Spell': gs 'fight', 'spellcast'
+!! Find Action for an NPC fighter to take
+!	$ARGS[1] = Attacker Type ('opp','pcs')
+!	 ARGS[2] = Attacker party member number
+if $ARGS[0] = 'fightAlgorithm':
+	$AttackerType = $ARGS[1]
+	AttackerNumber = ARGS[2]
+	if $AttackerType = 'pcs':
+		$TargetType = 'opp'
+	else
+		$TargetType = 'pcs'
 	end
-	if opp_health[0] > 0:
-		act 'Kick <<$opp_name[0]>>':
-			gs 'fight', 'Attack', 'Kick', 'opp', 0, 0
+	TargetNumber = func('fight', 'RandomTarget', $TargetType)
+	!! Some Target still has some hitpoints
+	if TargetNumber>= 0:
+		!!Fight Algorithm
+		ActionMade = 0
+		! First try to cast spells
+		if dyneval('result=<<$AttackerType>>_magik[<<AttackerNumber>>]') > 0:
+			gs 'fight', 'buildCasterSpellList', $dyneval('$result=$<<$AttackerType>>_spells[<<AttackerNumber>>]')
+			!Heal self if hurt badly
+			if dyneval('result=<<$AttackerType>>_health[<<AttackerNumber>>]') < 50:
+				ActionMade = func('fight','spellListCheck', '$comHealSpells',$AttackerType,AttackerNumber,$AttackerType,AttackerNumber)
+			end
+			!Clone if none left
+			if dyneval('result=<<$AttackerType>>_clone[<<AttackerNumber>>]') = 0 and ActionMade = 0:
+				ActionMade = func('fight','spellCheck', 'multiclone',$AttackerType,AttackerNumber,$AttackerType,AttackerNumber)
+				if ActionMade = 0:
+					ActionMade = func('fight','spellCheck', 'clone',$AttackerType,AttackerNumber,$AttackerType,AttackerNumber)
+				end
+			end
+			!Shield if low shield
+			if dyneval('result=<<$AttackerType>>_shield[<<AttackerNumber>>]') = 0 and ActionMade = 0:
+				ActionMade = func('fight','spellListCheck', '$comShldSpells',$AttackerType,AttackerNumber,$AttackerType,AttackerNumber)
+			end
+			!Fog if no Fog , Any fog on the field makes casting fog impossible
+			!if opp_fog[ARGS[2]] = 0 and ActionMade = 0:
+			!	ActionMade = func('fight','spellCheck', 'fog','opp',ARGS[2],'opp',ARGS[2])
+			!end
+			!Buff if needed
+			!  ToDo - How to determine if buff has already been applied
+			!Attack Spell if Possible
+			if ActionMade = 0:
+				ActionMade = func('fight','spellListCheck', '$comAtkSpells',$TargetType,TargetNumber,$AttackerType,AttackerNumber)
+			end
+			!make sure we can continue the fight.
+			!if ActionMode = 1:
+				act 'Next': gt 'fight', 'main'
+			!end
 		end
+		!Physical attack if nothing else can be done.
+		if ActionMade = 0:
+			if rand(0,dyneval('result=<<$AttackerType>>_kick[<<AttackerNumber>>]')) > 40:
+				gs 'fight', 'Attack', 'Kick', $TargetType, AttackerNumber, TargetNumber
+			elseif rand(0,dyneval('result=<<$AttackerType>>_punch[<<AttackerNumber>>]')) > 40:
+				gs 'fight', 'Attack', 'Hard Punch', $TargetType, AttackerNumber, TargetNumber
+			else
+				gs 'fight', 'Attack', 'Jab', $TargetType, AttackerNumber, TargetNumber
+			end
+		end!
+	!!This should never happen
+	else
+		gt 'fight', 'main'
+	end
 
-		act 'Punch <<$opp_name[0]>> hard':
-			gs 'fight', 'Attack', 'Hard Punch', 'opp', 0, 0
-		end
+	killvar 'ActionMade'
+	killvar 'TargetNumber'
+	killvar '$TargetType'
+	killvar '$AttackerType'
+	killvar 'AttackerNumber'
+end
+
+if $ARGS[0] = 'opponent':
+	gs 'fight', 'statDisplay'
+	gs 'fight','fightAlgorithm','opp',ARGS[2]
+end
+
+if $ARGS[0] = 'player':
+	gs 'fight', 'statDisplay'
 
-		act 'Jab <<$opp_name[0]>>':
-			gs 'fight', 'Attack', 'Jab', 'opp', 0, 0
+	!! If this is the Player character
+	if ARGS[2] = 0:
+		if pcs_magik > 0:
+			act 'Cast a Spell': gs 'fight', 'spellcast'
 		end
-	end
-	if opp_health[1] > 0:
-		act 'Kick <<$opp_name[1]>>':
-			gs 'fight', 'Attack', 'Kick', 'opp', 0, 1
+		if func('fight', 'AvailableTargets', 'opp') > 0:
+			i=0
+			:loop000000
+			if i < arrsize('fightAvailTarg'):
+				$op_name_000000 = $opp_name[fightAvailTarg[i]]
+				dynamic "
+					act 'Kick <<$op_name_000000>>':
+						gs 'fight', 'Attack', 'Kick', 'opp', 0, <<fightAvailTarg[i]>>
+					end
+
+					act 'Punch <<$op_name_000000>> hard':
+						gs 'fight', 'Attack', 'Hard Punch', 'opp', 0, <<fightAvailTarg[i]>>
+					end
+
+					act 'Jab <<$op_name_000000>>':
+						gs 'fight', 'Attack', 'Jab', 'opp', 0, <<fightAvailTarg[i]>>
+					end
+				"
+				killvar '$op_name_000000'
+				i +=1
+				jump 'loop000000'
+			end
 		end
+		act 'Surrender': gt 'ender', 'surrender'
 
-		act 'Punch <<$opp_name[1]>> hard':
-			gs 'fight', 'Attack', 'Hard Punch', 'opp', 0, 1
-		end
+	!! If this is a team member of the player
+	else
+		gs 'fight','fightAlgorithm','pcs',ARGS[2]
+	end
+end
 
-		act 'Jab <<$opp_name[1]>>':
-			gs 'fight', 'Attack', 'Jab', 'opp', 0, 1
-		end
+
+!! Builds an array spell list from a comma delimited spell name list
+!	$ARGS[1] = comma delimited list of spell names
+if $ARGS[0] = 'buildCasterSpellList':
+	killvar '$casterSpellList'
+	$tmpStr = $trim($ARGS[1])
+	:loop000001
+	i=INSTR($tmpStr,',')
+	if i > 0:
+		$casterSpellList[] = $trim($mid($tmpStr,1,i-1))
+		$tmpStr = $trim($mid($tmpStr,i+1))
+		jump 'loop000001'
+	else
+		$casterSpellList[] = $trim($tmpStr)
 	end
-	if opp_health[2] > 0:
-		act 'Kick <<$opp_name[2]>>':
-			gs 'fight', 'Attack', 'Kick', 'opp', 0, 2
-		end
+	killvar 'i'
+	killvar '$tmpStr'
+	exit
+end
 
-		act 'Punch <<$opp_name[2]>> hard':
-			gs 'fight', 'Attack', 'Hard Punch', 'opp', 0, 2
+!! Check if spell will be cast
+!	$ARGS[1] = spell name
+!	$ARGS[2] = Target Type ('opp','pcs')
+!	 ARGS[3] = Target party member number
+!	$ARGS[4] = Caster Type ('opp','pcs')
+!	 ARGS[5] = Caster party member number
+if $ARGS[0] = 'spellCheck':
+	$spellCheckVar['SpellName'] = $ARGS[1]
+	$spellCheckVar['TargetType'] = $ARGS[2]
+	 spellCheckVar['TargetNumber'] = ARGS[3]
+	$spellCheckVar['CasterType'] = $ARGS[4]
+	 spellCheckVar['CasterNumber'] = ARGS[5]
+	 spellCheckVar['CasterMana'] = dyneval("result = <<$spellCheckVar['CasterType']>>_mana[<<spellCheckVar['CasterNumber']>>]")
+
+	if ARRPOS('$casterSpellList',$spellCheckVar['SpellName'])>=0 and spellCheckVar['CasterMana'] >= spellMana[$spellCheckVar['SpellName']]:
+		if $spellTarget[$spellCheckVar['SpellName']] = 'self':
+			gs 'castSpellNPC', $spellCheckVar['SpellName'], $spellCheckVar['CasterType'], spellCheckVar['CasterNumber'],$spellCheckVar['CasterType'], spellCheckVar['CasterNumber']
+		else
+			gs 'castSpellNPC', $spellCheckVar['SpellName'], $spellCheckVar['TargetType'], spellCheckVar['TargetNumber'],$spellCheckVar['CasterType'], spellCheckVar['CasterNumber']
 		end
+		result = 1
+	else
+		result = 0
+	end
+	killvar 'spellCheckVar'
+	killvar '$spellCheckVar'
+	exit
+end
 
-		act 'Jab <<$opp_name[2]>>':
-			gs 'fight', 'Attack', 'Jab', 'opp', 0, 2
-		end
-	end	
-	act 'Surrender': gt 'ender', 'surrender'
+!! Check list of spells if they will be cast
+!	$ARGS[1] = spell List array name
+!	$ARGS[2] = Target Type ('opp','pcs')
+!	 ARGS[3] = Target party member number
+!	$ARGS[4] = Caster Type ('opp','pcs')
+!	 ARGS[5] = Caster party member number
+if $ARGS[0] = 'spellListCheck':
+	i=0
+	ActionMade1 = 0
+	:loop000002
+	if i < arrsize($ARGS[1]) and ActionMade1=0:
+		ActionMade1 = func('fight','spellCheck','<<$ARGS[1]>>[<<i>>]',$ARGS[2],ARGS[3],$ARGS[4],ARGS[5])
+		i+=1
+		jump 'loop000002'
+	end
+	result = ActionMade1
+	killvar 'ActionMade1'
+	exit
 end
 
 
 if $ARGS[0] = 'spellcast':
-	cls
+	*clr
 	cla
+	act 'Next': gt 'fight', 'main'
 	func('spellBook', 'targetable', '$combatSpells', 'gt ''fight'', ''main''', 'gt ''fight'', ''main''')
 end
 
-if $ARGS[0] = 'opp_spellcast':
-end
-
-if $ARGS[0] = 'pcs_spellcast':
-end
-
 
 
 

+ 3 - 0
locations/kisameQW.qsrc

@@ -93,6 +93,9 @@ if $ARGS[0] = 'start':
 			opp_health[0] = (opp_vital * 10 + opp_stren * 5)
 			opp_willpwr[0] = 100
 			opp_shoot[0] = 100
+			opp_magik[0] = 1
+			opp_mana[0] = 500
+			$opp_spells[0] = 'leechmana,flood,blister,sharkrockets'
 			fightEnding = 7
 
 			gt 'fight', 'start'

+ 3 - 0
locations/lab.qsrc

@@ -134,6 +134,9 @@ if $ARGS[0] = 'start':
 			opp_health[0] = (opp_vital * 10 + opp_stren * 5)
 			opp_willpwr[0] = 100
 			opp_shoot[0] = 100
+			opp_magik[0] = 1
+			opp_mana[0] = 200
+			$opp_spells[0] = 'fog,clone,stun,energo'
 			fightEnding = 3
 			gt 'fight', 'start'
 		end

+ 13 - 19
locations/spell.qsrc

@@ -57,7 +57,6 @@ $spellFunc['UpdateAttrib'] = {
 	SpellFuncVar['TargetNum']  =  ARGS[2]
 	$SpellFuncVar['Operation'] = $ARGS[3]
 	SpellFuncVar['Amount']     =  ARGS[4]
-
 	if $SpellFuncVar['Operation'] = '=':
 		!       "opp_fog[0] = 0"
 		dynamic "<<$SpellFuncVar['TargetType']>>_<<$SpellFuncVar['BaseArray']>>[<<SpellFuncVar['TargetNum']>>] = <<SpellFuncVar['Amount']>>"
@@ -365,7 +364,7 @@ end
 if $ARGS[0] = 'fog':
 	if SuccessValue > 0:
 		dynamic $spellFunc['UpdateAttrib'], 'fog', $TargetType, TargetNumber, '+', 10 * SuccessValue
-		'<b><font color = green>A Fog materializes around, obscuring <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> from enemies.</font></b>'
+		'<b><font color = green>A Fog materializes around, obscuring <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> from enemies.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
@@ -374,10 +373,10 @@ end
 if $ARGS[0] = 'clone':
 	if SuccessValue > 0:
 		dynamic $spellFunc['UpdateAttrib'], 'clone', $TargetType, TargetNumber, '+', SuccessValue
-		'<b><font color = green><<SuccessValue>> clone<<iif(SuccessValue>1,"s","")>> springs from <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> confusing enemies.</font></b>'
+		'<b><font color = green><<SuccessValue>> clone<<iif(SuccessValue>1,"s","")>> springs from <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> confusing enemies.</font></b>'
 	elseif SuccessValue < 0 and dyneval('result=<<$TargetType>>_clone[<<TargetNumber>>]') > 0:
 		dynamic $spellFunc['UpdateAttrib'], 'clone', $TargetType, TargetNumber, '-', 1
-		'<b><font color = red>The spell backfires! A <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> clone disappears.</font></b>'
+		'<b><font color = red>The spell backfires! A <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> clone disappears.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
@@ -387,11 +386,10 @@ if $ARGS[0] = 'stun':
 	if SuccessValue > 0:
 		stunner = 1
 		dynamic $spellFunc['UpdateAttrib'], 'stun', $TargetType, TargetNumber, '+', rand(2,5)+ SuccessValue
-		'<b><font color = green><<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> is stunned.</font></b>'
+		'<b><font color = green><<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> is stunned.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
-	!xgt'atak','player'
 end
 
 if $ARGS[0] = 'weapon':
@@ -411,14 +409,14 @@ end
 if $ARGS[0] = 'wind':
 	if SuccessValue = 2:
 		dynamic $spellFunc['UpdateAttrib'], 'fog', $TargetType, TargetNumber, '=', 0
-		'<b><font color = green>A wind blows through the area eliminating the fog around <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> from the battlefield.</font></b>'
+		'<b><font color = green>A wind blows through the area eliminating the fog around <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> from the battlefield.</font></b>'
 	elseif SuccessValue = 1:
 		dynamic $spellFunc['UpdateAttrib'], 'fog', $TargetType, TargetNumber, '=', 0
 		dynamic $spellFunc['UpdateAttrib'], 'fog', $CasterType, CasterNumber, '=', 0
 		'<b><font color = green>A wind blows through the area eliminating all fog on the battlefield.</font></b>'
 	elseif SuccessValue = -1:
 		dynamic $spellFunc['UpdateAttrib'], 'fog', $CasterType, CasterNumber, '=', 0
-		'<b><font color = red>A wind blows through the area eliminating the fog around <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> from the battlefield.</font></b>'
+		'<b><font color = red>A wind blows through the area eliminating the fog around <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> from the battlefield.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
@@ -427,14 +425,14 @@ end
 if $ARGS[0] = 'multiclone':
 	if SuccessValue > 0:
 		dynamic $spellFunc['UpdateAttrib'], 'clone', $TargetType, TargetNumber, '+', SuccessValue * 3
-		'<b><font color = green><<SuccessValue * 3>> clone<<iif(SuccessValue>1,"s","")>> of <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> springs forth confusing the enemy.</font></b>'
+		'<b><font color = green><<SuccessValue * 3>> clone<<iif(SuccessValue>1,"s","")>> of <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> springs forth confusing the enemy.</font></b>'
 	elseif SuccessValue < 0 and klon > 0:
 		if dyneval('result=<<$TargetType>>_clone[<<TargetNumber>>]') < 3:
 			dynamic $spellFunc['UpdateAttrib'], 'clone', $TargetType, TargetNumber, '=', 0
 		else
 			dynamic $spellFunc['UpdateAttrib'], 'clone', $TargetType, TargetNumber, '-', 3
 		end
-		'<b><font color = red>The spell backfires! Some clones of <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> disappear.</font></b>'
+		'<b><font color = red>The spell backfires! Some clones of <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> disappear.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
@@ -443,7 +441,7 @@ end
 if $ARGS[0] = 'energo':
 	if SuccessValue > 0:
 		dynamic $spellFunc['UpdateAttrib'], 'shield', $TargetType, TargetNumber, '+', SuccessValue * 100
-		'<b><font color = green>An energy shield materializes around <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>>, granting protection from enemies.</font></b>'
+		'<b><font color = green>An energy shield materializes around <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>>, granting protection from enemies.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
@@ -452,7 +450,7 @@ end
 if $ARGS[0] = 'haste':
 	if SuccessValue > 0:
 		dynamic $spellFunc['UpdateAttrib'], 'init', $TargetType, TargetNumber, '+', SuccessValue * 120
-		'<b><font color = green><<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> feels mind and body race though a sluggish world.</font></b>'
+		'<b><font color = green><<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> feels mind and body race though a sluggish world.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
@@ -461,7 +459,7 @@ end
 if $ARGS[0] = 'heal':
 	if SuccessValue > 0:
 		dynamic $spellFunc['UpdateAttrib'], 'health', $TargetType, TargetNumber, '+', SuccessValue * 400
-		'<b><font color = green><<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>> surges with life, feeling much stronger.</font></b>'
+		'<b><font color = green><<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>> surges with life, feeling much stronger.</font></b>'
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
@@ -473,7 +471,7 @@ if $ARGS[0] = 'hand':
 		TargetStrenDelta = TargetStren*20*SuccessValue/100
 		TargetStrenBase  = TargetStren*10
 		dynamic $spellFunc['UpdateAttrib'], 'stren', $TargetType, TargetNumber, '=', RAND(TargetStrenBase - TargetStrenDelta,TargetStrenBase + TargetStrenDelta)
-		'<b><font color = green>Power flows from the hands of <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>>.</font></b>'
+		'<b><font color = green>Power flows from the hands of <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>>.</font></b>'
 		killvar 'TargetStren'
 		killvar 'TargetStrenDelta'
 		killvar 'TargetStrenBase'
@@ -498,7 +496,6 @@ if $ARGS[0] = 'burninghands':
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
-	xgt'atakA','atak'
 end
 
 if $ARGS[0] = 'firebarrier':
@@ -513,7 +510,7 @@ end
 if $ARGS[0] = 'firestorm':
 	if SuccessValue > 0:
 		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 4250 + (2000 * SuccessValue)
-		'<b><font color = green>Uncountable glowing embers steak down upon the foes of <<dyneval $spellFunc["GetCombatantName"], $TargetType, TargetNumber>>.</font></b>'
+		'<b><font color = green>Uncountable glowing embers steak down upon the foes of <<dyneval($spellFunc["GetCombatantName"], $TargetType, TargetNumber)>>.</font></b>'
 	elseif SuccessValue < 0:
 		gs 'fight', 'applyDamage', $TargetType, TargetNumber, 2000
 		gs 'fight', 'applyDamage', $CasterType, CasterNumber, 200
@@ -542,7 +539,6 @@ if $ARGS[0] = 'shock':
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
-	xgt'atakA','atak'
 end
 
 if $ARGS[0] = 'lightning':
@@ -555,7 +551,6 @@ if $ARGS[0] = 'lightning':
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
-	xgt'atakA','atak'
 end
 
 if $ARGS[0] = 'electricbarrier':
@@ -760,7 +755,6 @@ if $ARGS[0] = 'sharkrockets':
 	else
 		'<b>The spell fizzles.  Nothing seems to happen.</b>'
 	end
-	xgt'atakA','atak'
 end
 
 if $ARGS[0] = 'greatflood':

+ 36 - 0
locations/spellList.qsrc

@@ -534,6 +534,42 @@ $waterSpells[2] = 'blister'
 $waterSpells[3] = 'sharkrockets'
 $waterSpells[4] = 'greatflood'
 
+!! Spell Sets for Combat algorithms
+!Healing Spells
+$comHealSpells[0] = 'heal'
+!Shield Spells
+$comShldSpells[0] = 'flameshield'
+$comShldSpells[1] = 'firebarrier'
+$comShldSpells[2] = 'dancingsphere'
+$comShldSpells[3] = 'electricbarrier'
+$comShldSpells[4] = 'earthguardian'
+$comShldSpells[5] = 'earthshield'
+$comShldSpells[6] = 'vacuum'
+$comShldSpells[7] = 'blister'
+$comShldSpells[8] = 'energo'
+!Buff Spells
+$comBuffSpells[] = 'haste'
+$comBuffSpells[] = 'hand'
+!Attack Spells
+$comAtkSpells[0] = 'firestorm'
+$comAtkSpells[1] = 'burninghands'
+$comAtkSpells[2] = 'scaldingtouch'
+$comAtkSpells[3] = '1000birds'
+$comAtkSpells[4] = 'lightning'
+$comAtkSpells[5] = 'shock'
+$comAtkSpells[6] = 'sando'
+$comAtkSpells[7] = 'abyss'
+$comAtkSpells[8] = 'devouringvacuum'
+$comAtkSpells[9] = 'vacuumshells'
+$comAtkSpells[10] = 'quicksand'
+$comAtkSpells[11] = 'pressure'
+$comAtkSpells[12] = 'windgust'
+$comAtkSpells[13] = 'greatflood'
+$comAtkSpells[14] = 'sharkrockets'
+$comAtkSpells[15] = 'flood'
+$comAtkSpells[16] = 'leechmana'
+$comAtkSpells[17] = 'stun'
+$comAtkSpells[18] = 'weapon'
 
 !-------------------------------------------------------------------------------------------
 ! Helper procedure to build Action bar for Learning Spells.

+ 3 - 0
locations/stallion.qsrc

@@ -82,6 +82,9 @@ if $ARGS[0] = 'fight':
 		opp_health[0] = (opp_vital * 10 + opp_stren * 5)
 		opp_willpwr[0] = 100
 		opp_shoot[0] = 10
+		opp_magik[0] = 1
+		opp_mana[0] = 200
+		$opp_spells[0] = 'clone,energo'
 		fightEnding = 13
 
 		gt 'fight', 'start'