*temp quadx 0
*set quadx (quadrant + 3)
*if quadx > 111
	*set quadx (quadrant - 3)
	
*temp man "man"
*temp employee_emoji "👨"

*temp game "none"

*temp drinks_ordered 0

*rand dieroll 1 3

*if dieroll = 1
	*set man "woman"
	*set employee_emoji "👩"
	*goto casino_start
*else
	*goto casino_start

*label casino_start

*if sound
	*sound casino.mp3

🎰 [b]${planet_name} Casino[/b]

Stepping into the casino, your senses are assaulted by flashing lights, ringing bells, and several clashing perfumes.

${employee_emoji} "[i]Welcome to the best entertainment this side of Quadrant ${quadx}, off-worlder[/i]!" says a ${man} wearing a striped uniform who approaches you.  

"$!{greetings}," you say.

${employee_emoji} "[i]We've got a card table where you can play War, several slot machines, and an off-track betting parlor where you can wager on camel races.  Remember, all players get free drinks!  And to welcome you to the casino, we're giving you 20 free credits.[/i]"

*set credits + 20

Cash on hand: ¢${credits}

[b]:::[/b] What do you want to do, Captain?

*fake_choice
	#🍒 Play the slot machines
		*goto play_slots
	#🐪 Bet on a camel race
		*goto bet_camel
	#🃏 Play War (card game)
		*goto wargame
	#↩️ Leave the casino
		*goto_scene spaceport leave_market
	
	
*label casino2

*if sound
	*sound casino.mp3

🎰 [b]${planet_name} Casino[/b]

${employee_emoji} [i]"Looks like you've been having fun, Captain!  How else can we serve you today?"[/i] says the casino employee.
*line_break
"Hmm," you say.

${employee_emoji} [i]"We've got a card table for playing War, several slot machines, and an off-track betting parlor where you can wager on camel races.  Remember, all players get free drinks![/i]"

[b]:::[/b] What do you want to do, Captain?

*fake_choice
	#🃏 Play War (card game)
		*goto wargame
	#🍒 Play the slot machines
		*goto play_slots
	#🐪 Bet on a camel race
		*goto bet_camel
	#↩️ Leave the casino
		*goto_scene spaceport leave_market
	
*label play_slots

*temp slotmachine 0

*if sound
	*sound slotmachinestart.mp3

🎰 [b]${planet_name} Casino[/b]

Walking over to the slot machine area of the casino, you see a bank of different machines, all of which look identical.

Carefully, you examine each slot machine to see which one is putting out the "luckiest" vibes today.

[b]:::[/b] What do you want to do, Captain?

*fake_choice
	#💺 Sit at slot machine #1
		*set slotmachine 1
	#💺 Sit at slot machine #2
		*set slotmachine 2
	#💺 Sit at slot machine #3
		*set slotmachine 3
	#💺 Sit at slot machine #4
		*set slotmachine 4
	#💺 Sit at slot machine #5
		*set slotmachine 5
	#💺 Sit at slot machine #6
		*set slotmachine 6
	#💺 Sit at slot machine #7
		*set slotmachine 7
	#↩️ Try a different game
		*goto casino2
	
*label slots_action

*if sound
	*sound slotsaction.wav

*temp bet 0
*temp spins 0

🎰 [b]${planet_name} Casino - Slot Machine ${slotmachine}[/b]

Seated in front of the slot machine, you see a brightly lit screen listing the various payoffs that the machine will deliver if you get lucky.

There is also a small sign that says "Max bet: 50 credits"

*if credits < 1
	Unfortunately, you are completely out of money.
	
	*page_break 😌
	
	*goto casino2

*label slot_money

[b]:::[/b] How much money do you want to put into the slot machine, Captain?

*fake_choice
	*selectable_if (credits >= 1) #🪙 1 credit
		*set bet 1
	*selectable_if (credits >= 5) #🪙 5 credits
		*set bet 5
	*selectable_if (credits >= 10) #🪙 10 credits
		*set bet 10
	*selectable_if (credits >= 25) #🪙 25 credits
		*set bet 25
	*selectable_if (credits >= 50) #🪙 50 credits
		*set bet 50
		
*check_achievements
*if choice_achieved_first_casino = false
	*achieve first_casino
				
*label spinner

*if sound
	*sound slotspin.wav
		
🎰 [b]${planet_name} Casino - Slot Machine ${slotmachine}[/b]

