Browse Source

[fixes] experimental fix for blackjack when played on android and made the loops unique

julzor 5 years ago
parent
commit
f840f85eb8
1 changed files with 76 additions and 76 deletions
  1. 76 76
      locations/casino.qsrc

+ 76 - 76
locations/casino.qsrc

@@ -766,40 +766,40 @@ if $ARGS[0] = 'blackjack_play':
 	doubleBet = 0
 	minBet = 10
 	maxBet = 500
-	*PL '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/stolbd.jpg"></center>'
-	*PL 'You are sitting at the blackjack table.'
+	*pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/stolbd.jpg"></center>'
+	*pl 'You are sitting at the blackjack table.'
 	act 'Move away from the table' : gt 'casino', 'cards'
 	act 'Play blackjack' : gt 'casino', 'bet'
 	act 'Ask for the rules' : gt 'casino', 'rules'
 end
 
 if $ARGS[0] = 'rules':
-	*PL '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/crupbd.jpg"></center>'
-	*PL '<h2><u>Blackjack Rules:</u></h2>'
-	*P '<ol><li>The player and dealer are each dealt 2 cards after initial bets (<<minBet>> <b>₽</b> - <<maxBet>> <b>₽</b>). The dealer will have 1 face-up card and 1 face-down card.</li>'
-	*P '<li>Face cards are worth 10 points, aces can double as either 11 or 1, and all other cards are worth their numeric value.</li>'
-	*P '<li>After the player finishes drawing, the dealer must continue to draw until he has 17 points or more.</li>'
-	*P '<li>To win, the player must score more points than the dealer, have the dealer bust, or get a blackjack.</li>'
-	*P '<li>Getting over 21 points is known as a bust, and an automatic loss.</li>'
-	*P '<li>Getting an ace and a 10 point card in the first 2 cards is known as a blackjack, and is an automatic win which pays 3 : 2.</li>'
-	*P '<li>If the dealer''s face-up card is an ace, the player can make a side-bet called "insurance" that pays 2 : 1 if the dealer has a blackjack.</li>'
-	*P '<li>At any time, the player can choose to double his/her bet, which gives the player 1 more card but prevents further draws on that hand.</li>'
-	*P '<li>If the player''s hand only consists of two cards of equal value, he/she can split them into 2 hands. Each hand must be covered by an amount equal to the original bet.</li>'
-	*P '<li>The player cannot score a blackjack using a split hand.</li>'
+	*pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/crupbd.jpg"></center>'
+	*pl '<h2><u>Blackjack Rules:</u></h2>'
+	*p '<ol><li>The player and dealer are each dealt 2 cards after initial bets (<<minBet>> <b>₽</b> - <<maxBet>> <b>₽</b>). The dealer will have 1 face-up card and 1 face-down card.</li>'
+	*p '<li>Face cards are worth 10 points, aces can double as either 11 or 1, and all other cards are worth their numeric value.</li>'
+	*p '<li>After the player finishes drawing, the dealer must continue to draw until he has 17 points or more.</li>'
+	*p '<li>To win, the player must score more points than the dealer, have the dealer bust, or get a blackjack.</li>'
+	*p '<li>Getting over 21 points is known as a bust, and an automatic loss.</li>'
+	*p '<li>Getting an ace and a 10 point card in the first 2 cards is known as a blackjack, and is an automatic win which pays 3 : 2.</li>'
+	*p '<li>If the dealer''s face-up card is an ace, the player can make a side-bet called "insurance" that pays 2 : 1 if the dealer has a blackjack.</li>'
+	*p '<li>At any time, the player can choose to double his/her bet, which gives the player 1 more card but prevents further draws on that hand.</li>'
+	*p '<li>If the player''s hand only consists of two cards of equal value, he/she can split them into 2 hands. Each hand must be covered by an amount equal to the original bet.</li>'
+	*p '<li>The player cannot score a blackjack using a split hand.</li>'
 	act 'Return' : gt 'casino', 'blackjack_play'
 end
 
 if $ARGS[0] = 'bet':
-	*PL '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/stavkabd.jpg"></center>'
-	playerBets[0] = INPUT('Place your bet.')
+	*pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/stavkabd.jpg"></center>'
+	playerBets[0] = input('Place your bet.')
 	if money < playerBets[0]:
-		MSG 'You don''t have enough money for that bet.'
+		msg 'You don''t have enough money for that bet.'
 		gt 'casino', 'blackjack_play'
 	elseif playerBets[0] < minBet:
