diff --git a/game/engines/default/engine/Actor.lua b/game/engines/default/engine/Actor.lua index 4a830e6c2a3c968d81f12262f1e267d3818bcf5c..3aa9db72bde383c24db4cb31d5ceb9cb2aea59cf 100644 --- a/game/engines/default/engine/Actor.lua +++ b/game/engines/default/engine/Actor.lua @@ -142,7 +142,7 @@ function _M:defineDisplayCallback() end end - if self._mo == self._last_mo then + if self._mo == self._last_mo or not self._last_mo then self._mo:displayCallback(function(x, y, w, h) tactical(x, y, w, h) particles(x, y, w, h) diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 504099b9fb6be79e3b0c233fc5844f761dcd43ec..f3624c5abed1777b959eb2d0748e150a682b5cfd 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -874,7 +874,7 @@ function _M:defineDisplayCallback() end end - if self._mo == self._last_mo then + if self._mo == self._last_mo or not self._last_mo then self._mo:displayCallback(function(x, y, w, h, zoom, on_map) tactical(x, y, w, h, zoom, on_map) particles(x, y, w, h, zoom, on_map) diff --git a/game/modules/tome/data/gfx/particles/discharge_bolt.lua b/game/modules/tome/data/gfx/particles/discharge_bolt.lua new file mode 100644 index 0000000000000000000000000000000000000000..c2bf2d34d032f0e280275ffe66379981d1d44fd7 --- /dev/null +++ b/game/modules/tome/data/gfx/particles/discharge_bolt.lua @@ -0,0 +1,51 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010, 2011, 2012 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 + +return { generator = function() + local radius = 0 + local sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2 + local ad = rng.float(0, 360) + local a = math.rad(ad + 180) + local r = rng.float(0, sradius / 4) + local x = r * math.cos(a) + local y = r * math.sin(a) + local bx = math.floor(x / engine.Map.tile_w) + local by = math.floor(y / engine.Map.tile_h) + local static = rng.percent(40) + + return { + trail = 1, + life = 2, + size = 12, sizev = 0, sizea = 0, + + x = x, xv = 0, xa = 0, + y = y, yv = 0, ya = 0, + dir = a, dirv = 0, dira = 0, + vel = sradius / 2 / 24, velv = 0, vela = 0, + + r = rng.range(255, 255)/255, rv = 0, ra = 0, + g = rng.range(180, 230)/255, gv = 0, ga = 0, + b = 0, bv = 0, ba = 0, + a = rng.range(25, 220)/255, av = 0, aa = 0, + } +end, }, +function(self) + self.ps:emit(5) +end, +5*2 \ No newline at end of file diff --git a/game/modules/tome/data/gfx/particles/distortion_trail.lua b/game/modules/tome/data/gfx/particles/distortion_trail.lua new file mode 100644 index 0000000000000000000000000000000000000000..d7dd3c719cf64a072311d59ff0ea568e3b4fd5f7 --- /dev/null +++ b/game/modules/tome/data/gfx/particles/distortion_trail.lua @@ -0,0 +1,57 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010, 2011, 2012 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 + +local nb = 0 + +return { generator = function() + local radius = 0 + local sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2 + local ad = rng.float(0, 360) + local a = math.rad(ad) + local r = rng.float(0.1, sradius / 2) + local x = r * math.cos(a) + local y = r * math.sin(a) + local bx = math.floor(x / engine.Map.tile_w) + local by = math.floor(y / engine.Map.tile_h) + local static = rng.percent(40) + + return { + trail = 1, + life = 3 + 9 * (sradius - r) / sradius, + size = 3, sizev = 0, sizea = 0, + + x = x, xv = 0, xa = 0, + y = y, yv = 0, ya = 0, + dir = 0, dirv = 0, dira = 0, + vel = 0, velv = 0, vela = 0, + + + r = rng.range(255, 255)/255, rv = 0.005, ra = 0.0005, + g = rng.range(180, 255)/255, gv = 0.005, ga = 0.0005, + b = rng.range(180, 255)/255, bv = 0.005, ba = 0.0005, + a = rng.range(200, 255)/255, av = static and -0.034 or 0, aa = 0.005, + } +end, }, +function(self) + if nb < 1 then + self.ps:emit(40) + end + nb = nb + 1 +end, +40 diff --git a/game/modules/tome/data/gfx/particles/generic_blast.lua b/game/modules/tome/data/gfx/particles/generic_blast.lua new file mode 100644 index 0000000000000000000000000000000000000000..c21094610a5f9bc044ad05b2c2759a59464dee24 --- /dev/null +++ b/game/modules/tome/data/gfx/particles/generic_blast.lua @@ -0,0 +1,53 @@ +-- ToME - Tales of Middle-Earth +-- Copyright (C) 2009, 2010, 2011, 2012 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 +base_size = 32 + +local first = true + +return { generator = function() + local life = rng.range(20, 40) + local size = rng.range(4, 8) + local alpha = rng.range(100, 200) / 255 + local angle = math.rad(rng.range(0, 360)) + local distance = engine.Map.tile_w * rng.float(0.5, radius) + local vel = distance / life / 0.75 + + return { + trail = 1, + life = life, + size = size, sizev = size / life / 3, sizea = 0, + + x = -size / 2, xv = 0, xa = 0, + y = -size / 2, yv = 0, ya = 0, + dir = angle, dirv = 0, dira = 0, + vel = vel, velv = -vel / life / 2, vela = 0, + + r = rng.range(rm, rM)/255, rv = 0, ra = 0, + g = rng.range(gm, gM)/255, gv = 0, ga = 0, + b = rng.range(bm, bM)/255, bv = 0, ba = 0, + a = rng.range(am, aM)/255, av = -alpha / life / 2, aa = 0, + } +end, }, +function(self) + if first then + self.ps:emit(100 * radius) + first = false + end +end, +100 * radius * 60 \ No newline at end of file diff --git a/game/modules/tome/data/gfx/particles/generic_charge.lua b/game/modules/tome/data/gfx/particles/generic_charge.lua new file mode 100644 index 0000000000000000000000000000000000000000..fb1a5f9861844c641e0eaea1378eed1f0c84602b --- /dev/null +++ b/game/modules/tome/data/gfx/particles/generic_charge.lua @@ -0,0 +1,51 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010, 2011, 2012 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 + +base_size = 32 + +return { generator = function() + local life = rng.range(10, 20) + local size = rng.range(15, 20) + local angle = math.rad(rng.range(0, 360)) + local distance = engine.Map.tile_w * rng.float(2, 2.5) + local vel = distance / life + + return { + trail = 1, + life = life, + size = size, sizev = 0.2, sizea = 0, + + x = -size / 2 + distance * math.cos(angle), xv = 0, xa = 0, + y = -size / 2 + distance * math.sin(angle), yv = 0, ya = 0, + dir = angle, dirv = 0, dira = 0, + vel = -vel, velv = 0, vela = 0, + + r = rng.range(rm, rM)/255, rv = 0, ra = 0, + g = rng.range(gm, gM)/255, gv = 0, ga = 0, + b = rng.range(bm, bM)/255, bv = 0, ba = 0, + a = rng.range(am, aM)/255, av = 0.01, aa = 0, + } +end, }, +function(self) + self.nb = (self.nb or 0) + 1 + if self.nb < 6 then + self.ps:emit(10) + end +end, +120 diff --git a/game/modules/tome/data/gfx/particles/generic_discharge.lua b/game/modules/tome/data/gfx/particles/generic_discharge.lua new file mode 100644 index 0000000000000000000000000000000000000000..7aa2fd0740c6c3cf36cd30fb41145fcdf9b60f78 --- /dev/null +++ b/game/modules/tome/data/gfx/particles/generic_discharge.lua @@ -0,0 +1,50 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010, 2011, 2012 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 + +base_size = 32 + +return { generator = function() + local ad = rng.range(0, 360) + local a = math.rad(ad + 15) + local dir = math.rad(ad) + local r = rng.range(12, 20) + + return { + trail = 1, + life = 5, + size = 10, sizev = 0.08, sizea = 0, + + x = r * math.cos(a), xv = 0, xa = 0, + y = r * math.sin(a), yv = 0, ya = 0, + dir = dir, dirv = math.rad(3), dira = math.rad(3) / 3, + vel = 1.4, velv = 0, vela = 0, + + r = rng.range(rm, rM)/255, rv = 0, ra = 0, + g = rng.range(gm, gM)/255, gv = 0, ga = 0, + b = rng.range(bm, bM)/255, bv = 0, ba = 0, + a = rng.range(am, aM)/255, av = 0, aa = 0, + } +end, }, +function(self) + self.nb = (self.nb or 0) + 1 + if self.nb < 4 then + self.ps:emit(20) + end +end, +800 \ No newline at end of file diff --git a/game/modules/tome/data/gfx/particles/generic_power.lua b/game/modules/tome/data/gfx/particles/generic_power.lua new file mode 100644 index 0000000000000000000000000000000000000000..75aa564bd0c0a2f38ce64d51d8825d791002496e --- /dev/null +++ b/game/modules/tome/data/gfx/particles/generic_power.lua @@ -0,0 +1,50 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010, 2011, 2012 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 + +base_size = 32 + +return { generator = function() + local ad = rng.range(0, 360) + local a = math.rad(ad) + local dir = math.rad(90) + local r = rng.range(18, 22) + local dirchance = rng.chance(2) + local x = rng.range(-16, 16) + local y = 16 - math.abs(math.sin(x / 16) * 8) + + return { + trail = 1, + life = rng.range(10, 18), + size = rng.range(2, 3), sizev = 0, sizea = 0.005, + + x = x, xv = 0, xa = 0, + y = y, yv = 0, ya = -0.2, + dir = 0, dirv = 0, dira = 0, + vel = 0, velv = 0, vela = 0, + + r = rng.range(rm, rM)/255, rv = 0, ra = 0, + g = rng.range(gm, gM)/255, gv = 0, ga = 0, + b = rng.range(bm, bM)/255, bv = 0, ba = 0, + a = rng.range(am, aM)/255, av = 0, aa = 0, + } +end, }, +function(self) + self.ps:emit(4) +end, +40 diff --git a/game/modules/tome/data/gfx/particles/generic_teleport.lua b/game/modules/tome/data/gfx/particles/generic_teleport.lua new file mode 100644 index 0000000000000000000000000000000000000000..d1c7eb452595733d87c92099ec672f5339a38751 --- /dev/null +++ b/game/modules/tome/data/gfx/particles/generic_teleport.lua @@ -0,0 +1,47 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010, 2011, 2012 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 + +base_size = 32 + +return { generator = function() + local ad = rng.float(0, 360) + local dir = math.rad(ad) + + return { + x = math.cos(dir) * 5, y = math.sin(dir) * 5, + dir = dir, vel = rng.float(1, 3), + + life = rng.range(20, 30), + size = rng.range(3, 7), sizev = 0, sizea = 0, + + r = rng.range(rm, rM)/255, rv = 0, ra = 0, + g = rng.range(gm, gM)/255, gv = 0, ga = 0., + b = rng.range(bm, bM)/255, bv = 0, ba = 0, + a = rng.range(am, aM)/255, av = 0, aa = 0.005, + } + +end, }, +function(self) + self.nb = (self.nb or 0) + 1 + if self.nb < 6 then + self.ps:emit(50) + end +end, +300 + diff --git a/game/modules/tome/data/gfx/particles/generic_vortex.lua b/game/modules/tome/data/gfx/particles/generic_vortex.lua new file mode 100644 index 0000000000000000000000000000000000000000..b79b9a6264f4ac4d3f9f0714dffcee0e0771350a --- /dev/null +++ b/game/modules/tome/data/gfx/particles/generic_vortex.lua @@ -0,0 +1,48 @@ +-- ToME - Tales of Maj'Eyal +-- Copyright (C) 2009, 2010, 2011, 2012 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 + +return { generator = function() + local radius = radius + local sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2 + local ad = rng.range(0, 360) + local a = math.rad(ad) + local dir = math.rad(ad + 60) + local r = rng.float(0, sradius) + local dirv = math.rad(3) + + return { + trail = 1, + life = 2, + size = 4, sizev = 0, sizea = 0, + + x = r * math.cos(a), xv = 0, xa = 0, + y = r * math.sin(a), yv = 0, ya = 0, + dir = dir, dirv = 0, dira = 0, + vel = -r/8, velv = 0, vela = 0, + + r = rng.range(rm, rM)/255, rv = 0.005, ra = 0.0005, + g = rng.range(gm, gM)/255, gv = 0.005, ga = 0.0005, + b = rng.range(bm, bM)/255, bv = 0.005, ba = 0.0005, + a = rng.range(am, aM)/255, av = 0, aa = 0.005, + } +end, }, +function(self) + self.ps:emit(500*radius) +end, +500*radius*2 \ No newline at end of file diff --git a/game/modules/tome/data/gfx/particles/shader_shield.lua b/game/modules/tome/data/gfx/particles/shader_shield.lua index 211fbb36a5693d10c40c9540f681562fb9cc6e68..d50e5d57fc40b8fe7590dd6c7d0017b94526a22f 100644 --- a/game/modules/tome/data/gfx/particles/shader_shield.lua +++ b/game/modules/tome/data/gfx/particles/shader_shield.lua @@ -45,4 +45,4 @@ function(self) self.ps:emit(1) end, 1, -"particles_images/shield2" +"particles_images/"..(img or "shield2") diff --git a/game/modules/tome/data/gfx/particles_images/shield3.png b/game/modules/tome/data/gfx/particles_images/shield3.png new file mode 100644 index 0000000000000000000000000000000000000000..5eabed7968e7b8933f834dfb4f1e42ae3bdfe4cd Binary files /dev/null and b/game/modules/tome/data/gfx/particles_images/shield3.png differ diff --git a/game/modules/tome/data/timed_effects/other.lua b/game/modules/tome/data/timed_effects/other.lua index 3e5e127155e0e2f748824daf3d8bf834439f72ac..e365f2d550aa28ca034881c1ba85721cb160b83a 100644 --- a/game/modules/tome/data/timed_effects/other.lua +++ b/game/modules/tome/data/timed_effects/other.lua @@ -113,6 +113,14 @@ newEffect{ on_aegis = function(self, eff, aegis) self.time_shield_absorb = self.time_shield_absorb + eff.power * aegis / 100 end, + damage_feedback = function(self, eff, src, value) + if eff.particle and eff.particle._shader and eff.particle._shader.shad and src and src.x and src.y then + local r = -rng.float(0.2, 0.4) + local a = math.atan2(src.y - self.y, src.x - self.x) + eff.particle._shader:setUniform("impact", {math.cos(a) * r, math.sin(a) * r}) + eff.particle._shader:setUniform("impact_tick", core.game.getTime()) + end + end, activate = function(self, eff) if self:attr("shield_factor") then eff.power = eff.power * (100 + self:attr("shield_factor")) / 100 end if self:attr("shield_dur") then eff.dur = eff.dur + self:attr("shield_dur") end @@ -121,7 +129,11 @@ newEffect{ --- Warning there can be only one time shield active at once for an actor self.time_shield_absorb = eff.power self.time_shield_absorb_max = eff.power - eff.particle = self:addParticles(Particles.new("time_shield_bubble", 1)) + if core.shader.active() then + eff.particle = self:addParticles(Particles.new("shader_shield", 1, {img="shield3"}, {type="shield", time_factor=2000, color={1, 1, 0.3}})) + else + eff.particle = self:addParticles(Particles.new("time_shield_bubble", 1)) + end end, deactivate = function(self, eff) self:removeTemporaryValue("reduce_status_effects_time", eff.durid) @@ -1594,13 +1606,13 @@ newEffect{ if eff.target:attr("lucid_dreamer") then spawn_time = 2 end - if eff.dur%spawn_time == 0 then + if eff.dur%spawn_time == 0 then local x, y = util.findFreeGrid(eff.target.x, eff.target.y, 1, true, {[Map.ACTOR]=true}) if not x then game.logPlayer(self, "Not enough space to summon!") return end - + -- Create a clone for later spawning local m = require("mod.class.NPC").new(eff.target:clone{ shader = "shadow_simulacrum", @@ -1642,7 +1654,7 @@ newEffect{ m.no_timeflow = m.no_timeflow - 1 m.status_effect_immune = m.status_effect_immune - 1 m:removeParticles(eff.particle) - + -- track number killed m.on_die = function(self, who) if who then @@ -1650,7 +1662,7 @@ newEffect{ p.projections_killed = p.projections_killed + 1 end end - + game.zone:addEntity(game.level, m, "actor", x, y) game.level.map:particleEmitter(x, y, 1, "generic_teleport", {rm=0, rM=0, gm=180, gM=255, bm=180, bM=255, am=35, aM=90}) @@ -1756,7 +1768,7 @@ newEffect{ game.level.map:recreate() game.logPlayer(game.player, "#LIGHT_BLUE#You are brought back from the Dreamscape!") - + -- Apply Dreamscape hit if eff.projections_killed > 0 then eff.target:takeHit(eff.target.max_life/5 * eff.projections_killed, self)