[i]The images on the slot machine whirl at high speed for several moments until they slowly begin to click into place...[/i]

*gosub slot_results

*if spins < 3
	*page_break SPIN
	*goto spinner

*page_break 🤞

*gosub slot_results

*label slot_reveal

*set spins 0

🎰 [b]${planet_name} Casino - Slot Machine ${slotmachine}[/b]

When the images come to a stop, you see:

${emoji1} ::: ${emoji2} ::: ${emoji3}

*if payoff = 0
	*if sound
		*sound loser.wav
		
	Unfortunately, you didn't win any money this time.
	*set credits - payoff

*if payoff > 0
	*if sound
		*sound cashout.mp3
		
	*set payoff (bet * payoff)
	You won ${payoff} credits!
	*set credits + payoff
	
Cash on hand: ¢${credits}

::: What do you want to do, Captain?

*fake_choice
	*selectable_if (credits >= bet) #🔁 Spin again
		*set credits - bet
		*goto spinner
	#🪙 Change your bet amount
		🎰 [b]${planet_name} Casino - Slot Machine ${slotmachine}[/b]
		
		*goto slot_money
	#💺 Move to a different slot machine
		*goto play_slots
	*selectable_if (credits > 0) #🍸 Order a drink
		*set game "slots"
		*goto order_drink
	#↩️ Try a different game
		*goto casino2
	
*label slot_results

*temp payoff 0

*temp emoji1 ""
*temp emoji2 ""
*temp emoji3 ""

*rand dieroll 1 7

*if dieroll = 1
	*set emoji1 "🍓"
	
*if dieroll = 2
	*set emoji1 "🥝"
	
*if dieroll = 3
	*set emoji1 "🍋"
	
*if dieroll = 4
	*set emoji1 "🍑"
	
*if dieroll = 5
	*set emoji1 "🍉"
	
*if dieroll = 6
	*set emoji1 "🍌"
	
*if dieroll = 7
	*set emoji1 "🍒"
	
*rand dieroll 1 7

*if dieroll = 1
	*set emoji2 "🍓"
	
*if dieroll = 2
	*set emoji2 "🥝"
	
*if dieroll = 3
	*set emoji2 "🍋"
	
*if dieroll = 4
	*set emoji2 "🍑"
	
*if dieroll = 5
	*set emoji2 "🍉"
	
*if dieroll = 6
	*set emoji2 "🍌"
	
*if dieroll = 7
	*set emoji2 "🍒"
	
*rand dieroll 1 7

*if dieroll = 1
	*set emoji3 "🍓"
	
*if dieroll = 2
	*set emoji3 "🥝"
	
*if dieroll = 3
	*set emoji3 "🍋"
	
*if dieroll = 4
	*set emoji3 "🍑"
	
*if dieroll = 5
	*set emoji3 "🍉"
	
*if dieroll = 6
	*set emoji3 "🍌"
	
*if dieroll = 7
	*set emoji3 "🍒"
	
*if spins = 3
	*goto jumper

${emoji1}::${emoji2}::${emoji3}
*set spins +1
*if spins < 3
	*return
	
*label jumper
	
*if (emoji1 = "🍒") and (emoji2 = "🍒")
	*if emoji3 = "🍒"
		*set payoff 111
		*return
		
*if (emoji1 = "🍒") and (emoji2 = "🍒")
	*set payoff 7
	*return
	
*if (emoji3 = "🍒") and (emoji2 = "🍒")
	*set payoff 7
	*return
	
*if (emoji3 = "🍒") and (emoji1 = "🍒")
	*set payoff 7
	*return

*if (emoji1 = emoji2) and (emoji2 = emoji3)
	*set payoff 7
	*return
	
*if emoji1 = "🍒"
	*set payoff 1
	*return
	
*if emoji2 = "🍒"
	*set payoff 1
	*return
	
*if emoji3 = "🍒"
	*set payoff 1
	*return
	
*if emoji1 = emoji2
	*set payoff 1
	*return
	
*if emoji1 = emoji3
	*set payoff 1
	*return
	
*if emoji2 = emoji3
	*set payoff 1
	*return
	
*set payoff 0

*return

*label bet_camel

*gosub camel_setup

*if sound
	*sound camelracing.wav

🎰 [b]${planet_name} Casino - Off-track Betting Parlor[/b]

