The error appears to be caused by core.fov.calc_circle returning a nil table if the starting point is a darkened grid. This is then returned through
Code: Select all
if typ.ball and typ.ball > 0 then
==> core.fov.calc_circle(
stop_radius_x,
stop_radius_y,
game.level.map.w,
game.level.map.h,
typ.ball,
function(_, px, py)
if typ.block_radius and typ:block_radius(px, py) then return true end
end,
function(_, px, py)
-- Deal damage: ball
addGrid(px, py)
end,
nil)
addGrid(stop_x, stop_y)
Code: Select all
if self:knowTalent(self.T_EXPLOSION_EXPERT) then
local theorical_nb = ({ 9, 25, 45, 77, 109, 145 })[tg.radius] or 145
local nb = 0
==> local grids = self:project(tg, x, y, function(tx, ty) end)
for px, ys in pairs(grids) do for py, _ in pairs(ys) do nb = nb + 1 end end
nb = theorical_nb - nb
if nb > 0 then
local mult = math.log10(nb) / (6 - math.min(self:getTalentLevelRaw(self.T_EXPLOSION_EXPERT), 5))
print("Adjusting explosion damage to account for ", nb, " lost tiles => ", mult * 100)
dam = dam + dam * mult
end
end