Browse Source

[Fixed] Ender calls for fight aren't working, cause no actions available. Temporarily bypassed them. Improved Fight Poster at beginning to support any number of participants.

KeyMasterOfGozer 5 years ago
parent
commit
4366464a4a
1 changed files with 50 additions and 14 deletions
  1. 50 14
      locations/fight.qsrc

+ 50 - 14
locations/fight.qsrc

@@ -53,18 +53,19 @@ if $ARGS[0] = 'initFight':
 	killvar 'opp_init'
 	killvar 'opp_stun'
 
-	!! Clear any allies from previous battle{
-	i = arrsize('pcs_def')
+	!! Clear any allies from previous battle
+	i = arrsize('pcs_health')
 	:ClearAllyLoop
-	if i > 0:
+	if i > 1:
 		gs 'fight', 'clearPCSArray', i-1
 		i -= 1
 		jump 'ClearAllyLoop'
 	end
-	killvar 'i'}
+	killvar 'i'
 
 	!! Initialize $pcs_name for Sveta
 	$pcs_name[0] = 'You'
+	$pcs_image[0] = FUNC('$face_image')
 end
 
 if $ARGS[0] = 'clearPCSArray':
@@ -105,7 +106,7 @@ if $ARGS[0] = 'randomOpp':
 	ARGS[1] = Optional, raise difficulty of the attacker, 0 - 50
 }
 	OppDiffBonus = ARGS[1]
-	i = arrsize('opp_def')
+	i = arrsize('opp_health')
 	$opp_name[i] = 'Opponent 1'
 	$opp_image[i] = 'images/locations/shared/street/mugger.jpg'
 	opp_def[i] = rand(1,50) + OppDiffBonus
@@ -132,16 +133,47 @@ if $ARGS[0] = 'start':
 	gs 'themes', 'indoors'
 	cla
 
-	'<center><b><font color="maroon">Fight!</font></b></center>'
-	*nl
-	'<left><img <<$set_imgh>> src="<<FUNC(''$face_image'')>>"></left><right><img <<$set_imgh>> src="<<$opp_image[0]>>"></right>'
-	*nl
-	'<left><<$pcs_firstname>></left><center>vs.</center><right><<$opp_name[0]>></right>'
+	if arrsize('pcs_health') > arrsize('opp_health'):
+		tableSize = arrsize('pcs_health')
+	else
+		tableSize = arrsize('opp_health')
+	end
+
+	$HTMLText = '<table>
+		<tr>
+			<th align="right">Allies</td>
+			<th align="center" valign="center" rowspan=<<tableSize*2+1>> >vs.</td>
+			<th align="left">Opponents</td>
+		</tr>'
+	i = 0
+	:FightPoster
+	if i < tableSize:
+		$HTMLText += '
+		<tr>
+			<td align="right"><img HEIGHT=400 src="<<$pcs_image[i]>>"></td>
+
+			<td align="left"><img HEIGHT=400 src="<<$opp_image[i]>>"></td>
+		</tr>
+		<tr>
+			<td align="right"><<$pcs_name[i]>></td>
+
+			<td align="left"><<$opp_name[i]>></td>
+		</tr>'
+		i += 1
+		jump 'FightPoster'
+	end
+	$HTMLText += '</table>'
+
+	*pl func('cleanHTML',$HTMLText)
 
 	pcs_timer = 100 - pcs_react
 	opp_timer = 100 - opp_react[0]
 
 	act 'Engage': gt 'fight', 'main'
+
+	killvar '$HTMLText'
+	killvar 'tableSize'
+	killvar 'i'
 end
 
 if $ARGS[0] = 'main':
@@ -217,7 +249,8 @@ end
 if $ARGS[0] = 'result_check':
 !!cheat to auto-win fights check
 	if fight_cheat = 1:
-		xgt 'ender', 'win'
+		!xgt 'ender', 'win'
+		gt $loc, $metka
 		exit
 	end
 
@@ -226,17 +259,20 @@ if $ARGS[0] = 'result_check':
 	if pcs_health <= 0:
 		'<b><font color = red> You lost!</font></b>'
 
-		xgt'ender','loss'
+		!xgt'ender','loss'
+		gt $loc, $metka
 		exit
 	elseif opp_health[0] <= 0:
 		'<b><font color = green><<$boydesc>> You won!</font></b>'
 
-		xgt'ender','win'
+		!xgt'ender','win'
+		gt $loc, $metka
 		exit
 	elseif pcs_willpwr <= 0:
 		'<b><font color = red> You cannot summon the will to fight!</font></b>'
 
-		xgt'ender','loss'
+		!xgt'ender','loss'
+		gt $loc, $metka
 		exit
 	end
 	!gt 'fight', 'main'