Skip to content
Snippets Groups Projects
Commit 0aa74896 authored by dg's avatar dg
Browse files

Birther.new() takes a new first parameter: either nil or a special title to...

Birther.new() takes a new first parameter: either nil or a special title to display. *WARNING* modules need to update
The game will now display the current number of unlocked birth options and the max during character creation


git-svn-id: http://svn.net-core.org/repos/t-engine4@2203 51575b47-30f0-44d4-a5cc-537603b46e54
parent d1414a15
No related branches found
No related tags found
No related merge requests found
......@@ -67,7 +67,7 @@ end
--- Instanciates a birther for the given actor
function _M:init(actor, order, at_end, quickbirth, w, h)
function _M:init(title, actor, order, at_end, quickbirth, w, h)
self.quickbirth = quickbirth
self.actor = actor
self.order = order
......@@ -84,7 +84,7 @@ function _M:init(actor, order, at_end, quickbirth, w, h)
self.at_end = at_end
end
Dialog.init(self, "Character Creation: "..actor.name, w or 600, h or 400)
Dialog.init(self, title and title or ("Character Creation: "..actor.name), w or 600, h or 400)
self.descriptors = {}
......
......@@ -100,7 +100,7 @@ function _M:newGame()
self:setupDisplayMode()
self.creating_player = true
local birth = Birther.new(self.player, {"base", "race", "class" }, function()
local birth = Birther.new(nil, self.player, {"base", "race", "class" }, function()
self:changeLevel(1, "dungeon")
print("[PLAYER BIRTH] resolve...")
self.player:resolve()
......
......@@ -95,7 +95,7 @@ function _M:newGame()
self:setupDisplayMode()
self.creating_player = true
local birth = Birther.new(self.player, {"base", "role" }, function()
local birth = Birther.new(nil, self.player, {"base", "role" }, function()
self:changeLevel(1, "dungeon")
print("[PLAYER BIRTH] resolve...")
self.player:resolve()
......
......@@ -95,7 +95,7 @@ function _M:newGame()
self:setupDisplayMode()
self.creating_player = true
local birth = Birther.new(self.player, {"base", "role" }, function()
local birth = Birther.new(nil, self.player, {"base", "role" }, function()
self:changeLevel(1, "dungeon")
print("[PLAYER BIRTH] resolve...")
self.player:resolve()
......
......@@ -158,8 +158,10 @@ function _M:newGame()
self.always_target = true
local nb_unlocks, max_unlocks = self:countBirthUnlocks()
self.creating_player = true
local birth; birth = Birther.new(self.player, {"base", "difficulty", "world", "race", "subrace", "sex", "class", "subclass" }, function()
local birth; birth = Birther.new("Character Creation: "..self.player.name.." ("..nb_unlocks.."/"..max_unlocks.." unlocked birth options)", self.player, {"base", "difficulty", "world", "race", "subrace", "sex", "class", "subclass" }, function()
-- Save for quick birth
local save = Savefile.new(self.save_name)
save:saveQuickBirth(self.player.descriptor)
......@@ -1114,6 +1116,41 @@ function _M:placeRandomLoreObject(define)
end
end
--- Returns the current number of birth unlocks and the max
function _M:countBirthUnlocks()
local nb = 0
local max = 0
local list = {
campaign_infinite_dungeon = true,
undead_ghoul = true,
undead_skeleton = true,
mage = true,
mage_tempest = true,
mage_geomancer = true,
mage_pyromancer = true,
mage_cryomancer = true,
divine_anorithil = true,
divine_sun_paladin = true,
wilder_wyrmic = true,
wilder_summoner = true,
corrupter_reaver = true,
corrupter_corruptor = true,
afflicted_cursed = true,
afflicted_doomed = true,
}
for name, _ in pairs(list) do
max = max + 1
if profile.mod.allow_build[name] then nb = nb + 1 end
end
return nb, max
end
--------------------------------------------------------------
-- UI stuff
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment