diff --git a/game/engines/default/engine/dialogs/ShowEquipInven.lua b/game/engines/default/engine/dialogs/ShowEquipInven.lua index 84bf762fcbfcaf9777081e95144304ebb538166c..78cb0f18b692cb3e09befbe804859f14f4b6458c 100644 --- a/game/engines/default/engine/dialogs/ShowEquipInven.lua +++ b/game/engines/default/engine/dialogs/ShowEquipInven.lua @@ -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 diff --git a/game/engines/default/engine/dialogs/ShowStore.lua b/game/engines/default/engine/dialogs/ShowStore.lua index 519988da96c469584af3aaa8c9a22aa86ac60807..18894fbe7445e9d4d10b96a0d544ed743c31e363 100644 --- a/game/engines/default/engine/dialogs/ShowStore.lua +++ b/game/engines/default/engine/dialogs/ShowStore.lua @@ -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 diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index 2074c3aebb2dbd2d7afbefa4de90e9ef4fec0455..239245d612640520b231b1a9479258aa640ee0f7 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -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) diff --git a/game/modules/tome/data/talents/gifts/call.lua b/game/modules/tome/data/talents/gifts/call.lua index ca7be5ec2b6313b6ea18bd7ff7ec891c486ba437..0047f9f17595f1d25d3920be0489a4f2886a6f6e 100644 --- a/game/modules/tome/data/talents/gifts/call.lua +++ b/game/modules/tome/data/talents/gifts/call.lua @@ -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,