Lua errors with Throw Bomb talent into magical darkness

Moderator: Moderator

Post Reply
Message
Author
Hachem_Muche
Uruivellas
Posts: 744
Joined: Thu Nov 18, 2010 6:42 pm

Lua errors with Throw Bomb talent into magical darkness

#1 Post by Hachem_Muche »

Using Throw Bomb will generate a targetting error if you try to target a spot inside magical darkness. (The explosive damage is not impeded by darkness, however.)

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)
in _M:project in ActorProject.lua back to

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
in explosives.lua
Author of the Infinite 500 and PlenumTooltip addons, and the joys of Scaling in ToME.

darkgod
Master of Eyal
Posts: 10750
Joined: Wed Jul 24, 2002 9:26 pm
Location: Angolwen
Contact:

Re: Lua errors with Throw Bomb talent into magical darkness

#2 Post by darkgod »

fixd
[tome] joylove: You can't just release an expansion like one would release a Kraken XD
--
[tome] phantomfrettchen: your ability not to tease anyone is simply stunning ;)

Post Reply