diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index b0417e50b5010bfb31fce1ee32893c6c27fe8c9f..e3a0fe7032bd70e1c7d5ee340827ebb70f03b3c1 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -185,9 +185,9 @@ function _M:newGame() -- Create the entity to store various game state things self.state = GameState.new{} local birth_done = function() - if self.player.__allow_rod_recall then game.state:allowRodRecall(true) self.player.__allow_rod_recall = nil end - if self.player.__allow_transmo_chest and profile.mod.allow_build.birth_transmo_chest then - self.player.__allow_transmo_chest = nil + if self.state.birth.__allow_rod_recall then game.state:allowRodRecall(true) self.state.birth.__allow_rod_recall = nil end + if self.state.birth.__allow_transmo_chest and profile.mod.allow_build.birth_transmo_chest then + self.state.birth.__allow_transmo_chest = nil local chest = game.zone:makeEntityByName(game.level, "object", "TRANSMO_CHEST") if chest then game.zone:addEntity(game.level, chest, "object") diff --git a/game/modules/tome/class/GameState.lua b/game/modules/tome/class/GameState.lua index 3353c9e2f9ac4bc6b09508c06f4372f6e605cfa7..1283c81b691ab5fa58846e557e0b24fa95f8c638 100644 --- a/game/modules/tome/class/GameState.lua +++ b/game/modules/tome/class/GameState.lua @@ -38,6 +38,7 @@ function _M:init(t, no_default) self.boss_killed = 0 self.stores_restock = 1 self.east_orc_patrols = 4 + self.birth = {} end --- Restock all stores diff --git a/game/modules/tome/data/birth/classes/mage.lua b/game/modules/tome/data/birth/classes/mage.lua index e2f8b43e22f3e7e1c355427ddc604646243d49e1..6b26b7a726c037eba146e300cef8f30347e04ee8 100644 --- a/game/modules/tome/data/birth/classes/mage.lua +++ b/game/modules/tome/data/birth/classes/mage.lua @@ -223,6 +223,9 @@ newBirthDescriptor{ }, copy_add = { life_rating = -3, - resolvers.generic(function(self) self:grantQuest("lichform") end), + resolvers.generic(function(self) + self:grantQuest("lichform") + if game.state.birth.campaign_name ~= "maj-eyal" then self:setQuestStatus("lichform", engine.Quest.DONE) end + end), }, } diff --git a/game/modules/tome/data/birth/worlds.lua b/game/modules/tome/data/birth/worlds.lua index cf3dd82c9cbb788bb994424158e86b7bc76c5a9e..76ceb04dd43241fc9b8889899e2e5bb05cfc7f46 100644 --- a/game/modules/tome/data/birth/worlds.lua +++ b/game/modules/tome/data/birth/worlds.lua @@ -74,10 +74,11 @@ newBirthDescriptor{ "But what lurks in the shadows of the world?", }, descriptor_choices = default_eyal_descriptors{}, - copy = { + game_state = { + campaign_name = "maj-eyal", __allow_rod_recall = true, __allow_transmo_chest = true, - } + }, } newBirthDescriptor{ @@ -96,8 +97,6 @@ newBirthDescriptor{ }, descriptor_choices = default_eyal_descriptors{ difficulty = { Tutorial = "never"} }, copy = { - __allow_transmo_chest = true, - -- Can levelup forever resolvers.generic(function(e) e.max_level = nil end), no_points_on_levelup = function(self) @@ -130,6 +129,11 @@ newBirthDescriptor{ self.starting_intro = "infinite-dungeon" end, }, + game_state = { + campaign_name = "infinite-dungeon", + __allow_transmo_chest = true, + is_infinite_dungeon = true, + }, } newBirthDescriptor{ @@ -157,111 +161,9 @@ newBirthDescriptor{ self.starting_intro = "arena" end, }, -} - -newBirthDescriptor{ - type = "world", - name = "Spydre", - display_name = "Spydrë: Thouch of the Spider", - locked = function() return profile.mod.allow_build.campaign_spidre and true or "hide" end, - locked_desc = "", - desc = - { - "Spydrë is home to the essence of spiders. The mighty Ungoliant of Arda actually originated from this world.", - "It is home to uncounted numbers of spider races, all fighting for supremacy of all the lands.", - "Some humanoids also live there, but they are usually the prey, not the hunter.", - }, - descriptor_choices = - { - race = - { - __ALL__ = "disallow", - Human = "allow", --- Spider = function() return profile.mod.allow_build.spider and "allow" or "disallow" end, - }, - }, -} - -newBirthDescriptor{ - type = "world", - name = "Trolls", - display_name = "Trolls: Pirates of the Kar'Haib", - locked = function() return profile.mod.allow_build.campaign_troll and true or "hide" end, - locked_desc = "", - desc = - { - "", - }, - descriptor_choices = - { - race = - { - __ALL__ = "disallow", - Human = "allow", --- Spider = function() return profile.mod.allow_build.spider and "allow" or "disallow" end, - }, + game_state = { + campaign_name = "arena", + is_arena = true, }, } -newBirthDescriptor{ - type = "world", - name = "Nagas", - display_name = "Nagas: Guardians of the Tide", - locked = function() return profile.mod.allow_build.campaign_naga and true or "hide" end, - locked_desc = "", - desc = - { - "", - }, - descriptor_choices = - { - race = - { - __ALL__ = "disallow", - Human = "allow", --- Spider = function() return profile.mod.allow_build.spider and "allow" or "disallow" end, - }, - }, -} - -newBirthDescriptor{ - type = "world", - name = "Faeros", - display_name = "Urthalath: Treason or the High Guards", - locked = function() return profile.mod.allow_build.campaign_faeros and true or "hide" end, - locked_desc = "", - desc = - { - "", - }, - descriptor_choices = - { - race = - { - __ALL__ = "disallow", - Human = "allow", --- Spider = function() return profile.mod.allow_build.spider and "allow" or "disallow" end, - }, - }, -} - -newBirthDescriptor{ - type = "world", - name = "Undeads", - display_name = "Broken Oath: The Curse of Undeath", - locked = function() return profile.mod.allow_build.campaign_undead and true or "hide" end, - locked_desc = "", - desc = - { - "", - }, - descriptor_choices = - { - race = - { - __ALL__ = "disallow", - Human = "allow", --- Spider = function() return profile.mod.allow_build.spider and "allow" or "disallow" end, - }, - }, -} diff --git a/game/modules/tome/dialogs/Birther.lua b/game/modules/tome/dialogs/Birther.lua index 91fdaaa1c5d8dd78627efa45a25d43c4062f605c..1345c1182046d7ecd801ef891b1594f80311a3c0 100644 --- a/game/modules/tome/dialogs/Birther.lua +++ b/game/modules/tome/dialogs/Birther.lua @@ -198,6 +198,16 @@ function _M:applyingDescriptor(i, d) end end end + if d.game_state then + local copy = table.clone(d.game_state, true) + -- Append array part + while #copy > 0 do + local f = table.remove(copy) + table.insert(game.state.birth, f) + end + -- Copy normal data + table.merge(game.state.birth, copy, true) + end end function _M:atEnd(v)