TFSagas/public_scripts/coinflip.tf
2024-10-12 22:04:11 -03:00

94 lines
3.5 KiB
HCL

# TFSagas: Public: Coin Flip
# Testnet
# Files:
# ../assets/thrallGamble_256.jpeg
# ../assets/coinFlip_128.jpeg
# ../assets/coinFlip_256.jpeg
script {
name "TFS: Coin Flip"
description "Flip a coin and try your luck. -- 0.36-1"
icon "@raw:coinFlip_128.jpeg"
owner 18
public
# deployable
overrides {
1 "@b64:thrallGamble_256.jpeg"
2 "@b64:coinFlip_256.jpeg"
3 "<h2>A young thrall is lingering about.</h2><h3>As soon as he spots you, he yells out:</h3>- Ah! Feeling lucky today, <strong>%P</strong>? Let us a wager <strong>${gold:pledge}</strong> gold.<br>- I will flip a coin, if it is the high Karl, your gold is mine;<br>- If it is Jormungand, you'll get to have my gold.<br>- Oh, and it can land on its <strong>side</strong> too, which is <strong>my win</strong>!<h3>He grins.</h3><br>"
4 "You choose to <strong>play!</strong>"
5 "<h2>The thrall flips the coin,</h2><h3>and it flickers sunlight during the jump, landing on the thrall's hand...</h3>"
6 "<strong>Not today.</strong><br>The stars don't feel like they'd align for you..."
7 "<h2>Fair enough!</h2><br>- May the stars align in your favor next time.<br>- Until then, may your journey be smooth and your spirits high.<br>"
8 "<h1>%P plays the gamble and...</h1>"
9 "<h2>Ah, it's the Jormungand! Excellent...</h2><h3>The thrall is annoyed,<br>but nods and hands over you the gold.</h3>"
10 "<h2>Thor blessed you today,</h2><h3>the win is yours!</h3>"
11 "<h2>The coin lands on the high Karl's silhouette.</h2><h3>The thrall grins and grabs your gold.</h3>"
12 "<h2>The gods turned their back on you today,</h2><h3>more luck next time my friend!</h3>"
13 "<h2>The coin lands sideways after the flip.</h2><h3>The thrall laughs, and grabs your gold.</h3>"
14 "<h2>The gods turned their back on you today,</h2><h3>more luck next time my friend!</h3>"
local "pledge" 100000000
local "side_chance" 10
}
reserves {
player gold local "pledge"
owner gold local "pledge"
}
state "init" {
text "<center><img src=data:,${1}/></center><br>${3}<br>"
choice {
text "
<center>
${4}<br>
[ Wager is <strong>${gold:pledge}</strong> TFG ]<br>
[ Chance of falling sideways: <strong>${local side_chance}%</strong>]
</center>
"
selected text "<center><img src=data:,${2}/></center><br>${5}<br>"
actions {
set local "coin_flip" random 2
set local "side_fall" random 100
}
next state "flip"
}
choice {
text "<center>${6}</center>"
selected text "<center><img src=data:,${1}/></center><br>${7}<br>"
}
}
state "flip" {
text "<center><img src=data:,${1}/></center><br>${8}<br>"
choice {
enabled (local "coin_flip" == 1 AND local "side_fall" > local "side_chance")
text "<center>${9}[ Won <strong>${gold:pledge}</strong> TFG ]</center>"
selected text "<center><img src=data:,${2}/></center><br>${10}<br>"
actions { award gold local "pledge" }
}
choice {
enabled (local "coin_flip" == 0 AND local "side_fall" > local "side_chance")
text "<center>${11}<br>[ Lost <strong>${gold:pledge}</strong> TFG ]</center>"
selected text "<center><img src=data:,${1}/></center><br>${12}<br>"
actions { pay gold local "pledge" }
}
choice {
enabled local "side_fall" <= local "side_chance"
text "<center>${13}<br>[ Lost <strong>${gold:pledge}</strong> TFG ]</center>"
selected text "<center><img src=data:,${1}/></center><br>${14}<br>"
actions { pay gold local "pledge" }
}
}
}