diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 3df6e1d2cac25111e48860b36a094ff3dfab3d60..853dc3eac8645eadf6d500438aa0ffa3b1b845a8 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -277,13 +277,16 @@ function _M:display() end function _M:targetMode(v, msg, co, typ) + local old = self.target_mode + self.target_mode = v + if not v then Map:setViewerFaction(self.always_target and "players" or nil) if msg then self.log(type(msg) == "string" and msg or "Tactical display disabled. Press shift+'t' or right mouse click to enable.") end self.level.map.changed = true self.target:setActive(false) - if tostring(self.target_mode) == "exclusive" then + if tostring(old) == "exclusive" then self.key = self.normal_key self.key:setCurrent() if self.target_co then @@ -313,51 +316,39 @@ function _M:targetMode(v, msg, co, typ) end end end - self.target_mode = v end function _M:setupCommands() self.targetmode_key = engine.KeyBind.new() - self.targetmode_key:addCommands + self.targetmode_key:addCommands{ _SPACE=function() self:targetMode(false, false) end, } + self.targetmode_key:addBinds { - _t = function() - self:targetMode(false, false) - end, - _RETURN = {"alias", "_t"}, - _SPACE = {"alias", "_t"}, - _KP_ENTER = {"alias", "_t"}, - _ESCAPE = function() + TACTICAL_DISPLAY = function() self:targetMode(false, false) end, + ACCEPT = function() self:targetMode(false, false) end, + EXCIT = function() self.target.target.entity = nil self.target.target.x = nil self.target.target.y = nil self:targetMode(false, false) end, -- Targeting movement - [{"_LEFT","shift"}] = function() self.target:freemove(4) end, - [{"_RIGHT","shift"}] = function() self.target:freemove(6) end, - [{"_UP","shift"}] = function() self.target:freemove(8) end, - [{"_DOWN","shift"}] = function() self.target:freemove(2) end, - [{"_KP4","shift"}] = function() self.target:freemove(4) end, - [{"_KP6","shift"}] = function() self.target:freemove(6) end, - [{"_KP8","shift"}] = function() self.target:freemove(8) end, - [{"_KP2","shift"}] = function() self.target:freemove(2) end, - [{"_KP1","shift"}] = function() self.target:freemove(1) end, - [{"_KP3","shift"}] = function() self.target:freemove(3) end, - [{"_KP7","shift"}] = function() self.target:freemove(7) end, - [{"_KP9","shift"}] = function() self.target:freemove(9) end, - - _LEFT = function() if self.target_style == "lock" then self.target:scan(4) else self.target:freemove(4) end end, - _RIGHT = function() if self.target_style == "lock" then self.target:scan(6) else self.target:freemove(6) end end, - _UP = function() if self.target_style == "lock" then self.target:scan(8) else self.target:freemove(8) end end, - _DOWN = function() if self.target_style == "lock" then self.target:scan(2) else self.target:freemove(2) end end, - _KP4 = function() if self.target_style == "lock" then self.target:scan(4) else self.target:freemove(4) end end, - _KP6 = function() if self.target_style == "lock" then self.target:scan(6) else self.target:freemove(6) end end, - _KP8 = function() if self.target_style == "lock" then self.target:scan(8) else self.target:freemove(8) end end, - _KP2 = function() if self.target_style == "lock" then self.target:scan(2) else self.target:freemove(2) end end, - _KP1 = function() if self.target_style == "lock" then self.target:scan(1) else self.target:freemove(1) end end, - _KP3 = function() if self.target_style == "lock" then self.target:scan(3) else self.target:freemove(3) end end, - _KP7 = function() if self.target_style == "lock" then self.target:scan(7) else self.target:freemove(7) end end, - _KP9 = function() if self.target_style == "lock" then self.target:scan(9) else self.target:freemove(9) end end, + RUN_LEFT = function() self.target:freemove(4) end, + RUN_RIGHT = function() self.target:freemove(6) end, + RUN_UP = function() self.target:freemove(8) end, + RUN_DOWN = function() self.target:freemove(2) end, + RUN_LEFT_DOWN = function() self.target:freemove(1) end, + RUN_RIGHT_DOWN = function() self.target:freemove(3) end, + RUN_LEFT_UP = function() self.target:freemove(7) end, + RUN_RIGHT_UP = function() self.target:freemove(9) end, + + MOVE_LEFT = function() if self.target_style == "lock" then self.target:scan(4) else self.target:freemove(4) end end, + MOVE_RIGHT = function() if self.target_style == "lock" then self.target:scan(6) else self.target:freemove(6) end end, + MOVE_UP = function() if self.target_style == "lock" then self.target:scan(8) else self.target:freemove(8) end end, + MOVE_DOWN = function() if self.target_style == "lock" then self.target:scan(2) else self.target:freemove(2) end end, + MOVE_LEFT_DOWN = function() if self.target_style == "lock" then self.target:scan(1) else self.target:freemove(1) end end, + MOVE_RIGHT_DOWN = function() if self.target_style == "lock" then self.target:scan(3) else self.target:freemove(3) end end, + MOVE_LEFT_UP = function() if self.target_style == "lock" then self.target:scan(7) else self.target:freemove(7) end end, + MOVE_RIGHT_UP = function() if self.target_style == "lock" then self.target:scan(9) else self.target:freemove(9) end end, } self.normal_key = self.key @@ -600,6 +591,7 @@ function _M:setupMouse() if button == "wheelup" then self.logdisplay:scrollUp(1) end if button == "wheeldown" then self.logdisplay:scrollUp(-1) end end, {button=true}) + self.mouse:setCurrent() end --- Ask if we realy want to close, if so, save the game first diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index 6b680b613276611d3d4302686c256c2b52401b07..4a39c4ad01469471bf87aea1fb27256343b52b73 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -139,7 +139,7 @@ function _M:getTarget(typ) local msg if type(typ) == "string" then msg, typ = typ, nil elseif type(typ) == "table" then - if typ.default_target then self.target.target.entity = typ.default_target end + if typ.default_target then game.target.target.entity = typ.default_target end msg = typ.msg end game:targetMode("exclusive", msg, coroutine.running(), typ) diff --git a/game/modules/tome/data/talents/spells/conveyance.lua b/game/modules/tome/data/talents/spells/conveyance.lua index 1ed96ecafa4288f559dfbd551b18ced4193547af..bd4fd7aa73f21d0bc77b990fedac3b392e73fa4b 100644 --- a/game/modules/tome/data/talents/spells/conveyance.lua +++ b/game/modules/tome/data/talents/spells/conveyance.lua @@ -1,7 +1,6 @@ newTalent{ name = "Phase Door", type = {"spell/conveyance",1}, - message = "@Source@ blinks.", require = spells_req1, points = 5, mana = 10, @@ -13,15 +12,15 @@ newTalent{ local target = self if self:getTalentLevel(t) >= 5 then --- local tx, ty = self:getTarget{type="hit", range=10} --- if tx and ty then --- target = game.level.map(tx, ty, Map.ACTOR) or self --- end + local tx, ty = self:getTarget{type="hit", range=10} + if tx and ty then + target = game.level.map(tx, ty, Map.ACTOR) or self + end end local x, y = self.x, self.y if self:getTalentLevel(t) >= 4 then - x, y = self:getTarget{type="ball", range=10 + self:combatSpellpower(0.1), radius=7 - self:getTalentLevel(t)} + x, y = self:getTarget{type="ball", nolock=true, no_restrict=true, range=10 + self:combatSpellpower(0.1), radius=7 - self:getTalentLevel(t)} if not x then return nil end -- Target code doesnot restrict the target coordinates to the range, it lets the poject function do it -- but we cant ... @@ -47,7 +46,6 @@ newTalent{ newTalent{ name = "Teleport", type = {"spell/conveyance",2}, - message = "@Source@ teleports away.", require = spells_req2, points = 5, mana = 20, @@ -67,17 +65,17 @@ newTalent{ local x, y = self.x, self.y if self:getTalentLevel(t) >= 4 then - x, y = self:getTarget{type="ball", range=100 + self:combatSpellpower(1), radius=20 - self:getTalentLevel(t)} + x, y = self:getTarget{type="ball", nolock=true, no_restrict=true, range=100 + self:combatSpellpower(1), radius=20 - self:getTalentLevel(t)} if not x then return nil end -- Target code doesnot restrict the target coordinates to the range, it lets the poject function do it -- but we cant ... - x, y = game.target:pointAtRange(self.x, self.y, x, y, 10 + self:combatSpellpower(0.1)) + x, y = game.target:pointAtRange(self.x, self.y, x, y, 100 + self:combatSpellpower(0.1)) game.level.map:particleEmitter(target.x, target.y, 1, "teleport") target:teleportRandom(x, y, 20 - self:getTalentLevel(t)) game.level.map:particleEmitter(target.x, target.y, 1, "teleport") else game.level.map:particleEmitter(target.x, target.y, 1, "teleport") - target:teleportRandom(x, y, 100 + self:combatSpellpower(1)) + target:teleportRandom(x, y, 100 + self:combatSpellpower(0.1)) game.level.map:particleEmitter(target.x, target.y, 1, "teleport") end return true @@ -86,7 +84,7 @@ newTalent{ return ([[Teleports you randomly on a big scale range (%d) At level 4 it allows to specify the target area. At level 5 it allows to choose the target to teleport. - The range will increase with the Magic stat]]):format(10 + self:combatSpellpower(0.1)) + The range will increase with the Magic stat]]):format(100 + self:combatSpellpower(0.1)) end, }