Skip to content

Commit

Permalink
yes but...
Browse files Browse the repository at this point in the history
  • Loading branch information
qualityshepherd committed Jul 19, 2024
1 parent 83b5669 commit e2263a8
Show file tree
Hide file tree
Showing 3 changed files with 17 additions and 7 deletions.
5 changes: 3 additions & 2 deletions src/data/situation.json
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@
"A noble family discovers their treasured heirloom stolen. It is a magical amulet that renders the bearer invisible. The thief is revealed as the family's own estranged child; now involved with an underground resistance. The family seeks help to retrieve the amulet, and capture this rebellious child. They stress: by any means necessary. ",
"An ancient scroll surfaces in the a scholarly city. The scroll contains the secret of phoenix resurrection. City leaders believe it could bring about either great prosperity or devastating chaos. A council deliberates on the fate of the scroll. They must decide whether to preserve its knowledge or destroy it, as not to fall into ill hands. They wish to bolster the guard and secure the scroll until a decision can be reached.",
"The sound of raised voices and unsheathed swords. A rogue with wry wit sits by a fire, roasting a badger. She is being questioned by the local constable and a small party of volunteers. It seems some prize livestock has gone missing from a lord's stable and the constable is desperate to find ANY guilty party. \"A badger... prized livestock?!?\" The rogue's wit has embarrassed the constable and he means to make an example of her. She is wanted as a traitor.",
"A robed figure sits near a grave sipping tea from fine china. Two minions dig up the grave. His lord--whom he longs to be free of--would have him raise these poor creatures to his service. Shovels hit rotted wood. One of the minions brings a prize; a magical jade stone. The figure turns and says \"bring the body... and the tea\". Could this stone be the solution to his problem? A twig snaps in the dark; someone watches... ",
"A robed figure sits near a grave sipping tea from fine china while minions dig. His lord commands he raise these poor creatures and he reluctantly obeys. Shovels hit rotted wood. One of the minions brings a prize: a magical jade stone. The figure turns and says \"bring the body... and the tea\". Could this stone be the solution to his problem? A twig snaps in the dark; someone watches... ",
"Within a small clearing, a wounded griffin is caught in a bear trap. It shrieks as it struggles in vein to free its leg. In the air, the faint smell of wood smoke and distant voices... getting closer. Poachers?",
"A band of nomadic traders led by a charismatic merchant named Zara. Zara offers to trade with the adventurers and showcases a variable plethora of spices, herbs, oils and trinkets. Tensions rise when a group of bandits arrive, demanding a toll for safe passage through the area.",
"A stone circle surrounds a shimmering pool of water. Each stone is inscribed with symbols and glyphs, many of which depict the moon. While reflecting moonlight, the water reveals glimpses of distant places and events. However, each use of the pool drains the vitality of the viewer.",
Expand All @@ -44,5 +44,6 @@
"A robed woman sits cross legged in the sand. She's waiting for the sun to either come out or be at the right moment so she can shadowalk to her intended destination. Once the shadows are just right, she will walk into it, through a disorienting maze of darkness and out of another shadow elsewhere. Shadow walking is tricky; the traveler may come out feet or miles off course. The woman might teach PCs how it works... for a price.",
"A band of thieves have taken over a crucial trade route. They claim to be former soldiers, abandoned by their kingdom, and seek only to provide for their families. Local merchants seek adventurers to reclaim their goods and deal with these brigands. They use the phrase \"dead or alive\" multiple times...",
"A cloaked figure dashes through the tavern door, waves a feminine hand covered in runes, and disappears through a false wall. The tavern keeper loudly clears his throat and a patron pushes a table in front of the wall, and sits down. Moments later soldiers arrive and begin searching and asking questions.",
"A blacksmith's apprentice is hailed \"The Chosen One\" by a wandering prophet and his followers. He claims to have seen the young boy slay a local monster in his dreams. The blacksmith suspects he is a charlatan but others are quick to believe this prophecy."
"A blacksmith's apprentice is hailed \"The Chosen One\" by a wandering prophet and his followers. He claims to have seen the young boy slay a local monster in his dreams. The blacksmith suspects he is a charlatan but others are quick to believe this prophecy.",
"A wounded thief stubles upon a hermit dwelling. The hermit is a fallen priest burdened by guilt for the failures of his past. He offers the thief sanctuary and healing, believing that redemption can heal his own guilt. Meanwhile, the PCs are hired to bring the thief to justice and track him to the hermit's door. The thief has a jeweled bracelet worth more than his bounty..."
]
15 changes: 12 additions & 3 deletions src/utils.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,6 @@
// Note: fetch is provided in the browser...

// eslint-disable-next-line no-extend-native
Array.prototype.random = function () {
return this[Math.floor((Math.random() * this.length))]
}
Expand All @@ -22,6 +23,7 @@ export async function spark () {
const randSparks = []
while (randSparks.length < 3) {
randSparks.push(spark.random())
// eslint-disable-next-line no-new
new Set(randSparks)
}
return `${randSparks[0]}, ${randSparks[1]}, ${randSparks[2]}`
Expand Down Expand Up @@ -57,7 +59,7 @@ export async function situation () {

export async function misc () {
const misc = await getJsonData('./src/data/misc.json')
return [misc.villageItem.random(), misc.dungeonItem.random(), misc.dungeonFeature.random(), misc.ruinFeature.random(), misc.complication.random(), misc.threat.random(), misc.pocket.random(), misc.problem.random(), misc.theme.random() ]
return [misc.villageItem.random(), misc.dungeonItem.random(), misc.dungeonFeature.random(), misc.ruinFeature.random(), misc.complication.random(), misc.threat.random(), misc.pocket.random(), misc.problem.random(), misc.theme.random()]
}

export async function loot () {
Expand All @@ -76,8 +78,15 @@ export async function weather () {
return [severity[severity[0]], weather[weather[0]], `./assets/images/weather/${weather[0]}.svg`]
}

export async function yesOrNo () {
return (d6() > 3) ? 'Yes' : 'No'
export async function yesNoAndBut () {
switch (d6()) {
case 6: return 'Yes+'
case 5: return 'Yes'
case 4: return 'Yes?'
case 3: return 'No?'
case 2: return 'No'
case 1: return 'No+'
}
}

export async function arrow () {
Expand Down
4 changes: 2 additions & 2 deletions src/views/rando.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ const rando = {
const [male, female, they, sur] = await r.names()
const [role, epithet, trait, relationship, belief] = await r.monikers()
const card = await r.tarotCard()
const [villageItem, dungeonItem, dungeonFeature, ruinFeature, complication, threat, pocket, problem, theme ] = await r.misc()
const [villageItem, dungeonItem, dungeonFeature, ruinFeature, complication, threat, pocket, problem, theme] = await r.misc()
const [severity, weather, iconUrl] = await r.weather()
const [potion, loot, magicItem] = await r.loot()

Expand All @@ -26,7 +26,7 @@ const rando = {
<img src="${iconUrl}" alt="${weather}" class="dim" title="${weather}" />
<div class="small">${severity} ${weather}</div>
<img src="${await r.arrow()}" class="dim" title="direction or hit location" />
<div class="header dim" title="ask a question">${await r.yesOrNo()}</div>
<div class="header dim" title="ask a question">${await r.yesNoAndBut()}</div>
</symbols>
</right>
Expand Down

0 comments on commit e2263a8

Please sign in to comment.