🐪 Today's race list and odds:

1) [i]${camel1}[/i]: ${camel1odds} to 1
*line_break
2) [i]${camel2}[/i]: ${camel2odds} to 1
*line_break
3) [i]${camel3}[/i]: ${camel3odds} to 1
*line_break
4) [i]${camel4}[/i]: ${camel4odds} to 1
*line_break
5) [i]${camel5}[/i]: ${camel5odds} to 1
*line_break
6) [i]${camel6}[/i]: ${camel6odds} to 1
*line_break
7) [i]${camel7}[/i]: ${camel7odds} to 1

[b]:::[/b] What do you want to do, Captain?

*fake_choice
	#🪙 Place a bet
		*goto camel_bet
	#❓ Ask for instructions
		*goto camel_instructions
	#↩️ Try a different game
		*goto casino2
	
*label camel_instructions

*if sound
	*sound charliebrown.mp3

🎰 [b]${planet_name} Casino - Off-track Betting Parlor[/b]

${employee_emoji} "[i]As an off-worlder, it is only natural that you are unfamiliar with ${planet_name}'s most popular sport[/i]," says the casino employee.

"Just tell me the rules," you say.

${employee_emoji} "[i]Each race features seven camels.  Professional handicappers establish the odds for each camel.  If you bet on camel number one, for instance, and that camel was rated at five to one odds of winning, and that camel wins, your payoff will be five times your bet,[/i]" says the employee.

"I understand," you say.

${employee_emoji} "[i]Of course, the camels with the lowest odds are the ones most likely to win[/i]," says the casino employee with a smirk.

[b]:::[/b] What do you want to do, Captain?

*fake_choice
	#🪙 Place a bet on the camel race
		*goto camel_bet
	#↩️ Try a different game
		*goto casino2
	
*label camel_bet

*temp bet_camel ""
*temp payoff 0
*temp bet 0
*temp betcamelnumber 0

🎰 [b]${planet_name} Casino - Off-track Betting Parlor[/b]

[b]:::[/b] Which camel do you want to bet on, Captain?

*fake_choice
	#${camel1} (${camel1odds} to 1)
		*set bet_camel camel1
		*set betcamelnumber 1
		*set payoff camel1odds
	#${camel2} (${camel2odds} to 1)
		*set bet_camel camel2
		*set betcamelnumber 2
		*set payoff camel2odds
	#${camel3} (${camel3odds} to 1)
		*set bet_camel camel3		
		*set betcamelnumber 3
		*set payoff camel3odds
	#${camel4} (${camel4odds} to 1)
		*set bet_camel camel4
		*set betcamelnumber 4
		*set payoff camel4odds
	#${camel5} (${camel5odds} to 1)
		*set bet_camel camel5
		*set betcamelnumber 5
		*set payoff camel5odds
	#${camel6} (${camel6odds} to 1)
		*set bet_camel camel6
		*set betcamelnumber 6
		*set payoff camel6odds
	#${camel7} (${camel7odds} to 1)
		*set bet_camel camel7
		*set betcamelnumber 7
		*set payoff camel7odds
	
		
🎰 [b]${planet_name} Casino - Off-track Betting Parlor[/b]

*temp placer_number 0
*temp placement "blank text"

You are betting that ${bet_camel} is going to win.

Cash on hand: ¢${credits}

::: How much would you like to wager on today's race, Captain?

*input_number bet 1 credits

*if bet = 0
	*goto casino2

*check_achievements
*if choice_achieved_first_casino = false
	*achieve first_casino

🎰 [b]${planet_name} Casino - Off-track Betting Parlor[/b]

The seven camels have lined up, and the race is about to begin!

*page_break 🏁

*temp segment 1

*temp camel1standing "🐪"
*temp camel2standing "🐪"
*temp camel3standing "🐪"
*temp camel4standing "🐪"
*temp camel5standing "🐪"
*temp camel6standing "🐪"
*temp camel7standing "🐪"

*temp camel1position 0
*temp camel2position 0
*temp camel3position 0
*temp camel4position 0
*temp camel5position 0
*temp camel6position 0
*temp camel7position 0

*label camels_are_racing

🏁 [b]The Camel Race[/b]

*if segment = 1
	And they're off!
	
*set segment +1

*if sound
	*sound gallop.wav
	
*gosub camels_move

