Skip to content

Commit

Permalink
Fix: different archfiend levels had same bonetag
Browse files Browse the repository at this point in the history
Since the lawdemon1/2 and chaosdemon1/2 levels had a bonetag that was
constant for that branch, it was possible to load bones with the wrong
level. This meant that if someone left bones on Geryon's level in
Asphodel, and someone else's game placed Geryon in Cocytus, the Cocytus
level could generate Geryon's pasture normally, and the Asphodel level
would also be Geryon's pasture, restored from the bones file. (But
humorously, entering the throne room in the Asphodel level in this
example would still summon Baalzebub, since the dungeon structure knows
it's his level.)

Fix this by changing the bonetag dynamically based on the resident
archfiend, the same as how it works for the level name. This means that
e.g. in Cocytus, a bonC0.B Baalz file can coexist with a bonC0.G Geryon
file, and when bones are loaded, the game will only find the one with
the correct tag, if it exists.

That is, if a game's dungeon structure puts Baalzebub in Cocytus, the
player enters the appropriate level of Cocytus, and there is only a
Cocytus-Geryon bones file, it won't be selected; nor will a
Asphodel-Baalzebub bones file.

This change shouldn't break any existing bones files, but it should
render them incapable of loading.
  • Loading branch information
copperwater committed Sep 14, 2024
1 parent 920681a commit 874e48c
Showing 1 changed file with 12 additions and 12 deletions.
24 changes: 12 additions & 12 deletions dat/dungeon.lua
Original file line number Diff line number Diff line change
Expand Up @@ -6,14 +6,14 @@

-- Randomize a couple of demon lair placements. These strings are the special
-- level identifiers.
local lawdemon1 = 'baalz'
local lawdemon2 = 'geryon'
local lawdemon1 = { name='baalz', bonetag='B' }
local lawdemon2 = { name='geryon', bonetag='G' }
if percent(50) then
lawdemon1, lawdemon2 = lawdemon2, lawdemon1
end

local chaosdemon1 = 'orcus'
local chaosdemon2 = 'yeenoghu'
local chaosdemon1 = { name='orcus', bonetag='O' }
local chaosdemon2 = { name='yeenoghu', bonetag='Y' }
if percent(50) then
chaosdemon1, chaosdemon2 = chaosdemon2, chaosdemon1
end
Expand Down Expand Up @@ -299,8 +299,8 @@ dungeon = {
entry = 1,
levels = {
{
name = lawdemon1,
bonetag = "H",
name = lawdemon1.name,
bonetag = lawdemon1.bonetag,
base = 2
},
{
Expand All @@ -318,8 +318,8 @@ dungeon = {
alignment = "lawful",
levels = {
{
name = lawdemon2,
bonetag = "P",
name = lawdemon2.name,
bonetag = lawdemon2.bonetag,
base = 1
}
}
Expand All @@ -337,8 +337,8 @@ dungeon = {
base = 1
},
{
name = chaosdemon1,
bonetag = "P",
name = chaosdemon1.name,
bonetag = chaosdemon1.bonetag,
base = 2
}
}
Expand Down Expand Up @@ -373,8 +373,8 @@ dungeon = {
},
levels = {
{
name = chaosdemon2,
bonetag = "Q",
name = chaosdemon2.name,
bonetag = chaosdemon2.bonetag,
base = 3
}
}
Expand Down

0 comments on commit 874e48c

Please sign in to comment.