-		MSG 'There is a minimum bet of <<minBet>> <b>₽</b>.'
+		msg 'There is a minimum bet of <<minBet>> <b>₽</b>.'
 		gt 'casino', 'blackjack_play'
 	elseif playerBets[0] > maxBet:
-		MSG 'There is a maximum bet of <<maxBet>> <b>₽</b>.'
+		msg 'There is a maximum bet of <<maxBet>> <b>₽</b>.'
 		gt 'casino', 'blackjack_play'
 	end
 	betTotal = playerBets[0]
@@ -818,15 +818,15 @@ end
 if $ARGS[0] = 'blackjack':
 	gs 'casino', 'blackjack_view', 1
 	if playerPoints[0] = 21 and dealerPoints = 21:
-		*PL 'DRAW GAME'
-		*PL 'You retrieve your bet.'
+		*pl 'DRAW GAME'
+		*pl 'You retrieve your bet.'
 	elseif playerPoints[0] = 21:
-		*PL 'PLAYER WINS'
-		*PL 'You receive <<playerBets[0] * 3 / 2>> <b>₽</b> in winnings.'
+		*pl 'PLAYER WINS'
+		*pl 'You receive <<playerBets[0] * 3 / 2>> <b>₽</b> in winnings.'
 		money += playerBets[0] * 3 / 2
 	else
-		*PL 'DEALER WINS'
-		*PL 'The dealer takes your <<playerBets[0]>> <b>₽</b> bet.'
+		*pl 'DEALER WINS'
+		*pl 'The dealer takes your <<playerBets[0]>> <b>₽</b> bet.'
 		money -= playerBets[0]
 	end
 	act 'Continue' : gt 'casino', 'blackjack_play'
@@ -834,18 +834,18 @@ end
 
 if $ARGS[0] = 'insurance1':
 	gs 'casino', 'blackjack_view'
-	*PL 'The dealer has an ace showing.  Would you like to place a bet for insurance?'
+	*pl 'The dealer has an ace showing.  Would you like to place a bet for insurance?'
 	insurance = 0
 	act 'Bet insurance' :
-		insurance = INPUT('Place your bet.')
+		insurance = input('Place your bet.')
 		if money < insurance:
-			MSG 'You don''t have enough money for that bet.'
+			msg 'You don''t have enough money for that bet.'
 			gt 'casino', 'insurance1'
 		elseif insurance < 0:
-			MSG 'You cannot bet a negative amount of money.'
+			msg 'You cannot bet a negative amount of money.'
 			gt 'casino', 'insurance1'
 		elseif insurance > playerBets[0] / 2:
-			MSG 'Insurance cannot exceed half the original bet.'
+			msg 'Insurance cannot exceed half the original bet.'
 			gt 'casino', 'insurance1'
 		else
 			gt 'casino', 'insurance2'
@@ -858,16 +858,16 @@ if $ARGS[0] = 'insurance2':
 	if deckFace[dealerCards[1]] > 9: gs 'casino', 'blackjack_view', 1
 	if deckFace[dealerCards[1]] < 10: gs 'casino', 'blackjack_view'
 	if dealerPoints = 21:
-		*PL 'DEALER WINS'
-		*P 'The dealer takes your <<playerBets[0]>> <b>₽</b> bet'
-		if insurance > 0: *P ' but also gives you <<insurance>> <b>₽</b> for your side bet'
-		*P '.'
+		*pl 'DEALER WINS'
+		*p 'The dealer takes your <<playerBets[0]>> <b>₽</b> bet'
+		if insurance > 0: *p ' but also gives you <<insurance>> <b>₽</b> for your side bet'
+		*p '.'
 		money -= playerBets[0]
 		money += insurance
 		act 'Continue' : gt 'casino', 'blackjack_play'
 	else
-		*PL 'The dealer takes a peek at his hole card; no blackjack.'
-		if insurance > 0: *P 'He relieves you of <<insurance>> <b>₽</b> for your side bet.'
+		*pl 'The dealer takes a peek at his hole card; no blackjack.'
+		if insurance > 0: *p 'He relieves you of <<insurance>> <b>₽</b> for your side bet.'
 		money -= insurance
 		act 'Continue' :
 			cla