*if (camel1position >= 11) and (camel2position >= 11)
	*if (camel3position >= 11) and (camel4position >= 11)
		*if (camel5position >= 11) and (camel6position >= 11)
			*if camel6position >= 11
				*goto camel_race_over

Current standings:

1: ${camel1standing}
*line_break
2: ${camel2standing}
*line_break
3: ${camel3standing}
*line_break
4: ${camel4standing}
*line_break
5: ${camel5standing}
*line_break
6: ${camel6standing}
*line_break
7: ${camel7standing}

You bet ¢${bet} on [i]${bet_camel}[/i] (#${betcamelnumber}) to win.

*if placement = "blank text"
	*page_break 📣 Go ${bet_camel}!
	
*if placement != "blank text"
	*page_break 😌

*set segment +1

*goto camels_are_racing

*label camel_race_over

*if sound
	*sound raceover.wav

Final results:

[i]${camel1}[/i]: ${camel1standing}
*line_break
[i]${camel2}[/i]: ${camel2standing}
*line_break
[i]${camel3}[/i]: ${camel3standing}
*line_break
[i]${camel4}[/i]: ${camel4standing}
*line_break
[i]${camel5}[/i]: ${camel5standing}
*line_break
[i]${camel6}[/i]: ${camel6standing}
*line_break
[i]${camel7}[/i]: ${camel7standing}

*temp winnings 0

*temp frog ""
*set frog "camel${betcamelnumber}standing"

*if {frog} = "🥇 1st place"
	*set winnings (bet * payoff)
	You won ${winnings} credits!
	*set credits + winnings
	*goto singletary
	
*if {frog} = "🥈 2nd place"
	*set winnings (bet / 2)
	*set winnings round(winnings)
	You won ${winnings} credits!
	*set credits + winnings
	*goto singletary
	
*if {frog} = "🥉 3rd place"
	*set winnings (bet / 3)
	*set winnings round(winnings)
	You won ${winnings} credits!
	*set credits + winnings
	*goto singletary

You didn't win any money.
*set credits - bet
	
*label singletary
	
Cash on hand: ¢${credits}

[b]:::[/b] What do you want to do, Captain?

*fake_choice
	#🪙 Bet on another camel race
		*goto bet_camel
	*selectable_if (credits > 0) #🍸 Order a drink
		*set game "camel races"
		*goto order_drink
	#↩️ Try a different game
		*goto casino2

*ending

*label camel_setup

*temp camel1 ""
*temp camel2 ""
*temp camel3 ""
*temp camel4 ""
*temp camel5 ""
*temp camel6 ""
*temp camel7 ""

*rand dieroll 1 7

*if dieroll = 1
	*set camel1 "Golden Chance"
	
*if dieroll = 2
	*set camel1 "Raging Winner"
	
*if dieroll = 3
	*set camel1 "Fu Man Sue"
	
*if dieroll = 4
	*set camel1 "Fully Loaded"
	
*if dieroll = 5
	*set camel1 "Fundador"
	
*if dieroll = 6
	*set camel1 "Lucky Gold"
	
*if dieroll = 7
	*set camel1 "Royal Flush"
	
*rand dieroll 1 7

*if dieroll = 1
	*set camel2 "Second Saturday"
	
*if dieroll = 2
	*set camel2 "Desert Cheetah"
	
*if dieroll = 3
	*set camel2 "Desert Bloom"
	
*if dieroll = 4
	*set camel2 "Cactus Cutie"
	
*if dieroll = 5
	*set camel2 "Cacoon"
	
*if dieroll = 6
	*set camel2 "Ca Ching the Green"
	
*if dieroll = 7
	*set camel2 "Dreams Come True"

*rand dieroll 1 7

*if dieroll = 1
	*set camel3 "Sanctuary"
	
*if dieroll = 2
	*set camel3 "Saucy Pants"
	
*if dieroll = 3
	*set camel3 "Sancho"
	
*if dieroll = 4
	*set camel3 "Sanctified Lady"
	
*if dieroll = 5
	*set camel3 "Starry Night"
	
*if dieroll = 6
	*set camel3 "Sandcat"
	
*if dieroll = 7
	*set camel3 "Citizen's Fire"
	
*rand dieroll 1 7

*if dieroll = 1
	*set camel4 "Citron Kid"
	
*if dieroll = 2
	*set camel4 "Go West"
	
*if dieroll = 3
	*set camel4 "City Breeze"
	
*if dieroll = 4
	*set camel4 "Forsaken"
	
*if dieroll = 5
	*set camel4 "Fort Attitude"
	
*if dieroll = 6
	*set camel4 "Fort Defiance"
	
*if dieroll = 7
	*set camel4 "Lady Flower"
	
*rand dieroll 1 7

*if dieroll = 1
	*set camel5 "Silky Boy"
	
*if dieroll = 2
	*set camel5 "Silky Sullivan"
	
*if dieroll = 3
	*set camel5 "Sister Willy"
	
*if dieroll = 4
	*set camel5 "Willa's Justice"
	
*if dieroll = 5
	*set camel5 "Scurry Baby"
	
*if dieroll = 6
	*set camel5 "Sea Are Seven"
	
*if dieroll = 7
	*set camel5 "Seabeescando"
	
*rand dieroll 1 7

*if dieroll = 1
	*set camel6 "Scuti de Patuti"
	
*if dieroll = 2
	*set camel6 "Lucifer's Lady"
	
*if dieroll = 3
	*set camel6 "Luck be a Lady"
	
*if dieroll = 4
	*set camel6 "Wise Uncle Chester"
	
*if dieroll = 5
	*set camel6 "Magic Wish"
	
*if dieroll = 6
	*set camel6 "Wishbone Katie"
	
*if dieroll = 7
	*set camel6 "Ship n' Win"
	
*rand dieroll 1 7

*if dieroll = 1
	*set camel7 "Space Dragon"
	
*if dieroll = 2
	*set camel7 "Soy Poncena"
	
*if dieroll = 3
	*set camel7 "Space Cadet"
	
*if dieroll = 4
	*set camel7 "Space Tiger"
	
*if dieroll = 5
	*set camel7 "Outbacker"
	
*if dieroll = 6
	*set camel7 "Outhustle"
	
*if dieroll = 7
	*set camel7 "Outer Limits"
	
*temp camel1odds 0
*temp camel2odds 0
*temp camel3odds 0
*temp camel4odds 0
*temp camel5odds 0
*temp camel6odds 0
*temp camel7odds 0
	
*rand camel1odds 1 2
*rand camel2odds 1 3
*rand camel3odds 1 4
*rand camel4odds 1 5
*rand camel5odds 2 6
*rand camel6odds 2 7
*rand camel7odds 3 11

*return

*label camels_move

*if camel1position < 11
	*rand dieroll 0 2
	
*if camel1position >= 11
	*set dieroll 0

*if dieroll = 1
	*set camel1standing &"💨"
	*set camel1position +1
	*if camel1position >= 11
		*gosub placer
		*set camel1standing placement
	
*if dieroll = 2
	*set camel1standing &"💨💨"
	*set camel1position +2
	*if camel1position >= 11
		*gosub placer
		*set camel1standing placement
		
*if dieroll = 3
	*set camel1standing &"💨💨💨"
	*set camel1position +3
	*if camel1position >= 11
		*gosub placer
		*set camel1standing placement
		
*if camel2position < 11
	*rand dieroll 0 2
	
*if camel2position >= 11
	*set dieroll 0

*if dieroll = 1
	*set camel2standing &"💨"
	*set camel2position +1
	*if camel2position >= 11
		*gosub placer
		*set camel2standing placement
	
*if dieroll = 2
	*set camel2standing &"💨💨"
	*set camel2position +2
	*if camel2position >= 11
		*gosub placer
		*set camel2standing placement
		
*if dieroll = 3
	*set camel2standing &"💨💨💨"
	*set camel2position +3
	*if camel2position >= 11
		*gosub placer
		*set camel2standing placement
		
*if camel3position < 11
	*rand dieroll 0 2
	
*if camel3position >= 11
	*set dieroll 0

*if dieroll = 1
	*set camel3standing &"💨"
	*set camel3position +1
	*if camel3position >= 11
		*gosub placer
		*set camel3standing placement
	
*if dieroll = 2
	*set camel3standing &"💨💨"
	*set camel3position +2
	*if camel3position >= 11
		*gosub placer
		*set camel3standing placement
		
*if dieroll = 3
	*set camel3standing &"💨💨💨"
	*set camel3position +3
	*if camel3position >= 11
		*gosub placer
		*set camel3standing placement
		
*if camel4position < 11
	*rand dieroll 0 2
	
*if camel4position >= 11
	*set dieroll 0	

*if dieroll = 1
	*set camel4standing &"💨"
	*set camel4position +1
	*if camel4position >= 11
		*gosub placer
		*set camel4standing placement
	
*if dieroll = 2
	*set camel4standing &"💨💨"
	*set camel4position +2	
	*if camel4position >= 11
		*gosub placer
		*set camel4standing placement
		
*if dieroll = 3
	*set camel4standing &"💨💨💨"
	*set camel4position +3
	*if camel4position >= 11
		*gosub placer
		*set camel4standing placement
		
*if camel5position < 11
	*rand dieroll 0 2
	
*if camel5position >= 11
	*set dieroll 0	

*if dieroll = 1
	*set camel5standing &"💨"
	*set camel5position +1
	*if camel5position >= 11
		*gosub placer
		*set camel5standing placement
	
*if dieroll = 2
	*set camel5standing &"💨💨"
	*set camel5position +2
	*if camel5position >= 11
		*gosub placer
		*set camel5standing placement
		
*if dieroll = 3
	*set camel5standing &"💨💨💨"
	*set camel5position +3
	*if camel5position >= 11
		*gosub placer
		*set camel5standing placement
		
*if camel6position < 11
	*rand dieroll 0 2
	
*if camel6position >= 11
	*set dieroll 0	

*if dieroll = 1
	*set camel6standing &"💨"
	*set camel6position +1
	*if camel6position >= 11
		*gosub placer
		*set camel6standing placement
	
*if dieroll = 2
	*set camel6standing &"💨💨"
	*set camel6position +2
	*if camel6position >= 11
		*gosub placer
		*set camel6standing placement
		
*if dieroll = 3
	*set camel6standing &"💨💨💨"
	*set camel6position +3
	*if camel6position >= 11
		*gosub placer
		*set camel6standing placement
		
*if camel7position < 11
	*rand dieroll 0 3
	
*if camel7position >= 11
	*set dieroll 0

*if dieroll = 1
	*set camel7standing &"💨"
	*set camel7position +1
	*if camel7position >= 11
		*gosub placer
		*set camel7standing placement
	
*if dieroll = 2
	*set camel7standing &"💨💨"
	*set camel7position +2
	*if camel7position >= 11
		*gosub placer
		*set camel7standing placement
		
*if dieroll = 3
	*set camel7standing &"💨💨💨"
	*set camel7position +3
	*if camel7position >= 11
		*gosub placer
		*set camel7standing placement
		
*return

*label placer

*set placer_number +1

*if placer_number = 1
	*set placement "🥇 1st place"
	
*if placer_number = 2
	*set placement "🥈 2nd place"
	
*if placer_number = 3
	*set placement "🥉 3rd place"
	
*if placer_number = 4
	*set placement "4th place"
	
*if placer_number = 5
	*set placement "5th place"
	
*if placer_number = 6
	*set placement "6th place"
	
*if placer_number = 7
	*set placement "Last place"
	
*return

*label wargame

*if sound
	*sound shuffle2.mp3

🃏 [b]${planet_name} Casino - Card Table[/b]

Approaching the card table, you see an elegantly dressed dealer.

${employee_emoji} "[i]War is a simple card game.  First, you will get five cards, and I will get five cards.  We'll each flip over one card.  If one is higher, then that player gets both cards.  However, if both of our cards are of the same rank, we'll fight a card War to see who wins that hand[/i]," says the ${man}.

"I understand," you say.

${employee_emoji} [i]"The first person who gets all the cards will win the game,[/i]" concludes the dealer.

::: What do you want to do, Captain?

*fake_choice
	#🃏 Play some War
		*goto war_wager
	#↩️ Try a different game
		*goto casino2
	
*label war_wager

*temp bet 0
*temp player_card1 ""
*temp player_card1_value 0
*temp dealer_card1 ""
*temp dealer_card1_value 0

*temp player_suite ""
*temp dealer_suite ""

*temp playercards 5
*temp dealercards 5

🃏 [b]${planet_name} Casino - Card Table[/b]

Cash on hand: ¢${credits}

[b]:::[/b] How much would you like to wager on this game of War?

*input_number bet 0 credits

*if bet = 0
	*goto casino2

*check_achievements
*if choice_achieved_first_casino = false
	*achieve first_casino
	
*label play_war

🃏 [b]${planet_name} Casino - Card Table[/b]

*gosub assign_cards

You and the dealer both turn over your top card:

You: [b]${player_card1}[/b] ${player_suite}

Dealer: [b]${dealer_card1}[/b] ${dealer_suite}

*if player_card1_value > dealer_card1_value
	*if sound
		*sound winner2.wav
	You won this hand.
	*set playercards +1
	*set dealercards -1
	
*if dealer_card1_value > player_card1_value
	*if sound
		*sound loser.wav
	The dealer won this hand.
	*set dealercards +1
	*set playercards -1
	
*if dealer_card1_value = player_card1_value
	*if sound
		*sound war-cards.wav
	This means war!
	
	*page_break ⚔️
	*temp battlenumber 0
	*goto war_battle
	
*if dealercards < 1
	*if sound
		*sound winner.wav
	*page_break Game over
	*goto you_won_war

*if playercards < 1
	*if sound
		*sound loser.wav
	*page_break Game over
	*goto you_lost_war
	
Your cards remaining: ${playercards}
*line_break
Dealer's cards remaining: ${dealercards}

*fake_choice
	#🔂 Turn over another card
		*goto play_war
	#🏳️ Forfeit this game
		*set credits - bet
		*goto casino2

*label war_battle

*set battlenumber +3

🃏 [b]${planet_name} Casino - Card Table[/b]

⚔️ WAR BATTLE

*gosub assign_cards

You and the dealer each place two cards face down and then turn over a third card.

You: [b]${player_card1}[/b] ${player_suite}

Dealer: [b]${dealer_card1}[/b] ${dealer_suite}

*if player_card1_value > dealer_card1_value
	You won the battle!
	*if sound
		*sound grandwinner.wav
	
	*set playercards + battlenumber
	*set dealercards - battlenumber
	
*if dealer_card1_value > player_card1_value
	Unfortunately, the dealer won this battle.
	*if sound
		*sound grandloser2.wav
	*set dealercards + battlenumber
	*set playercards - battlenumber
	
*if dealer_card1_value = player_card1_value
	*if sound
		*sound war-cards.wav
	This means another war!
	
	*page_break ⚔️
	*goto war_battle
	
*if (playercards >= 14) or (dealercards < 1)
	*page_break Game over
	*goto you_won_war

*if (dealercards >= 14) or (playercards < 1)
	*page_break Game over
	*goto you_lost_war
	
Your cards remaining: ${playercards}
*line_break
Dealer's cards remaining: ${dealercards}

*fake_choice
	#🔂 Turn over another card
		*goto play_war
	#🏳️ Forfeit this game
		You forfeited the game and so lost ${bet} credits.
		*set credits - bet
		*goto casino2

*goto play_war

*label you_won_war

*if sound
	*sound cashregister.wav

🃏 [b]${planet_name} Casino - Card Table[/b]

You won the game and earned ${bet} credits.

*set credits + bet

Cash on hand: ¢${credits}

*label war_finished

[b]:::[/b] What do you want to do, Captain?

*fake_choice
	#🃏 Play another game of War
		*goto war_wager
	*selectable_if (credits > 0) #🍸 Order a drink
		*set game "War"
		*goto order_drink
	#↩️ Try a different game
		*goto casino2

*label you_lost_war

*if sound
	*sound grandloser2.wav

🃏 [b]${planet_name} Casino - Card Table[/b]

Unfortunately, you have lost this game of War.

*set credits - bet

Cash on hand: ¢${credits}

*goto war_finished

*label assign_cards
	
*rand dieroll 2 14

*if dieroll = 2
	*set player_card1 dieroll
	*set player_card1_value dieroll
	
*if dieroll = 3
	*set player_card1 dieroll
	*set player_card1_value dieroll
	
*if dieroll = 4
	*set player_card1 dieroll
	*set player_card1_value dieroll
	
*if dieroll = 5
	*set player_card1 dieroll
	*set player_card1_value dieroll
	
*if dieroll = 6
	*set player_card1 dieroll
	*set player_card1_value dieroll
	
*if dieroll = 7
	*set player_card1 dieroll
	*set player_card1_value dieroll
	
*if dieroll = 8
	*set player_card1 dieroll
	*set player_card1_value dieroll
	
*if dieroll = 9
	*set player_card1 dieroll
	*set player_card1_value dieroll
	
*if dieroll = 10
	*set player_card1 dieroll
	*set player_card1_value dieroll

*if dieroll = 11
	*set player_card1 "Jack"
	*set player_card1_value dieroll
	
*if dieroll = 12
	*set player_card1 "Queen"
	*set player_card1_value dieroll
	
*if dieroll = 13
	*set player_card1 "King"
	*set player_card1_value dieroll
	
*if dieroll = 14
	*set player_card1 "Ace"
	*set player_card1_value dieroll
	
*rand dieroll 2 14

*if dieroll = 2
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll
	
*if dieroll = 3
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll
	
*if dieroll = 4
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll
	
*if dieroll = 5
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll
	
*if dieroll = 6
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll
	
*if dieroll = 7
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll
	
*if dieroll = 8
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll
	
*if dieroll = 9
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll
	
*if dieroll = 10
	*set dealer_card1 dieroll
	*set dealer_card1_value dieroll

*if dieroll = 11
	*set dealer_card1 "Jack"
	*set dealer_card1_value dieroll
	
*if dieroll = 12
	*set dealer_card1 "Queen"
	*set dealer_card1_value dieroll
	
*if dieroll = 13
	*set dealer_card1 "King"
	*set dealer_card1_value dieroll
	
*if dieroll = 14
	*set dealer_card1 "Ace"
	*set dealer_card1_value dieroll
	
*rand dieroll 1 4

*if dieroll = 1
	*set player_suite "of 💛"
	
*if dieroll = 2
	*set player_suite "of 💜"
	
*if dieroll = 3
	*set player_suite "of 💙"
	
*if dieroll = 4
	*set player_suite "of 💚"
	
*label gemiah
	
*rand dieroll 1 4

*if dieroll = 1
	*set dealer_suite "of 💛"
	
*if dieroll = 2
	*set dealer_suite "of 💜"
	
*if dieroll = 3
	*set dealer_suite "of 💙"
	
*if dieroll = 4
	*set dealer_suite "of 💚"
	
*if (dealer_suite = player_suite) and (dealer_card1 = player_card1)
	*goto gemiah
	
*return
	
*label order_drink

*check_achievements
*if choice_achieved_first_drink = false
	*achieve first_drink

*temp drink "water"

🎰 [b]${planet_name} Casino[/b]

You give the intergalactic signal for a customer needing service, and a moment later, a waiter approaches you.

${employee_emoji} [i]"What can I get you to drink, Captain?  Remember, drinks are free for all players at the ${planet_name} casino!"[/i]

[b]:::[/b] What do you want to order?

*fake_choice
	#🚰 Order a glass of water
		*set drink "water"
	#🍺 Order a beer
		*set drink "beer"
	#🍷 Order a glass of wine
		*set drink "wine"
	#🍹 Order a tropical cocktail
		*set drink "tropical cocktail"
	#🥃 Order a whiskey
		*set drink "whiskey"
		
🎰 [b]${planet_name} Casino[/b]

*set drinks_ordered +1
		
*if drinks_ordered = 1
	${employee_emoji} [i]"One ${drink} coming right up, Captain!"[/i]
	
*if drinks_ordered > 1
	${employee_emoji} [i]"Excellent choice! One ${drink} coming right up."[/i]

*if sound
	*sound gulpdrink.wav

A few moments later, the waiter returns and hands you your drink.

You take a cautious sip.

*if drink = "water"
	The water tastes exactly as it should - crisp and refreshing.
	
*if drink = "beer"
	The beer has a deliciously hoppy aroma and a smooth finish.
	
*if drink = "wine"
	The wine is clearly of an excellent vintage, and you detect a lovely earthy undertone mixed with an exciting floral bouquet on top.
	
*if drink = "tropical cocktail"
	As the ice clinks in the glass, you savor the heady fruity aromas that are excellent paired with the sharp, full-bodied taste of the alcohol underneath.
	
*if drink = "whiskey"
	With a strong, smooth finish and a deeply warm, earthy start, the taste of the whiskey pleasantly lingers on your tongue.

[b]:::[/b] What do you want to do, Captain?

*fake_choice
	#🍸 Order another drink
		*goto order_drink
	#⏯️ Back to the ${game}
		
*if game = "slots"
	*goto spinner

*if game = "camel races"
	*goto bet_camel

*if game = "War"
	*goto war_wager

This is an error

*ending