diff --git a/game/modules/tome/class/Player.lua b/game/modules/tome/class/Player.lua index 3735ecad63af510de28326e1d14337440ea491be..4794828b9c76c3d9bd3ec700975d88e2c363fbf8 100644 --- a/game/modules/tome/class/Player.lua +++ b/game/modules/tome/class/Player.lua @@ -190,6 +190,16 @@ function _M:onTakeHit(value, src) local sx, sy = game.level.map:getTileToScreen(self.x, self.y) game.flyers:add(sx, sy, 30, (rng.range(0,2)-1) * 0.5, 2, "LOW HEALTH!", {255,0,0}, true) end + + -- Hit direction warning + if src.x and src.y and (self.x ~= src.x or self.y ~= src.y) then + local range = math.floor(core.fov.distance(src.x, src.y, self.x, self.y)) + if range > 1 then + local angle = math.atan2(src.y - self.y, src.x - self.x) + game.level.map:particleEmitter(self.x, self.y, 1, "hit_warning", {angle=math.deg(angle)}) + end + end + return ret end diff --git a/game/modules/tome/data/gfx/particles/hit_warning.lua b/game/modules/tome/data/gfx/particles/hit_warning.lua new file mode 100644 index 0000000000000000000000000000000000000000..9a71d2f5b09c9cf283255d7a129026063d7858bf --- /dev/null +++ b/game/modules/tome/data/gfx/particles/hit_warning.lua @@ -0,0 +1,46 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010 Nicolas Casalini +-- +-- This program is free software: you can redistribute it and/or modify +-- it under the terms of the GNU General Public License as published by +-- the Free Software Foundation, either version 3 of the License, or +-- (at your option) any later version. +-- +-- This program is distributed in the hope that it will be useful, +-- but WITHOUT ANY WARRANTY; without even the implied warranty of +-- MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the +-- GNU General Public License for more details. +-- +-- You should have received a copy of the GNU General Public License +-- along with this program. If not, see <http://www.gnu.org/licenses/>. +-- +-- Nicolas Casalini "DarkGod" +-- darkgod@te4.org +angle = angle or 0 +return { generator = function() + local ad = rng.range(-30, 30) + angle + local a = math.rad(ad) + local r = rng.range(15, 16) + + return { + life = 8, + size = 4, sizev = -0.1, sizea = 0, + + x = r * math.cos(a), xv = 0, xa = 0, + y = r * math.sin(a), yv = 0, ya = 0, + dir = 0, dirv = 0, dira = 0, + vel = 0, velv = 0, vela = 0, + + r = rng.range(160, 220)/255, rv = rng.range(0, 10), ra = 0, + g = 0, gv = 0, ga = 0, + b = 0, bv = rng.range(0, 10), ba = 0, + a = rng.range(70, 255)/255, av = 0, aa = 0, + } +end, }, +function(self) + self.nb = (self.nb or 0) + 1 + if self.nb < 4 then + self.ps:emit(10) + end +end, +100 diff --git a/ideas/zones.ods b/ideas/zones.ods index 32ebcc53cad241a4b898390dc58ce0aace88e0ae..ad61762869db26fd111462cda0f13629901ecdbd 100644 Binary files a/ideas/zones.ods and b/ideas/zones.ods differ