summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
Diffstat (limited to 'data/examples/blackjack/global.fate')
-rw-r--r--data/examples/blackjack/global.fate36
1 files changed, 36 insertions, 0 deletions
diff --git a/data/examples/blackjack/global.fate b/data/examples/blackjack/global.fate
new file mode 100644
index 0000000..9c10c9f
--- /dev/null
+++ b/data/examples/blackjack/global.fate
@@ -0,0 +1,36 @@
+(fate_version 1)
+
+(require player.fate)
+
+(global player player)
+
+(global (lambda text (int)) coins_word)
+
+(set coins_word
+ (lambda ((int i))
+ (if_else (= (var i) 1)
+ (text a single coin )
+ (text (var i) coins )
+ )
+ )
+)
+
+(declare_text_effect action_description)
+
+(define_sequence money_acquisition ((int amount))
+ (set player.money (+ (var player.money) (var amount)))
+ (if (> (var amount) 0)
+ (text_effect action_description
+ You acquired (eval coins_word (var amount))!
+ )
+ )
+)
+
+(define_sequence money_loss ((int amount))
+ (set player.money (- (var player.money) (var amount)))
+ (if (> (var amount) 0)
+ (text_effect action_description
+ You lost (eval coins_word (var amount)).
+ )
+ )
+)