Skip to content
Snippets Groups Projects
Commit 01df68a6 authored by Chris Davidson's avatar Chris Davidson
Browse files

Change how Bone Grab works

- Can now be targeted through allies (Rot worms, etc)

- Now checks Teleport resistance

- Always moves the target to the closest space adjacent to you
parent df867540
No related branches found
No related tags found
No related merge requests found
......@@ -1966,6 +1966,34 @@ function util.adjacentCoords(x, y, no_diagonals, no_cardinals)
return coords
end
--- Return the closest adjacent coordinate to the source coordinate from the target coordinate (use for gap closer positioning, etc)
-- @param x x-coordinate of the source tile.
-- @param y y-coordinate of the source tile.
-- @param tx x-coordinate of the target tile.
-- @param ty y-coordinate of the target tile.
-- @param check_block Boolean for whether to check for block_move
-- @param extra_check(x,y) Function to run on each grid and return true if that grid is invalid
-- @return Table containing the x,y coordinate of the closest grid.
function util.closestAdjacentCoord(x, y, tx, ty, check_block, extra_check)
local check_block = check_block or true
local coords = util.adjacentCoords(x, y)
local valid = {}
for _, coord in pairs(coords) do
if not (check_block and game.level.map:checkEntity(coord[1], coord[2], engine.Map.TERRAIN, "block_move")) and not (extra_check and extra_check(coord[1], coord[2])) then
valid[#valid+1] = coord
end
end
if #valid == 0 then return end
local closest = valid[1]
for _, coord in pairs(valid) do
if core.fov.distance(closest[1], closest[2], tx, ty, true) > core.fov.distance(coord[1], coord[2], tx, ty, true) then
closest = coord
end
end
return closest
end
function util.coordAddDir(x, y, dir)
local dx, dy = util.dirToCoord(dir, x, y)
return x + dx, y + dy
......
......@@ -72,7 +72,7 @@ newTalent{
getDuration = function(self, t) return math.floor(self:combatTalentScale(t, 4, 8)) end,
getDamage = function(self, t) return self:combatTalentSpellDamage(t, 5, 140) end,
action = function(self, t)
local tg = {type="bolt", range=self:getTalentRange(t), talent=t}
local tg = {type="bolt", range=self:getTalentRange(t), friendlyblock=false, talent=t}
local x, y = self:getTarget(tg)
if not x or not y then return nil end
......@@ -82,13 +82,23 @@ newTalent{
if not target then return end
if core.fov.distance(self.x, self.y, target.x, target.y) > 1 then
target:pull(self.x, self.y, tg.range)
DamageType:get(DamageType.PHYSICAL).projector(self, target.x, target.y, DamageType.PHYSICAL, dam)
if target:canBe("pin") then
target:setEffect(target.EFF_BONE_GRAB, t.getDuration(self, t), {apply_power=self:combatSpellpower()})
else
game.logSeen(target, "%s resists the pin!", target.name:capitalize())
end
local hit = self:checkHit(self:combatSpellpower(), target:combatSpellResist() + (target:attr("continuum_destabilization") or 0))
if not target:canBe("teleport") or not hit then
game.logSeen(target, "%s resists being teleported by Bone Grab!", target.name:capitalize())
return true
end
-- Grab the closest adjacent grid that doesn't have block_move or no_teleport
local grid = util.closestAdjacentCoord(self.x, self.y, target.x, target.y, true, function(x, y) return game.level.map.attrs(x, y, "no_teleport") end)
if not grid then return true end
target:teleportRandom(grid[1], grid[2], 0)
else
local tg = {type="cone", cone_angle=90, range=0, radius=6, friendlyfire=false}
......@@ -141,6 +151,7 @@ newTalent{
end,
callbackOnTalentPost = function(self, t, ab, ret, silent)
if ab.no_energy then return end
if ab.mode ~= "active" then return end
if self.turn_procs.bone_spike then return end
self.turn_procs.bone_spike = true
......@@ -182,7 +193,7 @@ newTalent{
direct_hit = true,
getRegen = function(self, t) return self:combatTalentLimit(t, 3, 20, 3.3) end,
getNb = function(self, t) return math.floor(self:combatTalentScale(t, 1, 3.5)) end,
getThreshold = function(self, t) return math.floor(self:combatSpellpower()) end,
getThreshold = function(self, t) return math.floor(self:combatSpellpower() * 0.7) end,
iconOverlay = function(self, t, p)
local p = self.sustain_talents[t.id]
if not p or not p.nb then return "" 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