Choose a character:
(link: "Devin is a Fighter. He fights. That's, uh, pretty much it.")[
(set: $character to "Devin")
(set: $class to "Fighter")
(set: $health to 15)
(set: $intelligence to 5)
(set: $totalPoints to 5)
(goto: "Statistics")
]
(link: "Thilda is a Wizard. They have studied the arcana for many years and has even mastered some of it.")[
(set: $character to "Thilda")
(set: $class to "Wizard")
(set: $health to 5)
(set: $intelligence to 15)
(set: $totalPoints to 5)
(goto: "Statistics")
]
(link: "Smoke is a Rogue. She knows how to pick a lock, steal anything found inside, and close the lock before anyone notices. Yes, she has your missing wallet.")[
(set: $character to "Smoke")
(set: $class to "Rogue")
(set: $health to 10)
(set: $intelligence to 10)
(set: $totalPoints to 5)
(goto: "Statistics")
]
Health: {
(link-repeat: "|+|")[
(if: $totalPoints > 0)[
(set: $health to it + 1)
(set: $totalPoints to it - 1)
(replace: ?healthStat)[|healthStat>[$health]]
(replace: ?pointsStat)[|pointsStat>[$totalPoints]]
]
]
(link-repeat: "|-|")[
(if: $health > 0)[
(set: $health to it - 1)
(set: $totalPoints to it + 1)
(replace: ?healthStat)[|healthStat>[$health]]
(replace: ?pointsStat)[|pointsStat>[$totalPoints]]
]
]
}
Intelligence: {
(link-repeat: "|+|")[
(if: $totalPoints > 0)[
(set: $intelligence to it + 1)
(set: $totalPoints to it - 1)
(replace: ?intelligenceStat)[|intelligenceStat>[$intelligence]]
(replace: ?pointsStat)[|pointsStat>[$totalPoints]]
]
]
(link-repeat: "|-|")[
(if: $intelligence > 0)[
(set: $intelligence to it - 1)
(set: $totalPoints to it + 1)
(replace: ?intelligenceStat)[|intelligenceStat>[$intelligence]]
(replace: ?pointsStat)[|pointsStat>[$totalPoints]]
]
]
}
{
(link-repeat: "|Reset Points|")[
(set: $health to 10)
(set: $intelligence to 10)
(set: $totalPoints to 5)
(replace: ?healthStat)[|healthStat>[$health]]
(replace: ?intelligenceStat)[|intelligenceStat>[$intelligence]]
(replace: ?pointsStat)[|pointsStat>[$totalPoints]]
]
}
Health: |healthStat>[$health]
Intelligence: |intelligenceStat>[$intelligence]
Remaining Points: |pointsStat>[$totalPoints]
(set: $showHeader to true)
(set: $healthMax to $health)
(if: $class is "Fighter")[
[[Enter the Cave->Fighter Cave]]
]
(if: $class is "Wizard")[
[[Enter the Cave->Wizard Cave]]
]
(if: $class is "Rogue")[
[[Enter the Cave->Rogue Cave]]
]You stand in front of a cave. To prove your worth, you need to enter the cave, figure out its secrets, and kill everything within it. Easy.
(display: "Next Event")You sigh inwardly as you look at the cave in front of you. It's been decades since you have needed to re-verify your license to use magic, but here you are. In front of this cave. Needing to enter and figure out whatever is going on here.
(display: "Next Event")You look at the scroll you stole from a merchant earlier today and back up again. This has to be the cave mentioned. The bounty explains that treasure awaits. And, if there was ever woman who needed more treasure, it would be you.
(display: "Next Event")(if: $showHeader is true)[
You are $character, a $class.
[Health: $health]<health|
Intelligence: $intelligence
]You see a large, open area.You see a tunnel extending ahead.
{
(if: $intelligence > 10)[
You avoid a trap! (Intelligence > 10)
] (else:) [
(set: _loss to (random: 1, 3))
You lose _loss health due to rough climbing.
(set: $health to it - _loss)
(replace: ?health)[[Health: $health]<health|]
(display: "Check Health")
]
}{
(for: each _i, ...(range:1,10))[
(set: $nextLocation to (either: "Open Area", "Tunnel", "Encounter"))
(set: $events to it + (a: $nextLocation))
]
(set: $nextEvent to $events's ($eventCount))
}{
(if: $intelligence <= 5)[
You fight your way through some (either: "rats", "bugs") and take no damage. (Intelligence <= 5)
](else-if: $intelligence >= 15)[
You avoid an ambush! (Intelligence >= 15)
] (else:) [
(set: _loss to (random: 1, 3))
You lose _loss health.
(set: $health to it - _loss)
(replace: ?health)[[Health: $health]<health|]
You fight some (either: "rats", "bugs") and take _loss damage.
(display: "Check Health")
]
}{
(set: _healing to (random: 1,5))
(set: $health to it + _healing)
(if: $health > $healthMax)[
(set: $health to $healthMax)
]
(replace: ?health)[[Health: $health]<health|]
}{
(set: $showHeader to false)
(set: $events to (a:))
(set: $nextEvent to "")
(set: $eventCount to 1)
(set: $healthMax to 0)
(set: $remainingRests to 3)
(display: "Generate Events")
}[Current area:<br> (display: $nextEvent)]<event|
{
(link-repeat: "Proceed")[
(set: $eventCount to it + 1)
(if: $eventCount > $events's length)[
(set: $showHeader to false)
(goto: "Good Ending")
]
(set: $nextEvent to $events's ($eventCount))
(replace: ?event)[[Current area:<br> (display: $nextEvent)]<event|]
]
<br>
[(Remaining rests: $remainingRests)]<rests|
(link-repeat: "Rest")[
(set: $remainingRests to it - 1)
(if: $remainingRests <= 0)[
(set: $remainingRests to 0)
]
(replace: ?rests)[[(Remaining rests: $remainingRests)]<rests|]
(if: $remainingRests > 0)[
(display: "Rest")
]
]
}{
(if: $health <= 0)[
(set: $showHeader to false)
(goto: "Bad Ending")
]
}You died in the dungeon.
The end.You pass through the cave successfully!
The end.