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

Tutorial is now a special button in the birth UI, and both the basic and the...

Tutorial is now a special button in the birth UI, and both the basic and the stats tutorial are availavble


git-svn-id: http://svn.net-core.org/repos/t-engine4@4648 51575b47-30f0-44d4-a5cc-537603b46e54
parent e5fb2921
No related branches found
No related tags found
No related merge requests found
...@@ -74,12 +74,21 @@ function _M:display(x, y, nb_keyframes, ox, oy) ...@@ -74,12 +74,21 @@ function _M:display(x, y, nb_keyframes, ox, oy)
if self.focused then if self.focused then
if button == 1 and mx > ox and mx < ox+self.w and my > oy and my < oy+self.h then if button == 1 and mx > ox and mx < ox+self.w and my > oy and my < oy+self.h then
self:drawFrame(self.frame, x, y, 0, 1, 0, 1) self:drawFrame(self.frame, x, y, 0, 1, 0, 1)
elseif self.glow then
local v = self.glow + (1 - self.glow) * (1 + math.cos(core.game.getTime() / 300)) / 2
self:drawFrame(self.frame, x, y, v*0.8, v, 0, 1)
else else
self:drawFrame(self.frame_sel, x, y) self:drawFrame(self.frame_sel, x, y)
end end
else else
self:drawFrame(self.frame, x, y) if self.glow then
if self.focus_decay then local v = self.glow + (1 - self.glow) * (1 + math.cos(core.game.getTime() / 300)) / 2
self:drawFrame(self.frame, x, y, v*0.8, v, 0, 1)
else
self:drawFrame(self.frame, x, y)
end
if self.focus_decay and not self.glow then
self:drawFrame(self.frame_sel, x, y, 1, 1, 1, self.focus_decay / self.focus_decay_max_d) self:drawFrame(self.frame_sel, x, y, 1, 1, 1, self.focus_decay / self.focus_decay_max_d)
self.focus_decay = self.focus_decay - nb_keyframes self.focus_decay = self.focus_decay - nb_keyframes
if self.focus_decay <= 0 then self.focus_decay = nil end if self.focus_decay <= 0 then self.focus_decay = nil end
......
...@@ -273,7 +273,7 @@ The lower it is the faster it is. ...@@ -273,7 +273,7 @@ The lower it is the faster it is.
]] ]]
TOOLTIP_MINDPOWER = [[#GOLD#Mindpower#LAST# TOOLTIP_MINDPOWER = [[#GOLD#Mindpower#LAST#
Your mindpower value represents how powerful your mental abilities are. Your mindpower value represents how powerful your mental abilities are.
In addition, when you use mental abilities inflict temporary detrimental effects, every five points of mindpower counteracts a single turn of duration reduction granted by the enemy's saving throws. In addition, when your mental abilities inflict temporary detrimental effects, every five points of mindpower counteracts a single turn of duration reduction granted by the enemy's saving throws.In addition, when your mental abilities inflict temporary detrimental effects, every five points of mindpower counteracts a single turn of duration reduction granted by the enemy's saving throws.
]] ]]
------------------------------------------------------------- -------------------------------------------------------------
......
...@@ -35,9 +35,12 @@ newBirthDescriptor{ ...@@ -35,9 +35,12 @@ newBirthDescriptor{
}, },
descriptor_choices = descriptor_choices =
{ {
world = difficulty =
{ {
Tutorial = "disallow", Tutorial = "disallow",
},
world =
{
["Maj'Eyal"] = "allow", ["Maj'Eyal"] = "allow",
Infinite = "allow", Infinite = "allow",
Arena = "allow", Arena = "allow",
...@@ -90,7 +93,7 @@ newBirthDescriptor{ ...@@ -90,7 +93,7 @@ newBirthDescriptor{
newBirthDescriptor{ newBirthDescriptor{
type = "difficulty", type = "difficulty",
name = "Tutorial", name = "Tutorial",
selection_default = not profile.mod.allow_build.tutorial_done, never_show = true,
desc = desc =
{ {
"#GOLD##{bold}#Tutorial mode", "#GOLD##{bold}#Tutorial mode",
...@@ -154,7 +157,7 @@ newBirthDescriptor{ ...@@ -154,7 +157,7 @@ newBirthDescriptor{
newBirthDescriptor{ newBirthDescriptor{
type = "difficulty", type = "difficulty",
name = "Normal", name = "Normal",
selection_default = profile.mod.allow_build.tutorial_done, selection_default = true,
desc = desc =
{ {
"#GOLD##{bold}#Adventure mode#WHITE##{normal}#", "#GOLD##{bold}#Adventure mode#WHITE##{normal}#",
......
...@@ -45,7 +45,24 @@ newBirthDescriptor{ ...@@ -45,7 +45,24 @@ newBirthDescriptor{
newBirthDescriptor newBirthDescriptor
{ {
type = "subrace", type = "subrace",
name = "Tutorial Human", name = "Tutorial Basic",
desc = {
"A Human hailing from the northern town of Derth. A common kind of man, unremarkable in all respects.",
},
copy = {
default_wilderness = {1, 1, "wilderness"},
starting_zone = "tutorial",
starting_quest = "tutorial",
starting_intro = "tutorial",
moddable_tile = "human_#sex#",
moddable_tile_base = "base_cornac_01.png",
},
}
newBirthDescriptor
{
type = "subrace",
name = "Tutorial Stats",
desc = { desc = {
"A Human hailing from the northern town of Derth. A common kind of man, unremarkable in all respects.", "A Human hailing from the northern town of Derth. A common kind of man, unremarkable in all respects.",
}, },
......
...@@ -18,7 +18,7 @@ ...@@ -18,7 +18,7 @@
-- darkgod@te4.org -- darkgod@te4.org
return [[ return [[
Now you know the basics: what these seven #GOLD#combat stats#WHITE# mean and when they're used. It's time to look at some numbers. Now you know the basics: what these eight #GOLD#combat stats#WHITE# mean and when they're used. It's time to look at some numbers.
Head north to the stairs, and descend into the #GOLD#Dungeon of Adventurer Enlightenment.#WHITE# Head north to the stairs, and descend into the #GOLD#Dungeon of Adventurer Enlightenment.#WHITE#
]] ]]
...@@ -63,6 +63,7 @@ function _M:init(title, actor, order, at_end, quickbirth, w, h) ...@@ -63,6 +63,7 @@ function _M:init(title, actor, order, at_end, quickbirth, w, h)
self.c_premade = Button.new{text="Load premade", fct=function() self:loadPremadeUI() end} self.c_premade = Button.new{text="Load premade", fct=function() self:loadPremadeUI() end}
self.c_tile = Button.new{text="Select custom tile", fct=function() self:selectTile() end} self.c_tile = Button.new{text="Select custom tile", fct=function() self:selectTile() end}
self.c_cancel = Button.new{text="Cancel", fct=function() self:atEnd("quit") end} self.c_cancel = Button.new{text="Cancel", fct=function() self:atEnd("quit") end}
self.c_tut = Button.new{text="Tutorial", fct=function() self:tutorial() end}
self.c_name = Textbox.new{title="Name: ", text=(not config.settings.cheat and game.player_name == "player") and "" or game.player_name, chars=30, max_len=50, fct=function() self.c_name = Textbox.new{title="Name: ", text=(not config.settings.cheat and game.player_name == "player") and "" or game.player_name, chars=30, max_len=50, fct=function()
if config.settings.cheat then self:makeDefault() end if config.settings.cheat then self:makeDefault() end
...@@ -135,6 +136,7 @@ function _M:init(title, actor, order, at_end, quickbirth, w, h) ...@@ -135,6 +136,7 @@ function _M:init(title, actor, order, at_end, quickbirth, w, h)
{left=self.c_difficulty_text, top=self.c_campaign, ui=self.c_difficulty}, {left=self.c_difficulty_text, top=self.c_campaign, ui=self.c_difficulty},
{left=self.c_difficulty, top=self.c_campaign, ui=self.c_permadeath_text}, {left=self.c_difficulty, top=self.c_campaign, ui=self.c_permadeath_text},
{left=self.c_permadeath_text, top=self.c_campaign, ui=self.c_permadeath}, {left=self.c_permadeath_text, top=self.c_campaign, ui=self.c_permadeath},
{right=0, top=self.c_name, ui=self.c_tut},
-- Lists -- Lists
{left=0, top=self.c_permadeath, ui=self.c_race}, {left=0, top=self.c_permadeath, ui=self.c_race},
...@@ -162,6 +164,11 @@ function _M:init(title, actor, order, at_end, quickbirth, w, h) ...@@ -162,6 +164,11 @@ function _M:init(title, actor, order, at_end, quickbirth, w, h)
for i, item in ipairs(self.c_permadeath.c_list.list) do if self.default_permadeath == item.id then self.c_permadeath.c_list.sel = i break end end for i, item in ipairs(self.c_permadeath.c_list.list) do if self.default_permadeath == item.id then self.c_permadeath.c_list.sel = i break end end
self:setFocus(self.c_campaign) self:setFocus(self.c_campaign)
self:setFocus(self.c_name) self:setFocus(self.c_name)
if not profile.mod.allow_build.tutorial_done then
self:setFocus(self.c_tut)
self.c_tut.glow = 0.70
end
end end
function _M:checkNew(fct) function _M:checkNew(fct)
...@@ -279,6 +286,37 @@ function _M:makeDefault() ...@@ -279,6 +286,37 @@ function _M:makeDefault()
self:atEnd("created") self:atEnd("created")
end end
--- Run one of the tutorials
function _M:tutorial()
local run = function(t)
self:setDescriptor("sex", "Female")
self:setDescriptor("world", "Maj'Eyal")
self:setDescriptor("difficulty", "Tutorial")
self:setDescriptor("permadeath", "Adventure")
self:setDescriptor("race", "Tutorial Human")
self:setDescriptor("subrace", "Tutorial "..t)
self:setDescriptor("class", "Tutorial Adventurer")
self:setDescriptor("subclass", "Tutorial Adventurer")
self:atEnd("created")
end
local d = Dialog.new("Tutorials", 170, 100)
local basic = Button.new{text="Basic Gameplay", fct=function() run("Basic") d.key:triggerVirtual("EXIT") end}
local stats = Button.new{text="Advanced Stats", fct=function() run("Stats") d.key:triggerVirtual("EXIT") end}
local cancel = Button.new{text="Cancel", fct=function() d.key:triggerVirtual("EXIT") end}
local sep = Separator.new{dir="vertical", size=150}
d:loadUI{
{hcenter=0, top=0, ui=basic},
{hcenter=0, top=basic.h, ui=stats},
{hcenter=0, bottom=cancel.h, ui=sep},
{hcenter=0, bottom=0, ui=cancel},
}
d:setupUI(false, true)
d.key:addBind("EXIT", function() game:unregisterDialog(d) end)
game:registerDialog(d)
end
function _M:randomBirth() function _M:randomBirth()
-- Random sex -- Random sex
local sex = rng.percent(50) local sex = rng.percent(50)
...@@ -527,7 +565,7 @@ function _M:isDescriptorAllowed(d, ignore_type) ...@@ -527,7 +565,7 @@ function _M:isDescriptorAllowed(d, ignore_type)
end end
-- Check it is allowed -- Check it is allowed
return allowed return allowed and not d.never_show
end end
function _M:getLock(d) function _M:getLock(d)
......
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