TFSagas/storyline_scripts/thrall_gamble.tf

389 lines
13 KiB
HCL
Raw Permalink Blame History

This file contains ambiguous Unicode characters

This file contains Unicode characters that might be confused with other characters. If you think that this is intentional, you can safely ignore this warning. Use the Escape button to reveal them.

# Townforge: Storyline: A thrall's gamble
# Testnet
# Files:
# ../assets/thrallGamble_128.jpeg
# ../assets/thrallGamble_256.jpeg
# ../assets/coinFlip_256.jpeg
# Attributes:
# Fate
# Variables:
# player storyline_thrallGamble_lucky
# player storyline_thrallGamble_lost
# Items:
# Grandmother's Hairpin
# Gambler`s Coin
# Practice Wood Coin
## TODO:
## Set ITEM IDs
script {
name "A thrall's gamble"
description "A snake-eyed thrall is preying on strangers, hoping to win a wager. -- 0.36-2"
icon "@raw:thrallGamble_128.jpeg"
owner 0
storyline
# deployable
overrides {
1 "@b64:thrallGamble_256.jpeg"
2 "@b64:coinFlip_256.jpeg"
local "min_level" 5
local "city_id" 0
local "pledge" 100000000
local "side_chance" 30
local "min_Fate" 5
local "i_hairpin" 100039
local "i_coin" 100040
local "i_woodCoin" #
local "max_lucky_times" 3
local "fee" 200000000
local "max_lost" 9
}
precondition "Level required" level >= local "min_level"
precondition "City" city id == local "city_id"
precondition "Banned by the thrall" player "storyline_thrallGamble_lucky" < local "max_lucky_times"
precondition "Pity from the thrall" player "storyline_thrallGamble_lost" <= local "max_lost"
reserves {
player gold local "pledge"
owner gold local "pledge"
owner fees local "fee"
}
procedure "lucky" {
award gold local "pledge"
set player "storyline_thrallGamble_lucky" player "storyline_thrallGamble_lucky" + 1
if (player "storyline_thrallGamble_lucky" >= local "max_lucky_times") { create item local "i_coin" 1 }
}
state "init" {
text "
<center>
<img src=data:,${1}/>
<h3>
- Anger level: ${player storyline_thrallGamble_lucky}/${local max_lucky_times} -<br>
- Pity level: ${player storyline_thrallGamble_lost}/${local max_lost} -<br>
</h3>
</center>
<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>?<br>
- How about a little wager of <strong>${gold:pledge}</strong> gold?<br>
- Ill flip a coin; if it shows the high Karl, your gold is mine;<br>
- If its Jormungand, youll get my gold instead.<br>
- Oh, and it can land on its <strong>side</strong> toothat's <strong>my win</strong>!<br>
<h3>He grins, but there's a glint in his eye that makes you wonder...</h3><br>
"
init { if (player "storyline_thrallGamble_lost" >= local "max_lost") { create item local "i_woodCoin" 1 } }
choice {
enabled player "storyline_thrallGamble_lost" < local "max_lost"
text "
<center>
You choose to <strong>play!</strong><br>
[ Wager is <strong>${gold:pledge}</strong> TFG ]
</center>
"
selected text "
<center><img src=data:,${2}/></center>
<h2>The thrall flips the coin,</h2>
<h3>and it flickers in the sunlight mid-air, casting an unusual shimmer as it lands in the thrall's hand...</h3>
<h3>But something seems off... was that a glint of mischief in his eyes?</h3><br>
"
actions {
set local "coin_flip" random 2
set local "side_fall" random 100
}
next state "flip"
}
choice {
enabled player "storyline_thrallGamble_lost" < local "max_lost"
text "
<center>
<strong>Not today.</strong><br>
The stars don't feel like they'd align for you...
</center>
"
selected text "
<center><img src=data:,${1}/></center><br>
<h2>Poor luck, my friend!</h2>
- It seems fate has not been kind to you lately.<br>
- May the stars align in your favor next time.<br>
- Until then, may your journey be smooth and your spirits high.
<h3>
But remember, even the bold can falter.<br>
I'll be waiting for your return, hoping for better fortune next time.
</h3><br>
"
}
choice {
enabled player "storyline_thrallGamble_lost" >= local "max_lost"
text "
<center>
<h2>The thrall now looks at you with pity in his eyes.</h2>
<h3>
As if weighing your misfortunes against his own playful nature.<br>
He sighs, understanding that your losses have been too many.
</h3>
- Perhaps its best for you to <strong>stop</strong>.
- The stars dont seem to align for you... </strong>never</strong>.
<h3>He reaches for his pouch, searching for something....</h3>
- As a token of goodwill, here, take this <strong>${item:local i_woodCoin}</strong>.<br>
- I used it when I was just starting out, practicing my luck.<br>
- May it remind you that every master was once a novice, and better fortune awaits you.<br>
<h3>He look at you with an ashamed smile and eyes of pitty.</h3>
[ Awarded: <strong>${item:local i_woodCoin}</strong> ]
</center>
"
actions {
set player "storyline_thrallGamble_lost" player "storyline_thrallGamble_lost" + 1
award item local "i_woodCoin" 1
}
selected text "
<center><img src=data:,${1}/></center><br>
<h2>Poor luck... or lack of Fate?</h2>
<h3>As you leave, the thrall turns to you one last time.</h3>
- It seems fate has not been kind to you, and I cant bear to wager against you anymore.<br>
- May the stars finally align in your favor onde day, and may you find better luck on your journey.<br>
- And until then, remember, that every setback is just a setup for a greater comeback.<br><br>
"
}
}
state "flip" {
text "
<center><img src=data:,${1}/></center>
<h1>%P plays the gamble and...</h1><br>
"
choice {
enabled (local "coin_flip" == 1 AND local "side_fall" >= local "side_chance")
text "
<center>
<h2>Ah, it's the Jormungand! Excellent...</h2>
<h3>
The thrall look annoyed, a fleeting frown crossing his face,<br>
yet he nods and hands you the gold with an exaggerated sigh.<br>
</h3>
- Guess Ill have to find a better coin next time,
<h3>He mutters, a hint of mischief lingering in his eyes.</h3>
[ Won <strong>${gold:pledge}</strong> TFG ]
</center>
"
selected text "
<center><img src=data:,${2}/></center>
<h2>Thor blessed you today,</h2>
<h3>
the win is yours!<br>
You wonder if luck was truly on your side...<br>
Or if the game was rigged from the start.<br>
Maybe this time you just had enough fate.
</h3>
[ Player Fate attribute: <strong>${attribute Fate}</strong> ]<br><br>
"
actions { award gold local "pledge" }
}
choice {
enabled (local "coin_flip" == 0 AND local "side_fall" >= local "side_chance")
text "
<center>
<h2>The coin lands on the high Karl's silhouette.</h2>
<h3>The thrall grins widely, his eyes gleaming with mischief as he snatches your gold.</h3>
- Looks like luck's not on your side today.
<h3>He chuckles, but there's a glimmer in his gaze</h3>
[ Lost <strong>${gold:pledge}</strong> TFG ]
</center>
"
selected text "
<center><img src=data:,${1}/></center>
<h2>The gods turned their back on you today.</h2>
<h3>
Perhaps a little more Fate is what you need to sway the tides in your favor.
Come back when you're ready to tempt the fates again!
</h3>
[ Player Fate attribute: <strong>${attribute Fate}</strong> ]<br><br>
"
actions { pay gold local "pledge" }
}
choice {
enabled (local "side_fall" <= local "side_chance" AND attribute "Fate" < local "min_Fate" AND player item local "i_hairpin" == 0)
text "
<center>
<h2>The coin lands sideways after the flip.</h2>
<h3>The thrall bursts into laughter, a glint of mischief in his eyes as he grabs your gold.</h3>
- Well, well! A curious outcome.<br>
- Looks like the coin has its own ideas today!
<h3>He says, smirking.</h3>
[ Lost <strong>${gold:pledge}</strong> TFG ]
</center>
"
selected text "
<center><img src=data:,${1}/></center>
<h2>The gods turned their back on you today.</h2>
<h3>
Perhaps a little more Fate is what you need to sway the tides in your favor.
Come back when you're ready to tempt the fates again!
</h3>
[ Player Fate attribute: <strong>${attribute Fate}</strong> ]<br><br>
"
actions {
pay gold local "pledge"
set player "storyline_thrallGamble_lost" player "storyline_thrallGamble_lost" + 1
}
}
choice {
enabled (local "side_fall" <= local "side_chance" AND attribute "Fate" >= local "min_Fate" AND player item local "i_hairpin" == 0)
text "
<center>
<h2>The coin lands sideways after the flip...</h2>
<h3>
only to finally barely roll to its Jormungand side!<br>
The thrall frowns, having already thought to have won the bet.<br>
He grunts as he hands over your gold.
</h3>
[ Won <strong>${gold:pledge}</strong> TFG ]<br><br>
</center>
"
selected text "
<center><img src=data:,${1}/></center>
<h2>The thrall scowls, hands on his hips.</h2>
<h3>His eyes narrowed at the coin that landed sideways but somehow flipped in your favor.</h3><br>
"
actions { call "lucky" }
next state "sideways"
}
choice {
enabled (local "side_fall" <= local "side_chance" AND player item local "i_hairpin" >= 1)
text "
<center>
<h2>The coin lands sideways after the flip...</h2>
<h3>
You feel a warmth next to your body, emanating from your ${item:local i_hairpin}.<br>
Memories of the eerie encounter with the Hag flood back your mind.<br>
You watch, as the coin roll to its Jormungand side.<br>
The thrall frowns, clearly disappointed at having miscalculated his chances.<br>
With a grunt, he reluctantly hands over your gold.
</h3>
[ Won <strong>${gold:pledge}</strong> TFG ]
</center>
"
selected text "
<center><img src=data:,${1}/></center>
<h2>The thrall scowls, hands on his hips.</h2>
<h3>His eyes narrowed at the coin that landed sideways but somehow flipped in your favor.</h3><br>
"
actions { call "lucky" }
next state "sideways"
}
}
state "sideways" {
text "
<center><img src=data:,${1}/></center>
<h2>The thrall squinted at you.</h2><br>
"
choice {
enabled (player "storyline_thrallGamble_lucky" < local "max_lucky_times")
text "
<h3>He shakes his head, his voice dripping with sarcasm.</h3>
- Well, well, <strong>%P</strong>! Would you look at that?<br>
- The coin may have danced for me, but it seems it had other plans.<br>
- I cant help but feel theres some trickery afoot!<br>
- Did you charm my <strong>${item:local i_coin}</strong>?<br>
- Lets flip it <strong>once more</strong>!<br>
- Maybe the spirits are just playing with me today.<br>
<h3>He crosses his arms defiantly.</h3>
"
selected text "
<center><img src=data:,${2}/></center>
<h2>You stride away</h2>
<h3>
A satisfied smirk on your face, the thrall watches you with a mix of disbelief and grudging respect.<br>
The sun glints off the gold in your pouch, a weighty reminder of your unexpected victory.<br>
You can hear his muttering behind you, a blend of irritation and admiration, but it only makes your triumph sweeter.<br>
The thrill of the gamble lingers in the air, youve bested the thrall.<br>
As you turn the corner, the coins unpredictable flip echoes in your mind, a perfect reminder that fortune favors the bold.<br>
Today, luck was undeniably on your side.
</h3><br>
"
}
choice {
enabled (player "storyline_thrallGamble_lucky" >= local "max_lucky_times")
text "
<h3>He shakes his head, venom drenching his words.</h3>
- By the gods <strong>%P</strong>!<br>
- My <strong>${item:local i_coin}</strong> seems to mock me now, doesnt it?<br>
- Youve got some kind of charm, eh?<br>
- Did you conjure this misfortune somehow?
<h3>He steps closer, eyes narrowed with suspicion, then erupts.</h3>
- <strong>Enough</strong> of this madness! I swear, Ill <strong>never wager with you again</strong>.<br>
- From this day forth, <strong>you are banned</strong>!
<h3>He looks at the <strong>${item:local i_coin}</strong> in his hand, with fury radiating from him.</h3>
- Your luck is a plague, as is this coin, <strong>keep it</strong>!<br><br>
[ Awarded: <strong>${item:local i_coin}</strong> ]
"
actions { award item local "i_coin" 1 }
selected text "
<center><img src=data:,${2}/></center>
<h2>You stride away</h2>
<h3>
A smug grin spreads across your face as the thrall glares at you, disbelief mixing with rage.<br>
The sun glints off coin in hand, a heavy reminder of your unexpected victory.<br>
You hear his angry mutterings behind you, a blend of irritation and resentment that makes your triumph all the sweeter.<br>
The thrill of victory hangs in the air; youve left the thrall fuming.<br>
As you turn the corner, the coins chaotic flip echoes in your mind, a clear sign that fortune favors the bold.<br>
Today, luck was unmistakably on your side.
</h3><br>
"
}
}
}