@@ -882,12 +882,12 @@ if $ARGS[0] = 'player':
 	if playerPoints[currentHand] > 21: currentHand += 1 & handLosses += 1 & doubleBet = 0
 	if playerPoints[currentHand] = 21 or doubleBet = 1: currentHand += 1 & doubleBet = 0
 	if handLosses = numHands:
-		*PL 'DEALER WINS'
-		*P 'The dealer relieves you of <<betTotal>> <b>₽</b>.'
+		*pl 'DEALER WINS'
+		*p 'The dealer relieves you of <<betTotal>> <b>₽</b>.'
 		money -= betTotal
 		act 'Continue' : gt 'casino', 'blackjack_play'
 	elseif currentHand >= numHands:
-		*PL 'You can take no further actions.'
+		*pl 'You can take no further actions.'
 		act 'Continue' :
 			cla
 			wait 500
@@ -895,10 +895,10 @@ if $ARGS[0] = 'player':
 		end
 	else
 		if numHands = 1:
-			*PL 'You are considering actions for your hand.'
+			*pl 'You are considering actions for your hand.'
 			$text = ''
 		else
-			*PL 'You are considering your actions for <b>hand #<<currentHand + 1>></b>.'
+			*pl 'You are considering your actions for <b>hand #<<currentHand + 1>></b>.'
 			$text = 'Hand #<<currentHand + 1>>: '
 		end
 		act '<<$text>>Hit' :
@@ -908,7 +908,7 @@ if $ARGS[0] = 'player':
 			playerHand[i] = cardsDealt
 			cardsDealt += 1
 			*clr & cla
-			*PL '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
+			*pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
 			wait 750
 			gt 'casino', 'player'
 		end
@@ -923,7 +923,7 @@ if $ARGS[0] = 'player':
 				playerHand[i] = cardsDealt
 				cardsDealt += 1
 				*clr & cla
-				*PL '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
+				*pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
 				wait 750
 				gt 'casino', 'player'
 			end
@@ -941,7 +941,7 @@ if $ARGS[0] = 'player':
 					playerHand[i + 1] = cardsDealt
 					cardsDealt += 1
 					*clr & cla
-					*PL '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
+					*pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
 					wait 750
 					gt 'casino', 'player'
 				end
@@ -967,7 +967,7 @@ if $ARGS[0] = 'dealer':
 			dealerHand[i] = cardsDealt
 			cardsDealt += 1
 			*clr & cla
-			*PL '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
+			*pl '<center><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbde.jpg"></center>'
 			wait 750
 			gt 'casino', 'dealer'
 		end
@@ -978,8 +978,8 @@ if $ARGS[0] = 'dealer':
 		if playerPoints[i] <= 21: betTotal += playerBets[i]
 		i += 1
 		if i < numHands: jump 'loop5'
-		*PL 'PLAYER WINS'
-		*P 'You receive <<betTotal>> <b>₽</b> in winnings.'
+		*pl 'PLAYER WINS'
+		*p 'You receive <<betTotal>> <b>₽</b> in winnings.'
 		money += betTotal
 		act 'Continue' : gt 'casino', 'blackjack_play'
 	else
@@ -996,17 +996,17 @@ if $ARGS[0] = 'dealer':
 		i += 1
 		if i < numHands: jump 'loop6'
 		if betTotal = 0:
-			*PL 'DRAW GAME'
-			if numHands = 1: *P 'You retrieve your bet.'
-			if numHands > 1: *P 'You retrieve your bets.'
+			*pl 'DRAW GAME'
+			if numHands = 1: *p 'You retrieve your bet.'
+			if numHands > 1: *p 'You retrieve your bets.'
 		elseif betTotal < 0:
-			*PL 'DEALER WINS'
-			if numHands > 1: *P 'After taking into account all the hands, you have lost. '
-			*P 'The dealer relieves you of <<0 - betTotal>> <b>₽</b>.'
+			*pl 'DEALER WINS'
+			if numHands > 1: *p 'After taking into account all the hands, you have lost. '
+			*p 'The dealer relieves you of <<0 - betTotal>> <b>₽</b>.'
 		else
-			*PL 'PLAYER WINS'
-			if numHands > 1: *P 'After taking into account all the hands, you have won. '
-			*P 'You receive <<betTotal>> <b>₽</b> in winnings.'
+			*pl 'PLAYER WINS'
+			if numHands > 1: *p 'After taking into account all the hands, you have won. '
+			*p 'You receive <<betTotal>> <b>₽</b> in winnings.'
 		end
 		money += betTotal
 		act 'Continue' : gt 'casino', 'blackjack_play'
