Skip to content
Snippets Groups Projects
Commit 9fad7062 authored by dg's avatar dg
Browse files

even more particle effects: corrosive vapour & inferno

git-svn-id: http://svn.net-core.org/repos/t-engine4@701 51575b47-30f0-44d4-a5cc-537603b46e54
parent 6c31ca59
No related branches found
No related tags found
No related merge requests found
......@@ -657,15 +657,39 @@ end
-- @param damtype the DamageType to apply
-- @param radius the radius of the effect
-- @param dir the numpad direction of the effect, 5 for a ball effect
-- @param overlay a simple display entity to draw upon the map
-- @param overlay either a simple display entity to draw upon the map or a Particle class
-- @param update_fct optional function that will be called each time the effect is updated with the effect itself as parameter. Use it to change radius, move around ....
function _M:addEffect(src, x, y, duration, damtype, dam, radius, dir, angle, overlay, update_fct, friendlyfire)
if friendlyfire == nil then friendlyfire = true end
print(friendlyfire)
table.insert(self.effects, {
src=src, x=x, y=y, duration=duration, damtype=damtype, dam=dam, radius=radius, dir=dir, angle=angle, overlay=overlay,
local grids
-- Handle balls
if dir == 5 then
grids = core.fov.circle_grids(x, y, radius, true)
-- Handle beams
else
grids = core.fov.beam_grids(x, y, radius, dir, angle, true)
end
local e = {
src=src, x=x, y=y, duration=duration, damtype=damtype, dam=dam, radius=radius, dir=dir, angle=angle,
overlay=overlay.__CLASSNAME and overlay,
grids = grids,
update_fct=update_fct, friendlyfire=friendlyfire
})
}
if not overlay.__CLASSNAME then
e.particles = {}
for lx, ys in pairs(grids) do
for ly, _ in pairs(ys) do
e.particles[#e.particles+1] = self:particleEmitter(lx, ly, 1, overlay.type, overlay.args)
end
end
end
table.insert(self.effects, e)
self.changed = true
end
......@@ -673,20 +697,11 @@ end
function _M:displayEffects()
for i, e in ipairs(self.effects) do
-- Dont bother with obviously out of screen stuff
if e.x + e.radius >= self.mx and e.x - e.radius < self.mx + self.viewport.mwidth and e.y + e.radius >= self.my and e.y - e.radius < self.my + self.viewport.mheight then
local grids
if e.overlay and e.x + e.radius >= self.mx and e.x - e.radius < self.mx + self.viewport.mwidth and e.y + e.radius >= self.my and e.y - e.radius < self.my + self.viewport.mheight then
local s = self.tilesSurface:get(e.overlay.display, e.overlay.color_r, e.overlay.color_g, e.overlay.color_b, e.overlay.color_br, e.overlay.color_bg, e.overlay.color_bb, e.overlay.image, e.overlay.alpha)
-- Handle balls
if e.dir == 5 then
grids = core.fov.circle_grids(e.x, e.y, e.radius, true)
-- Handle beams
else
grids = core.fov.beam_grids(e.x, e.y, e.radius, e.dir, e.angle, true)
end
-- Now display each grids
for lx, ys in pairs(grids) do
for lx, ys in pairs(e.grids) do
for ly, _ in pairs(ys) do
if self.seens(lx, ly) then
s:toScreen(self.display_x + (lx - self.mx) * self.tile_w, self.display_y + (ly - self.my) * self.tile_h)
......@@ -728,7 +743,12 @@ function _M:processEffects()
end
end
for i = #todel, 1, -1 do table.remove(self.effects, todel[i]) end
for i = #todel, 1, -1 do
if self.effects[todel[i]].particles then
for j, ps in ipairs(self.effects[todel[i]].particles) do self:removeParticleEmitter(ps) end
end
table.remove(self.effects, todel[i])
end
end
......
......@@ -43,6 +43,10 @@ function _M:save()
})
end
function _M:cloned()
self:loaded()
end
function _M:loaded()
local def, fct, max, gl
if type(self.def) == "string" then
......
......@@ -46,13 +46,21 @@ newBirthDescriptor{
},
stats = { mag=2, str=2, dex=2, },
talents_types = {
["divine/sun"]={true, 0.3},
["technique/shield-offense"]={true, 0.1},
["technique/combat-techniques-active"]={false, 0.1},
["technique/combat-techniques-passive"]={true, 0.1},
["technique/combat-training"]={true, 0.1},
["cunning/survival"]={false, 0.1},
["divine/sun"]={true, 0},
["divine/chants"]={true, 0.3},
["divine/glyphs"]={true, 0.3},
["divine/combat"]={true, 0.3},
["divine/light"]={true, 0.3},
["divine/light"]={false, 0},
},
talents = {
[ActorTalents.T_CHANT_OF_FORTITUDE] = 1,
[ActorTalents.T_WEAPON_COMBAT] = 1,
[ActorTalents.T_HEAVY_ARMOUR_TRAINING] = 1,
[ActorTalents.T_MASSIVE_ARMOUR_TRAINING] = 1,
},
copy = {
max_life = 110,
......
-- 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
return { generator = function()
local ad = rng.range(0, 360)
local a = math.rad(ad)
local dir = math.rad(ad + 90)
local r = rng.range(1, 20)
local dirv = math.rad(1)
return {
trail = 1,
life = 10,
size = 4, sizev = -0.1, sizea = 0,
x = r * math.cos(a), xv = -0.1, xa = 0,
y = r * math.sin(a), yv = -0.1, ya = 0,
dir = dir, dirv = dirv, dira = dir / 20,
vel = 1, velv = 0, vela = 0.1,
r = rng.range(200, 255)/255, rv = 0, ra = 0,
g = rng.range(120, 170)/255, gv = 0.005, ga = 0.0005,
b = rng.range(0, 10)/255, bv = 0, ba = 0,
a = rng.range(25, 220)/255, av = 0, aa = 0.005,
}
end, },
function(self)
self.ps:emit(4)
end,
40
-- 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
-- Make up the grids list
local gs = {}
max_alpha = max_alpha or 220
-- Compute the clipping circle
local sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2
for i = -radius, radius do for j = -radius, radius do
local lastx, lasty = 0, 0
local l = line.new(0, 0, i, j)
local lx, ly = l()
while lx do
if grids[lx+tx] and grids[lx+tx][ly+ty] then
lastx, lasty = lx, ly
else
gs[lx] = gs[lx] or {}
gs[lx][ly] = {x=lastx, y=lasty, radius=math.sqrt(lastx^2 + lasty^2)}
-- print("block", lx, ly, "=>", math.sqrt(lastx^2 + lasty^2))
end
lx, ly = l()
end
end end
local nb = 0
return { generator = function()
local radius = radius
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(sradius - 12, sradius)
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)
if gs[bx] and gs[bx][by] and rng.chance(2) then
-- print("block at angle", ad, radius, ":=>", gs[bx][by].radius)
radius = gs[bx][by].radius
sradius = (radius + 0.5) * (engine.Map.tile_w + engine.Map.tile_h) / 2
local r = rng.float(sradius - 5, sradius)
x = r * math.cos(a)
y = r * math.sin(a)
end
local static = rng.percent(40)
return {
trail = 1,
life = 24,
size = 3, sizev = static and 0.05 or 0.15, sizea = 0,
x = x, xv = 0, xa = 0,
y = y, yv = 0, ya = 0,
dir = static and a + math.rad(90 + rng.range(10, 20)) or a, dirv = 0, dira = 0,
vel = static and 2 or 0.5 * (-1-nb) * radius / 2.7, velv = 0, vela = static and 0.01 or rng.float(-0.3, -0.2) * 0.3,
r = rng.range(220, 255)/255, rv = 0, ra = 0,
g = rng.range(200, 230)/255, gv = 0, ga = 0,
b = 0, bv = 0, ba = 0,
a = rng.range(25, max_alpha)/255, av = static and -0.034 or 0, aa = 0.005,
}
end, },
function(self)
if nb < 5 then
self.ps:emit(radius*266)
nb = nb + 1
self.ps:emit(radius*266)
nb = nb + 1
self.ps:emit(radius*266)
nb = nb + 1
self.ps:emit(radius*266)
nb = nb + 1
self.ps:emit(radius*266)
nb = nb + 1
end
end,
5*radius*266
--[[
local nb = 0
return { generator = function()
local ad = rng.range(0, 360)
local a = math.rad(ad)
local r = rng.range(2, sradius)
local boundx = r * math.cos(a)
local boundy = r * math.sin(a)
local x = math.floor(boundx / engine.Map.tile_w) + tx
local y = math.floor(boundy / engine.Map.tile_h) + ty
if not grids[x] or not grids[x][y] then return end
return {
trail = 1,
life = 12,
size = 3, sizev = 0.3, sizea = 0,
x = boundx, xv = 0, xa = 0,
y = boundy, yv = 0, ya = 0,
-- x = r * math.cos(a), xv = -0.1, xa = 0,
-- y = r * math.sin(a), yv = -0.1, ya = 0,
dir = a + 5 * math.rad(rng.range(10, 20)), dirv = math.rad(rng.range(10, 20)), dira = -math.rad(2),
vel = 1, velv = 0, vela = 0.1,
r = rng.range(200, 255)/255, rv = 0, ra = 0,
g = rng.range(120, 170)/255, gv = 0, ga = 0,
b = rng.range(0, 10)/255, bv = 0, ba = 0,
a = rng.range(25, 220)/255, av = 0, aa = 0,
}
end, },
function(self)
if nb < 2 then
self.ps:emit(800)
nb = nb + 1
end
end,
5000
]]
\ No newline at end of file
-- 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
return { generator = function()
local ad = rng.range(0, 360)
local a = math.rad(ad)
local dir = math.rad(ad + 90)
local r = rng.range(1, 20)
local dirv = math.rad(1)
return {
trail = 1,
life = 10,
size = 1, sizev = 0.4, sizea = 0,
x = r * math.cos(a), xv = -0.1, xa = 0,
y = r * math.sin(a), yv = -0.1, ya = 0,
dir = math.rad(rng.range(0, 360)), dirv = 0, dira = 0,
vel = 0.1, velv = 0, vela = 0,
r = rng.range(0, 20)/255, rv = 0, ra = 0,
g = rng.range(220, 255)/255, gv = 0.005, ga = 0.0005,
b = rng.range(100, 170)/255, bv = 0, ba = 0,
a = rng.range(25, 220)/255, av = 0, aa = 0.005,
}
end, },
function(self)
self.ps:emit(4)
end,
40,
"particle_torus"
......@@ -65,13 +65,14 @@ newTalent{
},
range = 6,
action = function(self, t)
local tg = {type="ball", range=0, friendlyfire=true, radius=5 + self:getTalentLevel(t), talent=t}
local tg = {type="ball", range=0, friendlyfire=true, radius=2 + self:getTalentLevel(t) / 2, talent=t}
tg.friendlyfire = false
self:project(tg, self.x, self.y, DamageType.BLIND, 3 + self:getTalentLevel(t))
local grids = self:project(tg, self.x, self.y, DamageType.BLIND, 3 + self:getTalentLevel(t))
self:project(tg, self.x, self.y, DamageType.LITE, 1)
if self:getTalentLevel(t) then
self:project(tg, self.x, self.y, DamageType.LIGHT, 4 + self:combatSpellpower(0.1) * self:getTalentLevel(t))
end
game.level.map:particleEmitter(self.x, self.y, tg.radius, "sunburst", {radius=tg.radius, grids=grids, tx=self.x, ty=self.y, max_alpha=80})
game:playSoundNear(self, "talents/flame")
return true
end,
......@@ -125,7 +126,10 @@ newTalent{
range = 3,
action = function(self, t)
local tg = {type="ball", range=0, radius=3, friendlyfire=false, talent=t}
self:project(tg, self.x, self.y, DamageType.LIGHT, self:spellCrit(10 + self:combatSpellpower(0.17) * self:getTalentLevel(t)), {type="light"})
local grids = self:project(tg, self.x, self.y, DamageType.LIGHT, self:spellCrit(10 + self:combatSpellpower(0.17) * self:getTalentLevel(t)))
game.level.map:particleEmitter(self.x, self.y, tg.radius, "sunburst", {radius=tg.radius, grids=grids, tx=self.x, ty=self.y})
game:playSoundNear(self, "talents/fireflash")
return true
end,
......
......@@ -122,9 +122,12 @@ newTalent{
DamageType.FIRE, dam,
radius,
5, nil,
engine.Entity.new{alpha=100, display='', color_br=180, color_bg=30, color_bb=60},
{type="inferno"},
nil, self:spellFriendlyFire()
)
-- self:project(tg, x, y, function(dx, dy) end, nil, {type="inferno"})
-- game.level.map:particleEmitter(x, y, 1, "inferno", {})
game:playSoundNear(self, "talents/fire")
return true
end,
......
......@@ -42,7 +42,7 @@ newTalent{
DamageType.ACID, dam,
radius,
5, nil,
engine.Entity.new{alpha=100, display='', color_br=30, color_bg=180, color_bb=60},
{type="vapour"},
nil, self:spellFriendlyFire()
)
game:playSoundNear(self, "talents/cloud")
......
No preview for this file type
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment