summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'data/examples/blackjack/main.fate')
-rw-r--r--data/examples/blackjack/main.fate77
1 files changed, 77 insertions, 0 deletions
diff --git a/data/examples/blackjack/main.fate b/data/examples/blackjack/main.fate
new file mode 100644
index 0000000..0b5acf8
--- /dev/null
+++ b/data/examples/blackjack/main.fate
@@ -0,0 +1,77 @@
+(fate_version 1)
+
+(require player.fate)
+(require global.fate)
+(require cards.fate)
+(require rules.fate)
+(require play.fate)
+
+(local int original_amount)
+
+(set player.money 0)
+
+Welcome to Tonkadur's wonderful and totally original blackjack!
+Say, I don't think I've seen you before...
+No, no, I am sure I haven't, actually.
+(prompt_string player.name 1 64 What's your name, then?)
+Alright, (var player.name), well, since it's your first time here, let me give
+you some coins.
+Just between you and me, someone left those laying around, they aren't mine.
+
+(visit money_acquisition (+ 100 (rand 0 100)))
+(set original_amount (var player.money))
+
+Now, you're all set to go... unless you don't know how to play?
+
+(player_choice
+ (
+ ( As it happens, I do not. )
+ (visit rules_of_blackjack)
+ (text_effect action_description
+ You leave the counter and approach one of the tables.
+ )
+ (visit play_a_game)
+ )
+ (
+ ( I am familiar with BlackJack. )
+ (text_effect action_description
+ You leave the counter and approach one of the tables.
+ )
+ (visit play_a_game)
+ )
+)
+(text_effect action_description
+ As you leave the establishment, the receptionist notices you.
+)
+
+(cond
+ (
+ (=< (var player.money) (/ (var original_amount) 2))
+ Outch. I suppose all your luck was spent by getting these free coins.
+ )
+ (
+ (< (var player.money) (var original_amount))
+ Well, that's not too bad for your first time. Come back tomorrow, I am
+ sure you'll be getting it all back.
+ )
+ (
+ (< (var player.money) (* (var original_amount) 2))
+ Had a good day, I hope?
+ )
+ (
+ (< (var player.money) (* (var original_amount) 4))
+ Well! That was some fine play, if I do say so myself!
+ )
+ (
+ (true)
+ (var player.name)! How did you do that?! You have to teach me! I did give
+ you the tools of your success, so please?
+ )
+)
+
+(text_effect action_description
+ You walk out, having turned (eval coins_word (var original_amount)) into
+ (eval coins_word (var player.money)).
+)
+
+(end)