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

Wild Gift Meditation can only be used with no monsters in sight, to prevent mistakes

Store and equipment listing can not bleed over vertically


git-svn-id: http://svn.net-core.org/repos/t-engine4@1288 51575b47-30f0-44d4-a5cc-537603b46e54
parent 1a1a1593
No related branches found
No related tags found
No related merge requests found
......@@ -34,7 +34,7 @@ function _M:init(title, actor, filter, action)
self.list = self.inven_list
self.sel = 1
self.scroll = 1
self.max = math.floor((self.ih * 0.8 - 5) / self.font_h) - 1
-- self.max = math.floor((self.ih * 0.8 - 5) / self.font_h) - 1
self:keyCommands({
__TEXTINPUT = function(c)
......@@ -96,11 +96,15 @@ function _M:init(title, actor, filter, action)
else
self.list = self.inven_list
end
self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list)
if button ~= "wheelup" and button ~= "wheeldown" then
self.sel = util.bound(self.scroll + math.floor(ty / self.font_h), 1, #self.list)
end
self.changed = true
if button == "left" and event == "button" then self:use()
elseif button == "right" and event == "button" then
elseif button == "wheelup" and event == "button" then self.key:triggerVirtual("MOVE_UP")
elseif button == "wheeldown" and event == "button" then self.key:triggerVirtual("MOVE_DOWN")
end
end },
}
......@@ -127,14 +131,17 @@ function _M:generateList()
local list = {}
local chars = {}
local i = 0
self.max_h = 0
for inven_id = 1, #self.actor.inven_def do
if self.actor.inven[inven_id] and self.actor.inven_def[inven_id].is_worn then
list[#list+1] = { name=self.actor.inven_def[inven_id].name, color={0x90, 0x90, 0x90}, inven=inven_id }
self.max_h = math.max(self.max_h, #self.actor.inven_def[inven_id].description:splitLines(self.iw - 10, self.font))
for item, o in ipairs(self.actor.inven[inven_id]) do
if not self.filter or self.filter(o) then
local char = string.char(string.byte('a') + i)
list[#list+1] = { name=char..") "..o:getDisplayString()..o:getName(), color=o:getDisplayColor(), object=o, inven=inven_id, item=item }
self.max_h = math.max(self.max_h, #o:getDesc():splitLines(self.iw - 10, self.font))
chars[char] = #list
i = i + 1
end
......@@ -152,6 +159,7 @@ function _M:generateList()
if not self.filter or self.filter(o) then
local char = string.char(string.byte('a') + i)
list[#list+1] = { name=char..") "..o:getDisplayString()..o:getName(), color=o:getDisplayColor(), object=o, inven=self.actor.INVEN_INVEN, item=item }
self.max_h = math.max(self.max_h, #o:getDesc():splitLines(self.iw - 10, self.font))
chars[char] = #list
i = i + 1
end
......@@ -163,6 +171,7 @@ function _M:generateList()
self.list = self.inven_list
self.sel = 1
self.scroll = 1
self.max = math.floor((self.ih - 5) / self.font_h) - self.max_h
end
function _M:on_recover_focus()
......@@ -178,7 +187,7 @@ function _M:drawDialog(s)
lines = {}
end
local sh = self.ih - 4 - #lines * self.font:lineSkip()
local sh = self.ih - 4 - self.max_h * self.font:lineSkip()
h = sh
self:drawWBorder(s, 3, sh, self.iw - 6)
for i = 1, #lines do
......
......@@ -36,7 +36,7 @@ function _M:init(title, store_inven, actor_inven, store_filter, actor_filter, ac
self.list = self.store_list
self.sel = 1
self.scroll = 1
self.max = math.floor((self.ih * 0.8 - 5) / self.font_h) - 1
-- self.max = math.floor((self.ih * 0.8 - 5) / self.font_h) - 1
self:keyCommands({
__TEXTINPUT = function(c)
......@@ -94,9 +94,11 @@ function _M:generateList()
-- Makes up the list
local list = {}
local i = 0
self.max_h = 0
for item, o in ipairs(self.store_inven) do
if not self.store_filter or self.store_filter(o) then
list[#list+1] = { name=string.char(string.byte('a') + i)..") "..o:getDisplayString()..o:getName(), color=o:getDisplayColor(), object=o, item=item }
self.max_h = math.max(self.max_h, #o:getDesc():splitLines(self.iw - 10, self.font))
i = i + 1
end
end
......@@ -108,10 +110,12 @@ function _M:generateList()
for item, o in ipairs(self.actor_inven) do
if not self.actor_filter or self.actor_filter(o) then
list[#list+1] = { name=string.char(string.byte('a') + i)..") "..o:getDisplayString()..o:getName(), color=o:getDisplayColor(), object=o, item=item }
self.max_h = math.max(self.max_h, #o:getDesc():splitLines(self.iw - 10, self.font))
i = i + 1
end
end
self.actor_list = list
self.max = math.floor((self.ih - 5) / self.font_h) - self.max_h
end
function _M:drawDialog(s)
......@@ -121,7 +125,7 @@ function _M:drawDialog(s)
lines = {}
end
local sh = self.ih - 4 - #lines * self.font:lineSkip()
local sh = self.ih - 4 - self.max_h * self.font:lineSkip()
h = sh
self:drawWBorder(s, 3, sh, self.iw - 6)
for i = 1, #lines do
......
......@@ -72,7 +72,9 @@ function _M:init(t, no_default)
t.rank = t.rank or 3
t.old_life = 0
t.easy_mode_lifes = 1
if game.difficulty == game.DIFFICULTY_EASY then
t.easy_mode_lifes = 1
end
mod.class.Actor.init(self, t, no_default)
engine.interface.PlayerHotkeys.init(self, t)
......
......@@ -27,6 +27,16 @@ newTalent{
cooldown = 150,
range = 20,
action = function(self, t)
local seen = false
-- Check for visible monsters, only see LOS actors, so telepathy wont prevent it
core.fov.calc_circle(self.x, self.y, 20, function(_, x, y) return game.level.map:opaque(x, y) end, function(_, x, y)
local actor = game.level.map(x, y, game.level.map.ACTOR)
if actor and actor ~= self then seen = true end
end, nil)
if seen then
game.log("There's too much going on for you to use Meditation right now!")
return
end
self:setEffect(self.EFF_STUNNED, 17 - self:getTalentLevel(t), {})
self:incEquilibrium(-10 - self:getWil(50) * self:getTalentLevel(t))
game:playSoundNear(self, "talents/spell_generic2")
......@@ -34,6 +44,7 @@ newTalent{
end,
info = function(self, t)
return ([[Meditate on your link with Nature. You are considered stunned for %d turns and regenerate %d equilibrium.
Meditating require peace and quiet and may not be cast with hostile creatures in sight.
The effect will increase with your Willpower stat.]]):
format(17 - self:getTalentLevel(t), 10 + self:getWil(50) * self:getTalentLevel(t))
end,
......
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