Skip to content

Commit

Permalink
Vary the legacy start-of-game text based on role
Browse files Browse the repository at this point in the history
This provides a little extra flavor to the legacy text without writing a
completely new message for every role (unnecessary since the Marduk vs
Moloch backstory is always the same).

I did end up coming up with a different message for each role; initially
I had only about 8 planned. Regardless, any new role will still fall
back on "written in the Book" until a message is added.

I initially implemented this with a new '%W' quest pager format string,
but then got it to work purely in Lua instead, which is good because %W
wouldn't have been used anywhere else.

Closes #147
  • Loading branch information
copperwater committed Apr 13, 2024
1 parent 4ae65b2 commit e22d688
Show file tree
Hide file tree
Showing 2 changed files with 40 additions and 2 deletions.
40 changes: 38 additions & 2 deletions dat/quest.lua
Original file line number Diff line number Diff line change
Expand Up @@ -24,7 +24,41 @@
-- pline, unless the text contains newlines, or is too long to fit a message buffer,
-- then will be shown as a text window instead.


-- Return a role-specific variant on the middle part of the first sentence of
-- the legacy text, "It is written in the Book of %d" (the first and last parts
-- remain constant so this doesn't handle them)
function written_in_Book()
local role = u.role;
if role == 'Archeologist' then
return 'written in the Ancient Scrolls'
elseif role == 'Barbarian' then
return 'etched on the Tablets'
elseif role == 'Caveman' then
return 'painted in the Sacred Caves'
elseif role == 'Healer' then
return 'taught in the School'
elseif role == 'Knight' then
return 'told in the Legends'
elseif role == 'Monk' then
return 'chanted in the Rites'
elseif role == 'Priest' then
return 'catechized in the Temples'
elseif role == 'Ranger' then
return 'remembered in the Grove'
elseif role == 'Rogue' then
return 'whispered in the Secret History'
elseif role == 'Samurai' then
return 'illustrated in the Emakimono'
elseif role == 'Tourist' then
return 'referenced in the Guidebooks'
elseif role == 'Valkyrie' then
return 'sung in the Sagas'
elseif role == 'Wizard' then
return 'inscribed in the Tomes'
end
-- if a role doesn't have a string defined, fall back on the standard message
return 'written in the Book'
end

questtext = {
-- If a role doesn't have a specific message, try a fallback
Expand Down Expand Up @@ -174,7 +208,9 @@ Go now! You are banished from this place.]],
legacy = {
synopsis = "[%dC has chosen you to recover the Amulet of Yendor for %dI.]",
output = "menu",
text = [[It is written in the Book of %d:
-- used to be hardcoded "written in the Book", now replaced by
-- role-specific strings
text = "It is "..written_in_Book()..[[ of %d:
After the Creation, the cruel god Moloch rebelled
against the authority of Marduk the Creator.
Expand Down
2 changes: 2 additions & 0 deletions doc/xnh-changelog-9.0.md
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,8 @@ changes:
instead gives instructions on how to explicitly request that and prompts
again. (However, escaping or failing to enter a valid form 5 times still
causes a random polymorph.)
- The legacy text at the start of the game uses different role-based opening
lines that replace the standard "It is written in the Book of [deity]:"

### Architectural changes

0 comments on commit e22d688

Please sign in to comment.