<<set $name to "">>
<<set $contentReplaced to false>> <!-- Variable to track if content was replaced -->
<style>
/* Styling for the "Choose Your Weapon" button */
.choose-weapon-button {
background-color: #d0403f; /* Red */
color: white;
padding: 10px 20px;
margin: 10px 0;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.choose-weapon-button:hover {
background-color: #a83232; /* Darker Red */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">The Beginning</h1>
<<button "Skip to Full Text">>
<<if not $contentReplaced>> <!-- Check if content has already been replaced -->
<<set $contentReplaced to true>> <!-- Set the variable to true to prevent further replacements -->
<<replace "#content">>
<div id="content">
<span class="fade-in">You find yourself in a quiet, forgotten corner of the world...</span><br><br>
<div id="story-text">
<!-- Main narrative up until the weapon choice -->
<span class="fade-in">[[Doraida|Doraida 1]] — a human village nestled between ancient woods and the imposing peaks of the Gray Mountains. It’s a place untouched by the world’s troubles, where each day blends seamlessly into the next, like pages of an old story.</span><br><br>
<span class="fade-in">You are a young adventurer, restless and longing for something beyond the quiet life of Doraida.</span><br><br>
<span class="fade-in">One day, the [[village elder|village elder 1]] shared a tale with you — a prophecy, spoken by an oracle ages ago.</span><br><br>
<span class="fade-in">The prophecy told of a chosen one, a hero destined to reclaim a hidden [[Artifact|Artifact 1]] within the Dark Forest. This relic of immense power is said to be the kingdom's only hope against a looming darkness, a sinister force that threatens to consume the land of the kingdom and cast shadows over its future.</span><br><br>
<span class="fade-in">Some say the Artifact is both a blessing and a curse, capable of bringing prosperity or destruction, depending on the heart of the one who wields it.</span><br><br>
<span class="fade-in">Few know the details of the prophecy, but the elder has spent a lifetime studying its secrets and believes that its fulfillment is near.</span><br><br>
<span class="fade-in">That night, something strange occurs.</span><br><br>
<span class="fade-in">A mysterious glow pulses from deep within the the Dark Forest, casting eerie shadows on the village homes.</span><br><br>
<span class="fade-in">The wind carries a whisper, speaking of destiny, of change… of danger.</span><br><br>
<span class="fade-in">You feel a pull, a calling, leading you to the forest where the Artifact awaits — and with it, your fate.</span><br><br>
<span class="fade-in">Knowing that this day would come, the village elder had prepared for your departure. When the time comes for you to leave, he approaches you with a quiet resolve, offering a choice of weapon to aid you on your journey.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span>"I sensed that you would one day seek the Artifact," the elder says, "and have made ready what you may need to face the trials ahead."</span><br><br>
</div>
<!-- Name Input Section (appears only if $name is empty) -->
<<if $name == "" || $name is undefined>>
<span class="fade-in">Before we proceed, what shall we call you, young adventurer?</span><br>
<<textbox "$name" "Enter your name here">><br>
<<button "Confirm Name">>
<<replace "#confirmation">>
<span class="fade-in">Your journey begins here, <<print $name>>.<br><br></span>
<button class="choose-weapon-button" onclick="SugarCube.Engine.play('Choose Weapon');">Choose Your Weapon</button>
<</replace>>
<</button>>
<</if>>
<div id="confirmation">
<!-- This section will display the confirmed name and weapon choice button -->
<<if $name != "" && $name is not undefined>>
<span class="fade-in">Your journey begins here, <<print $name>>.<br><br></span>
<button class="choose-weapon-button" onclick="SugarCube.Engine.play('Choose Weapon');">Choose Your Weapon</button>
<</if>>
</div>
</div>
<</replace>>
<</if>>
<</button>>
<div id="content">
<span class="fade-in">You find yourself in a quiet, forgotten corner of the world...</span><br><br>
<<timed 2s>><span class="fade-in">[[Doraida|Doraida 1]] — a human village nestled between ancient woods and the imposing peaks of the Gray Mountains. It’s a place untouched by the world’s troubles, where each day blends seamlessly into the next, like pages of an old story.</span><br><br><</timed>>
<<timed 5s>><span class="fade-in">You are a young adventurer, restless and longing for something beyond the quiet life of Doraida.</span><br><br><</timed>>
<<timed 8s>><span class="fade-in">One day, the [[village elder|village elder 1]] shared a tale with you — a prophecy, spoken by an oracle ages ago.</span><br><br><</timed>>
<<timed 12s>><span class="fade-in">The prophecy told of a hidden [[Artifact|Artifact 1]] within the Dark Forest, a relic of immense power that could shape the kingdom’s fate. It is said to be the only hope against a looming darkness, a sinister force that has begun to plague the land and cast shadows over the kingdom’s future.</span><br><br><</timed>>
<<timed 16s>><span class="fade-in">Some say the Artifact is both a blessing and a curse, capable of bringing prosperity or destruction, depending on the heart of the one who wields it.</span><br><br><</timed>>
<<timed 19s>><span class="fade-in">That night, something strange occurs.</span><br><br><</timed>>
<<timed 22s>><span class="fade-in">A mysterious glow pulses from deep within the forest, casting eerie shadows on the village homes.</span><br><br><</timed>>
<<timed 26s>><span class="fade-in">The wind carries a whisper, speaking of destiny, of change… of danger.</span><br><br><</timed>>
<<timed 30s>><span class="fade-in">You feel a pull, a calling, leading you to the forest where the Artifact awaits — and with it, your fate.</span><br><br><</timed>>
<<timed 34s>><span class="fade-in">Knowing that this day would come, the village elder had prepared for your departure. When the time comes for you to leave, he approaches you with a quiet resolve, offering a choice of weapon to aid you on your journey.</span><br><br><</timed>>
<<timed 38s>><span class="fade-in"><span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span>"I sensed that you would one day seek the Artifact," the elder says, "and have made ready what you may need to face the trials ahead."</span><br><br><</timed>>
<!-- Name input prompt and confirmation just before weapon choice -->
<<if $name == "" || $name is undefined>>
<<timed 44s>><span class="fade-in">Before we proceed, what shall we call you, young adventurer?</span><br>
<<textbox "$name" "Enter your name here">><br>
<<button "Confirm Name">>
<<replace "#confirmation">>
<span class="fade-in">Your journey begins here, <<print $name>>.<br><br></span>
<button class="choose-weapon-button" onclick="SugarCube.Engine.play('Choose Weapon');">Choose Your Weapon</button>
<</replace>>
<</button>><</timed>>
<</if>>
<div id="confirmation">
<!-- This section will display the confirmed name and weapon choice button -->
<<if $name != "" && $name is not undefined>>
<span class="fade-in">Your journey begins here, <<print $name>>.<br><br></span>
<button class="choose-weapon-button" onclick="SugarCube.Engine.play('Choose Weapon');">Choose Your Weapon</button>
<</if>>
</div>
</div>
</div><div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Doraida I</h1>
Doraida is a secluded village, shielded from the larger world by towering mountains and dense forests. Founded by travelers seeking refuge, it has grown into a quiet sanctuary where life flows at a gentle pace. The people are resilient and self-sufficient, rarely venturing beyond the village's borders. Yet, rumors persist of ancient forces that slumber beneath the land, waiting for a time to awaken.
<img src="https://i.ibb.co/LgDcbx7/DALL-E-2024-11-12-02-32-47-A-scenic-village-named-Doraida-nestled-between-ancient-woods-and-the-impo.webp" width="400" height="auto"/>
<<back>>
</div><div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Village Elder I</h1>
The village elder is a wise figure, having lived through many seasons and witnessed the passage of time in [[Doraida|Doraida 1]]. He carries the collective knowledge of the village and is one of the few who know the truth about the prophecy. Some say the elder has spoken with spirits and seen visions of the future, while others whisper that he was once a great adventurer before choosing a life of peace.
<img src="https://i.ibb.co/dKNM8XH/DALL-E-2024-11-12-02-50-23-A-realistic-illustration-of-a-wise-elder-character-standing-in-the-foregr.webp" width="400" height="auto"/>
<<back>>
</div><div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Artifact I</h1>
Artifacts are ancient and powerful relics, imbued with forces capable of influencing the fate of entire civilizations. They are not bound by the borders of a single kingdom, nor the constraints of time. Across history, these relics have ignited wars, established empires, and brought about the downfall of mighty rulers. Their influence is as far-reaching as it is unpredictable, making them treasures of immeasurable value—and danger.
Legends speak of Artifacts as catalysts of change. They are said to hold the essence of natural forces or ancient magic, capable of restoring balance to the world or plunging it into chaos. In their presence, even the most steadfast are tested, for their allure is matched only by the weight of their consequences. Some Artifacts are thought to shape the land itself, while others bend the will of those around them, forging destinies that ripple through generations. Revered and feared in equal measure, Artifacts are protected by Guardians, who ensure their power remains safely out of reach of those with impure intentions.
<img src="https://i.postimg.cc/0NFFBKdF/temp-Imagev9m-Yhi.avif" width="400" height="auto"/>
<<back>>
</div><style>
/* Common button styles */
.weapon-button {
color: black;
padding: 10px 20px;
margin: 10px 0;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
/* Specific weapon button colors */
.sword-button {
background-color: #C0C0C0; /* Original Silver */
}
.bow-button {
background-color: #8B4513; /* Original Brown */
color: white; /* For better contrast */
}
.staff-button {
background-color: #FFD700; /* Original Gold */
}
/* Hover effects with slightly darker colors */
.sword-button:hover {
background-color: #A9A9A9; /* Darker Silver */
}
.bow-button:hover {
background-color: #69340E; /* Darker Brown */
}
.staff-button:hover {
background-color: #E6BE00; /* Darker Gold */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Choose Your Weapon</h1>
The village elder stands before you, hands folded thoughtfully as they present three weapons, each laid out with care upon a simple cloth.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "The path ahead is dangerous," the elder says, his gaze serious. "You’ll face trials that test not only your strength but your courage and wisdom. Choose carefully, for each weapon carries its own strengths, and it will shape the way you face the challenges ahead."
The elder gestures to the first weapon—a sword, its polished blade glinting faintly in the light.
<button class="weapon-button sword-button" onclick="SugarCube.State.variables.weapon = 'sword'; SugarCube.Engine.play('Choose Sword');">Choose the Sword</button>
The elder’s hand shifts to the second weapon—a bow, finely crafted with smooth, flexible wood and a quiver of arrows by its side.
<button class="weapon-button bow-button" onclick="SugarCube.State.variables.weapon = 'bow'; SugarCube.Engine.play('Choose Bow');">Choose the Bow</button>
Finally, the elder indicates the third weapon—a staff, its surface intricately carved with ancient runes that hum faintly with energy.
<button class="weapon-button staff-button" onclick="SugarCube.State.variables.weapon = 'staff'; SugarCube.Engine.play('Choose Staff');">Choose the Staff</button>
The elder steps back, giving you space to consider. Each weapon holds potential, but each will guide you down a different path, shaping your encounters and challenges to come. The choice is yours, and with it, the first step in your journey.
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">You Have Chosen the Sword</h1>
<<set $weapon to "sword">>
<img src="https://i.ibb.co/sCmP3Yv/Sword00-icon.png" width="400" height="auto"/>
The sword is a weapon of direct confrontation and strength, suited for those unafraid to face danger head-on. Its balanced weight and sharpened edge make it a powerful choice for close combat, capable of cutting through obstacles and opponents alike.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "The sword represents courage," the elder explains. "It will serve you well when you must stand your ground and strike with purpose. But remember, it demands a steady hand and a fearless heart."
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Forest');">Proceed to the Dark Forest</button>
<button class="option-button" onclick="SugarCube.Engine.play('Choose Weapon');">Change your mind and choose a different weapon</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">You Have Chosen the Bow</h1>
<<set $weapon to "bow">>
<img src="https://i.ibb.co/gTvyyZt/Bow00-icon.png" width="400" height="auto"/>
The bow is a weapon of precision and patience, suited for those who favor strategy and distance over close encounters. Its range allows you to observe from afar and strike only when the moment is right.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "The bow is the choice of the keen-eyed and the cautious,"
the elder says. "With it, you’ll find the advantage of distance, able to assess a threat before it reaches you. But beware, for the bow requires focus and foresight, and it is not forgiving of haste."
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Forest');">Proceed to the Dark Forest</button>
<button class="option-button" onclick="SugarCube.Engine.play('Choose Weapon');">Change your mind and choose a different weapon</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">You Have Chosen the Staff</h1>
<<set $weapon to "staff">>
<img src="https://i.ibb.co/KVC0Y0Y/Staff00-icon.png" width="400" height="auto"/>
The staff is a weapon of wisdom and adaptability, suited for those who can wield magic to overcome obstacles. It channels both defense and attack, bending the elements to your will.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "The staff embodies knowledge and resilience,"
the elder says, their voice almost reverent. "It is for those who seek to understand the world around them and turn that knowledge into strength. But wielding magic is no simple task; it requires patience, control, and a respect for the forces at work."
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Forest');">Proceed to the Dark Forest</button>
<button class="option-button" onclick="SugarCube.Engine.play('Choose Weapon');">Change your mind and choose a different weapon</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">The Dark Forest</h1>
The air grows thick and damp as you grip your <<if $weapon is "sword">>sword<</if>> <<if $weapon is "bow">>bow<</if>> <<if $weapon is "staff">>staff<</if>> and step cautiously into the Dark Forest. An eerie glow pulses faintly through the trees, and shadows twist and shift with every step. This place feels alive, watching, as if the forest itself resists your presence.
In the days leading up to this moment, you prepared in the safer reaches of the woods beyond the Dark Forest. Those familiar trails and clearings became your proving ground. <<if $weapon is "sword">> Each swing of your blade against wooden targets strengthened your understanding of the sword.<</if>> <<if $weapon is "bow">> Each arrow loosed at distant marks taught you precision and patience.<</if>> <<if $weapon is "staff">> Each spell cast, the staff humming in your hands, deepened your understanding of mana’s flow.<</if>>
The challenges you faced there shaped you—steep terrain, elusive creatures, and natural traps that tested your resolve. When the first growls of unseen beasts echoed in the distance, you steadied your breathing and learned to face the unknown. Each trial pushed you to grow stronger, faster, and more focused. Now, as you press further into the Dark Forest, each rustling branch and shifting shadow feels both familiar and foreboding—a reminder of how far you’ve come and how much further you have to go.
Branches claw at your clothes, and roots seem to lift from the earth, threatening to trip you as you move deeper into the woods. Strange, rustling noises echo in the darkness, and you feel eyes watching you, though you can see no one. A low, rumbling growl sounds from somewhere to your left, but when you turn, you find only shadows and silence.
<img src="https://i.ibb.co/Jst2RJw/DALL-E-2024-12-03-20-18-16-A-realistic-yet-slightly-cartoon-like-illustration-of-a-dark-and-dense-fo.jpg" width="400" height="auto"/>
As you approach the clearing where the Artifact rests, an unnatural mist rises, curling around your ankles and tightening its hold as if warning you to turn back. The mist thickens with every step, shrouding the path ahead until the glow of the Artifact barely pierces through. You feel a chill seep into your bones, an ancient power emanating from the relic that seems both alluring and foreboding.
<img src="https://i.ibb.co/4s51ndq/DALL-E-2024-12-03-20-03-19-A-fantastical-forest-clearing-enveloped-in-thick-curling-mist-with-a-glow.jpg" width="400" height="auto"/>
Finally, you step into the clearing, and there it is: the Luminous [[Artifact|Artifact 1]], resting atop a stone pedestal, pulsing with a mesmerizing, ethereal light. The inscriptions covering its surface shift and shimmer, their meanings just out of reach. The air here is different, alive with a quiet hum that sends vibrations through your body, as if the Artifact is calling to you.
Suddenly, a figure emerges from the mist—an apparition of an ancient Guardian, draped in ghostly armor. It raises a spectral weapon, blocking your path, and speaks in a language you cannot understand, its voice echoing in your mind like thunder. You realize this Guardian will not let you approach the Luminous Artifact without a test of your courage and strength.
If you choose to face the Guardian, you know that this battle is more than physical—it will test the depths of your resolve and the purity of your intentions.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Fight Guardian');">Face the Guardian and attempt to take the Luminous Artifact</button>
<button class="option-button" onclick="SugarCube.Engine.play('Leave Artifact');">Leave the Luminous Artifact alone and retreat</button>
</div><<set $encounteredGuardian to false>>
<<set $encounteredSorcerer to false>>
<style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2.2em; font-weight: bold; text-align: center; margin-bottom: 25px;">Face the [[Guardian|Guardian]]</h1>
<img src="https://i.ibb.co/Vjbt5dP/DALL-E-2024-12-03-20-10-06-A-mystical-forest-clearing-enveloped-in-thick-curling-mist-with-an-ethere.jpg" width="400" height="auto"/>
The Guardian’s ghostly form stands resolute before you, its spectral weapon raised as it sizes you up. You take a steadying breath, gripping your <<if $weapon is "sword">>sword<</if>><<if $weapon is "bow">>bow<</if>><<if $weapon is "staff">>staff<</if>>, preparing for the trial that lies ahead. You know this confrontation is more than a battle of skill—it’s a test of your courage and the worthiness of your heart.
<<if $weapon is "sword">> With your sword in hand, you feel an immediate surge of confidence. The blade feels perfectly balanced, responding intuitively to your movements. <</if>> <<if $weapon is "bow">> Holding your bow steady, you position yourself with calculated precision. The tension in the string feels familiar, and you mentally prepare for a battle that requires both agility and accuracy.<</if>> <<if $weapon is "staff">> Your staff hums with latent energy, its surface warm under your grip. You focus your thoughts, channeling mana into the staff, preparing for a confrontation that will test your magical prowess and mental fortitude. <</if>>
The Guardian moves first, lunging with an otherworldly speed that forces you to react instinctively.
<<if $weapon is "sword">> You parry its strike effortlessly, the sword's sharp edge glinting as it deflects the Guardian’s spectral blade. Each clash sends vibrations through your arms, but your training with the sword allows you to maintain control and counterattack with swift, decisive blows. <</if>> <<if $weapon is "bow">> You swiftly dodge the Guardian’s initial strike, drawing an arrow from your quiver. With practiced precision, you release the arrow, aiming for a weak spot. The arrow finds its mark, but the Guardian's agility makes it difficult to land consistent hits, prolonging the battle.<</if>> <<if $weapon is "staff">> As the Guardian lunges, you raise your staff, conjuring a barrier of magical energy that absorbs the impact. You retaliate with a burst of mana, sending a wave of force towards the Guardian. The duel becomes a dance of spells and strikes, each requiring intense concentration and quick reflexes.<</if>>
As the battle intensifies, you begin to feel the weight of the Guardian’s silent scrutiny, as if it’s probing deeper into your soul with each exchange. It’s as though the Guardian is not merely fighting you, but measuring your intent, searching for any shadow of doubt or selfishness. Every strike you land and every dodge you make seem to unlock fragments of understanding—the Guardian’s purpose, its duty to protect, and the burden it carries for those who seek the Artifact’s power.
<<if $weapon is "sword">> Your mastery with the sword allows you to anticipate the Guardian’s moves. Each powerful swing weakens its resolve, your strikes fueled by unwavering determination. The Guardian begins to falter under your relentless assault, its form flickering more frequently. <</if>> <<if $weapon is "bow">> Your strategic shots with the bow gradually erode the Guardian’s defenses. However, maintaining precision while evading its swift attacks drains your stamina, making each subsequent arrow more challenging to aim accurately. The Guardian’s persistence tests your endurance and focus. <</if>> <<if $weapon is "staff">> The continuous casting of spells takes a toll on your energy reserves. Balancing offense and defense becomes increasingly taxing as the Guardian's relentless onslaught pushes you to your limits. Each spell must be perfectly timed to counter its attacks, requiring immense mental resilience. <</if>>
Finally, with one final, determined blow, you strike the Guardian’s form, and it stumbles back, flickering as if made of smoke. It regards you for a moment, its gaze softened, almost approving. Slowly, the Guardian lowers its weapon, a silent acknowledgment of your worthiness. It dissolves back into the mist, leaving the path to the Artifact unobstructed.
You catch your breath, standing alone in the clearing as the eerie silence returns. The Luminous Artifact pulses before you, inviting you to approach. But as you take a step forward, you hear a faint rustling in the bushes behind you. The sound is unmistakable—someone is approaching, moving carefully yet swiftly, closing in on your position.
A dark figure cloaked in robes emerges from the edge of the clearing, though they haven't yet noticed you. You realize you only have a moment to act before they spot you. The figure's gaze sweeps across the scene, eyes flickering toward the faint glow of the Artifact, a silent confirmation that they too have come for it.
The seconds tick by, and you know you must make a choice. Will you confront this mysterious figure head-on, or hide behind a nearby tree to observe them before making a move?
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Confront Figure');">Confront the figure</button>
<button class="option-button" onclick="SugarCube.Engine.play('Hide Tree');">Hide behind a tree</button>
</div><<set $encounteredGuardian to false>>
<<set $encounteredSorcerer to false>>
<style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Leave the Artifact</h1>
You take a step back, your gaze lingering on the Luminous Artifact as it pulses faintly atop the stone pedestal. Its ethereal glow beckons, a silent promise of power and mystery. Yet, the weight of what you’ve just witnessed—the Guardian, the intense energy that fills the clearing—gives you pause.
Doubt creeps into your mind. The stories warned of the Artifact’s potential to change the fate of the kingdom, but they also hinted at the cost, a sacrifice that might be greater than you’re willing to pay. The mist around you seems to thicken, almost as if it, too, is urging you to make your choice.
You turn slowly, letting the Luminous Artifact slip from your sight as you walk away. The Dark Forest, once daunting and alive with strange energies, feels quieter now, yet a lingering sense of unease follows each step. The weight of your decision presses on you, and questions swirl through your mind: Is leaving the Artifact behind an act of wisdom, or are you abandoning the kingdom’s only hope? Perhaps the village elder would have the answers you need.
The shadows deepen around you, and with each step, you feel the pull of the Luminous Artifact still present, as if it’s calling you back.
<img src="https://i.ibb.co/9H4zYyh/DALL-E-2024-12-03-20-30-38-A-realistic-yet-slightly-cartoon-like-illustration-of-a-dark-forest-clear.jpg" width="400" height="auto"/>
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Fight Guardian');">Return to the Luminous Artifact</button>
<button class="option-button" onclick="SugarCube.Engine.play('Village Elder');">Go back to the village elder</button>
</div><div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Artifact II</h1>
Artifacts are ancient and powerful relics, imbued with forces capable of influencing the fate of entire civilizations. They are not bound by the borders of a single kingdom, nor the constraints of time. Across history, these relics have ignited wars, established empires, and brought about the downfall of mighty rulers. Their influence is as far-reaching as it is unpredictable, making them treasures of immeasurable value—and danger.
Legends speak of Artifacts as catalysts of change. They are said to hold the essence of natural forces or ancient magic, capable of restoring balance to the world or plunging it into chaos. In their presence, even the most steadfast are tested, for their allure is matched only by the weight of their consequences. Some Artifacts are thought to shape the land itself, while others bend the will of those around them, forging destinies that ripple through generations. Revered and feared in equal measure, Artifacts are protected by Guardians, who ensure their power remains safely out of reach of those with impure intentions.
The Luminous Artifact is a mysterious, glowing relic rumored to hold immense power. It’s said to be as old as the forest itself, with inscriptions in a forgotten language that only the most learned scholars could decipher. Its appearance resembles a small orb, pulsing faintly with an inner light, and its surface is smooth yet warm to the touch. Many believe it holds the power to shape the fate of the kingdom, but whether it will save or doom the land remains unknown.
Legends speak of the Luminous Artifact's ability to restore balance to the kingdom by channeling the life force of the land itself. Bound within its core is the essence of the ancient forest and the strength of generations who once protected this realm. In the hands of a worthy soul, the Luminous Artifact’s energy could banish the spreading darkness, healing the blight that threatens the kingdom’s people, land, and creatures. However, such power is not without risk.
<img src="https://i.postimg.cc/0NFFBKdF/temp-Imagev9m-Yhi.avif" width="400" height="auto"/>
<<back>>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Confront the Figure</h1>
<img src="https://i.ibb.co/8sCKmGv/DALL-E-2024-12-03-22-15-11-A-realistic-yet-slightly-cartoon-like-illustration-of-a-tense-confrontati.jpg" width="400" height="auto"/>
You step forward, confronting the figure who has emerged from the shadows. You grip your <<print $weapon>> tightly, prepared for whatever comes next. The figure, now fully visible in the dim light of the clearing, is cloaked in dark robes that swirl around him as if alive, his face partially obscured by a hood. However, you can feel the intensity of his gaze, sharp and calculating, fixed on the Artifact resting on the pedstal.
With a voice like crackling embers, the figure speaks.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “The [[Artifact|Artifact 2]] does not belong to you,” he intones, extending a hand toward you. “Its power is ancient, volatile, and beyond your understanding. Hand it over—before it consumes you.” His tone is laced with warning, yet there’s a hunger in his eyes, a desire for the Artifact that he can barely contain.
You feel the weight of his words, but a defiant spark ignites within you. You’ve faced the Guardian, endured the trials of the Dark Forest, and proven yourself worthy. The Luminous Artifact chose you—its power, for better or worse, is in your hands now. You raise your <<print $weapon>>, steadying yourself against the sorcerer’s cold, calculated stare.
The sorcerer’s lips twist into a dark smile, sensing your resistance.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “Very well,” he murmurs, his voice barely a whisper.
He raises his hands, fingers tracing arcane symbols in the air as an unnatural energy begins to gather around him. The air crackles with raw magic, and you feel a prickling sensation on your skin as the sorcerer draws power from the very forest around you. Shadows lengthen and writhe, twisting into spectral forms that hover by his side, waiting for his command.
He narrows his eyes, his voice dripping with disdain.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “If you refuse to relinquish the Artifact willingly, I will take it by force.”
The tension in the air thickens, and you know there’s no turning back. The sorcerer is prepared to fight, and his power feels as ancient and dangerous as the Luminous Artifact itself. You take a deep breath, readying yourself to face this formidable opponent, knowing that this battle will not be easily won.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Evade Sorcerer');">Engage the sorcerer in combat</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Hidden From View</h1>
<img src="https://i.ibb.co/M5gpG9F/DALL-E-2024-12-03-23-16-20-A-realistic-yet-slightly-cartoon-like-illustration-of-a-tense-moment-in-a.jpg" width="400" height="auto"/>
You duck behind a thick tree, pressing yourself against its rough bark as you try to calm your breathing. The forest around you falls into an unsettling silence, broken only by the soft rustling of leaves in the wind. Shadows shift and stretch across the ground, adding to the sense of unease as you peer cautiously around the tree.
The figure pauses in the clearing, his gaze sweeping over the area with a calculated intensity. He mutters something in a strange, ancient tongue, his voice low and resonant. The words are foreign, carrying an eerie weight that sends chills down your spine, but he does not appear to have seen you.
You watch as he studies the surroundings, seemingly searching for something. Your grip tightens on your <<print $weapon>>, and a bead of sweat forms on your brow as you weigh your options. The forest feels like it’s holding its breath, and you sense that this moment could shift in an instant.
For now, you remain unnoticed, but you know this might not last. You can choose to stay hidden, hoping he moves on, or reveal yourself and prepare for whatever lies ahead.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Stay Hidden');">Stay hidden</button>
<button class="option-button" onclick="SugarCube.Engine.play('Confront Figure');">Reveal yourself and prepare to defend</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">The Village Elder's Advice</h1>
You return to the elder, your steps slower and weighted with the memory of the Luminous Artifact and all that you experienced in the Dark Forest. When you reach him, he studies your expression carefully, sensing that you have come back without the relic.<<if $encounteredGuardian and $encounteredSorcerer>> Quietly, you explain that after facing the Guardian, you encountered a mysterious figure near the Artifact’s location. The elder listens, nodding with a grave understanding as you speak.
When you finish, he lets out a slow, thoughtful sigh, his gaze drifting toward the distant forest.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "The Artifact has waited for many generations," he says, his voice a quiet rumble. "It is no simple trinket; it holds the kingdom’s ancient strength and the potential to restore our lands to peace. Yet, such power is not easily wielded, nor is it meant for everyone. You were wise to recognize its burden, <<print $name>>, but without it, the kingdom may now lie exposed."
He pauses, a hint of concern shadowing his expression.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "This sorcerer you encountered… if he seeks the Luminous Artifact, then perhaps he, too, understands its power. His intentions may not be pure, and in the wrong hands, the Artifact could spell doom rather than salvation.
<<elseif $encounteredGuardian>> Quietly, you explain that you encountered the Artifact’s Guardian but ultimately chose to leave the Artifact behind, feeling unprepared for the burden it carried. The elder listens, nodding with a grave understanding as you speak.
When you finish, he lets out a slow, thoughtful sigh, his gaze drifting toward the distant forest.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "The Artifact has waited for many generations," he says, his voice a quiet rumble. "It is no simple trinket; it holds the kingdom’s ancient strength and the potential to restore our lands to peace. Yet, such power is not easily wielded, nor is it meant for everyone. You were wise to recognize its burden, <<print $name>>, but without it, the kingdom may now lie exposed."
He pauses, choosing his words carefully.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "You’ve encountered the Guardian, felt the call of the Luminous Artifact. You understand its purpose better than any in this village, yet it was your choice to walk away. The kingdom’s fate may now rest in other hands—or in shadow, should no one else rise to the challenge."
<<else>> Quietly, you explain that you chose to leave the Artifact behind without engaging its Guardian, feeling unprepared for the weight it carried. The elder listens, nodding with a grave understanding as you speak.
When you finish, he lets out a slow, thoughtful sigh, his gaze drifting toward the distant forest.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "The Artifact has waited for many generations," he says, his voice a quiet rumble. "It is no simple trinket; it holds the kingdom’s ancient strength and the potential to restore our lands to peace. Yet, such power is not easily wielded, nor is it meant for everyone. You were wise to recognize its burden, <<print $name>>, but without it, the kingdom may now lie exposed."
He pauses, as if choosing his words carefully.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "You sensed the call of the Luminous Artifact, yet chose to walk away without testing your resolve against its Guardian. Perhaps that was for the best, for sometimes knowing when to withdraw is as wise as knowing when to act. Yet the kingdom remains vulnerable, and there are those who may seek the Artifact with intentions unknown to us."
<</if>> You feel a quiet conflict within yourself, the elder’s words stirring a lingering sense of responsibility. Did leaving the Artifact behind truly preserve the peace, or did it simply delay a duty that may inevitably fall back upon you? The elder places a reassuring hand on your shoulder, sensing the weight of your doubt.
<span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> "Perhaps you needed time to gather your resolve, and that, too, is wise," he says softly. "There are few who can claim to be ready when faced with such a test. But remember, this choice will shape more than just your path. If you feel the call to return, the kingdom may yet be saved by your courage."
He steps back, offering you a moment to consider his words. The choice remains: to stay in the village or to return to the forest.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Wait Village');">Stay in the village and wait</button>
<button class="option-button" onclick="SugarCube.Engine.play('Return to Forest');">Gather your strength and return to the Dark Forest to claim the Luminous Artifact</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Wait in the Village</h1>
You decide to stay in the village, trusting the elder to decide what course of action to take. Days pass in uneasy silence, each one heavier than the last. Rumors ripple through the villagers about strange occurrences beyond the Dark Forest, but you tell yourself it’s best to wait and prepare rather than rush into the unknown.
One morning, you notice a chill in the air that wasn’t there before. As the sun climbs, a great shadow begins to spread across the sky, darkening the horizon. The villagers murmur in fear, gathering around as the light fades, replaced by an ominous darkness that seems to consume everything in its path. Realization dawns on you, heavy and cold—you waited too long.
Regret fills your heart as you watch the shadow engulf the village, leaving no trace of the life and light that once filled Doraida.
<span style="color: gray; font-style: italic; font-weight: bold;">Doraida and the kingdom are lost.</span>
<img src="https://i.ibb.co/qk7PsHc/DALL-E-2024-12-03-20-55-28-A-realistic-yet-slightly-cartoon-like-illustration-of-a-dark-and-ominous.jpg" width="400" height="auto"/>
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Start');">Restart your adventure</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<<set $returnToForest to true>>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Return to the Forest</h1>
<<if $weapon is "sword">> With renewed determination, you set off once more into the Dark Forest, your sword steady in your grip. This time, the path feels heavier, as though the forest itself knows you are returning with a purpose. Shadows stretch longer, and each step feels like an invitation back into the unknown.
As you push forward, a glow appears in the distance—the same eerie light you saw before. You recognize this as the clearing where the Guardian stands watch over the Luminous Artifact. But as you approach, you notice something unsettling. The Guardian, a massive figure cloaked in shadow, stands motionless, its form now surrounded by dark, crackling energy.
A figure steps forward from the shadows—a cloaked man with an air of menace. His eyes gleam with twisted satisfaction as he regards you, and you feel a dark magic emanating from him, pulsing in time with the glow of the Luminous Artifact.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “Ah, another foolish adventurer, come to claim what is mine,” he says, his voice low and dripping with malice. “The Artifact’s power now bends to my will… as does its Guardian.” He gestures, and the Guardian’s form shudders, bound by the sorcerer’s magic.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “You’re welcome to try and take it from me, but a simple sword will do little against powers you cannot comprehend.”
His mocking gaze settles on you, but you grip your sword tighter, feeling the weight of your resolve. This sorcerer may have control over the Guardian, but you’re determined to break his hold and save the kingdom.
<</if>> <<if $weapon is "bow">> Taking a deep breath, you step back onto the forest path, your bow drawn close as you begin the journey once more. The shadows twist and deepen around you, seeming to watch your every move. The forest feels more aware, as though it senses your resolve.
As you near the clearing, you see the faint glow that marks the presence of the Luminous Artifact. The Guardian, a hulking figure shrouded in shadow, stands rooted, its massive form encased in an aura of dark energy.
Before you can make sense of the scene, a new figure steps forward. Cloaked in darkness, the man’s presence is almost palpable. His gaze locks onto you, and a twisted smile spreads across his face as he raises a hand, channeling a dark magic that binds the Guardian to his will.
<span style="color: darkred; font-weight: bold;">Sorcerer:</span> “A bow?” he sneers, his tone dripping with contempt. “Do you really believe it would help you against the Artifact’s Guardian—or against me?”
His gaze sharpens as he holds the Luminous Artifact, dark magic radiating from it.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “The Artifact’s power is now mine… and so is its Guardian. You will not escape with your life, much less with this prize.”
His words echo through the clearing, but you hold your ground, feeling your focus sharpen. This sorcerer may control the Guardian, but you won’t be intimidated. You ready yourself, prepared to defy him and reclaim the Luminous Artifact.
<</if>> <<if $weapon is "staff">> Calling upon your inner strength, you step back into the dark forest, your staff humming faintly in your grip. The air is charged with energy, as though the Artifact’s presence stirs the very forest around you.
The path opens into a clearing where you see the glow of the Luminous Artifact and the Guardian—a hulking shadow whose form seems woven from the forest itself. But something is wrong. Dark energy crackles around the Guardian, binding it in place.
Before you can react, another figure steps forward—a man, cloaked in dark robes, with an aura of power that chills you to the core. His gaze settles on you, and he raises his hand, channeling magic that holds the Guardian in thrall.
<span style="color: darkred; font-weight: bold;">Sorcerer:</span> “So, you think yourself a wielder of magic?” he sneers, his voice cold and mocking.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “The Artifact’s power is now under my command… as is its Guardian. Turn back now, or learn the true meaning of despair.”
His words send a shiver through you, but you grip your staff tighter, feeling a surge of defiance. You’ve come too far to turn back. This sorcerer’s magic may be powerful, but you’re prepared to face him and reclaim the Luminous Artifact.
<</if>>
The forest seems to close in around you as you prepare to face the sorcerer and the Guardian, the weight of the Artifact’s power pressing on all of you. The sorcerer’s stance is confident, almost mocking, but you sense an underlying tension. Perhaps he knows that your determination is not easily dismissed.
<img src="https://i.ibb.co/rvLT5vQ/DALL-E-2024-12-03-22-48-35-A-realistic-yet-slightly-cartoon-like-illustration-of-a-mystical-forest-c.jpg" width="400" height="auto"/>
The sorcerer raises the Luminous Artifact, its light flickering dangerously as he channels its energy, preparing for what could be the final battle. You know that this will be no ordinary duel—this fight will determine the fate of the kingdom, and only one of you will walk away victorious.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Final Duel');">Engage in the final duel</button>
</div>
<<set $encounteredGuardian to true>>
<<set $encounteredSorcerer to true>>
<style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
/* Optional: Style the dialogue for consistency */
.dialogue {
color: darkred;
font-variant: small-caps;
font-weight: bold;
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Engage in Combat</h1>
The air crackles with tension as you prepare to confront the sorcerer. His dark magic swirls around him, shadows coiling at his feet like serpents ready to strike. You tighten your grip on your <<print $weapon>>, knowing this confrontation will test your every skill.
<<if $weapon is "staff">>
Using your staff, you feel a surge of confidence. Its length provides you with ample distance to react to the sorcerer's attacks, and its sturdy construction allows you to block incoming spells effectively. The sorcerer unleashes wave after wave of dark magic, each more potent than the last. You pivot and leap, using your staff to deflect the spells when necessary, but primarily focusing on evading the relentless barrage. The ground trembles as dark energy collides with your defenses, yet your enhanced agility and reflexes keep you one step ahead. With a final, powerful spell, the sorcerer reaches for the Luminous Artifact, its glow drawing him closer. Before you can react, he snatches the Artifact, the energy from his magic knocking you off your feet as he vanishes into the mist with a chilling promise.
<span class="dialogue">Sorcerer:</span> “Your strength is admirable,” he says, “but this is not over.”
The clearing falls silent as you catch your breath, frustration mingling with the sense of loss. The Luminous Artifact, the very thing you fought so hard to protect, is now in the hands of someone whose intentions are anything but noble. The sorcerer’s parting words echo in your mind, a reminder that this confrontation is far from finished. You know that letting him escape may have dire consequences—not only for you but for the entire kingdom.
<</if>>
<<if $weapon is "bow">> Armed with your bow, you rely on precision and agility to navigate the sorcerer's dark onslaught. The sorcerer fires bolts of magic your way, each one faster and more unpredictable than the last. You nimbly sidestep and weave through his attacks, your bow poised to respond if an opening appears. However, maintaining both offense and defense proves challenging as the sorcerer's spells grow more intense, leaving you little room to strike back. He conjures a barrier of dark magic, forcing you to move constantly to avoid the onslaught. Every evasive maneuver keeps you one step ahead, but the relentless assault takes its toll. With a swift incantation, he creates a vortex of shadows that envelops the area, and in a flash, he grasps the Luminous Artifact, disappearing into the shadows with a cold smile.
<span class="dialogue">Sorcerer:</span> "This is not over."
The clearing falls silent as you catch your breath, frustration mingling with the sense of loss. The Luminous Artifact, the very thing you fought so hard to protect, is now in the hands of someone whose intentions are anything but noble. The sorcerer’s parting words echo in your mind, a reminder that this confrontation is far from finished. You know that letting him escape may have dire consequences—not only for you but for the entire kingdom.
<</if>> <<if $weapon is "sword">> Wielding your sword, you brace yourself for a more direct and intense confrontation. The sorcerer unleashes a barrage of dark energy blasts, each one aimed with deadly precision. You swiftly dodge to the side, your sword serving both as a shield and a guide as you maneuver through his relentless attacks. Every parry and strike demands your utmost focus, as balancing offense and defense becomes increasingly difficult under the sorcerer's onslaught. Shadows twist and lunge at you from all directions, testing your agility and endurance. Despite your best efforts to counterattack, the sorcerer's power overwhelms your defenses. He closes the distance with alarming speed, his hand outstretched to seize the Luminous Artifact. With a final surge of dark energy, he snatches the Artifact from its resting place, vanishing into the darkness with a sinister laugh.
<span class="dialogue">Sorcerer:</span> "This is far from over," he sneers, retreating into the mist with the Artifact in hand.
The clearing falls silent as you catch your breath, frustration mingling with the sense of loss. The Luminous Artifact, the very thing you fought so hard to protect, is now in the hands of someone whose intentions are anything but noble. The sorcerer’s parting words echo in your mind, a reminder that this confrontation is far from finished. You know that letting him escape may have dire consequences—not only for you but for the entire kingdom.
<</if>>
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Pursue Sorcerer');">Pursue the sorcerer</button>
<button class="option-button" onclick="SugarCube.Engine.play('Village Elder');">Return to the village</button>
</div><<set $encounteredGuardian to true>>
<<set $encounteredSorcerer to true>>
<style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Stay Hidden</h1>
You remain hidden, pressing yourself against the tree and holding your breath. Every muscle in your body is tense, your grip tightening around your <<print $weapon>> as you listen to the figure’s strange mutterings. His voice is low, echoing in the stillness of the forest, and though you cannot understand his words, there’s an unsettling cadence to them that makes your skin crawl.
Seconds pass like hours as he pauses, his gaze lingering in your direction. You dare not move, feeling as if even the slightest sound would give you away. Finally, after what feels like an eternity, he seems to lose interest, turning his back to you. He steps deeper into the shadows, his form gradually swallowed by the darkness until he vanishes entirely from sight.
The forest remains quiet, as though it, too, is holding its breath, but slowly the tension eases. You exhale softly, grateful that your presence has gone unnoticed—for now. You know it’s best to return to the village and seek the elder’s counsel before venturing further.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Village Elder');">Return to the village</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Pursue the Sorcerer</h1>
You sprint after the sorcerer, your heart pounding as you plunge into the Dark Forest. Shadows thicken around you, the trees looming like ancient sentinels as the trail becomes harder to follow. The air grows dense with magic, a cloying energy that seeps into your very bones, filling you with both dread and determination. Each step pulls you deeper into the sorcerer’s domain, a place where light barely pierces the canopy and where whispers seem to echo through the trees.
Ahead, the faint glow of the Luminous Artifact flickers like a guiding star, taunting you with glimpses of its power. You can just make out the silhouette of the sorcerer as he strides confidently, his form swathed in shadows that move with him as if alive. He pauses, sensing your presence, and turns to face you, his eyes flashing with contempt and amusement.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “Foolish adventurer. You think you can defeat me? The Artifact’s power is beyond anything you can comprehend.” His voice is a sinister melody, each word laced with a confidence that chills you. The forest itself seems to respond to his presence, the ground trembling slightly, and the shadows stretching as if to shield him.
You feel the weight of your weapon in your hand, the familiar grip grounding you amid the swirling chaos of the sorcerer’s magic. <<if $weapon is "sword">>You tighten your hold on your sword, each muscle tensing as you ready yourself for what’s to come. You know this will be a test not only of strength but of will, as the Artifact’s power draws out the best and worst within.<</if>>
<<if $weapon is "bow">>Your fingers brush against your arrows as you grip your bow, steadying yourself. In the silence between breaths, you understand that this confrontation will demand precision, resolve, and a willingness to face the darkness that lies both within and before you.<</if>>
<<if $weapon is "staff">>The wood of your staff pulses faintly beneath your grip, resonating with the magic around you. You sense the depth of the power you are up against—a force ancient and relentless, one that calls for wisdom as much as bravery <</if>>
<img src="https://i.ibb.co/zmJGN53/DALL-E-2024-12-03-22-42-57-A-realistic-yet-slightly-cartoon-like-illustration-of-a-mystical-forest-c.jpg" width="400" height="auto"/>
As the sorcerer lifts the Luminous Artifact, its light intensifies, casting eerie patterns across his face and illuminating the dark symbols etched into his robes. The very air around you begins to shift, vibrating with an energy that feels both captivating and terrifying. You realize that he is attempting to unlock the Artifact’s true potential, drawing out its raw, untamed magic.
He sneers, watching your every move.
<span style="color: darkred; font-variant: small-caps; font-weight: bold;">Sorcerer:</span> “Are you prepared to meet your end, adventurer? You could have walked away. You could have left the Artifact in the hands of someone who truly understands its power.” He laughs, a harsh, echoing sound that reverberates through the forest. “But now, you’ll be the first to witness its true might… and the first to fall beneath it.”
The forest seems to hold its breath, waiting for the inevitable clash. You know this will be a battle like no other, one that will determine not only your fate but the fate of the kingdom itself. The sorcerer’s stance shifts, his eyes narrowing as he prepares to unleash the full force of the Luminous Artifact against you.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Final Duel');">Engage in the final duel</button>
</div><style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">The Final Duel</h1>
The forest around you seems to darken further, the shadows twisting as the sorcerer channels the Luminous Artifact’s power, his form merging with the swirling energy. You can feel the weight of this final confrontation bearing down on you—the air thick with magic, the ground trembling with anticipation. You know that only one of you will walk away from this battle. <<if $returnToForest>> The Guardian stands beside the sorcerer, its form cloaked in shadow and bound by dark magic. You realize that this fight won’t just be with the sorcerer alone, but also with the Guardian under his control, adding a daunting layer to this final showdown.
<<if $weapon is "sword">> Summoning every ounce of strength, you rush forward with your sword, slashing through waves of dark energy to reach the sorcerer. The Guardian intercepts you, blocking your path with its immense form. You parry its powerful blows, each clash sending shockwaves through the air. Focusing, you weave between the Guardian's attacks, slashing at the dark tendrils that bind it to the sorcerer. The sorcerer sneers, his control faltering as your relentless assault forces him back. In one final, powerful swing, you sever the bond between them, leaving the Guardian disoriented. With an opening, you lunge at the sorcerer, striking a decisive blow that brings him to his knees as his magic dissipates into the night. <</if>> <<if $weapon is "bow">> Planting your feet, you nock an arrow and take aim, not only at the sorcerer but also at the Guardian under his command. The sorcerer hurls bolts of dark magic toward you while the Guardian charges forward, blocking your line of sight. Dodging swiftly, you release an arrow toward the dark tendrils connecting the sorcerer to the Guardian, disrupting his control. The Guardian falters, its movements slowing as you fire a second arrow at the sorcerer. Your shot finds its mark, piercing through his defenses and forcing him back. In that moment, the Guardian’s form begins to weaken, allowing you to focus a final shot on the sorcerer. With a gasp, he collapses, his power fading as the Guardian fades into the shadows.
<</if>> <<if $weapon is "staff">> Holding your staff tightly, you summon a surge of energy to counter both the sorcerer’s magic and the Guardian’s strength. Dark bolts of magic and powerful swings from the Guardian test your defenses, but you counter with radiant waves, each clash lighting up the forest. You focus on severing the dark connection between the sorcerer and the Guardian, blasting the tendrils with concentrated energy. The sorcerer falters, his control slipping as the Guardian pauses, no longer under his thrall. Channeling a final spell, you unleash a blinding light that overwhelms the sorcerer. With a scream, he collapses, defeated, and the Guardian disappears into the mist, freed from his control.
<</if>>
<<else>>
<<if $weapon is "sword">>
Summoning every ounce of strength, you rush forward, sword in hand, slashing through the thick waves of dark energy with sheer force. The sorcerer raises a hand, attempting to unleash another blast of magic, but your relentless assault disrupts his focus. Sparks fly as your blade cuts through the air, forcing him to retreat step by step. He stumbles, momentarily losing control of his spell, and in that opening, you close the distance. With a final, powerful swing, your sword finds its mark, slicing through the shroud of magic around him. The sorcerer’s eyes widen in shock as he collapses, his spell dissipating into the night. <</if>> <<if $weapon is "bow">>
You plant your feet firmly, nocking an arrow as you take careful aim. The sorcerer’s hands are already glowing with dark magic, and he hurls bolts of energy toward you, each one crackling with dangerous power. You dodge, feeling the heat of the magic as it sears the air beside you. Holding steady, you draw back the bowstring, waiting for the right moment. The instant you find your mark, you let the arrow fly. It cuts through the air, piercing through his defenses with deadly precision. The sorcerer gasps, clutching his chest where the arrow struck true, and stumbles, his dark power waning as he falls. <</if>> <<if $weapon is "staff">>
You grip your staff with both hands, feeling the pulse of your own magic coursing through it as you prepare to match the sorcerer’s dark energy. His spells come fast and fierce, filling the air with jagged streaks of shadow, but you counter with waves of pure light, each spell clashing and creating bursts of raw energy that light up the forest. The ground beneath you quakes with each clash of power, the air heavy with the scent of ozone. Summoning every bit of strength, you channel a final surge of energy through your staff, casting a blinding spell that overwhelms the sorcerer’s defenses. His form flickers and wavers as the light consumes him, and with one last agonized cry, he collapses, defeated. <</if>> <</if>>
<img src="https://i.ibb.co/Rb9Nvbc/DALL-E-2024-12-03-21-47-37-A-realistic-yet-slightly-cartoon-like-illustration-focusing-on-the-Lumino.jpg" width="400" height="auto"/>
The air grows still, the echoes of your battle fading into silence. At your feet, the Luminous Artifact glows with an intense, almost blinding light, as if recognizing your victory. The pulsing energy within it calls to you, its warmth mingling with a strange weight that settles in your chest. You know that this power now lies in your hands—its potential to save or doom the kingdom is yours to wield.
You take a breath, feeling both the triumph of victory and the weight of responsibility that follows. The sorcerer’s final words linger in your mind, a reminder of the Artifact’s dangers as well as its promise.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('Touch Artifact');">Pick up the Luminous Artifact</button>
</div>
<style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">The Artifact in Grasp</h1>
The moment your fingers brush the surface of the Artifact a surge of energy floods through you, fierce and uncontainable. The Artifact’s warmth radiates up your arm, pulsing with an ancient rhythm that seems to sync with your heartbeat. The world around you blurs, spinning in a dizzying vortex of light and shadow. You close your eyes, feeling yourself pulled through time and space, past the forest, past the village, as if the Artifact itself is unraveling the fabric of reality to reveal its secrets.
<img src="https://i.ibb.co/DGtsDbS/DALL-E-2024-12-03-21-59-34-A-series-of-panels-in-a-realistic-yet-slightly-cartoon-like-style-visuall.jpg" width="400" height="auto"/>
Visions fill your mind—images of the kingdom as it once was, vibrant and flourishing, the land brimming with life and prosperity. You see the Artifact’s energy woven into the land, a force that sustained life and held the balance between light and dark. But as the images shift, you also see the toll of ages past: rulers who sought to harness its power for selfish ends, wars fought to claim its strength, and the gradual corruption that seeped into the kingdom as a result. The Artifact’s magic, once pure, became volatile, its power both a blessing and a curse to those who wielded it.
Suddenly, the visions fade, and you find yourself standing back in the village square. Everything is familiar, yet different. You feel a weight on your soul, a deep understanding of the [[Artifact|Artifact 3]]’s nature that goes beyond words. Its power is now a part of you, bound to your spirit. You know that it can bring healing to the kingdom, restore the land, and strengthen the people—but you also understand the cost. The Artifact demands balance, and to wield its power is to carry a responsibility that transcends personal ambition.
As you gather your bearings, villagers notice your presence, their eyes widening with awe and curiosity as they sense the change in you. They whisper among themselves, and a few even bow, recognizing the quiet authority that now radiates from you. Word spreads quickly, and soon a crowd gathers, murmuring questions about your journey, about the battle, and about the Artifact’s fate. Yet, in the midst of the crowd, one figure stands apart, waiting with knowing eyes—the [[village elder|village elder 2]].
You feel a pull to speak with the elder, the one who first told you of the Artifact and its ancient prophecy. Perhaps he knew all along what lay in store for you. Perhaps he, too, understands the weight that now rests on your shoulders.
<!-- Option Buttons -->
<button class="option-button" onclick="SugarCube.Engine.play('End Hero Return');">Speak to the elder about your journey</button>
</div><div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Village Elder II</h1>
The village elder is a wise figure, having lived through many seasons and witnessed the passage of time in [[Doraida|Doraida 1]]. He carries the collective knowledge of the village and is one of the few who know the truth about the prophecy. Some say the elder has spoken with spirits and seen visions of the future, while others whisper that he was once a great adventurer before choosing a life of peace.
Since your journey with the Luminous Artifact, whispers around the village suggest there is more to the elder’s past than you first knew. You come to learn that he was once a [[Guardian|Guardian]] himself—a keeper of secrets and a protector of powerful relics much like the Luminous Artifact. In his youth, he is said to have ventured to the far reaches of the kingdom, seeking knowledge of ancient magic and learning from sages hidden deep within the mountains. His travels were filled with encounters with mystical forces, and he acquired wisdom that now guides him in his role as elder.
It’s even said that he once wielded an [[Artifact|Artifact 3]] himself, though not the one you recovered. His own journey, however, ended in a difficult choice—a choice to leave that power behind and return to the quiet life of Doraida, where he could serve as a guide for others. He alone understands the weight of what you have now experienced, for he, too, has known the cost of such power and the responsibility it brings.
The elder’s understanding of the prophecy and his connection to ancient magic now makes sense in a way it didn’t before. His calm demeanor, his watchful gaze, and his patience with the villagers are born not only of age but of lived experience. He remains a quiet Guardian of knowledge, choosing a life of peace, yet ever watchful for the next generation who may need his guidance.
<img src="https://i.ibb.co/dKNM8XH/DALL-E-2024-11-12-02-50-23-A-realistic-illustration-of-a-wise-elder-character-standing-in-the-foregr.webp" width="400" height="auto"/>
<<back>>
</div><<set $contentReplaced to false>> <!-- Variable to track if content was replaced -->
<style>
/* Button styles for the options */
.option-button {
background-color: #d0403f; /* Base red color */
color: white;
padding: 10px 20px;
margin: 10px 5px;
border: none;
cursor: pointer;
font-size: 1em;
display: inline-block;
text-align: center;
transition: background-color 0.3s;
}
.option-button:hover {
background-color: #a83232; /* Darker red on hover */
}
</style>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">The Hero Returns</h1>
<<button "Skip to Full Text">>
<<if not $contentReplaced>> <!-- Check if content has already been replaced -->
<<set $contentReplaced to true>> <!-- Set the variable to true to prevent further replacements -->
<<replace "#ending-content">> <div id="ending-content"> <span class="fade-in">You approach the village elder, your steps steady yet weighted with the immense power now coursing through you. The elder’s eyes meet yours, filled with a mixture of pride, respect, and perhaps even relief. They nod knowingly, sensing that you have not only returned with the Artifact, but also with an understanding of its true purpose and the balance it demands.</span><br><br>
<span class="fade-in">As you recount your journey—the trials in the forest, the battle with the sorcerer, and the visions imparted by the Luminous Artifact—the elder listens in silence, his expression grave. When you finish, they take a deep breath and place a gentle hand on your shoulder.</span><br><br>
<span class="fade-in"><span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> “The Artifact has chosen you,” he says, his voice filled with reverence. “Its power is not easily wielded, nor is its burden light. But I see now that you are ready.”</span><br><br>
<span class="fade-in">With your newfound knowledge, you unlock the secrets of the Luminous Artifact, deciphering the ancient inscriptions and tapping into its dormant energy. The Artifact hums in your hands, its light growing brighter as you channel its power, sending waves of healing energy out into the land.</span><br><br>
<span class="fade-in">The darkness that has plagued the kingdom begins to dissipate, retreating under the Luminous Artifact’s influence. Rivers flow clean, crops begin to flourish, and the air itself feels lighter, filled with the renewed vitality of a kingdom restored.</span><br><br>
<span class="fade-in">The villagers of Doraida gather around, watching in awe as the land responds to the Artifact’s magic. Smiles break out, and cheers of joy and gratitude rise up as they witness the kingdom’s rebirth.</span><br><br>
<span class="fade-in">You look upon the faces of those you have saved—friends, families, people who may never know the full extent of your journey but who will live in the peace you have created.</span><br><br>
<span class="fade-in">The elder turns to you, bowing his head in a rare show of respect.</span><br><br>
<span class="fade-in"><span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> “The kingdom owes you its life, <<print $name>>, as do we all. You have fulfilled the prophecy, and in doing so, you have become a legend—a hero whose story will be told for generations.”</span><br><br>
<span class="fade-in">The weight of the Luminous Artifact lessens in your hands, its purpose fulfilled. Though it will always be a part of you, its power now lies dormant, waiting for the next soul who may one day need it to protect the kingdom.</span><br><br>
<span class="fade-in"><span style="color: goldenrod; font-weight: bold;">Congratulations!</span> You have completed your quest and saved both the kingdom and [[Doraida|Doraida 2]]. Your journey has come to an end, but the legacy of your heroism will endure.</span><br><br>
<img src="https://i.postimg.cc/G22Jph6V/temp-Image0-Xnj0-P.avif" width="400" height="auto"/><br><br>
<!-- Option Buttons -->
<span class="fade-in">
<button class="option-button" onclick="SugarCube.Engine.play('Start');">Restart your adventure</button></span>
</div>
<</replace>>
<</if>>
<</button>>
<!-- Default timed content -->
<div id="ending-content">
<<timed 3s>><span class="fade-in">You approach the village elder, your steps steady yet weighted with the immense power now coursing through you. The elder’s eyes meet yours, filled with a mixture of pride, respect, and perhaps even relief. They nod knowingly, sensing that you have not only returned with the Artifact, but also with an understanding of its true purpose and the balance it demands.</span><br><br><</timed>>
<<timed 6s>><span class="fade-in">As you recount your journey—the trials in the forest, the battle with the sorcerer, and the visions imparted by the Luminous Artifact—the elder listens in silence, his expression grave. When you finish, they take a deep breath and place a gentle hand on your shoulder.</span><br><br><</timed>>
<<timed 9s>><span class="fade-in"><span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> “The Artifact has chosen you,” he says, his voice filled with reverence. “Its power is not easily wielded, nor is its burden light. But I see now that you are ready.”</span><br><br><</timed>>
<<timed 12s>><span class="fade-in">With your newfound knowledge, you unlock the secrets of the Luminous Artifact, deciphering the ancient inscriptions and tapping into its dormant energy. The Artifact hums in your hands, its light growing brighter as you channel its power, sending waves of healing energy out into the land.</span><br><br><</timed>>
<<timed 15s>><span class="fade-in">The darkness that has plagued the kingdom begins to dissipate, retreating under the Luminous Artifact’s influence. Rivers flow clean, crops begin to flourish, and the air itself feels lighter, filled with the renewed vitality of a kingdom restored.</span><br><br><</timed>>
<<timed 18s>><span class="fade-in">The villagers of Doraida gather around, watching in awe as the land responds to the Artifact’s magic. Smiles break out, and cheers of joy and gratitude rise up as they witness the kingdom’s rebirth.</span><br><br><</timed>>
<<timed 21s>><span class="fade-in">You look upon the faces of those you have saved—friends, families, people who may never know the full extent of your journey but who will live in the peace you have created.</span><br><br><</timed>>
<<timed 24s>><span class="fade-in">The elder turns to you, bowing his head in a rare show of respect.</span><br><br><</timed>>
<<timed 27s>><span class="fade-in"><span style="color: darkgreen; font-variant: small-caps; font-weight: bold;">Elder:</span> “The kingdom owes you its life, <<print $name>>, as do we all. You have fulfilled the prophecy, and in doing so, you have become a legend—a hero whose story will be told for generations.”</span><br><br><</timed>>
<<timed 30s>><span class="fade-in">The weight of the Luminous Artifact lessens in your hands, its purpose fulfilled. Though it will always be a part of you, its power now lies dormant, waiting for the next soul who may one day need it to protect the kingdom.</span><br><br><</timed>>
<<timed 33s>><span class="fade-in"><span style="color: goldenrod; font-weight: bold;">Congratulations!</span> You have completed your quest and saved both the kingdom and [[Doraida|Doraida 2]]. Your journey has come to an end, but the legacy of your heroism will endure.</span><br><br><</timed>>
<<timed 36s>><img src="https://i.postimg.cc/G22Jph6V/temp-Image0-Xnj0-P.avif" width="400" height="auto"/><br><br><</timed>>
<<timed 38s>>
<span class="fade-in">
<button class="option-button" onclick="SugarCube.Engine.play('Start');">Restart your adventure</button>
</span>
<</timed>>
</div>
</div><div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Artifact III</h1>
Artifacts are ancient and powerful relics, imbued with forces capable of influencing the fate of entire civilizations. They are not bound by the borders of a single kingdom, nor the constraints of time. Across history, these relics have ignited wars, established empires, and brought about the downfall of mighty rulers. Their influence is as far-reaching as it is unpredictable, making them treasures of immeasurable value—and danger.
Legends speak of Artifacts as catalysts of change. They are said to hold the essence of natural forces or ancient magic, capable of restoring balance to the world or plunging it into chaos. In their presence, even the most steadfast are tested, for their allure is matched only by the weight of their consequences. Some Artifacts are thought to shape the land itself, while others bend the will of those around them, forging destinies that ripple through generations. Revered and feared in equal measure, Artifacts are protected by Guardians, who ensure their power remains safely out of reach of those with impure intentions.
The Luminous Artifact is a mysterious, glowing relic rumored to hold immense power. It’s said to be as old as the Dark Forest itself, with inscriptions in a forgotten language that only the most learned scholars could decipher. Its appearance resembles a small orb, pulsing faintly with an inner light, and its surface is smooth yet warm to the touch. Many believe it holds the power to shape the fate of the kingdom, but whether it will save or doom the land remains unknown.
Legends speak of the Luminous Artifact's ability to restore balance to the kingdom by channeling the life force of the land itself. Bound within its core is the essence of the ancient forest and the strength of generations who once protected this realm. In the hands of a worthy soul, the Luminous Artifact’s energy could banish the spreading darkness, healing the blight that threatens the kingdom’s people, land, and creatures. However, such power is not without risk.
The Luminous Artifact’s magic is potent and unpredictable. It is said that to wield it for salvation requires a sacrifice—an offering of life energy that binds the user to the Artifact’s purpose. Some fear that the price might be too great, warning that misuse could awaken ancient forces, unleashing chaos rather than peace. Thus, the Luminous Artifact remains shrouded in mystery and caution, a relic that could either renew the kingdom or bring about its end, depending on the heart and intent of its bearer.
<img src="https://i.postimg.cc/0NFFBKdF/temp-Imagev9m-Yhi.avif" width="400" height="auto"/>
<<back>>
</div><div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">Doraida II</h1>
Doraida is a secluded village, shielded from the larger world by towering mountains and dense forests. Founded by travelers seeking refuge, it has grown into a quiet sanctuary where life flows at a gentle pace. The people are resilient and self-sufficient, rarely venturing beyond the village's borders. Yet, rumors persist of ancient forces that slumber beneath the land, waiting for a time to awaken.
But now, the villagers tell a story—of a time when shadows crept across the land, and a darkness threatened to consume their peaceful valley. In those days, a prophecy spoke of a chosen one, a hero who would rise to reclaim an ancient Artifact and drive the darkness away.
One fateful night, the hero appeared, venturing deep into the forest to face the unknown. They returned with the Luminous Artifact, and with it, light and peace were restored to Doraida. The darkness faded, and the village was once again safe.
Today, the hero is remembered as a legend in Doraida—a figure of courage and sacrifice, whose story is passed down through the generations, inspiring all who call this land their home.
<img src="https://i.ibb.co/LgDcbx7/DALL-E-2024-11-12-02-32-47-A-scenic-village-named-Doraida-nestled-between-ancient-woods-and-the-impo.webp" width="400" height="auto"/>
<<back>>
</div>
<div id="text-box">
<h1 style="font-size: 2em; font-weight: bold; text-align: center; margin-bottom: 20px;">The Guardian</h1>
Guardians are powerful protectors bound to sacred relics called Artifacts, entrusted with their defense and preservation across the ages. Their purpose transcends mere guardianship; they serve as stewards of balance, ensuring that these powerful relics do not fall into the hands of those unworthy or driven by selfish ambition.
While often regarded as solitary figures shrouded in mystery, Guardians come from diverse backgrounds and species—humans, elves, spirits, and even enchanted creatures of nature. Each Guardian is chosen not for their physical prowess alone but for their unwavering resolve, their connection to the relic’s purpose, and their willingness to sacrifice personal desires for the greater good. Becoming a Guardian is both an honor and a burden, requiring a bond to the relic that often transforms the individual, tying their essence to its purpose.
<<back>>
</div><!-- HTML Structure -->
<div id="game-info">
<p>Defeat the Guardian before it overpowers you</p>
<p>Time Left: <span id="time-left">10</span> seconds</p>
<p>Targets Left: <span id="targets-left">0</span></p>
</div>
<div id="game-area">
<!-- Targets will be dynamically generated here -->
</div>
<div id="button-container">
<button id="start-game-button" onclick="startMinigame()">Fight Guardian</button>
<button id="stop-game-button" onclick="endMinigame(false, false)">Stop Fighting</button>
</div>
<!-- CSS Styling -->
<style>
/* Game info section */
#game-info {
position: absolute;
top: 100px;
left: 520px;
text-align: center;
font-size: 18px;
color: #000000; /* Black text */
margin-bottom: 10px; /* Space between game info and game area */
}
/* Style for the instruction text */
#game-info p:first-of-type {
font-size: 18px; /* Adjust font size as desired */
font-weight: bold; /* Makes the instruction text stand out */
margin: 0 0 10px 0; /* Adds space below this line only */
color: #333333; /* Adjust color to match your theme */
}
/* Game area container */
#game-area {
position: absolute; /* Allows precise positioning */
top: 370px; /* Adjust this value to move the game area vertically */
left: 520px; /* Adjust this value to move the game area horizontally */
width: 400px;
height: 300px;
border: 2px solid #333;
background-color: #f0f0f0;
margin: 0; /* Remove default margin to avoid unintended shifts */
overflow: hidden; /* Prevent targets from overflowing */
}
/* Clickable targets styled as circles */
.click-target {
position: absolute;
width: 65px; /* Adjust width for circular shape */
height: 65px; /* Make height equal to width for a perfect circle */
background-color: #87CEEB;
border: none;
color: white;
cursor: pointer;
font-size: 14px;
display: none; /* Initially hidden */
border-radius: 50%; /* Makes the targets circular */
justify-content: center;
align-items: center;
/* Removed the duplicate display property */
}
/* Hover effect for targets */
.click-target:hover {
background-color: #5a9bcf;
color: #ffffff; /* Keeps the text white on hover */
}
/* Button container for Start and Stop buttons */
#button-container {
position: absolute;
top: 640px;
left: 650px;
text-align: center;
margin-top: 10px; /* Space between buttons and game area */
}
/* Position and style for Start and Stop buttons */
#start-game-button,
#stop-game-button {
margin: 5px;
padding: 10px 15px;
background-color: #d0403f;
color: #ffffff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
#start-game-button:hover,
#stop-game-button:hover {
background-color: #a83232;
}
/* Styling for the Guardian image inside targets */
.guardian-image {
width: 60px; /* Adjust the size as needed */
height: 60px; /* Maintain aspect ratio */
pointer-events: none; /* Allow clicks to pass through to the button */
}
</style>
<!-- JavaScript Functionality -->
<script>
// Game variables
let timeLeft = 10; // Total time for the game
let targetsLeft = 0; // Will be set based on weapon
let currentTarget = 1; // Keeps track of the current target to click
let countdownInterval;
let gameActive = false;
// Mapping of weapons to number of targets
const weaponTargetCounts = {
"sword": 12,
"bow": 14,
"staff": 16
};
// Constants for game area and button size
const GAME_AREA_WIDTH = 400; // in pixels
const GAME_AREA_HEIGHT = 300; // in pixels
const BUTTON_SIZE = 65; // width and height in pixels (matches .click-target size)
// Function to start the game
window.startMinigame = function() {
console.log("Start Minigame clicked.");
// Prevent starting the game if it's already active
if (gameActive) {
console.log("Game is already active. Ignoring start request.");
return;
}
// Retrieve the selected weapon from SugarCube variables
const weapon = SugarCube.State.variables.weapon || "sword"; // Default to sword if undefined
console.log("Selected Weapon:", weapon);
// Determine the number of targets based on the weapon
const targetCount = weaponTargetCounts[weapon] || 15; // Default to 15 if weapon not found
console.log("Target Count:", targetCount);
// Set game variables
targetsLeft = targetCount;
timeLeft = 10;
currentTarget = 1;
gameActive = true;
// Update UI elements
document.getElementById('time-left').innerText = timeLeft;
document.getElementById('targets-left').innerText = targetsLeft;
// Disable the Start button to prevent multiple clicks
document.getElementById('start-game-button').disabled = true;
document.getElementById('start-game-button').style.opacity = "0.6";
document.getElementById('start-game-button').style.cursor = "not-allowed";
// Remove any existing targets
removeAllTargets();
// Create and show the first target
createAndShowTarget(currentTarget);
// Start countdown timer
countdownInterval = setInterval(countdown, 1000);
}
// Countdown function
function countdown() {
if (timeLeft > 0) {
timeLeft--;
document.getElementById('time-left').innerText = timeLeft;
console.log("Time Left:", timeLeft);
} else {
console.log("Time ran out.");
endMinigame(false, true); // End the game with failure due to time running out
}
}
// Function to create and show a target button
function createAndShowTarget(targetNumber) {
console.log("Creating and showing target:", targetNumber);
const gameArea = document.getElementById('game-area');
const button = document.createElement('button');
button.classList.add('click-target');
button.id = `target-${targetNumber}`;
// Replace innerText with an image
button.innerHTML = `<img src="https://i.ibb.co/wQCbk30/shield-3d-rendering-icon-illustration.png" alt="Guardian" class="guardian-image">`;
button.onclick = function() { clickTarget(targetNumber); };
// Customize target appearance based on weapon
const weapon = SugarCube.State.variables.weapon || "sword";
if (weapon === "sword") {
button.style.backgroundColor = "#C0C0C0"; // Silver for sword
} else if (weapon === "bow") {
button.style.backgroundColor = "#8B4513"; // Brown for bow
} else if (weapon === "staff") {
button.style.backgroundColor = "#FFD700"; // Gold for staff
}
gameArea.appendChild(button);
// Calculate random positions within bounds
const maxTop = GAME_AREA_HEIGHT - BUTTON_SIZE;
const maxLeft = GAME_AREA_WIDTH - BUTTON_SIZE;
const randomTop = Math.floor(Math.random() * maxTop);
const randomLeft = Math.floor(Math.random() * maxLeft);
button.style.top = `${randomTop}px`;
button.style.left = `${randomLeft}px`;
button.style.display = 'flex'; // Flex for centering
console.log(`Target ${targetNumber} positioned at (${randomLeft}px, ${randomTop}px).`);
}
// Function to remove all target buttons
function removeAllTargets() {
console.log("Removing all existing targets.");
const gameArea = document.getElementById('game-area');
const existingTargets = gameArea.querySelectorAll('.click-target');
existingTargets.forEach(target => target.remove());
}
// Function to handle clicks on targets
function clickTarget(targetNumber) {
console.log("Target clicked:", targetNumber);
if (targetNumber === currentTarget && gameActive) {
targetsLeft--;
document.getElementById('targets-left').innerText = targetsLeft;
console.log("Targets Left:", targetsLeft);
// Hide and remove the clicked target
const target = document.getElementById(`target-${targetNumber}`);
if (target) {
target.style.display = 'none';
target.remove();
console.log("Target removed:", targetNumber);
}
// Move to the next target
currentTarget++;
if (targetsLeft === 0) {
console.log("All targets defeated. Success!");
endMinigame(true, false); // End the game with success
} else {
// Create and show the next target
createAndShowTarget(currentTarget);
}
} else {
console.log("Clicked target is not the current target or game is inactive.");
}
}
// Function to end the game
function endMinigame(success, ranOutOfTime = false) {
console.log("Ending game. Success:", success, "Ran Out Of Time:", ranOutOfTime);
clearInterval(countdownInterval);
gameActive = false;
// Remove all targets
removeAllTargets();
// Enable the Start button again
const startButton = document.getElementById('start-game-button');
startButton.disabled = false;
startButton.style.opacity = "1";
startButton.style.cursor = "pointer";
// Show result message or redirect to next passage
if (success) {
alert("You succeeded! You defeated the Guardian in time.");
// Link to the next passage in Twine
SugarCube.Engine.play('Face Guardian');
} else if (ranOutOfTime) {
alert("Game over! You ran out of time.");
} else {
alert("You chose to stop the game.");
}
}
// Ensure the stop button works correctly without duplicating targets
document.addEventListener("DOMContentLoaded", function() {
const stopButton = document.getElementById('stop-game-button');
if (stopButton) {
stopButton.onclick = function() {
if (gameActive) {
console.log("Stop Minigame clicked.");
endMinigame(false, false); // Stopping the game manually
} else {
console.log("Stop Minigame clicked, but game is not active.");
}
};
}
});
</script><!-- HTML Structure -->
<div id="evade-game-info">
<p>Use the arrow keys to evade the Sorcerer's attacks until the time runs out</p>
<p>Time Left: <span id="evade-time-left">0</span> seconds</p>
</div>
<div id="evade-game-area">
<div id="evade-player"></div>
<div class="evade-sorcerer" id="evade-sorcerer-1"></div>
<div class="evade-sorcerer" id="evade-sorcerer-2"></div>
<div class="evade-sorcerer" id="evade-sorcerer-3"></div>
</div>
<div id="evade-button-container">
<button id="start-evade-game-button">Start Evading</button>
<button id="stop-evade-game-button">Stop Evading</button>
</div>
<!-- CSS Styling -->
<style>
/* Center the game area vertically and horizontally */
#passage {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
flex-direction: column;
}
/* Game info section */
#evade-game-info {
position: absolute;
top: 100px;
left: 440px;
text-align: center;
font-size: 18px;
color: #000000;
margin-bottom: 20px;
}
#evade-game-info p:first-of-type {
font-weight: bold;
font-size: 18px;
margin: 0 0 10px 0;
color: #333333; /* Slightly darker for emphasis */
}
/* Game area container */
#evade-game-area {
position: absolute;
top: 370px;
left: 520px;
width: 400px;
height: 300px;
border: 2px solid #333;
background-color: #f0f0f0;
overflow: hidden;
}
/* Player styling */
#evade-player {
position: absolute;
width: 30px;
height: 30px;
background-color: #4CAF50; /* Green for player */
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 50%;
z-index: 2; /* Ensure player is above sorcerers */
}
/* Sorcerer styling */
.evade-sorcerer {
position: absolute;
width: 30px;
height: 30px;
background-color: #FF0000; /* Default red for sorcerers */
border-radius: 50%;
display: none; /* Initially hidden */
z-index: 1; /* Below the player */
}
/* Button container for Start and Stop buttons */
#evade-button-container {
position: absolute;
top: 640px;
left: 650px;
margin-top: 10px;
text-align: center;
}
/* Position and style for Start and Stop buttons */
#start-evade-game-button,
#stop-evade-game-button {
margin: 5px;
padding: 10px 15px;
background-color: #d0403f;
color: #ffffff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
#start-evade-game-button:hover,
#stop-evade-game-button:hover {
background-color: #a83232;
}
</style>
<!-- JavaScript Functionality -->
<script>
// Evading game variables
let evadeGameTimeLeft = 0; // Initial time set to 0
let evadeGameInterval;
let evadeGameActive = false;
let evadePlayerSpeed = 15;
let evadeSorcererSpeed = 1;
let gameEnded = false;
// DOM Elements
const evadePlayerElement = document.getElementById('evade-player');
const evadeGameArea = document.getElementById('evade-game-area');
const evadeSorcerers = Array.from(document.getElementsByClassName('evade-sorcerer'));
const evadeTimeLeftDisplay = document.getElementById('evade-time-left');
// Player Position
let evadePlayerPosition = { x: 200, y: 150 };
// Sorcerer initial positions
let evadeSorcererPositions = [
{ x: 50, y: 0 },
{ x: 350, y: 0 },
{ x: 200, y: 0 }
];
// Mapping of weapons to their corresponding sorcerer colors
const weaponColorMap = {
"sword": "#C0C0C0", // Silver
"bow": "#8B4513", // Brown
"staff": "#FFD700" // Gold
};
// Function to start the evading game
function startEvadeGame() {
console.log("Start Evade Game clicked.");
// Prevent starting the game if it's already active
if (evadeGameActive) {
console.log("Evade game is already active. Ignoring start request.");
return;
}
// Retrieve the weapon from Twine's state variables
const weapon = SugarCube.State.variables.weapon || "sword"; // Default to sword if undefined
console.log("Selected Weapon:", weapon);
// Map weapons to their corresponding evade times
const weaponTimeMap = {
"sword": 16,
"bow": 14,
"staff": 12
};
// Set evadeGameTimeLeft based on the chosen weapon, default to 10 if undefined
evadeGameTimeLeft = weaponTimeMap[weapon] || 10;
console.log(`Weapon chosen: ${weapon}, Time Left: ${evadeGameTimeLeft} seconds`);
// Initialize game variables
evadeGameActive = true;
gameEnded = false;
evadeTimeLeftDisplay.innerText = evadeGameTimeLeft;
evadePlayerPosition = { x: 200, y: 150 };
evadePlayerElement.style.top = `${evadePlayerPosition.y}px`;
evadePlayerElement.style.left = `${evadePlayerPosition.x}px`;
// Initialize sorcerers
evadeSorcererPositions = [
{ x: 50, y: 0 },
{ x: 350, y: 0 },
{ x: 200, y: 0 }
];
// Determine sorcerer color based on weapon
const sorcererColor = weaponColorMap[weapon] || "#FF0000"; // Default red
evadeSorcerers.forEach((sorcerer, index) => {
const pos = evadeSorcererPositions[index];
sorcerer.style.top = `${pos.y}px`;
sorcerer.style.left = `${pos.x}px`;
sorcerer.style.backgroundColor = sorcererColor; // Apply color based on weapon
sorcerer.style.display = 'block'; // Make sorcerers visible
});
// Disable the Start button to prevent multiple clicks
const startButton = document.getElementById('start-evade-game-button');
startButton.disabled = true;
startButton.style.opacity = "0.6";
startButton.style.cursor = "not-allowed";
// Remove any existing movement or event listeners if any
document.removeEventListener('keydown', moveEvadingPlayer);
// Add event listener for player movement
document.addEventListener('keydown', moveEvadingPlayer);
// Start countdown timer
evadeGameInterval = setInterval(evadingCountdown, 1000);
// Start moving sorcerers
moveEvadingSorcerers();
}
// Countdown timer function for evading game
function evadingCountdown() {
if (evadeGameTimeLeft > 0) {
evadeGameTimeLeft--;
evadeTimeLeftDisplay.innerText = evadeGameTimeLeft;
console.log("Evading Game Time Left:", evadeGameTimeLeft);
} else {
console.log("Evading game time ran out.");
endEvadeGame(true);
}
}
// Function to move the Player using arrow keys
function moveEvadingPlayer(event) {
if (!evadeGameActive) return;
const playerRadius = evadePlayerElement.offsetWidth / 2;
const gameAreaWidth = evadeGameArea.clientWidth;
const gameAreaHeight = evadeGameArea.clientHeight;
switch (event.key) {
case 'ArrowUp':
evadePlayerPosition.y = Math.max(playerRadius, evadePlayerPosition.y - evadePlayerSpeed);
break;
case 'ArrowDown':
evadePlayerPosition.y = Math.min(gameAreaHeight - playerRadius, evadePlayerPosition.y + evadePlayerSpeed);
break;
case 'ArrowLeft':
evadePlayerPosition.x = Math.max(playerRadius, evadePlayerPosition.x - evadePlayerSpeed);
break;
case 'ArrowRight':
evadePlayerPosition.x = Math.min(gameAreaWidth - playerRadius, evadePlayerPosition.x + evadePlayerSpeed);
break;
default:
// Ignore other keys
return;
}
evadePlayerElement.style.top = `${evadePlayerPosition.y}px`;
evadePlayerElement.style.left = `${evadePlayerPosition.x}px`;
checkEvadeCollision();
}
// Function to move Sorcerers toward the Player
function moveEvadingSorcerers() {
if (!evadeGameActive) return;
const sorcererRadius = evadeSorcerers[0].offsetWidth / 2;
const gameAreaWidth = evadeGameArea.clientWidth;
const gameAreaHeight = evadeGameArea.clientHeight;
evadeSorcerers.forEach((sorcerer, index) => {
let pos = evadeSorcererPositions[index];
// Calculate direction vector toward player position
const sorcererCenter = {
x: pos.x + sorcererRadius,
y: pos.y + sorcererRadius
};
const playerCenter = {
x: evadePlayerPosition.x + (evadePlayerElement.offsetWidth / 2),
y: evadePlayerPosition.y + (evadePlayerElement.offsetHeight / 2)
};
const dx = playerCenter.x - sorcererCenter.x;
const dy = playerCenter.y - sorcererCenter.y;
const distance = Math.sqrt(dx * dx + dy * dy);
// Avoid division by zero
if (distance === 0) return;
// Normalize direction
const dirX = dx / distance;
const dirY = dy / distance;
// Move sorcerer toward player
pos.x += dirX * evadeSorcererSpeed;
pos.y += dirY * evadeSorcererSpeed;
// Boundary constraints
pos.x = Math.max(0, Math.min(gameAreaWidth - sorcererRadius * 2, pos.x));
pos.y = Math.max(0, Math.min(gameAreaHeight - sorcererRadius * 2, pos.y));
// Update sorcerer position in DOM
sorcerer.style.top = `${pos.y}px`;
sorcerer.style.left = `${pos.x}px`;
// Update sorcerer position in array
evadeSorcererPositions[index] = pos;
});
checkEvadeCollision();
if (evadeGameActive) {
requestAnimationFrame(moveEvadingSorcerers);
}
}
// Function to check for collision between Player and Sorcerers
function checkEvadeCollision() {
const playerRect = evadePlayerElement.getBoundingClientRect();
const playerRadius = evadePlayerElement.offsetWidth / 2;
const playerCenter = {
x: playerRect.left + playerRadius,
y: playerRect.top + playerRadius
};
for (let sorcerer of evadeSorcerers) {
const sorcererRect = sorcerer.getBoundingClientRect();
const sorcererRadius = sorcerer.offsetWidth / 2;
const sorcererCenter = {
x: sorcererRect.left + sorcererRadius,
y: sorcererRect.top + sorcererRadius
};
const dx = playerCenter.x - sorcererCenter.x;
const dy = playerCenter.y - sorcererCenter.y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < playerRadius + sorcererRadius) {
console.log("Collision detected between Player and Sorcerer.");
endEvadeGame(false, true);
break;
}
}
}
// Function to end the evading game
function endEvadeGame(playerSurvived, wasCaught = false) {
if (gameEnded) return;
gameEnded = true;
evadeGameActive = false;
clearInterval(evadeGameInterval);
document.removeEventListener('keydown', moveEvadingPlayer);
// Hide all sorcerers
evadeSorcerers.forEach(sorcerer => {
sorcerer.style.display = 'none';
});
// Enable the Start button again
const startButton = document.getElementById('start-evade-game-button');
startButton.disabled = false;
startButton.style.opacity = "1";
startButton.style.cursor = "pointer";
// Show result message or redirect to next passage
if (playerSurvived) {
alert("You succeeded! You evaded the Sorcerer's attacks.");
// Link to the next passage in Twine
SugarCube.Engine.play('Combat');
} else if (wasCaught) {
alert("Game over! You were caught by the Sorcerer.");
// === Added Code Start ===
evadeGameTimeLeft = 0; // Reset time to 0
evadeTimeLeftDisplay.innerText = evadeGameTimeLeft; // Update the display
// === Added Code End ===
} else {
alert("You chose to stop the game.");
}
}
// Event listeners for Start and Stop game buttons
document.getElementById('start-evade-game-button').onclick = startEvadeGame;
document.getElementById('stop-evade-game-button').onclick = function() {
if (!gameEnded) {
endEvadeGame(false, false);
}
};
</script><!-- HTML Structure -->
<div id="game-info">
<p>Defeat the Guardian before it overpowers you</p>
<p>Time Left: <span id="time-left">10</span> seconds</p>
<p>Targets Left: <span id="targets-left">0</span></p>
</div>
<div id="game-area">
<!-- Targets will be dynamically generated here -->
</div>
<div id="button-container">
<button id="start-game-button" onclick="startMinigame()">Fight Guardian</button>
<button id="stop-game-button" onclick="endMinigame(false, false)">Stop Fighting</button>
</div>
<!-- CSS Styling -->
<style>
/* Game info section */
#game-info {
position: absolute;
top: 100px;
left: 520px;
text-align: center;
font-size: 18px;
color: #000000; /* Black text */
margin-bottom: 10px; /* Space between game info and game area */
}
/* Style for the instruction text */
#game-info p:first-of-type {
font-size: 18px; /* Adjust font size as desired */
font-weight: bold; /* Makes the instruction text stand out */
margin: 0 0 10px 0; /* Adds space below this line only */
color: #333333; /* Adjust color to match your theme */
}
/* Game area container */
#game-area {
position: absolute; /* Allows precise positioning */
top: 370px; /* Adjust this value to move the game area vertically */
left: 520px; /* Adjust this value to move the game area horizontally */
width: 400px;
height: 300px;
border: 2px solid #333;
background-color: #f0f0f0;
margin: 0; /* Remove default margin to avoid unintended shifts */
overflow: hidden; /* Prevent targets from overflowing */
}
/* Clickable targets styled as circles */
.click-target {
position: absolute;
width: 65px; /* Adjust width for circular shape */
height: 65px; /* Make height equal to width for a perfect circle */
background-color: #87CEEB;
border: none;
color: white;
cursor: pointer;
font-size: 14px;
display: none; /* Initially hidden */
border-radius: 50%; /* Makes the targets circular */
justify-content: center;
align-items: center;
/* Removed the duplicate display property */
}
/* Hover effect for targets */
.click-target:hover {
background-color: #5a9bcf;
color: #ffffff; /* Keeps the text white on hover */
}
/* Button container for Start and Stop buttons */
#button-container {
position: absolute;
top: 640px;
left: 650px;
text-align: center;
margin-top: 10px; /* Space between buttons and game area */
}
/* Position and style for Start and Stop buttons */
#start-game-button,
#stop-game-button {
margin: 5px;
padding: 10px 15px;
background-color: #d0403f;
color: #ffffff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
#start-game-button:hover,
#stop-game-button:hover {
background-color: #a83232;
}
/* Styling for the Guardian image inside targets */
.guardian-image {
width: 60px; /* Adjust the size as needed */
height: 60px; /* Maintain aspect ratio */
pointer-events: none; /* Allow clicks to pass through to the button */
}
</style>
<!-- JavaScript Functionality -->
<script>
// Game variables
let timeLeft = 10; // Total time for the game
let targetsLeft = 0; // Will be set based on weapon
let currentTarget = 1; // Keeps track of the current target to click
let countdownInterval;
let gameActive = false;
// Mapping of weapons to number of targets
const weaponTargetCounts = {
"sword": 12,
"bow": 14,
"staff": 16
};
// Constants for game area and button size
const GAME_AREA_WIDTH = 400; // in pixels
const GAME_AREA_HEIGHT = 300; // in pixels
const BUTTON_SIZE = 65; // width and height in pixels (matches .click-target size)
// Function to start the game
window.startMinigame = function() {
console.log("Start Minigame clicked.");
// Prevent starting the game if it's already active
if (gameActive) {
console.log("Game is already active. Ignoring start request.");
return;
}
// Retrieve the selected weapon from SugarCube variables
const weapon = SugarCube.State.variables.weapon || "sword"; // Default to sword if undefined
console.log("Selected Weapon:", weapon);
// Determine the number of targets based on the weapon
const targetCount = weaponTargetCounts[weapon] || 15; // Default to 15 if weapon not found
console.log("Target Count:", targetCount);
// Set game variables
targetsLeft = targetCount;
timeLeft = 10;
currentTarget = 1;
gameActive = true;
// Update UI elements
document.getElementById('time-left').innerText = timeLeft;
document.getElementById('targets-left').innerText = targetsLeft;
// Disable the Start button to prevent multiple clicks
document.getElementById('start-game-button').disabled = true;
document.getElementById('start-game-button').style.opacity = "0.6";
document.getElementById('start-game-button').style.cursor = "not-allowed";
// Remove any existing targets
removeAllTargets();
// Create and show the first target
createAndShowTarget(currentTarget);
// Start countdown timer
countdownInterval = setInterval(countdown, 1000);
}
// Countdown function
function countdown() {
if (timeLeft > 0) {
timeLeft--;
document.getElementById('time-left').innerText = timeLeft;
console.log("Time Left:", timeLeft);
} else {
console.log("Time ran out.");
endMinigame(false, true); // End the game with failure due to time running out
}
}
// Function to create and show a target button
function createAndShowTarget(targetNumber) {
console.log("Creating and showing target:", targetNumber);
const gameArea = document.getElementById('game-area');
const button = document.createElement('button');
button.classList.add('click-target');
button.id = `target-${targetNumber}`;
// Replace innerText with an image
button.innerHTML = `<img src="https://i.ibb.co/wQCbk30/shield-3d-rendering-icon-illustration.png" alt="Guardian" class="guardian-image">`;
button.onclick = function() { clickTarget(targetNumber); };
// Customize target appearance based on weapon
const weapon = SugarCube.State.variables.weapon || "sword";
if (weapon === "sword") {
button.style.backgroundColor = "#C0C0C0"; // Silver for sword
} else if (weapon === "bow") {
button.style.backgroundColor = "#8B4513"; // Brown for bow
} else if (weapon === "staff") {
button.style.backgroundColor = "#FFD700"; // Gold for staff
}
gameArea.appendChild(button);
// Calculate random positions within bounds
const maxTop = GAME_AREA_HEIGHT - BUTTON_SIZE;
const maxLeft = GAME_AREA_WIDTH - BUTTON_SIZE;
const randomTop = Math.floor(Math.random() * maxTop);
const randomLeft = Math.floor(Math.random() * maxLeft);
button.style.top = `${randomTop}px`;
button.style.left = `${randomLeft}px`;
button.style.display = 'flex'; // Flex for centering
console.log(`Target ${targetNumber} positioned at (${randomLeft}px, ${randomTop}px).`);
}
// Function to remove all target buttons
function removeAllTargets() {
console.log("Removing all existing targets.");
const gameArea = document.getElementById('game-area');
const existingTargets = gameArea.querySelectorAll('.click-target');
existingTargets.forEach(target => target.remove());
}
// Function to handle clicks on targets
function clickTarget(targetNumber) {
console.log("Target clicked:", targetNumber);
if (targetNumber === currentTarget && gameActive) {
targetsLeft--;
document.getElementById('targets-left').innerText = targetsLeft;
console.log("Targets Left:", targetsLeft);
// Hide and remove the clicked target
const target = document.getElementById(`target-${targetNumber}`);
if (target) {
target.style.display = 'none';
target.remove();
console.log("Target removed:", targetNumber);
}
// Move to the next target
currentTarget++;
if (targetsLeft === 0) {
console.log("All targets defeated. Success!");
endMinigame(true, false); // End the game with success
} else {
// Create and show the next target
createAndShowTarget(currentTarget);
}
} else {
console.log("Clicked target is not the current target or game is inactive.");
}
}
// Function to end the game
function endMinigame(success, ranOutOfTime = false) {
console.log("Ending game. Success:", success, "Ran Out Of Time:", ranOutOfTime);
clearInterval(countdownInterval);
gameActive = false;
// Remove all targets
removeAllTargets();
// Enable the Start button again
const startButton = document.getElementById('start-game-button');
startButton.disabled = false;
startButton.style.opacity = "1";
startButton.style.cursor = "pointer";
// Show result message or redirect to next passage
if (success) {
alert("You succeeded! You defeated the Guardian in time.");
} else if (ranOutOfTime) {
alert("Game over! You ran out of time.");
} else {
alert("You chose to stop the game.");
}
}
// Ensure the stop button works correctly without duplicating targets
document.addEventListener("DOMContentLoaded", function() {
const stopButton = document.getElementById('stop-game-button');
if (stopButton) {
stopButton.onclick = function() {
if (gameActive) {
console.log("Stop Minigame clicked.");
endMinigame(false, false); // Stopping the game manually
} else {
console.log("Stop Minigame clicked, but game is not active.");
}
};
}
});
</script><!-- HTML Structure -->
<div id="evade-game-info">
<p>Use the arrow keys to evade the Sorcerer's attacks until the time runs out</p>
<p>Time Left: <span id="evade-time-left">0</span> seconds</p>
</div>
<div id="evade-game-area">
<div id="evade-player"></div>
<div class="evade-sorcerer" id="evade-sorcerer-1"></div>
<div class="evade-sorcerer" id="evade-sorcerer-2"></div>
<div class="evade-sorcerer" id="evade-sorcerer-3"></div>
</div>
<div id="evade-button-container">
<button id="start-evade-game-button">Evade Attacks</button>
<button id="stop-evade-game-button">Stop Evading</button>
</div>
<!-- CSS Styling -->
<style>
/* Center the game area vertically and horizontally */
#passage {
display: flex;
justify-content: center;
align-items: center;
min-height: 100vh;
margin: 0;
flex-direction: column;
}
/* Game info section */
#evade-game-info {
position: absolute;
top: 100px;
left: 440px;
text-align: center;
font-size: 18px;
color: #000000;
margin-bottom: 20px;
}
#evade-game-info p:first-of-type {
font-weight: bold;
font-size: 18px;
margin: 0 0 10px 0;
color: #333333; /* Slightly darker for emphasis */
}
/* Game area container */
#evade-game-area {
position: absolute;
top: 370px;
left: 520px;
width: 400px;
height: 300px;
border: 2px solid #333;
background-color: #f0f0f0;
overflow: hidden;
}
/* Player styling */
#evade-player {
position: absolute;
width: 30px;
height: 30px;
background-color: #4CAF50; /* Green for player */
top: 50%;
left: 50%;
transform: translate(-50%, -50%);
border-radius: 50%;
z-index: 2; /* Ensure player is above sorcerers */
}
/* Sorcerer styling */
.evade-sorcerer {
position: absolute;
width: 30px;
height: 30px;
background-color: #FF0000; /* Default red for sorcerers */
border-radius: 50%;
display: none; /* Initially hidden */
z-index: 1; /* Below the player */
}
/* Button container for Start and Stop buttons */
#evade-button-container {
position: absolute;
top: 640px;
left: 650px;
margin-top: 10px;
text-align: center;
}
/* Position and style for Start and Stop buttons */
#start-evade-game-button,
#stop-evade-game-button {
margin: 5px;
padding: 10px 15px;
background-color: #d0403f;
color: #ffffff;
border: none;
border-radius: 5px;
cursor: pointer;
font-size: 14px;
transition: background-color 0.3s;
}
#start-evade-game-button:hover,
#stop-evade-game-button:hover {
background-color: #a83232;
}
</style>
<!-- JavaScript Functionality -->
<script>
// Evading game variables
let evadeGameTimeLeft = 0; // Initial time set to 0
let evadeGameInterval;
let evadeGameActive = false;
let evadePlayerSpeed = 15;
let evadeSorcererSpeed = 1;
let gameEnded = false;
// DOM Elements
const evadePlayerElement = document.getElementById('evade-player');
const evadeGameArea = document.getElementById('evade-game-area');
const evadeSorcerers = Array.from(document.getElementsByClassName('evade-sorcerer'));
const evadeTimeLeftDisplay = document.getElementById('evade-time-left');
// Player Position
let evadePlayerPosition = { x: 200, y: 150 };
// Sorcerer initial positions
let evadeSorcererPositions = [
{ x: 50, y: 0 },
{ x: 350, y: 0 },
{ x: 200, y: 0 }
];
// Mapping of weapons to their corresponding sorcerer colors
const weaponColorMap = {
"sword": "#C0C0C0", // Silver
"bow": "#8B4513", // Brown
"staff": "#FFD700" // Gold
};
// Function to start the evading game
function startEvadeGame() {
console.log("Start Evade Game clicked.");
// Prevent starting the game if it's already active
if (evadeGameActive) {
console.log("Evade game is already active. Ignoring start request.");
return;
}
// Retrieve the weapon from Twine's state variables
const weapon = SugarCube.State.variables.weapon || "sword"; // Default to sword if undefined
console.log("Selected Weapon:", weapon);
// Map weapons to their corresponding evade times
const weaponTimeMap = {
"sword": 16,
"bow": 14,
"staff": 12
};
// Set evadeGameTimeLeft based on the chosen weapon, default to 10 if undefined
evadeGameTimeLeft = weaponTimeMap[weapon] || 10;
console.log(`Weapon chosen: ${weapon}, Time Left: ${evadeGameTimeLeft} seconds`);
// Initialize game variables
evadeGameActive = true;
gameEnded = false;
evadeTimeLeftDisplay.innerText = evadeGameTimeLeft;
evadePlayerPosition = { x: 200, y: 150 };
evadePlayerElement.style.top = `${evadePlayerPosition.y}px`;
evadePlayerElement.style.left = `${evadePlayerPosition.x}px`;
// Initialize sorcerers
evadeSorcererPositions = [
{ x: 50, y: 0 },
{ x: 350, y: 0 },
{ x: 200, y: 0 }
];
// Determine sorcerer color based on weapon
const sorcererColor = weaponColorMap[weapon] || "#FF0000"; // Default red
evadeSorcerers.forEach((sorcerer, index) => {
const pos = evadeSorcererPositions[index];
sorcerer.style.top = `${pos.y}px`;
sorcerer.style.left = `${pos.x}px`;
sorcerer.style.backgroundColor = sorcererColor; // Apply color based on weapon
sorcerer.style.display = 'block'; // Make sorcerers visible
});
// Disable the Start button to prevent multiple clicks
const startButton = document.getElementById('start-evade-game-button');
startButton.disabled = true;
startButton.style.opacity = "0.6";
startButton.style.cursor = "not-allowed";
// Remove any existing movement or event listeners if any
document.removeEventListener('keydown', moveEvadingPlayer);
// Add event listener for player movement
document.addEventListener('keydown', moveEvadingPlayer);
// Start countdown timer
evadeGameInterval = setInterval(evadingCountdown, 1000);
// Start moving sorcerers
moveEvadingSorcerers();
}
// Countdown timer function for evading game
function evadingCountdown() {
if (evadeGameTimeLeft > 0) {
evadeGameTimeLeft--;
evadeTimeLeftDisplay.innerText = evadeGameTimeLeft;
console.log("Evading Game Time Left:", evadeGameTimeLeft);
} else {
console.log("Evading game time ran out.");
endEvadeGame(true);
}
}
// Function to move the Player using arrow keys
function moveEvadingPlayer(event) {
if (!evadeGameActive) return;
const playerRadius = evadePlayerElement.offsetWidth / 2;
const gameAreaWidth = evadeGameArea.clientWidth;
const gameAreaHeight = evadeGameArea.clientHeight;
switch (event.key) {
case 'ArrowUp':
evadePlayerPosition.y = Math.max(playerRadius, evadePlayerPosition.y - evadePlayerSpeed);
break;
case 'ArrowDown':
evadePlayerPosition.y = Math.min(gameAreaHeight - playerRadius, evadePlayerPosition.y + evadePlayerSpeed);
break;
case 'ArrowLeft':
evadePlayerPosition.x = Math.max(playerRadius, evadePlayerPosition.x - evadePlayerSpeed);
break;
case 'ArrowRight':
evadePlayerPosition.x = Math.min(gameAreaWidth - playerRadius, evadePlayerPosition.x + evadePlayerSpeed);
break;
default:
// Ignore other keys
return;
}
evadePlayerElement.style.top = `${evadePlayerPosition.y}px`;
evadePlayerElement.style.left = `${evadePlayerPosition.x}px`;
checkEvadeCollision();
}
// Function to move Sorcerers toward the Player
function moveEvadingSorcerers() {
if (!evadeGameActive) return;
const sorcererRadius = evadeSorcerers[0].offsetWidth / 2;
const gameAreaWidth = evadeGameArea.clientWidth;
const gameAreaHeight = evadeGameArea.clientHeight;
evadeSorcerers.forEach((sorcerer, index) => {
let pos = evadeSorcererPositions[index];
// Calculate direction vector toward player position
const sorcererCenter = {
x: pos.x + sorcererRadius,
y: pos.y + sorcererRadius
};
const playerCenter = {
x: evadePlayerPosition.x + (evadePlayerElement.offsetWidth / 2),
y: evadePlayerPosition.y + (evadePlayerElement.offsetHeight / 2)
};
const dx = playerCenter.x - sorcererCenter.x;
const dy = playerCenter.y - sorcererCenter.y;
const distance = Math.sqrt(dx * dx + dy * dy);
// Avoid division by zero
if (distance === 0) return;
// Normalize direction
const dirX = dx / distance;
const dirY = dy / distance;
// Move sorcerer toward player
pos.x += dirX * evadeSorcererSpeed;
pos.y += dirY * evadeSorcererSpeed;
// Boundary constraints
pos.x = Math.max(0, Math.min(gameAreaWidth - sorcererRadius * 2, pos.x));
pos.y = Math.max(0, Math.min(gameAreaHeight - sorcererRadius * 2, pos.y));
// Update sorcerer position in DOM
sorcerer.style.top = `${pos.y}px`;
sorcerer.style.left = `${pos.x}px`;
// Update sorcerer position in array
evadeSorcererPositions[index] = pos;
});
checkEvadeCollision();
if (evadeGameActive) {
requestAnimationFrame(moveEvadingSorcerers);
}
}
// Function to check for collision between Player and Sorcerers
function checkEvadeCollision() {
const playerRect = evadePlayerElement.getBoundingClientRect();
const playerRadius = evadePlayerElement.offsetWidth / 2;
const playerCenter = {
x: playerRect.left + playerRadius,
y: playerRect.top + playerRadius
};
for (let sorcerer of evadeSorcerers) {
const sorcererRect = sorcerer.getBoundingClientRect();
const sorcererRadius = sorcerer.offsetWidth / 2;
const sorcererCenter = {
x: sorcererRect.left + sorcererRadius,
y: sorcererRect.top + sorcererRadius
};
const dx = playerCenter.x - sorcererCenter.x;
const dy = playerCenter.y - sorcererCenter.y;
const distance = Math.sqrt(dx * dx + dy * dy);
if (distance < playerRadius + sorcererRadius) {
console.log("Collision detected between Player and Sorcerer.");
endEvadeGame(false, true);
break;
}
}
}
// Function to end the evading game
function endEvadeGame(playerSurvived, wasCaught = false) {
if (gameEnded) return;
gameEnded = true;
evadeGameActive = false;
clearInterval(evadeGameInterval);
document.removeEventListener('keydown', moveEvadingPlayer);
// Hide all sorcerers
evadeSorcerers.forEach(sorcerer => {
sorcerer.style.display = 'none';
});
// Enable the Start button again
const startButton = document.getElementById('start-evade-game-button');
startButton.disabled = false;
startButton.style.opacity = "1";
startButton.style.cursor = "pointer";
// Show result message or redirect to next passage
if (playerSurvived) {
alert("You succeeded! You evaded the Sorcerer's attacks.");
} else if (wasCaught) {
alert("Game over! You were caught by the Sorcerer.");
// === Added Code Start ===
evadeGameTimeLeft = 0; // Reset time to 0
evadeTimeLeftDisplay.innerText = evadeGameTimeLeft; // Update the display
// === Added Code End ===
} else {
alert("You chose to stop the game.");
}
}
// Event listeners for Start and Stop game buttons
document.getElementById('start-evade-game-button').onclick = startEvadeGame;
document.getElementById('stop-evade-game-button').onclick = function() {
if (!gameEnded) {
endEvadeGame(false, false);
}
};
</script>