full early game polished up, flavor text now properly capitalizes names

This commit is contained in:
2025-08-07 15:37:23 -07:00
parent 8f7f173108
commit 5c3d34aafa
7 changed files with 175 additions and 13 deletions

View File

@@ -12,8 +12,14 @@ def dice_roll(min=0, max=100, modifiers=[]):
return result
@core.app.route("/act/steal/<resource>", methods=["POST"])
def steal_resource(resource):
@core.app.route("/act/steal/<resource>/<target>", methods=["POST"])
def steal_resource(resource, target):
return flask.Response(json.dumps({
"success": (dice_roll() >= 50)
}), status=200, content_type="application/json")
@core.app.route("/act/recruit", methods=["POST"])
def recruit():
return flask.Response(json.dumps({
"success": (dice_roll() >= 65)
}), status=200, content_type="application/json")

View File

@@ -5,7 +5,8 @@ from . import core
path_storagedir = pathlib.Path()
class JS_API:
debug_mode = False
def __init__(self):
self.debug_mode = False
def load_data(self, key):
if not (path_storagedir / key).exists():

View File

@@ -24,6 +24,7 @@ tick_event_list = []
tick_event_list.append(TickEvent(0, 16, "XYZZY")) # nothing happens
tick_event_list.append(TickEvent(1, 1, "FLAVOR")) # procedurally generated event of no consequence
tick_event_list.append(TickEvent(10, 2, "ENCHUMAN")) # encounter: human
tick_event_list.append(TickEvent(11, 2, "ENCGULL"))
@core.app.route("/tick")
def tick():
@@ -50,6 +51,13 @@ def tick():
"food": items.generate_item_list("food", "humans", 0, 2),
"shinies": items.generate_item_list("shinies", "humans", 0, 2)
}
case 11: # ENCGULL
result["items"] = {
# TODO: read ranges from XML rule files
"food": items.generate_item_list("food", "seagulls", 0, 2),
"shinies": items.generate_item_list("shinies", "seagulls", 0, 2)
}
result["recruit_cost"] = round(random.uniform(0, 10), 2)
case _:
core.log.warning("undefined tick: {0}".format(result["event_type"]))

View File

@@ -1,9 +1,14 @@
@require "wordlist"
[$title: str] @text {
<$split_str = [split: <str>]>
[cat: [upper: <split_str/0>] [lower: [join: <split_str/1..>]]]
}
{
You meet {
a `[pick: <wordlist/nouns/birds>] |
`{
[title: `{
[pick: <wordlist/names/people/butlers>] |
[pick: <wordlist/names/people/computing>] |
[pick: <wordlist/names/people/founders>] |
@@ -12,7 +17,7 @@
[pick: <wordlist/names/surnames/english>] |
[pick: <wordlist/names/surnames/irish>] |
[pick: <wordlist/names/surnames/scottish>]
} the `[pick: <wordlist/nouns/birds>]
}] the `[pick: <wordlist/nouns/birds>]
}. {
It completely ignores you. |
You have a polite conversation about birdly affairs. |

View File

@@ -0,0 +1,55 @@
@require "wordlist"
[$desc_food] @text {
{
[pick: <wordlist/adjectives/food>] @weight 1.25 |
[pick: <wordlist/adjectives/taste>] @weight 1.1 |
[pick: <wordlist/names/cities/united_states>] @weight 1.1 |
[pick: <wordlist/names/cities/canada>] @weight 0.9 |
[pick: <wordlist/names/cities/spain>] @weight 0.75 |
[pick: <wordlist/names/cities/alpha>] @weight 0.5 |
{ # stuffed/filled/covered
`{
[pick: <wordlist/nouns/fruit>] @weight 1 |
[pick: <wordlist/nouns/meat>] @weight 1 |
[pick: <wordlist/nouns/food>] @weight 1 |
[pick: <wordlist/nouns/cheese>] @weight 1 |
[pick: <wordlist/nouns/condiments>] @weight 1 |
[pick: <wordlist/nouns/music_theory>] @weight 0.5 |
[pick: <wordlist/nouns/music_production>] @weight 0.5 |
[pick: <wordlist/nouns/set_theory>] @weight 0.25 |
[pick: <wordlist/nouns/ghosts>] @weight 0.33 |
[pick: <wordlist/nouns/web_development>] @weight 0.25
} `{stuffed|filled|covered|dipped|coated}
} @weight 1 # stuffed/filled/covered
}
}
[$get_entree] @text {
{
[pick: <wordlist/nouns/food>] |
[pick: <wordlist/nouns/fast_food>]
}
}
##
[$mod_order] @text {
{
add | no | sub | extra |
half | left | right | side
} `{
[pick: <wordlist/nouns/condiments>] |
[pick: <wordlist/nouns/cheese>] |
[pick: <wordlist/nouns/food>] |
[pick: <wordlist/nouns/seasonings>] |
[pick: <wordlist/nouns/plants>]
}
}
##
{
a piece of `[pick: <wordlist/nouns/cheese>] cheese |
part of a `{
[if: [maybe]{[desc_food]}] [get_entree] |
[pick: <wordlist/nouns/fruit>]
}
}

View File

@@ -0,0 +1,4 @@
{
a watch |
a bracelet
}