diff --git a/game/engines/default/engine/Map.lua b/game/engines/default/engine/Map.lua index f874d7dac11292f778acccf69e507de3cb5c132f..f4f4663e8b2e9d78f0d4e50ada3f8e71361e3896 100644 --- a/game/engines/default/engine/Map.lua +++ b/game/engines/default/engine/Map.lua @@ -783,8 +783,11 @@ function _M:addEffect(src, x, y, duration, damtype, dam, radius, dir, angle, ove local grids + -- Handle any angle + if type(dir) == "table" then + grids = core.fov.beam_any_angle_grids(x, y, radius, dir.angle, angle, true) -- Handle balls - if dir == 5 then + elseif dir == 5 then grids = core.fov.circle_grids(x, y, radius, true) -- Handle beams else @@ -859,7 +862,8 @@ function _M:processEffects() table.insert(todel, i) elseif e.update_fct then if e:update_fct() then - if e.dir == 5 then e.grids = core.fov.circle_grids(e.x, e.y, e.radius, true) + if type(dir) == "table" then e.grids = core.fov.beam_any_angle_gridse(e.x, e.y, e.radius, e.dir.angle, e.angle, true) + elseif e.dir == 5 then e.grids = core.fov.circle_grids(e.x, e.y, e.radius, true) else e.grids = core.fov.beam_grids(e.x, e.y, e.radius, e.dir, e.angle, true) end if e.particles then if e.particles_only_one then diff --git a/game/engines/default/engine/utils.lua b/game/engines/default/engine/utils.lua index f2b3746bb40f041976e5d5964729468a2029b23d..1cefad5d6a99c3420520db599d1505669e7b6dd7 100644 --- a/game/engines/default/engine/utils.lua +++ b/game/engines/default/engine/utils.lua @@ -906,6 +906,25 @@ function core.fov.beam_grids(x, y, radius, dir, angle, block) return grids end +function core.fov.beam_any_angle_grids(x, y, radius, dir_angle, angle, block) + if not x or not y then return {} end + if radius == 0 then return {[x]={[y]=true}} end + local grids = {} + core.fov.calc_beam_any_angle(x, y, game.level.map.w, game.level.map.h, radius, dir_angle, angle, function(_, lx, ly) + if block and game.level.map:checkEntity(lx, ly, engine.Map.TERRAIN, "block_move") then return true end + end, + function(_, lx, ly) + if not grids[lx] then grids[lx] = {} end + grids[lx][ly] = true + end, nil) + + -- point of origin + if not grids[x] then grids[x] = {} end + grids[x][y] = true + + return grids +end + --- Finds free grids around coords in a radius. -- This will return a random grid, the closest possible to the epicenter -- @param sx the epicenter coordinates diff --git a/game/modules/tome/data/talents/spells/fire.lua b/game/modules/tome/data/talents/spells/fire.lua index de298686e102822de298b96dbb6d18358e68ec13..abda93b7672b6b256ab3a29f570c8b2c370fe222 100644 --- a/game/modules/tome/data/talents/spells/fire.lua +++ b/game/modules/tome/data/talents/spells/fire.lua @@ -108,7 +108,7 @@ newTalent{ self.x, self.y, 4, DamageType.INFERNO, self:attr("burning_wake"), tg.radius, - dir, 55, + {angle=math.deg(math.atan2(y - self.y, x - self.x))}, 55, {type="inferno"}, nil, self:spellFriendlyFire() ) diff --git a/game/modules/tome/data/talents/spells/water.lua b/game/modules/tome/data/talents/spells/water.lua index 7a213984c89c1cd8d2c830eca67f05c6e956664d..78f76a10ff87880614fceb9baa71fe5adefa2d02 100644 --- a/game/modules/tome/data/talents/spells/water.lua +++ b/game/modules/tome/data/talents/spells/water.lua @@ -132,8 +132,8 @@ newTalent{ local damage = t.getDamage(self, t) local duration = t.getDuration(self, t) return ([[A wall of water rushes out from the caster doing %0.2f cold damage and %0.2f physical damage as well as knocking back targets each turn for %d turns. - The damage and duration will increase with the Magic stat]]): - format(damDesc(self, DamageType.COLD, damage/2), damDesc(self, DamageType.PHYSICAL, damage/2), duration) + The damage and duration will increase with the Magic stat]]): + format(damDesc(self, DamageType.COLD, damage/2), damDesc(self, DamageType.PHYSICAL, damage/2), duration) end, } @@ -161,7 +161,6 @@ newTalent{ 3, 5, nil, {type="icestorm", only_one=true}, --- engine.Entity.new{alpha=100, display='', color_br=30, color_bg=60, color_bb=200}, function(e) e.x = e.src.x e.y = e.src.y