last recruit{(alert: "This trial game is currently not available on mobile or tablets. I apologize if this is an inconvenience. If you are on a computer, you may continue, but you will have issues continuing on a phone or tablet.")
(alert:"Game Instructions:
Welcome to the Trials of the Realms, $name! You will soon face challenges and combat that test your abilities. Your choices will not only affect the story, but also your stats and abilities.")
(alert:"Your Stats:
* Health: If this reaches zero, your journey ends.
* Essence: The resource used for special abilities.
* Speed: Determines who attacks first in combat. Higher speed = higher chance of attacking first.
* Attack: Your basic attack power.
* Agility: Increases dodge chance and critical hit probability.
* Defense: Reduces damage when blocking.
* Stats are listed at the bottom of the page")
(alert:"Combat Basics:
* In combat, you'll choose between offensive and defensive actions.
* Special abilities are powerful but cost Essence. You'll notice one that pertains to your race, and more will come later.
* Your race, items, and backstory provide unique advantages that you will see appear in your stats and special abilities
* Health and Essence do not fully replenish between battles!
")}
#CHAPTER THREE - AN UNMPROMPTED GOODBYE
Your fingers meet the man's, rough and calloused, and in one fluid motion he yanks you forward. Glass explodes inward as a felled spirit crashes through the window. The man's arm becomes an iron bar across your chest, shoving you into the kitchen as crystalline shards rain down behind you.
Immediately he fires a shot from his thick-barreled pistol. How did he draw the weapon so quickly? The bullet looks like a shooting star as it flies through the air. It catches the spirit in the chest and white flames burst from its impact and swallow the spirit up.
Writhing in agony, the beast falls to the floor as the white flames lick up its seething flesh. Your sister buries her head in your shoulder, her entire body trembling. Even though fear is wracking your nerves together, you squeeze her tighter, attempting to assure her that she’s safe and everything will be fine.
Before you’ve even realized what’s happened, the man has unsheathed a sword bathed in white flames, illuminating the room as the felled recoil in fear. Like a fluid dance, he wields his blade and attacks. One, two, three he slashes down, and the remaining few scatter in retreat to the nearest shadows.
The man spins around, the white flames illuminating one half of his face, revealing the hazel color in his eyes. For a moment he studies you, like your eyes are windows into a mystery he’s come to solve.
“If you don’t want more to show up,” he says calmly, “you’ll follow me and leave her behind.”
“Huh? Who?”
Pressing his lips into a flat line, he gestures at your sister.
“What?” your sister says, panic shaking her voice. She turns her blue eyes toward you, tears spilling out of them. “Don’t leave me! Please!”
Your eyes harden at the man. “Are you insane? I’m not leaving my sister. I’m the only one who can care for her.”
Hovering over you, the man takes a deep breath and says, “You don’t have a sister. She’s an agent of the felled. You know that.”
“What? You’re crazy!”
“I’m sorry,” the man says, sheathing his sword. “I was hoping it didn’t have to be this way.”
“Stay back!” you say, squeezing your sister tighter.
“Don’t let him take me!” she yells, kicking her legs repeatedly as the man lurches toward her. One foot lands on the man’s bottom lip. He spits blood on the kitchen floor and fastens his hands around each of her ankles.
“No!” screams your sister. “Stop! Please!”
You try to pry his arms away, kicking at his wrists yourself, but he bends his elbows and contorts his body, spinning all of you on the floor. Somehow you end up in his grasp, and your sister is on the kitchen floor.
Screaming, crying, kicking, you try to free yourself from the man’s grip, but he’s stronger than you. He yanks you away, and the last thing you see of your baby sister is a red, tear-stained face as she sobs helplessly.
[[Continue | 4]]
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>{(alert: "This trial game is currently not available on mobile or tablets. I apologize if this is an inconvenience. If you are on a computer, you may continue, but you will have issues continuing on a phone or tablet.")
(alert:"Game Instructions:
Welcome to the Trials of the Realms, $name! You will soon face challenges and combat that test your abilities. Your choices will not only affect the story, but also your stats and abilities.")
(alert:"Your Stats:
* Health: If this reaches zero, your journey ends.
* Essence: The resource used for special abilities.
* Speed: Determines who attacks first in combat. Higher speed = higher chance of attacking first.
* Attack: Your basic attack power.
* Agility: Increases dodge chance and critical hit probability.
* Defense: Reduces damage when blocking.
* Stats are listed at the bottom of the page")
(alert:"Combat Basics:
* In combat, you'll choose between offensive and defensive actions.
* Special abilities are powerful but cost Essence. You'll notice one that pertains to your race, and more will come later.
* Your race, items, and backstory provide unique advantages that you will see appear in your stats and special abilities
* Health and Essence do not fully replenish between battles!
")}
#CHAPTER THREE - THE MIRAGE
Disbelief washes over you as you approach the train station. How did you even end up here this fast? How could your plan have possibly worked? Fuzzy images replay in your mind of hurrying your sister down the hall and into the laundry chute, barely missing the claw of a felled spirit on your tail. Right now, you’re just thankful to be alive.
“Are we there yet?” your sister asks.
“Quiet,” you snap. A surge of guilt rises in you. The intensity of the past few moments has gotten to you, and you let it get the best of you. “I’m sorry, sis,” you say, pausing several feet before the ticket booths on either side of the arched entryway. You set her down and look her in the eyes, a reminder of how you share the same blue irises. “I’m going to get us some train tickets, alright?”
“Where are we going?”
“To Uncle Gordon’s. You remember Uncle Gordon, right?”
Beaming, your sister bobs her head up and down.
You chuckle. “Wait here, alright? I won’t be long.”
Whatever just happened at your apartment, you’re not sure. But if anyone would know what to do, it would be Gordon. Your brother lives in the closest thing to a safehouse you have access to as well.
“Where to?” an old woman says as you approach, her voice muffled behind the plexiglass.
“Glen Solace,” you say.
The old lady’s attention turns to an empty paper ticket as she scribbles on it with a feathered quill. You turn around to check on your sister, who’s impatient self is finding ways to entertain herself. Dancing, hopping, skipping…
A sinking feeling fills your gut. The world seems to spin. Your sister just walked through a flock of doves, and they did nothing. Instead, the flock just happily continued pecking at crumbs on the street. Passersby begin to glance at you, making you uncomfortable.
You step forward to examine your sister again, and this time a stranger steps through the bird flock, and at once they scatter into their air, resounding in a symphony of wing flaps.
“It can’t be,” you whisper. Memories flood your mind…
“The healer says he can make the hallucinations go away…” Gordon had said.
“You’re not well,” a man in a trench coat had said once. Where was that?
Snapping back to reality, you now see all eyes in the city locked on to you. What’s happening? Hundreds of people are staring directly at you.
Someone snatches you by the wrist and pulls you away. You fall into step behind the man in the fedora, his grip fastened tightly around you.
“I’m trying to save you!” the man says.
One glimpse over your shoulder reveals your sister now screaming, bounding toward you with tears filling her eyes.
[[Continue | 4]]
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>#CHAPTER FOUR - YOUR SISTER
“Stop!” you yell, clawing and punching and biting. The man overpowers you with impressive strength, almost otherworldly, and drags you into a nearby alley.
“You know you don’t want me to stop,” he says. The intensity of his eyes cuts through the shadow under his hat and pierces you. Something strangely familiar about this mind starts to rise up in the recesses of your mind. The memories are fuzzy. Why does nothing seem clear? “Think! You’ve seen me before. You know who I am.”
A voice calls to you from outside. Though muffled and faint, the voice is familiar. Your sister. She’s in danger!
“I’m coming, Sis!” You yell. You attempt to leave, but the man pins you to the wall.
“Your sister isn’t real,” he says. His tone is firm, yet remorseful. Almost as if it was news he didn’t care to deliver. “She’s an agent of the felled, crafted from the privation of your imagination.”
“What’re you talking about?” you say. Your heart is beating through your chest. Beads of sweat form at your hairline. “You’re crazy! Help! Somebody!”
“I am the help.”
Those words stop you cold. You look into his eyes, searching for any reason not to trust this man.
“You need to think, alright?” he says. “Where did we meet?”
Searching your thoughts, you try to piece together all the fragments of memories scattered throughout your mind. Pooling blurry images, you remember a handshake.
“Anchorton,” you say, finally. “I-I-I went to the council’s chambers.”
“That’s right,” he says.
“No!” you shout. “Th-that was a dream! That didn’t happen!”
“That’s the felled talking,” he says.
Heavy breaths escape your lungs faster than you can control them. Spots flash in front of your eyes. Are you about to pass out?
“Take it easy,” the man says. “The felled have had control of this place for a long time, and trying to win it back is going to be difficult.”
Your gaze passes over the alleyway. “Place? What place?”
“You’re not in Anchorton right now. You know that, you just have to remember. You’re in Sominvale.”
“Huh? We’re in Somnivale?”
Could this really be happening? Somnivale is the realm of dreams. Is this all a dream? Storm clouds form overhead and a crackling thunder tears through them.
“Settle down, now,” the man says. “You have to control your emotions or the whole place will get out of control.”
You try to calm your breathing and the thunder settles to a dull roar.
The man sighs with relief. “Think with me now. What’s the first realm you must conquer to become a scarlet knight?”
“It-it’s, uh… Somnivale.” A clearer image of shaking this man’s hand pops into your mind. You have met him before. You went with him to Somnivale, the realm of dreams…
Crying sounds turn your attention to the mouth of the alley. Your sister is there, tears streaming down her cheeks. “Please help me!” she says through her sobs.
“She’s not real,” the man says.
Casting a glance upward, you see felled spirits on the roofs, their beady eyes piercing the darkness. Two tiny explosions rock the skies, jolting you. Engulfed in white flames, two bullets pierce the spirits’ chests and they come falling, but the white fire vaporizes them before they hit the ground. Your eyes turn back down to the man, a tail of smoke is rising from his pistol’s barrel.
“When you believe that girl is real,” the man says, “the felled will show up.”
Shaking your head, you say, “This can’t be right.” Your sister cries harder, shattering your heart. Memories of taking her in flood your mind. You’ve cared for her for years, you’ve practically raised her. You promised her you’d never leave her.
“It is right,” the man says. “If you’re honest with yourself you’ll know it’s true.”
Your throat constricts as tears blur your vision. Each shake of your head feels like fighting against chains of memory. "Why her?" The words come out as barely more than a whisper, yet they carry the weight of years of protected lies.
“She was your choice. This world was built by you.”
“If I built it then why are the felled here?”
The man’s eyes darken. “Think back to when you met me. Think hard. If I try to convince you here, it’ll rattle you and this world will be swarming with the felled. You have the power to remember.”
Pooling your thoughts, you shut your eyes and search the fuzzy memories. You met him in Anchorton. At the Scarlet Council…
Pain shoots through your chest. You grunt and bend over.
“Just keep remembering,” the man says.
“For years I've known I wanted to be a scarlet knight,” you had told the man. “It’s my purpose, I’m sure of it.”
“It’s not easy,” he responded. “There’s a reason it’s the rarest profession in all the realms of Melodor. You must spend a year in each realm, studying and mastering their gifts. Over half of all recruits don’t even make it past the first trial.”
“What’s the first?”
“Somnivale.”
“That’s odd. I would think that dreams would be the easiest to master.”
“Most would. That's one of the reasons why it's so difficult. The felled are drawn to our first experiences of deep pain. The moments that shape us. When a child first encounters true hurt, the felled appear in their dreams offering a trade.”
“A trade?”
“They present themselves as healers, guardians, or comfort-givers. In exchange for taking away the pain, they ask for something that seems small: the ability to ‘help guide your dreams.’ What the child doesn't realize is that they're actually surrendering their imagination piece by piece.”
“But how does that work?” you asked. “How can anyone just give away their imagination?”
“Imagination isn't just about creating fantasies," Wulfric says. "It's about seeing possibilities beyond what is. When you give that up, you accept a single, comfortable story instead of facing the truth. But more than that—you're giving control of your dreams to another being. The felled feed on this—they grow stronger with each mind they've bound to their false comforts. Each piece of your imagination they control becomes another thread in their web.”
He pauses, letting the weight of his words sink in. "Think about your own dreams. When was the last time you had a truly new one? Or do you just return to the same safe places, the same comfortable lies, night after night?"
The question strikes uncomfortably close to home. You try to remember your recent dreams, but they all blur together into a familiar pattern.
"And you're telling me everyone accepts the felled's offer?"
“Most don’t know it’s happening. The felled are usually disguised in your dream as something that represents healing to your pain. Whatever that thing or person is, they essentially separate you from your imagination and bind it to the object. We call that a stronghold. Overcoming the stronghold is difficult, and most go their entire lives without ever even confronting it. Much less defeating it. Scarlet knights must vanquish it completely. If you’re to forge a scarlet stone, you can’t have any shred of a stronghold left.”
“Why is it so hard to let go of?”
“Because when you’re dreaming, every emotion is heightened. All your pains are twenty times more painful, and your joys twenty times more joyful. The felled have spent years tying your joy to your little make believe world where you never have to confront the pain you endured, and they’ve convinced your subconscious of its reality. Tell me, have you ever had a nightmare?”
“Only when I was little. Not anymore.”
“Exactly. And when did the nightmares stop?”
You furrow your brow, thinking. “Around the time…” Your voice trails off.
“Around the time your 'sister' first appeared,” Wulfric finishes. “That's how strongholds work. The felled first attack with nightmares, testing our defenses, searching for cracks in our resolve. When they find our deepest pain, they offer comfort—a dream so perfect we never want to wake up. That's why defeating a stronghold is so difficult: the moment you start to break free, the nightmares return.”
“So nightmares are... good?”
“They're honest,” he says grimly. “When you have nightmares, it means you're facing reality instead of hiding in comfortable lies. Every scarlet knight had to face their nightmares before they could truly wake up. The felled know this—that's why they fight so hard to keep us dreaming peacefully.”
The words hit you like a truck. You realize you can't remember the last time you had a truly frightening dream. All your nights blur together in a soft, warm haze of familiar comfort.
You suck in a deep breath as your eyes open. You’re gasping for air, and the man places his hand on your chest.
“Slow down,” he says.
The alleyway is darker than you remember, and felled spirits are surrounding you. Your sister is nowhere to be found.
Pain flares up in your chest.
“I’m impressed,” he says. “This is only your third attempt. Most recruits have at least five before they make serious progress.”
“Sure doesn’t look like progress,” you say as you look at all the felled spirits.
“The deception isn’t working,” he mumbles. “Now they’re resorting to fear.”
“Well that might work.”
“I can get us out of here with your imagination fully in your grasp,” he says. “But you need to fully release your sister to me. She is the stronghold. The embodiment of whatever pain you've yet to confront."
“How do I do that?” you say, an uneasy feeling simmering in your belly.
The man looks down at you with empathetic eyes. “Honesty. Tell me what your sister really means. What wound is that band-aid covering?”
Nausea churns your stomach. Everything in you wants to run away and go find your baby sister again. She’s scared and alone, and you can feel it. How could you abandon her?
“You need to say it out loud,” the man says. “Who is she to you?”
''WHAT IS YOUR BACKSTORY?''
//Choose to learn your story//
[[🧙♂️ The Orphaned Wanderer | 5 Orphan]]
Perks:
* +2 Speed
* +2 Agility
* Special: "Survival Instinct" - When Health drops below 30%, gain +3 to all stats for 2 turns - 1 Essence cost
[[👨🏫 'The Scholar Who Saw Too Much | 5 Scholar]]
Perks:
* +3 Essence
* +1 Attack
* Special: "Forbidden Knowledge" - Can analyze enemy patterns and gain advantage, using your next 2 special abilities at no essence cost during combat for - 1 Essence cost
[[👑 The Fallen Noble| 5 Noble]]
Perks:
* +2 Attack
* +2 Defense
* +1 Essence
* Special: "Noble Bearing" - Focus now adds an additional +5 to counterattacks - 2 Essence cost
[[🦸♂️ ''The Reluctant Hero: | 5 Hero]]
Perks:
* +3 Defense
* +3 Health
* Special: "Unexpected Courage" - After being hit by a powerful attack (30%+ health), next attack deals 40% more damage
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>#CHAPTER FIVE - THE RELUCTANT HERO
The alley walls seem to close in around you as memories you've tried to suppress come rushing back. You shake your head, fighting against the current of truth threatening to sweep away the comfortable fiction you've lived with for so long.
"I never wanted any of this," you say, your voice barely audible. "I was just a merchant. A simple life was all I ever asked for."
The man in the fedora nods, understanding in his eyes. "The most reluctant heroes often make the greatest difference. Tell me what happened."
You close your eyes, and the grimy alley transforms. You're standing in a bustling marketplace, weights and measures on your table, goods neatly arranged for display. The familiar smell of spices and leather fills your nostrils. Simple. Predictable. Safe.
"I had a small trading business," you say. "Nothing special – textiles from the east, spices from the south, crafts from the mountain villages. I kept to myself, made a modest living. I was... content."
Your sister appears beside your memory-self, helping arrange merchandise, smiling at customers. A perfect assistant, a perfect companion.
"I was on a trading route I'd traveled dozens of times before," you continue. "A small village called Elmridge was the last stop before home. I'd been there so many times I knew every family by name."
The scene shifts to a dirt road winding through rolling hills, your cart loaded with goods, the village visible in the distance. But something is wrong – dark smoke rises from thatched roofs, and an unnatural silence hangs in the air.
"I heard the screams before I saw them," you say, your hands trembling slightly. "The felled had come through the western forest – dozens of them. The village militia was overwhelmed."
Your sister tugs at your sleeve. "You don't have to remember this part," she pleads. "It was just a bad dream."
But the memory continues. You see yourself abandoning your cart, running toward the chaos rather than away. Villagers flee in terror as shadowy creatures with burning eyes tear through their homes.
"I told myself I was just going to help evacuate people," you say, watching your past self move from house to house, guiding terrified families toward safety. "I wasn't a fighter. I had no special training. Just a merchant's dagger and a fool's courage."
The man in the fedora steps closer. "What changed?"
Your eyes cloud with emotion as the memory shifts to a small cottage at the edge of the village. A felled spirit cornering a mother and her children, claws extended.
"I didn't think," you whisper. "I just... acted."
In your memory, you charge forward with nothing but your dagger, placing yourself between the creature and the family. As the felled lunges toward you, something extraordinary happens. A light erupts from within you – brilliant and blinding. The creature shrieks and recoils, its form dissolving in the radiance.
"I had no idea I could do that," you say, wonder mixing with sorrow in your voice. "No one was more surprised than me."
The scene changes again. Survivors gather around you, awe and hope in their eyes. Words like "savior" and "chosen one" ripple through the crowd.
"Word spread," you continue. "People started coming to me with their problems – disputes, monsters, mysteries. They looked at me like I had answers. Like I was meant to lead them."
Your sister stands beside you now, her expression darkening. "You never wanted that burden," she says. "You were happy before. Remember how simple things were? Just you and me, traveling the trade routes, counting coins by candlelight."
"I tried to go back," you admit. "For months, I ignored the calls for help, the stories of suffering in other villages. I told myself it wasn't my responsibility."
The memory shifts to you alone in your home, sleepless, haunted by the faces of those you could have saved but chose not to. The weight of potential unrealized crushing you more each day.
"But you couldn't hide from who you truly are," the man says softly.
You nod, a tear slipping down your cheek. "The night I decided to seek out the Scarlet Knights, to understand this power and learn how to use it properly... that was the first night I dreamed of her." You gesture toward your sister.
She backs away from you, betrayal in her eyes. "I've always been with you! Always! You can't just decide I'm not real!"
"You were never there," you say, the truth finally breaking through. "I created you because I was afraid – afraid of responsibility, afraid of failing those who needed me. You were my excuse to remain ordinary when the world needed me to be more."
Your sister's face contorts with rage. Her small form grows, darkness pouring from her eyes and mouth like smoke. Her limbs elongate, fingers stretching into claws.
"You could have been happy," the Nightmare Weaver hisses, its true form emerging from the illusion of your sister. "A simple merchant with a simple life. I offered you peace! Freedom from expectation!"
You stand your ground as the creature towers over you, its form a twisted reflection of your deepest fears.
"There is no freedom in hiding from who you're meant to be," you say, finding strength in the truth. "And there's no peace in turning away from those who need you."
The Nightmare Weaver shrieks, lunging toward you with outstretched claws.
[[Prepare for Battle!|Combat Checks]]
<!--SETTING BACKSTORY VARIABLES-->
(set: $backstory to "hero")
(set: $defense to $defense + 3)
(set: $maxHealth to $maxHealth + 3)
(set: $health to $health + 3)
(set: $courageActive to 0) <!-- Initialize for Hero ability -->
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>#CHAPTER FIVE - THE FALLEN NOBLE
The alleyway grows colder as you lean against the wall, memories flooding back like a tide you've spent years trying to hold at bay. Your hands instinctively adjust your posture – shoulders back, chin high – muscle memory from a life that feels impossibly distant.
"Your family," the man in the fedora prompts gently. "Tell me about them."
The simple question hits you like a physical blow. You close your eyes, and suddenly you're standing in the grand hall of your family estate. Polished marble floors reflect ornate chandeliers. Servants move efficiently through the space. The crest of your house – once one of the most respected in the realm – hangs proudly on tapestries along the walls.
"We were... respected," you say, your voice taking on the refined cadence of your upbringing. "For generations, House Devereux governed fairly. We had the ear of rulers, the trust of merchants, the gratitude of commoners."
Your sister appears beside you in a silk dress, her hair perfectly arranged, smiling the easy smile of someone who has never known want. She takes your hand, but you continue speaking.
"My father taught me that nobility wasn't about privilege, but responsibility. 'Power is given to us so we might lift others,' he would say."
The memory shifts to your father's study – warm firelight, the scent of leather-bound books and aged brandy, your father's kind but serious face as he instructed you in the duties that would one day be yours.
"Then the Autumn Festival came," you continue, your voice dropping. "Our home was filled with guests – nobles, diplomats, merchants from across the realms."
Your sister squeezes your hand tighter, her smile fading. "You don't need to remember this part," she whispers urgently.
The man in the fedora steps closer. "This is where the truth lies. You must face it."
You nod slowly, allowing the painful memory to unfold. The grand hall transforms, now crowded with guests in their finest attire. Music plays as servants circulate with trays of delicacies. You see yourself younger, dressed in formal regalia, moving confidently among the elite of society.
"I was speaking with a foreign ambassador when the commotion began," you recall. "My cousin – my father's brother's son – announcing that he had evidence of treason. He claimed my father had been conspiring with enemy forces, selling secrets, undermining the security of the realm."
The festive atmosphere in your memory shatters as royal guards storm in, followed by your cousin's triumphant sneer.
"It was all fabricated, of course," you continue, bitterness edging your voice. "But the evidence was compelling – forged correspondence, testimony from bribed servants, financial records meticulously altered. He had been planning it for years."
You watch as guards seize your father, your mother's screams echoing through the hall as guests back away, their faces transforming from respect to disgust in an instant.
"Within a day, everything was gone. Our titles, our lands, our fortune – all transferred to my cousin. My father was imprisoned. My mother..." Your voice breaks. "She took her own life rather than face the shame."
Your sister clings to you, tears streaming down her face. "Please stop," she begs. "We don't have to think about that anymore. Remember how it was before – the gardens, the music lessons, the summer balls."
But the memory continues relentlessly. You see yourself cast out, former friends crossing the street to avoid you, shopkeepers refusing to serve the child of a traitor.
"I lived on the streets," you say quietly. "I saw how the common people struggled under the very nobles I had once dined with. I witnessed the cruelty of the system I had benefited from without question."
The memory shifts to a rain-soaked night, you huddled in a doorway, watching a patrol of guards harassing a family unable to pay their taxes.
"That was when I truly understood my father's words about responsibility. I vowed that if I could ever reclaim my position, I would use it differently. Not for personal gain, but for justice."
Your sister's grip on your hand loosens. "You're choosing them over me," she says, her voice suddenly different – hollow, echoing. "I kept you connected to who you were. Without me, you're nothing but a fallen noble, a discarded relic."
You turn to face her, really seeing her for the first time. "No. Without you, I'm free to become something better than I was. You're not my sister – you're my past. The comfortable lie I told myself to avoid the pain of betrayal."
Your sister's face contorts with rage. Her skin cracks like porcelain, darkness seeping through the fissures. Her elegant dress melts into writhing shadows as she grows taller, more monstrous.
"You were royalty," the felled spirit hisses, its voice no longer your sister's but something ancient and malevolent. "I gave you back your rightful place, your dignity, your family's honor. And this is how you repay such generosity?"
You stand your ground, facing the creature that has fed on your pride and your grief for so long.
"My dignity was never in my title," you say firmly. "And my honor lies in fighting creatures like you, not hiding in false memories of a golden past."
The Nightmare Weaver lunges toward you, its form a chaotic blend of courtly refinement and abyssal horror.
[[Prepare for Battle!|Combat Checks]]
<!--SETTING BACKSTORY VARIABLES-->
(set: $backstory to "noble")
(set: $defense to $defense + 2)
(set: $essence to $essence + 1)
(set: $maxEssence to $maxEssence + 1)
(set: $attack to $attack + 2)
(set: $nobleBearingActive to 0) <!-- Initialize for Scholar ability -->
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>#CHAPTER FIVE - THE ORPHANED WANDERER
Tears fill your eyes, distorting your vision. The alleyway seems to stretch and distort as memories you've tried desperately to forget begin to surface.
"I... I can't," you whisper, pressing your back against the cold brick wall.
"You must, $name" the man in the fedora says firmly. "Your sister is not real. She's a manifestation of your pain, created by the felled to keep you trapped."
Your legs give out and you slide down the wall, sitting on the damp alley floor. The shadows around you grow longer, more menacing. Felled spirits gather at the edges of your vision, but they don't attack. They're waiting.
"My village..." you begin, the words catching in your throat.
The man kneels beside you, his eyes intent. "Tell me about your village."
"It was small. Peaceful." Your voice sounds distant, as if someone else is speaking. "We grew crops, traded with neighboring settlements. Everyone knew each other."
As you speak, the alley around you begins to shimmer, like heat rising from sun-baked stone. The urban scenery melts away, replaced by wooden houses, fields of grain, and a clear blue sky. You can almost smell the freshly baked bread from the communal ovens.
"It's not real," the man reminds you gently. "This is your memory."
You nod, tears streaming freely now. "I was... I was out hunting. Just a day's journey from home." Your hands begin to tremble. "When I saw the smoke."
The idyllic scene before you darkens as an unnatural storm gathers. In the distance, thick black smoke rises from where your village should be.
"I ran," you continue, your voice breaking. "I ran until my lungs burned and my legs gave out. But I was too late."
The peaceful village transforms into a scene of devastation – homes reduced to charred ruins, the fields trampled and burning. And everywhere, the bodies of people you loved, people who raised you, friends you grew up with.
"The felled came without warning," you say, a coldness settling in your chest. "They left nothing alive."
A small, desperate sound escapes your throat as you see yourself – younger, covered in ash and blood not your own – wandering among the ruins, calling out names that would never answer again.
"For days, I searched for survivors," you whisper. "Until I found her."
There, amid the rubble of what was once your home, your younger self discovers a small figure – a little girl, miraculously alive, cowering beneath a fallen beam.
"My sister..." you say, reaching out toward the vision.
"No," the man says firmly, gripping your shoulder. "You had no sister. Your family, everyone you knew, died that day."
You shake your head violently. "But she was there! I found her! I protected her!"
"Look again," he insists. "Really look."
Forcing yourself to focus through the pain, you stare at the scene. The little girl wavers like a mirage in desert heat. Sometimes she's there, sometimes the space beneath the beam is empty. A fabrication. A desperate wish.
"After that day, I was alone," you admit, the truth cutting through you like a blade. "I wandered from town to town, surviving however I could. I was... completely alone."
The vision of your destroyed village fades, leaving only the alley. But where your sister stood moments before, a new figure materializes – a twisted, shadowy creature with glowing red eyes and a mouth full of needle-like teeth. It's wearing your sister's face like an ill-fitting mask.
"That's why you created her," the man says quietly. "Not to remember, but to forget. To never be alone again. The felled found that wound and exploited it, creating a prison of false comfort."
The creature hisses as its disguise falls away completely. Your sister's innocent face dissolves into something monstrous and ancient.
"You couldn't protect them then," it says in a voice like breaking glass. "You can't protect yourself now."
You rise to your feet, a new determination cutting through your grief. This thing has fed on your pain, kept you trapped in a lie for years. The truth may hurt, but it's set something free inside you.
"I don't need to protect a memory," you say, readying yourself for battle. "I need to honor it by living."
The Nightmare Weaver shrieks, lunging toward you.
[[Prepare for Battle!|Combat Checks]]
<!--SETTING BACKSTORY VARIABLES-->
(set: $backstory to "orphan")
(set: $speed to $speed + 2)
(set: $agility to $agility + 2)
(set: $attack to $attack + 1)
(set: $survivalInstinctActive to 0) <!-- Initialize for Orphan ability -->
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>#CHAPTER FIVE - THE SCHOLAR WHO SAW TOO MUCH
The alleyway darkens as you struggle to confront the memories you've kept locked away. Books, scrolls, and ancient texts flash through your mind, each page a stepping stone that led you toward a truth you weren't meant to find.
"Knowledge," you murmur, almost involuntarily. "It was always about knowledge."
The man nods encouragingly. "Keep going, $name. What knowledge?"
You close your eyes, and immediately the scent of aged parchment and ink fills your senses. The musty smell of your master's study materializes around you – walls lined with leather-bound tomes, scrolls stacked in careful piles, artifacts from distant realms displayed on polished shelves.
"I was an apprentice to Sage Valerian," you say, your voice barely above a whisper. "One of the great minds of our age. For years, I cataloged his research, organized his experiments, prepared his materials. I was... devoted to him."
The memory shifts, and you see yourself hunched over a desk, candlelight flickering across ancient texts as you worked long into the night while others slept.
"There was a locked chamber in his tower," you continue. "Forbidden to all apprentices. But I had earned his trust. He gave me access to sort newly acquired manuscripts."
Your past self approaches a heavy door inlaid with strange symbols, a key trembling in your hand.
"I found an unmarked text," you say, watching your younger self pull a weathered journal from a hidden compartment. "Notes your master never intended anyone to see."
The man in the fedora remains silent, letting you work through the memory.
"It detailed... experiments. Terrible things." Your voice catches. "He had been studying the felled spirits not to defeat them but to harness their power. He had found a way to communicate with them, to negotiate."
In your memory, pages flip faster and faster, revealing diagrams of abominable rituals... correspondence with dark forces.
"The famines in the eastern villages, the unexplained disappearances – none of it was random. It was him. My master. The man I revered was feeding the felled, strengthening them, allowing them passage into our world in exchange for secrets of power."
Your sister appears beside you in the alleyway, her small hand reaching for yours. "You don't have to remember this," she says sweetly. "We can go back to how things were. You were happy then, weren't you? Before you knew?"
You stare at her, tempted by the comfort she offers.
"Don't listen," the man warns. "Truth is painful, but ignorance is fatal."
Turning back to your memories, you see yourself confronting your master in his private chambers, the damning journal clutched in your shaking hands.
"I challenged him with what I'd found," you say, your voice hollow. "I thought... I truly believed he would have some explanation. That I had misunderstood."
Your master's face transforms from surprise to cold calculation in the memory. "You always were too clever," he says, his kind mentor's voice gone. "But some knowledge isn't meant for apprentices. The felled have shown me wonders beyond your comprehension."
"He tried to silence me," you whisper. "Called the guards, claimed I had attempted to steal forbidden artifacts. When I fled, he sent hunters after me. My own master – the man who had been like a father – tried to have me killed for discovering his betrayal."
Your sister tugs more insistently at your hand. "Stop remembering! It only hurts you!"
But the memory continues relentlessly. You see yourself running through rain-slicked streets in the dead of night, precious few pages of evidence tucked inside your robe, betrayed by the one person you had trusted most in the world.
"I took what proof I could carry to the Scarlet Knights," you say, standing straighter now as the truth flows through you. "Because I knew the truth needed to be known, no matter how painful."
The alleyway begins to shimmer and distort. Your sister's form wavers like a reflection in troubled water.
"You were never there," you tell her, newfound certainty in your voice. "You're the comfort I created – the innocence I lost when I learned what knowledge could cost. You're what I was before I saw too much."
Your sister's face twists in rage, her sweet features mutating into something alien and terrifying. Her body stretches and darkens, transforming into a towering figure with too many limbs and gleaming red eyes.
"Knowledge is pain," it hisses in a voice that echoes inside your skull. "I offered you blissful ignorance, and you rejected it. Now you will know only suffering!"
You stand your ground, facing the creature that has fed on your fears and your desperate wish to return to simpler times.
"Knowledge is power," you counter, ready to fight. "And I won't surrender it – not even to escape the pain of truth."
The Nightmare Weaver lunges toward you, its form a writhing mass of shadows and stolen memories.
[[Prepare for Battle!|Combat Checks]]
<!--SETTING BACKSTORY VARIABLES-->
(set: $backstory to "scholar")
(set: $essence to $essence + 3)
(set: $maxEssence to $maxEssence + 3)
(set: $attack to $attack + 1)
(set: $forbiddenKnowledgeActive to 0) <!-- Initialize for Scholar ability -->
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>#Chapter 6
{(set: $currentRealm to "Riverwilds")}
IN PROGRESS
[[Play Again |Chapter 1]]
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div><!--Reset first turn after the first turn is played-->
(if: $firstAttack)[
<!--Check for Allosaurus first-->
(if: $beast is "allosaurus")[
(set: $dinoRoll to (random: 1, 100))
(if: $dinoRoll <= 50)[
(alert: "Your Allosaurus roars! Intimidating the opponent!")
(set: $predatorAdvantageActive to true)
](else:)[
(set: $predatorAdvantageActive to false)
]
]
(set: $firstAttack to false)
]
(if: $firstDefense)[
(set: $firstDefense to false)
]
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!-- Battle resolution -->
{
(if: $whoseTurn is "player")[
<!-- PLAYER ATTACKS -->
<!-- Critical hit calculation -->
(set: $critroll to (random: 1, 100))
(set: $critchance to 5 + ($agility * 1.5)) <!-- Base 5% + 1.5% per Agility point -->
(if: $critBoostActive is true)[
(set: $critchance to $critchance + 50) <!-- Add 50% critical chance from Stall Light -->
]
(set: $iscrit to false)
(if: not $wolfActive)[
(if: $critroll <= $critchance)[
(set: $iscrit to true)
(set: $critbonus to $attack * 0.5) <!-- Critical hits add 50% damage -->
(alert: "You find the perfect opening and attempt a CRITICAL HIT!")
](else:)[
(set: $critbonus to 0)
]
]
(if: $attacktype is "basic")[
<!-- Check if player has stored Sonic Blast damage -->
(if: $sonicBlastCharge > 0)[
<!-- Check if courage bonus is active -->
(if: $courageActive is 1)[
(set: $damage to ($attack * 1.4) + $critbonus + $counterattack + $sonicBlastCharge)
(set: $combatMessage to (if: $iscrit)[
"Fueled by determination, you unleash your stored sonic energy with precision, landing a CRITICAL HIT for " + (str: $damage) + " damage including " + (str: $sonicBlastCharge) + " sonic energy!"
](else:)[
"Drawing on your inner strength, you unleash your stored sonic energy at $bossname with unexpected courage, dealing " + (str: $damage) + " damage including " + (str: $sonicBlastCharge) + " sonic energy!"
])
<!-- Reset courage active flag after use -->
(set: $courageActive to 0)
](else:)[
(set: $damage to $attack + $critbonus + $counterattack + $sonicBlastCharge)
(set: $combatMessage to (if: $iscrit)[
"You unleash your stored sonic energy with precision, landing a CRITICAL HIT for " + (str: $damage) + " damage including " + (str: $sonicBlastCharge) + " sonic energy!"
](else:)[
"You unleash your stored sonic energy at $bossname, dealing " + (str: $damage) + " damage including " + (str: $sonicBlastCharge) + " sonic energy!"
])
]
<!-- Reset sonic blast charge after using it -->
(set: $sonicBlastCharge to 0)
](else:)[
<!-- Check if guaranteed crit is active -->
(if: $guaranteedCrit is true)[
(set: $iscrit to true)
(set: $critbonus to $attack * 0.5)
(set: $guaranteedCrit to false) <!-- Reset after use -->
(set: $damage to $attack + $critbonus + $counterattack)
(set: $combatMessage to "With precise knowledge of $bossname's weakness, you execute a perfect CRITICAL STRIKE for " + (str: $damage) + " damage!")
](else:)[
<!-- Original critical hit calculation code -->
(if: $courageActive is 1)[
(set: $damage to ($attack * 1.4) + $critbonus + $counterattack)
(set: $combatMessage to (if: $iscrit)[
"Fueled by determination, you land a CRITICAL HIT for " + (str: $damage) + " damage!"
](else:)[
"Drawing on your inner strength, you strike with unexpected courage for " + (str: $damage) + " damage!"
])
<!-- Reset courage active flag after use -->
(set: $courageActive to 0)
](else:)[
(set: $damage to $attack + $critbonus + $counterattack)
(set: $combatMessage to (if: $iscrit)[
"You strike with precision, landing a CRITICAL HIT for " + (str: $damage) + " damage!"
](else:)[
"You strike at $bossname, dealing " + (str: $damage) + " damage!"
])
]
]
]
<!-- Apply damage to boss -->
(set: $bosshealth to $bosshealth - $damage)
<!-- Reset counterattack after using it -->
(set: $counterattack to 0)
<!-- Reset spectacles Human synergy after attack -->
(if: $spectaclesBonusActive is true)[
(set: $attack to $attack - 2)
(set: $spectaclesBonusActive to false)
]
]
(if: $attacktype is "focus")[
<!-- Focus always sets counterattack to exactly 5, not incrementing -->
(set: $counterattack to 5)
(set: $combatMessage to "You steady yourself, focusing for a stronger counterstrike later. You gain +5 to your next attack.")
(set: $damage to 0)
]
(if: $attacktype is "noblebearing")[
<!-- Noble Bearing always sets counterattack to exactly 10, not incrementing -->
(set: $counterattack to 10)
(set: $combatMessage to "With noble bearing, you steady yourself for a powerful counterstrike. You gain +10 to your next attack.")
(set: $damage to 0)
]
<!-- SABRE STRIKE ability logic -->
(if: $attacktype is "sabrestrike")[
<!-- Calculate base damage -->
(set: $damage to $attack + 3)
(set: $combatMessage to "You unleash a powerful attack with your sabre blades, dealing " + (str: $damage) + " damage!")
<!-- Add Voxan synergy if applicable -->
(if: $race is "v")[
(set: $sabreBlockActive to true)
(set: $combatMessage to $combatMessage + "<br><br>Your blade resonates with sonic energy, granting you +3 defense for your next defensive turn.")
]
<!-- Reset counterattack after using it -->
(set: $counterattack to 0)
]
<!--check for Arborian Entangle Roots ability-->
(if: $attacktype is "entangle")[
(set: $combatMessage to "You summon twisted vines from the ground, entangling $bossname! They won't be able to counterattack on their next turn.")
(set: $damage to 0)
]
<!-- TINKER TANTRUM ability logic -->
(if: $attacktype is "tinkertantrum")[
<!-- Calculate base damage as attack + defense -->
(set: $damage to $attack + ($defense /2))
<!-- Check if used after Focus for 25% bonus -->
(if: $lastAction is "focus")[
(set: $damage to (ceil: $damage * 1.25))
(set: $combatMessage to "You deploy an intricate gadget with precise timing! The enhanced device deals " + (str: $damage) + " damage to $bossname!")
](else:)[
(set: $combatMessage to "You quickly assemble and deploy a gadget that deals " + (str: $damage) + " damage to $bossname!")
]
<!-- Reset counterattack if it was built up -->
(set: $counterattack to 0)
]
<!-- Reluctant Hero UNEXPECTED COURAGE ability -->
(if: $attacktype is "courage")[
(set: $damage to ($attack * 1.4) + $counterattack)
(set: $combatMessage to "Drawing strength from your pain, you unleash a powerful counterstrike for " + (str: $damage) + " damage!")
<!-- Reset counterattack after using it -->
(set: $counterattack to 0)
]
<!-- Check for FORBIDDEN KNOWLEDGE ABILITY -->
(if: $attacktype is "forbiddenknowledge")[
(set: $combatMessage to "You tap into forbidden knowledge, analyzing $bossname's patterns and weaknesses. Your next 2 special abilities will cost no Essence!")
(set: $damage to 0)
]
<!-- SPECTACLES Reveal Weakness ability -->
(if: $attacktype is "revealweakness")[
(set: $damage to 0)
(set: $combatMessage to "You carefully analyze $bossname through your spectacles, revealing a critical weakness. Your next attack will be a guaranteed critical strike!")
<!-- If Human, add the synergy effect -->
(if: $race is "h")[
(set: $attack to $attack + 2)
(set: $spectaclesBonusActive to true)
(set: $combatMessage to $combatMessage + "<br><br>Your human intuition combines with the spectacles' precision, granting you +2 Attack until your next attack!")
]
]
<!-- Check if boss will dodge (Dream Shift ability) -->
(set: $bossDefenseRoll to (random: 1, 100))
(if: $damage > 0)[
(if: $bossDefenseRoll <= 25)[
<!-- Boss uses Dream Shift to try to dodge -->
(set: $bossDodgeRoll to (random: 1, 100))
(if: $bossDodgeRoll <= 75)[
(set: $combatMessage to $combatMessage + "<br><br>$bossname uses Dream Shift and successfully dodges your attack!")
(set: $damage to 0)
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>$bossname tries to use Dream Shift but fails to dodge!")
]
]
]
<!-- Apply damage to boss -->
(set: $bosshealth to $bosshealth - $damage)
<!-- Reset critical hit boost after using it -->
(if: $critBoostActive is true)[
(set: $critBoostActive to false)
]
<!-- Store this action for next turn references -->
(set: $lastAction to $attacktype)
(set: $lastDamageDealt to $damage)
<!-- Check if boss is defeated before switching turns -->
(if: $bosshealth <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>Your attack defeats $bossname!")
(goto: "Combat Victory")
](else:)[
<!-- Explicitly set turn to boss before returning to hub -->
(set: $whoseTurn to "boss")
<!-- Reset first-turn flag after player's first action -->
(if: $whoseTurn is "player" and $isFirstTurn is true)[
(set: $isFirstTurn to false)
]
(goto: "Combat Hub")
]
](else:)[
<!-- BOSS ATTACKS -->
<!-- Check if boss is entangled -->
(if: $entangleActive is true)[
(set: $combatMessage to "$bossname struggles against the vines but can't break free! They miss their turn.")
(set: $entangleActive to false) <!-- Reset after one turn -->
(set: $whoseTurn to "player") <!-- Important! Set turn back to player -->
<!-- Reset first-turn flag after boss's first action -->
(if: $whoseTurn is "boss" and $isFirstTurn is true)[
(set: $isFirstTurn to false)
]
(goto: "Combat Hub")
](else:)[
<!-- Check for Dreamy Haze effect -->
(if: $hazeActive is true)[
<!-- Roll to see if boss misses -->
(set: $hazeRoll to (random: 1, 100))
(if: $hazeRoll <= 50)[
<!-- Boss misses -->
(set: $combatMessage to "$bossname seems confused and disoriented by your dream manipulation! Their attack misses completely!")
(set: $bossDamage to 0)
(set: $hazeActive to false)
(set: $whoseTurn to "player")
<!-- Reset first-turn flag after boss's first action -->
(if: $whoseTurn is "boss" and $isFirstTurn is true)[
(set: $isFirstTurn to false)
]
(goto: "Combat Hub")
](else:)[
<!-- Boss doesn't miss, but player gets essence back -->
(set: $essence to (min: $essence + 2, $maxEssence))
(set: $hazeActive to false)
(set: $combatMessage to "$bossname struggles against your dream haze but manages to focus! You gain 2 Essence back.")
]
]
<!-- Determine boss attack -->
(set: $bossAttackRoll to (random: 1, 10))
(if: $bossAttackRoll <= 5)[
<!-- Standard attack -->
(set: $bossDamage to $bossattack)
(set: $combatMessage to "$bossname lashes out with raw power!")
](else-if: $bossAttackRoll <= 8)[
<!-- Manifest Fear -->
(set: $bossDamage to (ceil: $attack / 2) + $bossattack)
(set: $combatMessage to "$bossname uses Manifest Fear, creating a reflection of you that adds to their attack!")
](else:)[
<!-- Mind Fog -->
(set: $bossDamage to (ceil: $bossattack * 0.7))
(set: $abilityEssenceCost to 1) <!-- This will increase essence costs next turn -->
(set: $combatMessage to "$bossname uses Mind Fog, clouding your thoughts! Your special abilities will cost +1 Essence next turn.")
]
<!-- Apply Arborian Tinker's Gauntlets reduction if active -->
(if: $bossNextAttackReduction > 0)[
(set: $bossDamage to (ceil: $bossDamage * (1 - $bossNextAttackReduction)))
(set: $combatMessage to $combatMessage + "<br><br>Your Arborian patience has worn down $bossname, reducing their attack power by " + (str: ($bossNextAttackReduction * 100)) + "%!")
(set: $bossNextAttackReduction to 0)
]
<!-- Boss critical hit calculation -->
(set: $bossCritRoll to (random: 1, 100))
(if: $bossCritRoll <= 30)[
<!-- Calculate percentage-based bonus -->
(set: $bossCritBonus to (ceil: $bossDamage * 0.1))
<!-- Add a minimum flat damage bonus between 3-5 -->
(set: $flatBonus to (random: 3, 5))
<!-- Apply both bonuses to ensure a significant hit -->
(set: $bossDamage to $bossDamage + $bossCritBonus + $flatBonus)
(alert: "$bossname attempts a CRITICAL STRIKE!")
]
<!-- Process player defense -->
(if: $defensetype is "block")[
<!-- Clear out any problematic variables first -->
(set: $damageReduction to 0)
(set: $finalDamage to 0)
<!-- Handle Sabre Blades Voxan synergy for defense -->
(if: $sabreBlockActive is true and $race is "v")[
(set: $damageReduction to $defense + 3)
(set: $sabreBlockActive to false)
](else:)[
(set: $damageReduction to $defense)
]
<!-- Calculate final damage -->
(set: $finalDamage to (max: 0, $bossDamage - $damageReduction))
<!-- Update combat message based on damage reduction -->
(if: $finalDamage is 0)[
(if: $sabreBlockActive is true and $race is "v")[
(set: $combatMessage to $combatMessage + "<br><br>Your sabre's sonic resonance forms a perfect defense! You completely block the attack, taking no damage!")
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>You completely block the attack, taking no damage!")
]
](else:)[
(if: $sabreBlockActive is true and $race is "v")[
(set: $combatMessage to $combatMessage + "<br><br>Your sabre's sonic resonance strengthens your defense, reducing the damage by " + (str: $damageReduction) + "! You take " + (str: $finalDamage) + " damage.")
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>You block the attack, reducing the damage by " + (str: $damageReduction) + "! You take " + (str: $finalDamage) + " damage.")
]
]
<!-- Apply damage to player -->
(set: $health to $health - $finalDamage)
(set: $lastDamageTaken to $finalDamage)
<!-- Check for Reluctant Hero ability trigger -->
(if: $backstory is "hero" and $lastDamageTaken >= ($maxHealth * 0.35) and $courageActive is 0)[
(set: $combatMessage to $combatMessage + "<br><br>The devastating blow awakens your hidden courage! Your next attack can be empowered!")
]
]
(if: $defensetype is "dodge")[
(set: $dodgeChance to 10 + ($agility * 2))
(set: $dodgeRoll to (random: 1, 100))
(if: $dodgeRoll <= $dodgeChance)[
(set: $combatMessage to $combatMessage + "<br><br>You nimbly dodge the attack, avoiding all damage!")
(set: $lastDamageTaken to 0)
(set: $lastDodgeSuccessful to true) <!-- Track successful dodge -->
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>You try to dodge but fail! You take " + (str: $bossDamage) + " damage.")
(set: $health to $health - $bossDamage)
(set: $lastDamageTaken to $bossDamage)
(set: $lastDodgeSuccessful to false) <!-- Track failed dodge -->
<!-- Check for Reluctant Hero ability trigger -->
(if: $backstory is "hero" and $lastDamageTaken >= ($maxHealth * 0.35) and $courageActive is 0)[
(set: $combatMessage to $combatMessage + "<br><br>The devastating blow awakens your hidden courage! Your next attack can be empowered!")
]
]
]
<!-- SICK BEAST ability resolution -->
(if: $defensetype is "sickbeast")[
<!-- Set beast damage to player's attack value -->
(set: $beastDamage to $attack)
<!-- Update combat message about the beast's counter -->
(set: $combatMessage to $combatMessage + "<br><br>Your beast leaps forward, intercepting the attack! Your loyal companion deals " + (str: $beastDamage) + " damage to $bossname, protecting you completely.")
<!-- Mark this ability as used for this combat -->
(set: $sickBeastUsed to true)
<!-- Apply damage to boss -->
(set: $bosshealth to $bosshealth - $beastDamage)
<!-- Player takes no damage from this attack -->
(set: $lastDamageTaken to 0)
<!-- Check if the beast's counter defeated the boss -->
(if: $bosshealth <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>Your beast's fierce protection defeats $bossname!")
(goto: "Combat Victory")
]
]
<!-- PREEMPTIVE SHOT ability resolution -->
(if: $defensetype is "preemptiveshot")[
<!-- Calculate base preemptive damage as half of attack -->
(set: $preemptiveDamage to (ceil: $attack / 2))
<!--reset preemptive shot so it doesn't appear again-->
<!-- Check for Riverkin synergy -->
(if: $race is "r")[
(set: $preemptiveDamage to $preemptiveDamage + 3)
(set: $combatMessage to $combatMessage + "<br><br>Your beast steadies your aim as you fire a preemptive shot! With enhanced accuracy, you deal " + (str: $preemptiveDamage) + " damage to $bossname before they can complete their attack!")
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>You quickly draw your percussion pistol and fire a preemptive shot, dealing " + (str: $preemptiveDamage) + " damage to $bossname before they can complete their attack!")
]
<!-- Set this ability as used for this combat -->
(set: $preemptiveShotUsed to true)
<!-- Apply preemptive damage to boss -->
(set: $bosshealth to $bosshealth - $preemptiveDamage)
<!-- Check if the preemptive shot defeated the boss -->
(if: $bosshealth <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>Your preemptive shot defeats $bossname before they can attack!")
(goto: "Combat Victory")
]
<!-- Boss attack is still coming if not defeated -->
(set: $combatMessage to $combatMessage + "<br><br>Despite your shot, $bossname continues their attack!")
<!-- Normal defense logic would continue here - let's use a default block -->
(set: $damageReduction to $defense)
(set: $finalDamage to (max: 0, $bossDamage - $damageReduction))
(if: $finalDamage is 0)[
(set: $combatMessage to $combatMessage + "<br><br>You manage to block the remaining attack, taking no damage!")
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>You block part of the attack, reducing the damage by " + (str: $damageReduction) + "! You take " + (str: $finalDamage) + " damage.")
]
(set: $health to $health - $finalDamage)
(set: $lastDamageTaken to $finalDamage)
]
<!-- DISRUPT ATTACK ability resolution -->
(if: $defensetype is "disruptattack")[
<!-- Calculate reduction percentage based on race -->
(if: $race is "n")[
<!-- Nightguard synergy - 50% reduction -->
(set: $reductionPercentage to 0.5)
(set: $counterattack to $counterattack + $essence)
(set: $combatMessage to $combatMessage + "<br><br>You skillfully play the Resonance Lute, creating harmonies that severely disrupt $bossname's attack! The attack's power is reduced by 50%, and you channel your essence (+" + (str: $essence) + ") into your next counterattack.")
](else:)[
<!-- Standard effect - 30% reduction -->
(set: $reductionPercentage to 0.3)
(set: $combatMessage to $combatMessage + "<br><br>You play the Resonance Lute, creating harmonies that disrupt $bossname's attack! The attack's power is reduced by 30%.")
]
<!-- Apply the damage reduction -->
(set: $bossDamage to (ceil: $bossDamage * (1 - $reductionPercentage)))
<!-- Apply remaining damage to player -->
(if: $bossDamage > 0)[
<!-- Player still takes some damage -->
(set: $health to $health - $bossDamage)
(set: $lastDamageTaken to $bossDamage)
(set: $combatMessage to $combatMessage + " You take " + (str: $bossDamage) + " damage.")
<!-- Check for Reluctant Hero ability trigger -->
(if: $backstory is "hero" and $lastDamageTaken >= ($maxHealth * 0.35) and $courageActive is 0)[
(set: $combatMessage to $combatMessage + "<br><br>The blow, though weakened, still awakens your hidden courage! Your next attack can be empowered!")
]
](else:)[
<!-- Player takes no damage -->
(set: $lastDamageTaken to 0)
(set: $combatMessage to $combatMessage + " The attack is completely neutralized!")
]
]
<!-- STALL LIGHT ability directly integrated -->
(if: $defensetype is "stalllight")[
<!-- Player successfully dodges the attack -->
(set: $combatMessage to $combatMessage + "<br><br>You manipulate light around your body, becoming virtually invisible! $bossname's attack passes harmlessly through your light shell.")
<!-- Player takes no damage from this attack -->
(set: $lastDamageTaken to 0)
]
<!-- SONIC BLAST ability directly integrated -->
(if: $defensetype is "sonicblast")[
<!-- Store the damage player would receive from boss attack -->
(set: $absorbedDamage to $bossDamage)
<!-- Add to the sonic blast charge -->
(set: $sonicBlastCharge to $sonicBlastCharge + $absorbedDamage)
<!-- Calculate healing (5% of newly absorbed damage) -->
(set: $healAmount to (ceil: $absorbedDamage * 0.05))
<!-- Apply healing, not exceeding max health -->
(set: $health to (min: $maxHealth, $health + $healAmount))
<!-- Update combat message about the absorbed attack -->
(set: $combatMessage to $combatMessage + "<br><br>You absorb $bossname's attack energy, storing " + (str: $absorbedDamage) + " damage for your next Basic Attack! You recover " + (str: $healAmount) + " health from the energy conversion. Total stored damage: " + (str: $sonicBlastCharge))
<!-- Player takes no damage from this attack since it was absorbed -->
(set: $lastDamageTaken to 0)
]
<!-- DREAMY HAZE ability directly integrated -->
(if: $defensetype is "dreamyhaze")[
<!-- Set the haze effect active for next boss turn -->
(set: $hazeActive to true)
<!-- Update combat message -->
(set: $combatMessage to $combatMessage + "<br><br>You weave a confusing dream haze around $bossname, distorting their perception! They have a 50% chance to miss their next attack.")
<!-- Player takes no immediate damage from this attack -->
(set: $lastDamageTaken to 0)
]
<!-- GAUNTLET CONVERSION ability resolution -->
(if: $defensetype is "gauntletconversion")[
<!-- Convert Defense to Attack -->
(set: $defense to $defense - 2)
(set: $attack to $attack + 2)
<!-- Check for Arborian synergy -->
(if: $race is "a")[
(set: $arborianRoll to (random: 1, 100))
(if: $arborianRoll <= 25)[
(set: $bossNextAttackReduction to 0.5)
(set: $combatMessage to "You convert your gauntlets' defensive power into offensive strength! Your Defense decreases by 2 but your Attack increases by 2.<br><br>Your Arborian patience wears down $bossname, reducing their next attack by 50%!")
](else:)[
(set: $combatMessage to "You convert your gauntlets' defensive power into offensive strength! Your Defense decreases by 2 but your Attack increases by 2.")
]
](else:)[
(set: $combatMessage to "You convert your gauntlets' defensive power into offensive strength! Your Defense decreases by 2 but your Attack increases by 2.")
]
<!-- Handle normal defense logic -->
(set: $damageReduction to $defense)
(set: $finalDamage to (max: 0, $bossDamage - $damageReduction))
(if: $finalDamage is 0)[
(set: $combatMessage to $combatMessage + "<br><br>Despite the conversion, you still manage to block the attack completely!")
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>With reduced defenses, you block part of the attack, reducing the damage by " + (str: $damageReduction) + "! You take " + (str: $finalDamage) + " damage.")
]
(set: $health to $health - $finalDamage)
(set: $lastDamageTaken to $finalDamage)
]
<!-- Check if player is defeated before switching turns -->
(if: $health <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>The attack overwhelms you, and darkness claims your vision...")
(goto: "Combat Defeat")
](else:)[
<!-- Explicitly set turn to player before returning to hub -->
(set: $whoseTurn to "player")
<!-- Reset first-turn flag after boss's first action -->
(if: $whoseTurn is "boss" and $isFirstTurn is true)[
(set: $isFirstTurn to false)
]
(goto: "Combat Hub")
]
]
]
}
#CHAPTER ONE - THE MYSTERIOUS MAN
<div class="image-container banner">
<img src="https://cdn.leonardo.ai/users/93a054d4-91be-4b29-8fec-bbb99ed6dd4d/generations/718e5c30-8ec3-4723-b085-5f6141556839/Leonardo_Phoenix_10_A_steampunkinspired_city_called_Anchorton_2.jpg" alt="Chapter 1 header">
</div>
Chime-stone energy thrums through your bones as you wake, its resonance mingling with the morning chaos of Anchorton City. Barterers' calls pierce the air like arrows through silk, while the thunder of countless footsteps below tells you the busybodies have already claimed the streets.
Something feels off about the scene—like watching a painting where the colors don't quite match reality. The chime-stones' hum sounds distant, almost echoing, and the shadows of passing crowds seem to linger a moment too long. You've had this feeling before, but can never quite place why.
A glance to your left, away from the open window, reveals a tiny apartment inside with a man in a trench coat and a fedora sitting on a loveseat across from you.
It doesn't take long for you to recognize the starlight gem hanging from his neck. He's one of the scarlet knights. A recruiter, by the looks of it.
“Finally awake I see,” he says. He leans forward, his mysterious eyes hidden in the shadow under the brim of his hat. “It's true, we've been watching you, and you've showed promise. But if you want any part in this, we're gonna need to know a little more about you.”
''WHO ARE YOU?''
<h3>HUMAN - REALM OF NEW EDEN</h3>
<div class="image-container selections-banner">
<img src="https://i.imgur.com/gMyx7Ea.png" alt="Human selections banner">
</div>
<div class="image-container float-left">
<img src="https://i.imgur.com/MkCtGx8.jpeg" alt="Human portrait 1">
</div>
Humans were the first beings to stir in Melodor's divine tapestry, granted the unique gift of pholythysts (chime stones) by Eimai. These crystalline artifacts harness both Song and Light—the twin forces of creation. Though fallible by nature, humans possess remarkable ingenuity and resourcefulness. They stand at a crossroads, striving to transform chaos into harmony by uniting with other races against the felled spirits that threaten all realms.
<div class="image-container float-right">
<img src="https://i.imgur.com/OSjsuwo.jpeg" alt="Human portrait 2">
</div>
Humans are versatile innovators who excel at adapting to different situations. With their tinkering abilities, they create gadgets and tools that give them an edge in combat. Their balanced stat distribution (+2 Speed, +1 to all other stats except Essence) makes them suitable for nearly any playstyle. Their signature ability, "Tinker Tantrum," deploys gadgets that deal damage based on both attack and defense values—perfect for tactical players who want to maximize their options in any situation.
(link: "Choose Human")[(set: $race to "h") (goto: "Chapter 2")]
<h3>SCINTILLIAN - REALM OF GLISTFIELD</h3>
<div class="image-container selections-banner">
<img src="https://cdn.leonardo.ai/users/93a054d4-91be-4b29-8fec-bbb99ed6dd4d/generations/56c10b05-f98f-4c4e-9b36-6e0e019b9890/Leonardo_Phoenix_10_A_vast_fantasy_landscape_bathed_in_perpetu_1.jpg" alt="Scintillian selections banner">
</div>
<div class="image-container float-left">
<img src="https://i.imgur.com/gD15dxo.png" alt="Scintillian portrait 1">
</div>
Scintillians have forged an intimate bond with Light itself, manipulating lightwaves like master weavers with threads. Their skin gleams like polished moonstone and their eyes shine with molten gold, but most striking is their prismatic hair—appearing white when still but erupting into cascading waves of color with movement. This profound connection grants them insight into both physical and metaphysical truths, allowing them to perceive intentions hidden beneath surface appearances.
<div class="image-container float-right">
<img src="https://i.imgur.com/BLO08i5.png" alt="Scintillian portrait 2">
</div>
Scintillians are agile rogues who emphasize dodging and critical strikes. Their exceptional Agility and Speed bonuses (+4 Agility, +2 Speed) make them the fastest race, though they sacrifice some Defense (-1). Perfect for players who prefer hit-and-run tactics, Scintillians excel at avoiding damage entirely rather than absorbing it. Their special ability "Stall Light" allows them to completely dodge attacks while increasing critical hit chance on their next strike. When equipped with a Trench Coat, they become nearly untouchable while delivering devastating critical hits.
(link: "Choose Scintillian")[(set: $race to "s") (goto: "Chapter 2")]
<h3>RIVERKIN - REALM OF THE RIVERWILDS</h3>
<div class="image-container selections-banner">
<img src="https://cdn.leonardo.ai/users/93a054d4-91be-4b29-8fec-bbb99ed6dd4d/generations/a74cfd79-0aa2-4fcc-9725-9480f5f2b738/Leonardo_Phoenix_10_Paint_the_following_in_a_digital_art_style_0.jpg" alt="Riverkin selections banner">
</div>
<div class="image-container float-left">
<img src="https://i.imgur.com/NaZ8LEQ.png" alt="Riverkin portrait 1">
</div>
Despite their shorter stature, Riverkin possess an indomitable spirit that towers above their physical frame. These semi-aquatic dwarves have built an empire beneath the waves, with living dams that rival mountains shielding their underwater cities. What truly sets them apart is their extraordinary affinity for wild creatures—from leviathans to dragons, Riverkin forge profound bonds with beasts others would flee, creating partnerships based on mutual respect rather than dominance.
<div class="image-container float-right">
<img src="https://i.imgur.com/0Lr9LBg.png" alt="Riverkin portrait 2">
</div>
Riverkin are range-fighters who balance offense and defense, complemented by their beast companions. Their stats favor endurance (-2 Speed, +2 Defense, +3 Health), making them ideal for players who value survivability. Their signature ability "Sick Beast" allows their bonded companion to intercept enemy attacks, dealing damage instead of the player taking damage. This defensive countermeasure perfectly complements their cultural emphasis on beast mastery and partnership. Different beast companions provide various bonuses, allowing for customized playstyles.
(link: "Choose Riverkin")[(set: $race to "r") (goto: "Chapter 2")]
<h3>VOXAN - REALM OF ETHERSONG</h3>
<div class="image-container selections-banner">
<img src="https://cdn.leonardo.ai/users/93a054d4-91be-4b29-8fec-bbb99ed6dd4d/generations/191b49d9-21c3-42e6-9e75-c31fb4eabc5f/Leonardo_Phoenix_10_All_throughout_a_shimmering_mist_where_the_3.jpg" alt="Voxan selections banner">
</div>
<div class="image-container float-left">
<img src="https://i.imgur.com/mlDy4Zr.png" alt="Voxan portrait 1">
</div>
In Ethersong, where reality resonates with ancient harmonies, Voxans have attuned their existence to the fundamental force known as Song. Their veins pulse with electricity-like energy beneath their storm-colored skin, while their hair dissolves into living cloudstuff. Through their profound connection to Song—the eternal melody first sung by Eimai—Voxans command acoustic forces powerful enough to lift massive airships or shatter solid matter, viewing their abilities as a sacred trust to align with creation's patterns.
<div class="image-container float-right">
<img src="https://i.imgur.com/QmZto08.png" alt="Voxan portrait 2">
</div>
Voxans are tanks who overwhelm opponents with raw power and endurance. Their impressive stat bonuses (+4 Health, +2 Attack, +2 Defense) compensate for reduced Agility (-2), making them ideal for players who prefer straightforward combat. Their special ability "Sonic Blast" absorbs damage taken during combat and reflects it back in one devastating attack, with 5% of the damage adding to their health. This ability synergizes perfectly with their high health pool, turning enemy attacks into an advantage.
(link: "Choose Voxan")[(set: $race to "v") (goto: "Chapter 2")]
<h3>NIGHTGUARD - REALM OF SOMNIVALE</h3>
<div class="image-container selections-banner">
<img src="https://i.imgur.com/7v7bGF5.jpeg" alt="Nightguard selections banner">
</div>
<div class="image-container float-left">
<img src="https://i.imgur.com/wmgMMON.jpeg">
</div>
In the starlit expanse between waking and dreaming lies Somnivale, where the insectoid Nightguard maintain their eternal vigil over mankind's dreams. These moth-like sentinels with gossamer wings are custodians of imagination itself, traversing the boundless landscapes of human consciousness while defending these delicate mindscapes from the Felled. Within dreams, reality bends to imagination's will, allowing Nightguard to manifest any construct of human thought into tangible form within Somnivale's boundaries.
<div class="image-container float-right">
<img src="https://i.imgur.com/K7sd8B6.jpeg" alt="Nightguard portrait 2">
</div>
Nightguard are control-oriented combatants who manipulate the flow of battle. Their higher Agility and Essence reserves (+3 Agility, +3 Essence) come at the cost of raw attacking power (-1 Attack), making them ideal for players who prefer tactical combat over brute force. Their special ability "Dreamy Haze" confuses opponents, giving them a 50% chance to miss their next attack—and if they do miss, the Nightguard regains Essence. This creates a sustainable cycle of control effects that can dominate longer battles, especially when paired with the Resonance Lute for maximum disruption.
(link: "Choose Nightguard")[(set: $race to "n") (goto: "Chapter 2")]
<h3>ARBORIAN - REALM OF ARBORLAND</h3>
<div class="image-container selections-banner">
<img src="https://cdn.leonardo.ai/users/93a054d4-91be-4b29-8fec-bbb99ed6dd4d/generations/2db9eb4b-9cfd-4056-a7e1-0803e360a643/Leonardo_Phoenix_10_Painted_in_the_style_of_a_middle_grade_fan_0.jpg" alt="Arborian selections banner">
</div>
<div class="image-container float-left">
<img src="https://i.imgur.com/iQ3yAoq.jpeg" alt="Arborian portrait 1">
</div>
Distinguished by their charred-orange skin, luminous teal hair, and majestic antlers, Arborians tend to a sacred grove where fruit springs from human virtue. They combat the insidious Rot that feeds the malevolent felled spirits, employing their rootwielding abilities with the same methodical care used to nurture delicate saplings. Arborians value patience above all—waiting for the perfect moment to act with devastating precision, just as trees grow slowly but endure for centuries.
<div class="image-container float-right">
<img src="https://i.imgur.com/poppNzb.jpeg" alt="Arborian portrait 2">
</div>
Arborians are patient powerhouses who prioritize defense and calculated strikes. Their high Defense and Attack (+2 Defense, +2 Attack) come at the cost of Speed (-3), making them excellent for players who prefer to weather attacks before delivering devastating counterblows. Their special ability "Entangling Roots" prevents opponents from counterattacking after you've focused, exemplifying their strategic combat approach. When paired with items like Tinker's Gauntlets, they become nearly impenetrable defensive juggernauts.
(link: "Choose Arborian")[(set: $race to "a") (goto: "Chapter 2")]
{(set: $speed to 2)
(set: $health to 20)
(set: $essence to 20)
(set: $attack to 2)
(set: $agility to 2)
(set: $defense to 2)
(set: $maxHealth to 20)
(set: $maxEssence to 20)
(set: $counterattack to 0)
(set: $backstory to "")
(set: $purifiedItem to "")
(set: $beast to "")
(set: $bossHealth to 0)
(set: $currentRealm to "Somnivale")}(set: $name to (prompt: "Enter Your Character's Name","Default Name"))
(set: $currentRealm to "Somnivale")
#CHAPTER TWO - ROOKIE'S AMNESIA
Something feels strange about this. You can’t explain why, but your head is fuzzy, and nothing seems quite right. Why is a scarlet knight recruiter in your apartment? It’s not common for recruiters to show up in your apartment while you’re sleeping.
Your mind shifts to your sister taking a nap in the bedroom down the hall. Could she be in danger?
“Take it easy, $name,” the man in the fedora says, his concerned expression mirroring yours. “We’ve already met once before, remember? I just needed to see if you remembered who you were.”
“Why would I not know who I was?” you say.
“Rookie’s amnesia is more common than you think,” the man says.
A chill runs down your spine. “What do you mean?”
“Imagination has power here,” he says, studying your reaction. “And where there's power, there are those who would corrupt it. The felled spirits don't just attack in the physical world—they've been working on your mind for years, clouding your memories, offering you comfortable lies in place of painful truths. Your imagination isn't just locked away—it's in their grasp.”
The walls of your apartment shimmer like a mirage. You blink hard, trying to focus. “My sister—”
“Is part of their deception,” he cuts in gently. “Think carefully. When did she first appear in your life?”
You try to remember, but the memories slip away like water through your fingers. Each time you grasp at a specific moment with her, the details blur and shift.
Vague memories surface in your head. You seem to remember shaking this man’s hand at one point. His goatee looks especially familiar. Have you met him?
“What’re you doing in my apartment?” you say.
“This was your choice,” the man says.
You shake your head. “You had to have sneaked in here while I was sleeping. I didn’t know you were here until I was awake.”
“Hello”? Comes a voice. Your sister is standing in the hallway, protecting her dolly under her arm. “Who’s he? Is everything okay?”
“She shouldn’t be here,” the man says, a shadow of worry passing over him.
You rush from your chair and pick her up. She wraps her arms around your neck, and you can feel her fear rushing through you.
Screeches echo through the air. Everyone in the apartment freezes as icy terror sweeps over you. Going against your better judgment, you hurry to the window, your sister still tight within your grasp, and peer outside.
Five felled spirits are climbing the brick wall, their beady red eyes locking on yours, black dust floating off their charcoal skin, their veins glowing deep red like lava.
“Don’t panic,” the man says. “Just stay calm. Listen to me, we’re surrounded, but I can get us out of here.”
He extends a hand to you, but you recoil. There’s another way out in your bedroom. The laundry chute. You’ve taken it before with your sister during play time. But who’s to say the felled won’t follow you out? If this man really is a scarlet knight, he can kill the felled.
But if he’s not, your fate could be worse.
''DO YOU TRUST THE MAN?''
[[Yes | 3A]]
[[No | 3B]]
(if: $race is "h")[
(set: $speed to $speed + 2)
(set: $health to $health + 1)
(set: $maxHealth to $maxHealth + 1)
(set: $essence to $essence + 1)
(set: $maxEssence to $maxEssence + 1)
(set: $attack to $attack + 1)
(set: $agility to $agility + 1)
(set: $defense to $defense + 1)
]
(else-if: $race is "s")[
(set: $speed to $speed + 2)
(set: $agility to $agility + 4)
(set: $defense to $defense - 1)
]
(else-if: $race is "r")[
(set: $speed to $speed - 2)
(set: $defense to $defense + 2)
(set: $health to $health + 3)
(set: $maxHealth to $maxHealth + 3)
]
(else-if: $race is "v")[
(set: $health to $health + 4)
(set: $maxHealth to $maxHealth + 4)
(set: $attack to $attack + 2)
(set: $agility to $agility - 2)
(set: $defense to $defense + 2)
]
(else-if: $race is "n")[
(set: $agility to $agility + 3)
(set: $essence to $essence + 3)
(set: $attack to $attack - 1)
]
(else-if: $race is "a")[
(set: $defense to $defense + 2)
(set: $attack to $attack + 2)
(set: $speed to $speed - 3)
]<h2>Defeat!</h2>
<p>Your strength fails as $bossname overwhelms you. The trial has claimed you.</p>
<!-- Reset any status effects when trying again -->
<div style="margin-top: 10px;">
(if: $currentRealm is "Somnivale")[
(link: "Try Again")[
<!-- Reset combat variables -->
(set: $health to $maxHealth)
(set: $bosshealth to $bossmaxhealth)
(set: $counterattack to 0)
(set: $lastDamageTaken to 0)
(set: $lastDamageDealt to 0)
(set: $lastAction to "")
(set: $whoseTurn to "player")
(goto: " 4")
]
]
</div>
{
<!--RESET NECESSARY VARIABLES-->
(set: $sickBeastActive to "not")
(set: $preemptiveShotUsed to "not")
(set: $lastDodgeSuccessful to false)
(set: $forbiddenKnowledgeActive to false)
<!--Reset Agility for Forbidden Knowledge Ability-->
(if: $forbiddenKnowledgeActive)[
(set: $agility to $currentAgility)
(set: $forbiddenKnowledgeActive to false)
]
<!-- Reset combat abilities including Survival Instinct -->
(if: $survivalInstinctActive is 1)[
(set: $speed to $speed - 3)
(set: $attack to $attack - 3)
(set: $defense to $defense - 3)
(set: $agility to $agility - 3)
(set: $survivalInstinctActive to 0)
]
}
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>{<!-- BOSS STATS DISPLAY -->
<div class="boss">
<h3>$bossname</h3>
(print: "<label>Health: " + (str: $bosshealth) + "/" + (str: $bossmaxhealth) + "</label><progress id='health' value='" + (str: $bosshealth) + "' max='" + (str: $bossmaxhealth) + "'></progress>")
<div>Attack Power: $bossattack</div>
<div>Special Abilities:
$bossabilities</div>
</div>
{
<!--SPECIAL PLACEMENT FOR ORPHAN WANDERER SPECIAL-->
<!-- Orphaned Wanderer: Survival Instinct ability -->
(if: $backstory is "orphan" and $health <= (ceil: $maxHealth * 0.30) and $essence >= 1 and $survivalInstinctActive is 0)[
(set: $speed to $speed + 3)
(set: $attack to $attack + 3)
(set: $defense to $defense + 3)
(set: $agility to $agility + 3)
(set: $survivalInstinctActive to 1)
(set: $essence to $essence - 1)
(set: $combatMessage to "Your Survival Instinct kicks in! As your health drops dangerously low, you gain +3 to all stats for the remainder of this battle.")
]
}
{
<!-- COMBAT MESSAGES -->
<div class="combat-message">
(if: $combatMessage is not "")[
$combatMessage
](else:)[
(if: $whoseTurn is "player")[
Your turn to attack. Choose your action carefully.
](else:)[
$bossname prepares to attack. Choose how to defend yourself.
]
]
</div>
<!-- Check whose turn it is and display appropriate options -->
(if: $whoseTurn is "player")[
<h3>Your Attack - Choose an action:</h3>
<!-- Basic Attack option -->
<div class="combat-option">
(link: "Basic Attack")[
(set: $attacktype to "basic")
(goto: "Action Resolution")
]
Standard attack using your weapon. Deals $attack damage with a (print: 5 + ($agility * 1.5))% chance to critically strike.
</div>
<!-- Focus option -->
(if: $counterattack is 0)[
<div class="combat-option">
(link: "Focus")[
(set: $attacktype to "focus")
(goto: "Action Resolution")
]
Skip your attack to add +5 to your next counterattack.
</div>
](else:)[
<div class="combat-option" style="opacity: 0.5;">
Focus (You already have a +$counterattack bonus stored)
</div>
]
<!--SPECIAL ABILITIES OFFENSE-->
<h3>Special Abilities</h3>
<!-- SABRE BLADES ability -->
(if: $purifiedItem is "sabre" and (($essence >= 4) or ($forbiddenKnowledgeActive > 0)) and $firstAttack)[
<div class="special-combat-option">
(link: "Sabre Strike (4 Essence)")[
(set: $attacktype to "sabrestrike")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 4)
]
(goto: "Action Resolution")
]
Unleash a powerful strike with your sabre blades. When attacking first, add an additional +3 damage to your attack.
(if: $race is "v")[
<br>Voxan Synergy: Your blade resonates with sonic energy, allowing you to also block with +3 defense on your next defensive turn.
]
</div>
]
<!-- Noble Bearing ability for Fallen Noble -->
(if: $backstory is "noble" and (($essence >= 2) or ($forbiddenKnowledgeActive > 0)) and $counterattack is 0)[
<div class="special-combat-option">
(link: "Noble Bearing (2 Essence)")[
(set: $attacktype to "noblebearing")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 2)
]
(set: $counterattack to 10)
(goto: "Action Resolution")
]
Skip your attack to add +10 to your next counterattack instead of the standard +5 Focus bonus.
</div>
]
<!-- Arborian ENTANGLING ROOTS ability -->
(if: $race is "a" and (($essence >= 3) or ($forbiddenKnowledgeActive > 0)) and $lastAction is "focus" and $entangleActive is not true)[
<div class="special-combat-option">
(link: "Entangling Roots (3 Essence)")[
(set: $attacktype to "entangle")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 3)
]
(set: $entangleActive to true)
(goto: "Action Resolution")
]
After focusing, you tangle your opponent in vines, preventing them from counterattacking for one turn.
</div>
]
<!-- TINKER TANTRUM ability for Human -->
(if: $race is "h" and (($essence >= 3) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Tinker Tantrum (3 Essence)")[
(set: $attacktype to "tinkertantrum")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 3)
]
(goto: "Action Resolution")
]
Deploy a gadget that deals damage based on your Attack + half your Defense value combined. If used after Focus, damage increases by 25%.
</div>
]
<!-- Reluctant Hero special ability - Unexpected Courage -->
(if: $backstory is "hero" and (($essence >= 1) or ($forbiddenKnowledgeActive > 0)) and $courageActive is 0 and $lastDamageTaken >= ($maxHealth * 0.35))[
<div class="special-combat-option">
(link: "Unexpected Courage (1 Essence)")[
(set: $attacktype to "courage")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 1)
]
(set: $courageActive to 1)
(goto: "Action Resolution")
]
After taking significant damage, your next attack deals 40% more damage.
</div>
]
<!-- Scholar - Forbidden Knowledge ability -->
(if: $backstory is "scholar" and $essence >= 2 and $forbiddenKnowledgeActive is 0)[
<div class="special-combat-option">
(link: "Forbidden Knowledge (2 Essence)")[
(set: $attacktype to "forbiddenknowledge")
(set: $essence to $essence - 2)
(set: $forbiddenKnowledgeActive to 2)
(goto: "Action Resolution")
]
Analyze enemy patterns and gain advantage, making your next 2 special abilities cost no Essence.
</div>
]
<!-- SPECTACLES ability -->
(if: $purifiedItem is "spectacles" and (($essence >= 4) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Reveal Weakness (4 Essence)")[
(set: $attacktype to "revealweakness")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 4)
]
(set: $guaranteedCrit to true)
(goto: "Action Resolution")
]
Reveal enemy's weakness, guaranteeing a critical strike on your next attack.
(if: $race is "h")[
<br>Human Synergy: Your enhanced targeting precision also provides +2 to your Attack.
]
</div>
]
](else:)[
<!-- BOSS'S TURN -->
<h3>$bossname's Turn - Prepare to defend!</h3><br>
<div class="defense-options">
<!-- Block option -->
<div class="combat-option">
(link: "Block")[
(set: $defensetype to "block")
(goto: "Action Resolution")
]
Reduce damage by your Defense value ($defense).
</div>
<!-- Dodge option -->
<div class="combat-option">
(link: "Dodge")[
(set: $defensetype to "dodge")
(goto: "Action Resolution")
]
(print: "Chance to avoid damage completely based on Agility. Current dodge chance: " + (str: (10 + ($agility * 2))) + "%")
</div>
<!--SPECIAL ABILITIES DEFENSE-->
<h3>Special Abilities</h3>
<!-- Winged Deer TAKE FLIGHT ability -->
(if: $beast is "deer" and (($essence >= 3) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Take Flight (3 Essence)")[
(set: $defensetype to "takeflight")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 3)
]
(goto: "Action Resolution")
]
After successfully dodging an attack, activate your Winged Deer's ability to guarantee another successful dodge on this attack.
</div>
]
<!-- RESONANCE LUTE ability -->
(if: $purifiedItem is "lute" and (($essence >= 4) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Disrupt Attack (4 Essence)")[
(set: $defensetype to "disruptattack")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 4)
]
(goto: "Action Resolution")
]
Disrupt an enemy attack, reducing its power by 30%.
(if: $race is "n")[
<br>Nightguard Synergy: Swift manipulation reduces enemy's attack by 50%, and adds your total essence to your next counterattack.
]
</div>
]
<!-- PERCUSSION PISTOL ability -->
(if: $firstDefense and $purifiedItem is "pistol" and (($essence >= 5) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Preemptive Shot (5 Essence)")[
(set: $defensetype to "preemptiveshot")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 5)
]
(goto: "Action Resolution")
]
If boss attacks first, shoot them preemptively, dealing half your Attack value as damage. You still get your regular attack afterward.
(if: $race is "r")[
<br>Riverkin Synergy: Your beast boosts your accuracy, adding +3 bonus damage to your preemptive shot.
]
</div>
]
<!-- RIVERKIN SICK BEAST ability -->
(if: $firstDefense)[
(if: $race is "r" and (($essence >= 3) or ($forbiddenKnowledgeActive > 0)) and $whoseTurn is "boss")[
<div class="special-combat-option">
(link: "Sick Beast (3 Essence)")[
(set: $defensetype to "sickbeast")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 3)
]
(goto: "Action Resolution")
]
Your beast intercepts the attack, dealing your Attack value in damage to $bossname instead of you taking damage.
</div>
]
]
<!-- Scintillian STALL LIGHT ability -->
(if: $race is "s" and (($essence >= 2) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Stall Light (2 Essence)")[
(set: $defensetype to "stalllight")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 2)
]
(set: $critBoostActive to true)
(goto: "Action Resolution")
]
Completely dodge an attack by manipulating light. Your next attack gains +50% critical hit chance.
</div>
]
<!-- Voxan SONIC BLAST ability -->
(if: $race is "v" and (($essence >= 5) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Sonic Blast (5 Essence)")[
(set: $defensetype to "sonicblast")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 5)
]
(goto: "Action Resolution")
]
Absorb the incoming damage and add it to your next Basic Attack. 5% of stored damage heals you immediately. Currently stored: $sonicBlastCharge damage.
</div>
]
<!-- TINKER'S GAUNTLETS ability -->
(if: $purifiedItem is "gauntlets" and (($essence >= 3) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Gauntlet Conversion (3 Essence)")[
(set: $defensetype to "gauntletconversion")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 3)
]
(goto: "Action Resolution")
]
Convert 2 Defense into 2 Attack. Your Defense will decrease by 2 until the end of combat.
(if: $race is "a")[
<br>Arborian Synergy: Your patience has a 25% chance to wear down the opponent while blocking, reducing their next attack by 50%.
]
</div>
]
</div>
<!-- Nightguard DREAMY HAZE ability -->
(if: $race is "n" and (($essence >= 3) or ($forbiddenKnowledgeActive > 0)))[
<div class="special-combat-option">
(link: "Dreamy Haze (3 Essence)")[
(set: $defensetype to "dreamyhaze")
(if: $forbiddenKnowledgeActive > 0)[
(set: $forbiddenKnowledgeActive to $forbiddenKnowledgeActive - 1)
](else:)[
(set: $essence to $essence - 3)
]
(set: $hazeActive to true)
(goto: "Action Resolution")
]
Confuse the opponent, giving them a 50% chance to miss their next attack. If they don't miss, you gain 2 Essence back.
</div>
]
]
}
}
<!-- STAT BAR -->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">Agility: $agility</span>
<span class="stat-item">Defense: $defense</span>
<span class="stat-item">Attack: $attack</span>
<span class="stat-item">Speed: $speed</span>
</div><!-- This is a new passage for initializing combat variables -->
<!-- Initialize basic combat variables if not already set -->
<!-- In Combat Initialization passage, add this in the variable initialization section -->
(if: not $lastDodgeSuccessful)[
(set: $lastDodgeSuccessful to false)
]
(if: $takeFlightActive is 0)[
(set: $takeFlightActive to false)
]
(if: $allosaurusDoubleActive is 0)[
(set: $allosaurusDoubleActive to false)
]
(if: $disruptActive is false)[
(set: $disruptActive to false)
]
(if: $bossNextAttackReduction is false)[
(set: $bossNextAttackReduction to 0)
]
(if: $guaranteedCrit is false)[
(set: $guaranteedCrit to false)
]
(if: $spectaclesBonusActive is false)[
(set: $spectaclesBonusActive to false)
]
(if: $sabreBlockActive is false)[
(set: $sabreBlockActive to false)
]
(if: $counterattack is false)[
(set: $counterattack to 0)
]
(if: $lastDamageTaken is false)[
(set: $lastDamageTaken to 0)
]
(if: $lastDamageDealt is false)[
(set: $lastDamageDealt to 0)
]
(if: $lastAction is false)[
(set: $lastAction to "")
]
(if: $forbiddenKnowledgeActive is false)[
(set: $forbiddenKnowledgeActive to 0)
]
(if: $critBoostActive is false)[
(set: $critBoostActive to false)
]
(if: $hazeActive is false)[
(set: $hazeActive to false)
]
(if: $sickBeastActive is false)[
(set: $sickBeastActive to false)
]
(if: $disruptActive is false)[
(set: $disruptActive to false)
]
(if: $guaranteedCrit is false)[
(set: $guaranteedCrit to false)
]
(if: $entangleActive is false)[
(set: $entangleActive to false)
]
(if: $survivalActive is false)[
(set: $survivalActive to false)
]
(if: $nobleActive is false)[
(set: $nobleActive to false)
]
(if: $courageActive is false)[
(set: $courageActive to false)
]
(if: $weaknessRevealed is false)[
(set: $weaknessRevealed to false)
]
(if: $abilityEssenceCost is false)[
(set: $abilityEssenceCost to 0)
]
(if: $combatMessage is false)[
(set: $combatMessage to "")
]
(if: $critBoostActive is false)[
(set: $critBoostActive to false)
]
(if: $guaranteedHit is false)[
(set: $guaranteedHit to false)
]
(if: $sonicBlastCharge is false)[
(set: $sonicBlastCharge to 0)
]
<!-- Set up boss for current realm with UPDATED MORE CHALLENGING STATS -->
(if: $currentRealm is "Somnivale")[
(set: $bossname to "The Nightmare Weaver")
(set: $bossabilities to "- Manifest Fear: Creates a reflection that adds damage equal to your half your Attack in addition to their attack.<br>- Dream Shift: 75% chance to dodge an attack.<br>- Mind Fog: Increases your ability costs by 1 Essence.")
(set: $bossspeed to 10)
(set: $bosshealth to 10)
(set: $bossmaxhealth to 10)
(set: $bossattack to 7)
](else-if: $currentRealm is "Riverwilds")[
(set: $bossname to "The Alpha Beast")
(set: $bossabilities to "- Primal Fury: Increases Attack by 5 for two turns.<br>- Territorial Roar: Reduces your Attack by 4 for one turn.<br>- Wild Instinct: 50% chance to counterattack when attacked.")
(set: $bossspeed to 4)
(set: $bosshealth to 16)
(set: $bossmaxhealth to 16)
(set: $bossattack to 8)
](else-if: $currentRealm is "New Eden")[
(set: $bossname to "The Corrupted Tinker")
(set: $bossabilities to "- Echo-Glow Explosion: 6 damage ignoring defense (every 3rd turn).<br>- Mechanical Arms: +3 Attack but -2 Defense for one turn.<br>- Corrupted Barrier: +5 Defense but can't attack next turn.")
(set: $bossspeed to 7)
(set: $bosshealth to 18)
(set: $bossmaxhealth to 18)
(set: $bossattack to 8)
](else-if: $currentRealm is "Ethersong")[
(set: $bossname to "The Discordant Conductor")
(set: $bossabilities to "- Dissonant Wave: 8 damage ignoring blocking.<br>- Sound Barrier: Absorbs next attack completely.<br>- Frequency Shift: Reduces your Speed by 4 for two turns.")
(set: $bossspeed to 10)
(set: $bosshealth to 15)
(set: $bossmaxhealth to 15)
(set: $bossattack to 9)
](else-if: $currentRealm is "Glistfield")[
(set: $bossname to "The Shadow Bender")
(set: $bossabilities to "- Shadow Clone: Creates a duplicate with 5 Health that deals 5 damage.<br>- Light Theft: Steals 2 Essence from you.<br>- Blinding Flash: 50% chance you miss your next attack.")
(set: $bossspeed to 3)
(set: $bosshealth to 17)
(set: $bossmaxhealth to 17)
(set: $bossattack to 7)
](else-if: $currentRealm is "Arborland")[
(set: $bossname to "The Rotwood Guardian")
(set: $bossabilities to "- Rot Burst: 7 damage and reduces your Defense by 2.<br>- Entangle: You lose your next turn.<br>- Ancient Resilience: Heals 4 Health (usable twice).")
(set: $bossspeed to 2)
(set: $bosshealth to 15)
(set: $bossmaxhealth to 15)
(set: $bossattack to 9)
](else-if: $currentRealm is "Final")[
(set: $bossname to "Wulfric the Deceiver")
(set: $bossabilities to "- Realm Shift: Changes the realm affinity for 2 turns.<br>- Soul Drain: Steals 3 Health from you.<br>- False Promise: Creates illusion of vulnerability, then counterattacks.<br>- Betrayer's Strike: Deals damage equal to 50% of your missing Health.")
(set: $bossspeed to 13)
(set: $bosshealth to 20)
(set: $bossmaxhealth to 20)
(set: $bossattack to 10)
](else:)[
<!-- Default boss (Nightmare Weaver) if no realm is specified -->
(set: $bossname to "The Nightmare Weaver")
(set: $bossabilities to "- Manifest Fear: Creates a reflection that deals damage equal to half your Attack.<br>- Dream Shift: 75% chance to dodge an attack.<br>- Mind Fog: Increases your ability costs by 1 Essence.")
(set: $bossspeed to 10)
(set: $bosshealth to 15)
(set: $bossmaxhealth to 15)
(set: $bossattack to 5)
]
<!-- Determine initiative based on speed stats -->
(set: $bossinitiative to (random: 1, 10) + $bossspeed)
(set: $playerinitiative to (random: 1, 10) + $speed)
<!-- Set turn order based on initiative roll -->
(if: $playerinitiative >= $bossinitiative)[
(set: $whoseTurn to "player")
(set: $firstAttack to true)
(set: $combatMessage to "You're quicker than $bossname! You get to attack first.")
](else:)[
(set: $whoseTurn to "boss")
(set: $firstDefense to true)
(set: $sickbeastUsed to false)
(set: $preemptiveShotUsed to false)
(set: $combatMessage to "$bossname moves faster than you expected! Prepare to defend.")
]
<!-- Go to Combat Hub to start the combat -->
(goto: "Combat Hub")(set: $speed to 3)
(set: $health to 20)
(set: $essence to 20)
(set: $attack to 2)
(set: $agility to 2)
(set: $defense to 2)
(set: $maxHealth to 20)
(set: $maxEssence to 20)
(set: $counterattack to 0)
(set: $beast to "wolf")
(set: $race to "r")
(set: $backstory to "scholar")
(set: $purifiedItem to "lute")
(set: $currentRealm to "Somnivale")
(if: $race is "h")[
(set: $speed to $speed + 2)
(set: $health to $health + 1)
(set: $maxHealth to $maxHealth + 1)
(set: $essence to $essence + 1)
(set: $maxEssence to $maxEssence + 1)
(set: $attack to $attack + 1)
(set: $agility to $agility + 1)
(set: $defense to $defense + 1)
]
(else-if: $race is "s")[
(set: $speed to $speed + 2)
(set: $agility to $agility + 4)
(set: $defense to $defense - 1)
]
(else-if: $race is "r")[
(set: $speed to $speed - 2)
(set: $defense to $defense + 2)
(set: $health to $health + 3)
(set: $maxHealth to $maxHealth + 3)
]
(else-if: $race is "v")[
(set: $health to $health + 4)
(set: $maxHealth to $maxHealth + 4)
(set: $attack to $attack + 2)
(set: $agility to $agility - 2)
(set: $defense to $defense + 2)
]
(else-if: $race is "n")[
(set: $agility to $agility + 3)
(set: $essence to $essence + 3)
(set: $maxEssence to $maxEssence + 3)
(set: $attack to $attack - 1)
]
(else-if: $race is "a")[
(set: $defense to $defense + 2)
(set: $attack to $attack + 2)
(set: $speed to $speed - 3)
]
(if: $backstory is "scholar")[
(set: $essence to $essence + 3)
(set: $maxEssence to $maxEssence + 3)
(set: $attack to $attack + 1)
(set: $forbiddenKnowledgeActive to 0)
]
(else-if: $backstory is "orphan")[
(set: $speed to $speed + 2)
(set: $agility to $agility + 2)
(set: $attack to $attack + 1)
(set: $survivalInstinctActive to 0)
]
(else-if: $backstory is "hero")[
(set: $defense to $defense + 3)
(set: $maxHealth to $maxHealth + 3)
(set: $health to $health + 3)
(set: $courageActive to 0)
]
(else-if: $backstory is "noble")[
(set: $defense to $defense + 2)
(set: $essence to $essence + 1)
(set: $maxEssence to $maxEssence + 1)
(set: $attack to $attack + 2)
(set: $nobleBearingActive to 0)
]
(goto: "Combat Checks")<div style="margin-bottom: 0;">
<h2>Victory!</h2>
<p>$bossname falls! You have conquered the $currentRealm trial!</p>
</div>
Choose what to restore:
{
(if: $currentRealm is "Somnivale")[
(link: "Restore +5 Health")[
(set: $health to (min: $health + 5, $maxHealth))
(goto: "6") <!-- Replace with your next passage -->
]<br>
]
(if: $currentRealm is "Somnivale")[
(link: "Restore +3 Essence")[
(set: $essence to (min: $essence + 3, $maxEssence))
(goto: "6") <!-- Replace with your next passage -->
]<br>
]
}
</div>
{
<!--RESET NECESSARY VARIABLES-->
(set: $sickBeastActive to "not")
(set: $preemptiveShotUsed to "not")
(set: $lastDodgeSuccessful to false)
<!--Reset Agility for Forbidden Knowledge Ability-->
(if: $forbiddenKnowledgeActive)[
(set: $agility to $currentAgility)
(set: $forbiddenKnowledgeActive to false)
]
<!-- Reset combat abilities including Survival Instinct -->
(if: $survivalInstinctActive)[
(set: $speed to $speed - 3)
(set: $attack to $attack - 3)
(set: $defense to $defense - 3)
(set: $agility to $agility - 3)
(set: $survivalInstinctActive to false)
]
}
<!--STAT BAR-->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">(print:"Agility: $agility")</span>
<span class="stat-item">(print:"Defense: $defense") </span>
<span class="stat-item">(print:"Attack: $attack") </span>
<span class="stat-item">(print:"Speed: $speed") </span>
</div>{
<!-- BOSS STATS DISPLAY -->
<div class="boss">
<h3>$bossname</h3>
(print: "<label>Health: " + (str: $bosshealth) + "/" + (str: $bossmaxhealth) + "</label><progress id='health' value='" + (str: $bosshealth) + "' max='" + (str: $bossmaxhealth) + "'></progress>")
<div>Attack Power: $bossattack</div>
<div>Special Abilities:
$bossabilities</div>
</div>
}
{
<!-- COMBAT MESSAGES -->
<div class="combat-message">
(if: $combatMessage is not "")[
$combatMessage
](else:)[
(if: $whoseTurn is "player")[
Your turn to attack. Choose your action carefully.
](else:)[
$bossname prepares to attack. Choose how to defend yourself.
]
]
</div>
<!--TRACKING DAMAGE FOR SONIC BLAST ABILITY (these variables are initially set in Combat Checks-->
(set: $allDamage to $currentHealth - $health)
<!-- Check whose turn it is and display appropriate options -->
(if: $whoseTurn is "player")[
<h3>Your Attack - Choose an action:</h3>
<!-- Basic Attack option -->
<div class="combat-option">
(link: "Basic Attack")[
(goto: "Basic Attack Resolution")
]
Standard attack using your weapon. Deals $attack damage with a (print: 5 + ($agility * 1.5))% chance to critically strike.
</div>
<!-- Focus option -->
(if: $counterattack is 0)[
<div class="combat-option">
(link: "Focus")[
(goto: "Focus Resolution")
]
Skip your attack to add +3 to your next counterattack.
</div>
](else:)[
<div class="combat-option" style="opacity: 0.5;">
Focus (You already have a +$counterattack bonus stored)
</div>
]
<!--SPECIAL ABILITIES OFFENSE-->
<h3>Special Abilities</h3>
<!--FALLEN NOBLE ABILITY-->
(if: $backstory is "noble" and $essence >=2)[
(if: $counterattack is 0)[
<div class="special-combat-option">
(link: "Noble Focus (2 Essence)")[
(set: $essence to $essence - 2)
(goto: "Noble Focus Resolution")
]
Skip your attack and add +5 to your counterattack
</div>
](else:)[
<div class="special-combat-option">
Noble Focus (You already have a +$counterattack bonus stored)
</div>
]
]
<!--SCHOLAR ABILITY OFFENSE AND DEFENSE-->
(if: $backstory is "scholar" and $essence >=2 and not $forbiddenKnowledgeActive)[
<div class="special-combat-option">
(link: "Forbidden Knowledge (2 Essence)")[
(set: $essence to $essence - 2)
(set: $forbiddenKnowledgeActive to true)
(set: $whoseTurn to "player")
(set: $currentAgility to $agility) <!--this allows to reset player agility after combat in combat victor/defeat-->
(set: $agility to (ceil: $agility + ($essence / 2)))
(goto: "Combat Zone")
]
Analyze enemy patterns and gain advantage, adding half your current essence points (after use) to your agility for the rest of combat
</div>
]
<!--RELUCTANT HERO ABILITY-->
(if: $backstory is "hero" and $essence >=1 and ($lastDamageTaken >= $maxHealth * .1))[
<div class="special-combat-option">
(link: "Unexpected Courage (1 Essence)")[
(set: $essence to $essence - 1)
(goto: "Courage Attack Resolution")
]
The last damage you took triggers your inner hero! Click to attack for an additional 30%
</div>
]
<!--ORPHAN ABILITY OFFENSE AND DEFENSE-->
(if: $backstory is "orphan" and $essence >= 1 and ($health <= $maxHealth * .4) and not $survivalInstinctActive)[
<div class="special-combat-option">
(link: "Survival Instinct (1 Essence)")[
(set: $essence to $essence - 1)
(set: $health to $health + 3)
(set: $attack to $attack + 3)
(set: $agility to $agility + 3)
(set: $defense to $defense + 3)
(set: $survivalInstinctActive to true)
(set: $whoseTurn to "player")
(goto: "Combat Zone")
]
Your low health kicks in your survival instincts and you gain +3 to all stats for the rest of combat.
</div>
]
<!--SONIC BLAST ABILITY-->
(if: $race is "v" and $essence >= 5)[
<div class="special-combat-option">
(link: "Sonic Blast (5 Essence)")[
(set: $essence to $essence - 5)
(goto: "Sonic Blast Resolution")
]
Absorb all the damage dealt to you this combat sesssion and deal it back to $bossname. You are healed for 5% of whatever damage you do. Current damage taken: $allDamage
</div>
]
<!--TINKER TANTRUM ABILITY-->
(if: $race is "h" and $essence >= 4)[
<div class="special-combat-option">
(link: "Tinker Tantrum (4 Essence)")[
(set: $essence to $essence - 4)
(goto: "Tinker Tantrum Resolution")
]
Deploy a gadget that deals damage based on your attack value added to your defense value
</div>
]
](else:)[
<!-- BOSS'S TURN -->
<h3>$bossname's Turn - Prepare to defend!</h3><br>
<div class="defense-options">
<!-- Block option -->
<div class="combat-option">
(link: "Block")[
(goto: "Block Resolution")
]
Reduce damage by your Defense value ($defense).
</div>
<!-- Dodge option -->
<div class="combat-option">
(link: "Dodge")[
(goto: "Dodge Resolution")
]
(print: "Chance to avoid damage completely based on Agility. Current dodge chance: " + (str: (10 + ($agility * 2))) + "%")
</div>
<!--SEPECIAL ABILITIES DEFENSE-->
<h3>Special Abilities</h3>
<!--ORPHAN ABILITY OFFENSE AND DEFENSE-->
(if: $backstory is "orphan" and $essence >= 1 and ($health <= $maxHealth * .4) and not $survivalInstinctActive)[
<div class="special-combat-option">
(link: "Survival Instinct (1 Essence)")[
(set: $essence to $essence - 1)
(set: $health to $health + 3)
(set: $attack to $attack + 3)
(set: $agility to $agility + 3)
(set: $defense to $defense + 3)
(set: $survivalInstinctActive to true)
(set: $whoseTurn to "boss")
(goto: "Combat Zone")
]
Your low health kicks in your survival instincts and you gain +3 to all stats for the rest of combat.
</div>
]
<!--DREAMY HAZE ABILITY-->
(if: $race is "n" and $essence >=3)[
<div class="special-combat-option">
(link: "Dreamy Haze (3 Essence)")[
(set: $essence to $essence - 3)
(goto: "Dreamy Haze Resolution")
]
Confuse your opponent in dream, giving them a 50% chance to miss their next attack. If they don't miss, you gain 2 essence back.
</div>
]
<!--STALL LIGHT ABILITY-->
(if: $race is "s" and $essence >=2)[
(if: $health > 1)[
<div class="special-combat-option">
(link: "Stall Light (2 Essence)")[
(set: $essence to $essence - 2)
(set: $health to $health - 1)
(goto: "Stall Light Resolution")
]
Leap out of your light shell to guarantee dodging the attack, but the energy of your shell returning hurts you, reducing your health by 1 point.
</div>
](else:)[
<div class="special-combat-option">
Stall Light: Your health is too low!
<div>
]
]
<!--SICK BEAST ABILITY-->
(if: $race is "r" and $firstDefend and $essence >= 3)[
<div class="special-combat-option">
(link: "Sick Beast (3 Essence)")[
(set: $essence to $essence - 3)
(goto: "Sick Beast Resolution")
]
You're defending first! Sick your beast preemptively on your opponent, dealing damage to them instead of you taking damage.
</div>
]
<!--ENTANGLING ROOTS ABILITY-->
(if: $race is "a" and $lastAction is "focus")[
<div class="special-combat-option">
(link: "Entangling Roots (3 Essence)")[
(if: $essence >= 3)[
(set: $essence to $essence - 3)
(goto: "Entangling Roots Resolution")
](else:)[
(alert: "You don't have enough Essence to use this ability!")
]
]
After using focus, you can tangle your opponent in vines, preventing them from counterattacking for one turn.
</div>
]
(if: $backstory is "scholar" and $essence >=2 and not $forbiddenKnowledgeActive)[
<div class="special-combat-option">
(link: "Forbidden Knowledge (2 Essence)")[
(set: $essence to $essence - 2)
(set: $forbiddenKnowledgeActive to true)
(set: $whoseTurn to "player")
(set: $currentAgility to $agility) <!--this allows to reset player agility after combat in combat victor/defeat-->
(set: $agility to (ceil: $agility + ($essence / 2)))
(goto: "Combat Zone")
]
Analyze enemy patterns and gain advantage, adding half your current essence points (after use) to your agility for the rest of combat
</div>
]
]
</div>
}
<!-- STAT BAR -->
<div class="stat-display">
(print: "<label>Health: " + (str: $health) + "/" + (str: $maxHealth) + "</label><progress id='health' value='" + (str: $health) + "' max='" + (str: $maxHealth) + "'></progress>")
(print: "<label>Essence: " + (str: $essence) + "/" + (str: $maxEssence) + "</label><progress id='essence' value='" + (str: $essence) + "' max='" + (str: $maxEssence) + "'></progress>")
<span class="stat-item">Agility: $agility</span>
<span class="stat-item">Defense: $defense</span>
<span class="stat-item">Attack: $attack</span>
<span class="stat-item">Speed: $speed</span>
</div>{
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!-- Focus always sets counterattack to exactly 3, not incrementing -->
(set: $counterattack to 3)
(set: $combatMessage to "You steady yourself, focusing for a stronger counterstrike later. You gain +5 to your next attack.")
(set: $damage to 0)
<!-- Store this action for next turn references -->
(set: $lastAction to "focus")
(set: $lastDamageDealt to 0)
<!-- Explicitly set turn to boss before returning to hub -->
(set: $whoseTurn to "boss")
<!-- Reset first-turn flag after player's first action -->
(if: $firstAttack is true)[
(set: $firstAttack to false)
]
(goto: "Combat Zone"){
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!--Nightmare Weaver Dream Shift Check-->
(set: $dreamRoll to (random: 1,100))
(if: $dreamRoll <= 40)[
(set: $damage to 0)
(set: $combatMessage to "The Nightmare Weaver uses Dream Shift and dodges your attack!")
(set: $whoseTurn to "boss")
(goto: "Combat Zone")
](else:)[
<!-- Critical hit calculation -->
(set: $critroll to (random: 1, 100))
(set: $critchance to 5 + ($agility * 1.5)) <!-- Base 5% + 1.5% per Agility point -->
(set: $iscrit to false)
(if: $critroll <= $critchance)[
(set: $iscrit to true)
(set: $critbonus to (ceil: $attack * 0.5))<!-- Critical hits add 50% damage -->
(alert: "You find the perfect opening and attempt a CRITICAL HIT!")
](else:)[
(set: $critbonus to 0)
]
<!-- Calculate damage -->
(set: $damage to $attack + $critbonus + $counterattack)
<!-- Set combat message -->
(set: $combatMessage to (if: $iscrit)[
"You strike with precision, landing a CRITICAL HIT for " + (str: $damage) + " damage!"
](else:)[
"You strike at $bossname, dealing " + (str: $damage) + " damage!"
])
<!-- Apply damage to boss -->
(set: $bosshealth to $bosshealth - $damage)
<!-- Reset counterattack after using it -->
(set: $counterattack to 0)
<!-- Store this action for next turn references -->
(set: $lastAction to "basic")
(set: $lastDamageDealt to $damage)
<!-- Check if boss is defeated before switching turns -->
(if: $bosshealth <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>Your attack defeats $bossname!")
(goto: "Combat Victory")
](else:)[
<!-- Explicitly set turn to boss before returning to hub -->
(set: $whoseTurn to "boss")
<!-- Reset first-turn flag after player's first action -->
(if: $firstAttack is true)[
(set: $firstAttack to false)
]
(goto: "Combat Zone")
]
]
}{
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!-- Determine boss attack -->
(set: $bossAttackRoll to (random: 1, 10))
(if: $bossAttackRoll <= 5)[
<!-- Standard attack -->
(set: $bossDamage to $bossattack)
(set: $combatMessage to "$bossname lashes out with raw power!")
](else-if: $bossAttackRoll <= 8)[
<!-- Manifest Fear -->
(set: $bossDamage to (ceil: $attack / 2) + $bossattack)
(set: $combatMessage to "$bossname uses Manifest Fear, creating a reflection of you that adds to their attack!")
](else:)[
<!-- Mind Fog -->
(set: $bossDamage to (ceil: $bossattack * 0.7))
(set: $abilityEssenceCost to 1) <!-- This will increase essence costs next turn -->
(set: $combatMessage to "$bossname uses Mind Fog, clouding your thoughts! Your special abilities will cost +1 Essence next turn.")
]
<!-- Boss critical hit calculation -->
(set: $bossCritRoll to (random: 1, 100))
(if: $bossCritRoll <= 30)[
<!-- Calculate percentage-based bonus -->
(set: $bossCritBonus to (ceil: $bossDamage * 0.1))
<!-- Add a minimum flat damage bonus between 3-5 -->
(set: $flatBonus to (random: 3, 5))
<!-- Apply both bonuses to ensure a significant hit -->
(set: $bossDamage to $bossDamage + $bossCritBonus + $flatBonus)
(alert: "$bossname attempts a CRITICAL STRIKE!")
]
<!-- Calculate damage reduction from block -->
(set: $damageReduction to $defense)
(set: $finalDamage to (max: 0, $bossDamage - $damageReduction))
<!-- Update combat message based on damage reduction -->
(if: $finalDamage is 0)[
(set: $combatMessage to $combatMessage + "<br><br>You completely block the attack, taking no damage!")
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>You block the attack, reducing the damage by " + (str: $damageReduction) + "! You take " + (str: $finalDamage) + " damage.")
]
<!-- Apply damage to player -->
(set: $health to $health - $finalDamage)
(set: $lastDamageTaken to $finalDamage)
<!-- Store this action for next turn references -->
(set: $lastAction to "block")
<!-- Check if player is defeated before switching turns -->
(if: $health <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>The attack overwhelms you, and darkness claims your vision...")
(goto: "Combat Defeat")
](else:)[
<!-- Explicitly set turn to player before returning to hub -->
(set: $whoseTurn to "player")
(goto: "Combat Zone")
<!--reset firstDefend variable-->
(if: $firstDefend)[
(set: $firstDefend to false)
]
]
}{
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!-- Determine boss attack -->
(set: $bossAttackRoll to (random: 1, 10))
(if: $bossAttackRoll <= 5)[
<!-- Standard attack -->
(set: $bossDamage to $bossattack)
(set: $combatMessage to "$bossname lashes out with raw power!")
](else-if: $bossAttackRoll <= 8)[
<!-- Manifest Fear -->
(set: $bossDamage to (ceil: $attack / 2) + $bossattack)
(set: $combatMessage to "$bossname uses Manifest Fear, creating a reflection of you that adds to their attack!")
](else:)[
<!-- Mind Fog -->
(set: $bossDamage to (ceil: $bossattack * 0.7))
(set: $abilityEssenceCost to 1) <!-- This will increase essence costs next turn -->
(set: $combatMessage to "$bossname uses Mind Fog, clouding your thoughts! Your special abilities will cost +1 Essence next turn.")
]
<!-- Boss critical hit calculation -->
(set: $bossCritRoll to (random: 1, 100))
(if: $bossCritRoll <= 30)[
<!-- Calculate percentage-based bonus -->
(set: $bossCritBonus to (ceil: $bossDamage * 0.1))
<!-- Add a minimum flat damage bonus between 3-5 -->
(set: $flatBonus to (random: 3, 5))
<!-- Apply both bonuses to ensure a significant hit -->
(set: $bossDamage to $bossDamage + $bossCritBonus + $flatBonus)
(alert: "$bossname attempts a CRITICAL STRIKE!")
]
<!-- Calculate dodge chance -->
(set: $dodgeChance to 10 + ($agility * 2))
(set: $dodgeRoll to (random: 1, 100))
(if: $dodgeRoll <= $dodgeChance)[
(set: $combatMessage to $combatMessage + "<br><br>You nimbly dodge the attack, avoiding all damage!")
(set: $lastDamageTaken to 0)
(set: $lastDodgeSuccessful to true) <!-- Track successful dodge -->
](else:)[
(set: $combatMessage to $combatMessage + "<br><br>You try to dodge but fail! You take " + (str: $bossDamage) + " damage.")
(set: $health to $health - $bossDamage)
(set: $lastDamageTaken to $bossDamage)
(set: $lastDodgeSuccessful to false) <!-- Track failed dodge -->
]
<!-- Store this action for next turn references -->
(set: $lastAction to "dodge")
<!-- Check if player is defeated before switching turns -->
(if: $health <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>The attack overwhelms you, and darkness claims your vision...")
(goto: "Combat Defeat")
](else:)[
<!-- Explicitly set turn to player before returning to hub -->
(set: $whoseTurn to "player")
(goto: "Combat Zone")
<!--reset firstDefend variable-->
(if: $firstDefend)[
(set: $firstDefend to false)
]
]
}{
<!-- Initialize basic combat variables -->
(set: $lastDodgeSuccessful to false)
(set: $counterattack to 0)
(set: $lastDamageTaken to 0)
(set: $lastDamageDealt to 0)
(set: $lastAction to "")
(set: $combatMessage to "")
(set: $abilityEssenceCost to 0)
<!--Reset proper variables-->
(if: $entangleActive is false)[
(set: $entangleActive to false)
]
(set: $survivalInstinctActive to false)
(set: $forbiddenKnowledgeActive to false)
(set: $nobleActive to false)
<!--Tracking for Sonic Blast Ability-->
(set: $allDamage to 0)
(set: $currentHealth to $health)
<!--Setting orphan ability variable-->
(set: $orphanActive to false)
<!-- Set up boss for current realm -->
(if: $currentRealm is "Somnivale")[
(set: $bossname to "The Nightmare Weaver")
(set: $bossabilities to "<br>- Manifest Fear: Creates a reflection that adds damage equal to your half your Attack in addition to their attack.<br>- Dream Shift: 40% chance to dodge an attack.<br>- Mind Fog: Increases your ability costs by 1 Essence.")
(set: $bossspeed to 10)
(set: $bosshealth to 10)
(set: $bossmaxhealth to 10)
(set: $bossattack to 5)
](else-if: $currentRealm is "Riverwilds")[
(set: $bossname to "The Alpha Beast")
(set: $bossabilities to "- Primal Fury: Increases Attack by 5 for one turn.<br>- Territorial Roar: Reduces your Attack by 4 for one turn.<br>- Wild Instinct: 50% chance to counterattack when attacked.")
(set: $bossspeed to 4)
(set: $bosshealth to 16)
(set: $bossmaxhealth to 16)
(set: $bossattack to 8)
](else-if: $currentRealm is "New Eden")[
(set: $bossname to "The Corrupted Tinker")
(set: $bossabilities to "- Echo-Glow Explosion: 6 damage ignoring defense (every 3rd turn).<br>- Mechanical Arms: +3 Attack but -2 Defense for one turn.<br>- Corrupted Barrier: +5 Defense but can't attack next turn.")
(set: $bossspeed to 7)
(set: $bosshealth to 18)
(set: $bossmaxhealth to 18)
(set: $bossattack to 8)
](else-if: $currentRealm is "Ethersong")[
(set: $bossname to "The Discordant Conductor")
(set: $bossabilities to "- Dissonant Wave: 8 damage ignoring blocking.<br>- Sound Barrier: Absorbs next attack completely.<br>- Frequency Shift: Reduces your Speed by 4 for two turns.")
(set: $bossspeed to 10)
(set: $bosshealth to 15)
(set: $bossmaxhealth to 15)
(set: $bossattack to 9)
](else-if: $currentRealm is "Glistfield")[
(set: $bossname to "The Shadow Bender")
(set: $bossabilities to "- Shadow Clone: Creates a duplicate with 5 Health that deals 5 damage.<br>- Light Theft: Steals 2 Essence from you.<br>- Blinding Flash: 50% chance you miss your next attack.")
(set: $bossspeed to 3)
(set: $bosshealth to 17)
(set: $bossmaxhealth to 17)
(set: $bossattack to 7)
](else-if: $currentRealm is "Arborland")[
(set: $bossname to "The Rotwood Guardian")
(set: $bossabilities to "- Rot Burst: 7 damage and reduces your Defense by 2.<br>- Entangle: You lose your next turn.<br>- Ancient Resilience: Heals 4 Health (usable twice).")
(set: $bossspeed to 2)
(set: $bosshealth to 15)
(set: $bossmaxhealth to 15)
(set: $bossattack to 9)
](else-if: $currentRealm is "Final")[
(set: $bossname to "Wulfric the Deceiver")
(set: $bossabilities to "- Realm Shift: Changes the realm affinity for 2 turns.<br>- Soul Drain: Steals 3 Health from you.<br>- False Promise: Creates illusion of vulnerability, then counterattacks.<br>- Betrayer's Strike: Deals damage equal to 50% of your missing Health.")
(set: $bossspeed to 13)
(set: $bosshealth to 20)
(set: $bossmaxhealth to 20)
(set: $bossattack to 10)
](else:)[
<!-- Default boss (Nightmare Weaver) if no realm is specified -->
(set: $bossname to "The Nightmare Weaver")
(set: $bossabilities to "- Manifest Fear: Creates a reflection that deals damage equal to half your Attack.<br>- Dream Shift: 75% chance to dodge an attack.<br>- Mind Fog: Increases your ability costs by 1 Essence.")
(set: $bossspeed to 10)
(set: $bosshealth to 15)
(set: $bossmaxhealth to 15)
(set: $bossattack to 5)
]
<!-- Determine initiative based on speed stats -->
(set: $bossinitiative to (random: 1, 10) + $bossspeed)
(set: $playerinitiative to (random: 1, 10) + $speed)
<!-- Set turn order based on initiative roll -->
(if: $playerinitiative >= $bossinitiative)[
(set: $whoseTurn to "player")
(set: $firstAttack to true)
(set: $firstDefenend to false)
(set: $combatMessage to "You're quicker than $bossname! You get to attack first.")
](else:)[
(set: $whoseTurn to "boss")
(set: $firstDefend to true)
(set: $firstAttack to false)
(set: $combatMessage to "$bossname moves faster than you expected! Prepare to defend.")
]
<!-- Go to Combat Zone to start the combat -->
(goto: "Combat Zone")
}### **Sick Beast Resolution**
{
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!-- Calculate beast damage -->
(set: $beastRoll to (random: 3,8))
(set: $damage to $beastRoll)
<!-- Set combat message -->
(set: $combatMessage to "Your beast intercepts the attack, dealing $damage damage to $bossname instead of you taking damage!")
<!-- Apply damage to boss -->
(set: $bosshealth to $bosshealth - $damage)
<!-- Store this action for next turn references -->
(set: $lastAction to "sick beast")
(set: $lastDamageDealt to $damage)
(set: $firstDefend to false)
<!-- Check if boss is defeated before switching turns -->
(if: $bosshealth <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>Your attack defeats $bossname!")
(goto: "Combat Victory")
](else:)[
<!-- The player still gets their attack turn after using Sick Beast -->
(set: $whoseTurn to "player")
(goto: "Combat Zone")
]
}{
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!-- Apply the entangling roots effect -->
(set: $entangleActive to true)
<!-- Set combat message -->
(set: $combatMessage to "You command roots to burst from the ground, entangling $bossname! The vines completely immobilize your opponent, preventing them from taking their turn.")
<!-- Store this action for next turn references -->
(set: $lastAction to "entangle")
<!-- Skip boss turn and go directly back to player -->
(set: $whoseTurn to "player")
<!-- Reset firstDefend variable if needed -->
(if: $firstDefend)[
(set: $firstDefend to false)
]
<!-- Go back to combat zone with player's turn -->
(goto: "Combat Zone")
}<!--RESET COMBAT MESAGE-->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
(alert: "You successfully dodge the attack, but the zap of returning your light hurts you 1 health point")
(set: $whoseTurn to "player")
(goto: "Combat Zone"){
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!--Nightmare Weaver Dream Shift Check-->
(set: $dreamRoll to (random: 1,100))
(if: $dreamRoll <= 40)[
(set: $damage to 0)
(set: $combatMessage to "The Nightmare Weaver uses Dream Shift and dodges your attack!")
(set: $whoseTurn to "boss")
(goto: "Combat Zone")
](else:)[
<!-- Critical hit calculation -->
(set: $critroll to (random: 1, 100))
(set: $critchance to 5 + ($agility * 1.5)) <!-- Base 5% + 1.5% per Agility point -->
(set: $iscrit to false)
(if: $critroll <= $critchance)[
(set: $iscrit to true)
(set: $critbonus to (ceil: $attack * 0.5))<!-- Critical hits add 50% damage -->
(alert: "You find the perfect opening and attempt a CRITICAL HIT!")
](else:)[
(set: $critbonus to 0)
]
<!-- Calculate damage -->
(set: $damage to $allDamage + $critbonus + $counterattack)
<!-- Set combat message -->
(set: $combatMessage to (if: $iscrit)[
"You strike with precision, landing a CRITICAL HIT for " + (str: $damage) + " damage!"
](else:)[
"You strike at $bossname, dealing " + (str: $damage) + " damage!"
])
<!--Heal for sonic blast ability-->
(set: $sonicHeal to $damage * .05)
(set: $health to (ceil: $health + $sonicHeal))
<!-- Apply damage to boss -->
(set: $bosshealth to $bosshealth - $damage)
<!-- Reset counterattack after using it -->
(set: $counterattack to 0)
<!-- Store this action for next turn references -->
(set: $lastAction to "sonic")
(set: $lastDamageDealt to $damage)
<!-- Check if boss is defeated before switching turns -->
(if: $bosshealth <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>Your attack defeats $bossname!")
(goto: "Combat Victory")
](else:)[
<!-- Explicitly set turn to boss before returning to hub -->
(set: $whoseTurn to "boss")
<!-- Reset first-turn flag after player's first action -->
(if: $firstAttack is true)[
(set: $firstAttack to false)
]
(goto: "Combat Zone")
]
]
}<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!--Nightmare Weaver Dream Shift Check-->
(set: $dreamRoll to (random: 1,100))
(if: $dreamRoll <= 40)[
(set: $damage to 0)
(set: $combatMessage to "The Nightmare Weaver uses Dream Shift and dodges your attack!")
(set: $whoseTurn to "boss")
(goto: "Combat Zone")
](else:)[
<!-- Critical hit calculation -->
(set: $critroll to (random: 1, 100))
(set: $critchance to 5 + ($agility * 1.5)) <!-- Base 5% + 1.5% per Agility point -->
(set: $iscrit to false)
(if: $critroll <= $critchance)[
(set: $iscrit to true)
(set: $critbonus to (ceil: $attack * 0.5))<!-- Critical hits add 50% damage -->
(alert: "You find the perfect opening and attempt a CRITICAL HIT!")
](else:)[
(set: $critbonus to 0)
]
<--Tinker Tantrum Damage Calculated-->
(set: $baseDamage to $attack)
(set: $damage to $baseDamage + $defense + $critbonus + $counterattack)
<!-- Set combat message -->
(set: $combatMessage to (if: $iscrit)[
"You strike with precision, landing a CRITICAL HIT for " + (str: $damage) + " damage!"
](else:)[
"You strike at $bossname, dealing " + (str: $damage) + " damage!"
])
<!-- Apply damage to boss -->
(set: $bosshealth to $bosshealth - $damage)
<!-- Reset counterattack after using it -->
(set: $counterattack to 0)
<!-- Store this action for next turn references -->
(set: $lastAction to "sonic")
(set: $lastDamageDealt to $damage)
<!-- Check if boss is defeated before switching turns -->
(if: $bosshealth <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>Your attack defeats $bossname!")
(goto: "Combat Victory")
](else:)[
<!-- Explicitly set turn to boss before returning to hub -->
(set: $whoseTurn to "boss")
<!-- Reset first-turn flag after player's first action -->
(if: $firstAttack is true)[
(set: $firstAttack to false)
]
(goto: "Combat Zone")
]
]{
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!--Calculate for Dreamy Haze Effect-->
(set: $haze to (random: 1, 100))
(if: $haze <= 50)[
(set: $combatMessage to "$bossname is confused by your hazy dream. They miss their attack!")
(set: $whoseTurn to "player")
(goto: "Combat Zone")
](else:)[
(set: $essence to $essence + 2)
(alert: "Dreamy Haze fails, but you still attempt to block!")
(goto: "Block Resolution")
]
}{
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!--Add Additional Attack Power-->
(set: $courageAttack to (ceil: $attack + $attack *.3))
<!--Nightmare Weaver Dream Shift Check-->
(set: $dreamRoll to (random: 1,100))
(if: $dreamRoll <= 40)[
(set: $damage to 0)
(set: $combatMessage to "The Nightmare Weaver uses Dream Shift and dodges your attack!")
(set: $whoseTurn to "boss")
(goto: "Combat Zone")
](else:)[
<!-- Critical hit calculation -->
(set: $critroll to (random: 1, 100))
(set: $critchance to 5 + ($agility * 1.5)) <!-- Base 5% + 1.5% per Agility point -->
(set: $iscrit to false)
(if: $critroll <= $critchance)[
(set: $iscrit to true)
(set: $critbonus to (ceil: $attack * 0.5))<!-- Critical hits add 50% damage -->
(alert: "You find the perfect opening and attempt a CRITICAL HIT!")
](else:)[
(set: $critbonus to 0)
]
<!-- Calculate damage -->
(set: $damage to $attack + $critbonus + $counterattack + $courageAttack)
<!-- Set combat message -->
(set: $combatMessage to (if: $iscrit)[
"You strike with precision, landing a CRITICAL HIT for " + (str: $damage) + " damage!"
](else:)[
"You strike at $bossname, dealing " + (str: $damage) + " damage!"
])
<!-- Apply damage to boss -->
(set: $bosshealth to $bosshealth - $damage)
<!-- Reset counterattack after using it -->
(set: $counterattack to 0)
<!-- Store this action for next turn references -->
(set: $lastAction to "basic")
(set: $lastDamageDealt to $damage)
<!-- Check if boss is defeated before switching turns -->
(if: $bosshealth <= 0)[
(set: $combatMessage to $combatMessage + "<br><br>Your attack defeats $bossname!")
(goto: "Combat Victory")
](else:)[
<!-- Explicitly set turn to boss before returning to hub -->
(set: $whoseTurn to "boss")
<!-- Reset first-turn flag after player's first action -->
(if: $firstAttack is true)[
(set: $firstAttack to false)
]
(goto: "Combat Zone")
]
}{
<!-- Reset combat message if needed -->
(if: $combatMessage is not "")[
(set: $combatMessage to "")
]
<!-- Focus always sets counterattack to exactly 3, not incrementing -->
(set: $counterattack to 5)
(set: $combatMessage to "You steady yourself, focusing for a stronger counterstrike later. You gain +5 to your next attack.")
(set: $damage to 0)
<!-- Store this action for next turn references -->
(set: $lastAction to "focus")
(set: $lastDamageDealt to 0)
<!-- Explicitly set turn to boss before returning to hub -->
(set: $whoseTurn to "boss")
<!-- Reset first-turn flag after player's first action -->
(if: $firstAttack is true)[
(set: $firstAttack to false)
]
(goto: "Combat Zone")