@@ -1014,17 +1014,17 @@ if $ARGS[0] = 'dealer':
 end
 
 if $ARGS[0] = 'blackjack_view':
-	*PL '<table width="100%"><tr><td>'
-	*PL '<u>Dealer</u>'
+	*pl '<table width="100%"><tr><td>'
+	*pl '<u>Dealer</u>'
 	if ARGS[1] = 0:
-		*P '<img <<$set_imgh>> src="<<$deckImg[dealerHand[0]]>>">'
-		*PL '<img <<$set_imgh>> src="images/locations/city/industrial/casino/cards/back.jpg">'
+		*p '<img <<$set_imgh>> src="<<$deckImg[dealerHand[0]]>>">'
+		*pl '<img <<$set_imgh>> src="images/locations/city/industrial/casino/cards/back.jpg">'
 	else
 		numAces = 0
 		dealerPoints = 0
 		i = 0
-		:loop1
-		*P '<img <<$set_imgh>> src="<<$deckImg[dealerHand[i]]>>">'
+		:loop7
+		*p '<img <<$set_imgh>> src="<<$deckImg[dealerHand[i]]>>">'
 		if deckFace[dealerHand[i]] = 1:
 			dealerPoints += 11
 			numAces += 1
@@ -1034,7 +1034,7 @@ if $ARGS[0] = 'blackjack_view':
 			dealerPoints += deckFace[dealerHand[i]]
 		end
 		i += 1
-		if dealerHand[i] ! 0: jump 'loop1'
+		if dealerHand[i] ! 0: jump 'loop7'
 		:loop2
 		if dealerPoints > 21 and numAces > 0:
 			dealerPoints -= 10
@@ -1042,24 +1042,24 @@ if $ARGS[0] = 'blackjack_view':
 			jump 'loop2'
 		end
 		if dealerPoints > 21:
-			*P '<br>BUST!'
+			*p '<br>BUST!'
 		elseif dealerPoints = 21 and dealerHand[2] = 0:
-			*P '<br>BLACKJACK!'
+			*p '<br>BLACKJACK!'
 		else
-			*P '<br><<dealerPoints>> points'
+			*p '<br><<dealerPoints>> points'
 		end
 	end
 
-	*PL '<br><br><u>Player</u>'
+	*pl '<br><br><u>Player</u>'
 	i = 0
 	:loop3
 	numAces = 0
 	playerPoints[i] = 0
-	if numHands > 1: *PL 'Hand #<<i + 1>>:'
+	if numHands > 1: *pl 'Hand #<<i + 1>>:'
 	j = 0
 	:loop4
 	if playerHand[i * 16 + j] ! 0:
-		*P '<img <<$set_imgh>> src="<<$deckImg[playerHand[i * 16 + j]]>>">'
+		*p '<img <<$set_imgh>> src="<<$deckImg[playerHand[i * 16 + j]]>>">'
 		if deckFace[playerHand[i * 16 + j]] = 1:
 			playerPoints[i] += 11
 			numAces += 1
@@ -1071,23 +1071,23 @@ if $ARGS[0] = 'blackjack_view':
 		j += 1
 		jump 'loop4'
 	end
-	:loop5
+	:loop8
 	if playerPoints[i] > 21 and numAces > 0:
 		playerPoints[i] -= 10
 		numAces -= 1
-		jump 'loop5'
+		jump 'loop8'
 	end
 	if playerPoints[i] > 21:
-		*P '<br>BUST!'
+		*p '<br>BUST!'
 	elseif playerPoints[i] = 21 and playerHand[2] = 0 and numHands = 1:
-		*P '<br>BLACKJACK!'
+		*p '<br>BLACKJACK!'
 	else
-		*P '<br><<playerPoints[i]>> points |'
+		*p '<br><<playerPoints[i]>> points |'
 	end
-	*P ' Bet = <<playerBets[i]>> <b>₽</b><br><br>'
+	*p ' Bet = <<playerBets[i]>> <b>₽</b><br><br>'
 	i += 1
 	if i < numHands: jump 'loop3'
-	*PL '</td><td valign="top"><div align="right"><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbd.jpg"></div></td></tr></table>'
+	*pl '</td><td valign="top"><div align="right"><img <<$set_imgh>> src="images/locations/city/industrial/casino/cartbd.jpg"></div></td></tr></table>'
 end
 
 --- casino ---------------------------------