diff --git a/game/modules/tome/class/Actor.lua b/game/modules/tome/class/Actor.lua index 1b19e2748af3246413e3f119de692c44b16b736a..7aa5d5f54960cbd73bae5439422820024dedc5cd 100644 --- a/game/modules/tome/class/Actor.lua +++ b/game/modules/tome/class/Actor.lua @@ -22,7 +22,7 @@ require "engine.Actor" require "engine.Autolevel" require "engine.interface.ActorInventory" require "engine.interface.ActorTemporaryEffects" -require "engine.interface.ActorLife" +require "mod.class.interface.ActorLife" require "engine.interface.ActorProject" require "engine.interface.ActorLevel" require "engine.interface.ActorStats" @@ -44,7 +44,7 @@ module(..., package.seeall, class.inherit( engine.Actor, engine.interface.ActorInventory, engine.interface.ActorTemporaryEffects, - engine.interface.ActorLife, + mod.class.interface.ActorLife, engine.interface.ActorProject, engine.interface.ActorLevel, engine.interface.ActorStats, @@ -201,7 +201,7 @@ function _M:init(t, no_default) engine.Actor.init(self, t, no_default) engine.interface.ActorInventory.init(self, t) engine.interface.ActorTemporaryEffects.init(self, t) - engine.interface.ActorLife.init(self, t) + mod.class.interface.ActorLife.init(self, t) engine.interface.ActorProject.init(self, t) engine.interface.ActorTalents.init(self, t) engine.interface.ActorResource.init(self, t) @@ -2003,7 +2003,7 @@ function _M:takeHit(value, src, death_note) end end - local dead, val = engine.interface.ActorLife.takeHit(self, value, src, death_note) + local dead, val = mod.class.interface.ActorLife.takeHit(self, value, src, death_note) if dead and src and src.attr and src:attr("overkill") and src.project and not src.turn_procs.overkill then src.turn_procs.overkill = true @@ -2038,7 +2038,7 @@ end function _M:die(src, death_note) if self.dead then self:disappear(src) self:deleteFromMap(game.level.map) return true end - engine.interface.ActorLife.die(self, src, death_note) + mod.class.interface.ActorLife.die(self, src, death_note) -- Gives the killer some exp for the kill local killer = nil diff --git a/game/modules/tome/class/Game.lua b/game/modules/tome/class/Game.lua index 0b8e6961fb2b1710bb5650d3e373b3417ba889f6..4b3938af180d1fb5035b1eaaa36676d1c4e0002f 100644 --- a/game/modules/tome/class/Game.lua +++ b/game/modules/tome/class/Game.lua @@ -1024,6 +1024,7 @@ function _M:displayDelayedLogDamage() if target.dead then if self.level.map.seens(x, y) and (rsrc == self.player or rtarget == self.player or self.party:hasMember(rsrc) or self.party:hasMember(rtarget)) then self.flyers:add(sx, sy, 30, (rng.range(0,2)-1) * 0.5, rng.float(-2.5, -1.5), ("Kill (%d)!"):format(dams.total), {255,0,255}, true) + game.logSeen(target, "#{bold}#%s killed %s!#{normal}#", src.name:capitalize(), target.name) end else if self.level.map.seens(x, y) and (rsrc == self.player or self.party:hasMember(rsrc)) then @@ -1034,6 +1035,8 @@ function _M:displayDelayedLogDamage() end end end + if self.delayed_death_message then game.log(self.delayed_death_message) end + self.delayed_death_message = nil self.delayed_log_damage = {} end diff --git a/game/modules/tome/class/interface/ActorLife.lua b/game/modules/tome/class/interface/ActorLife.lua new file mode 100644 index 0000000000000000000000000000000000000000..c4caebb40fd4e6c4a9d9115ef74bfb2c1a7936fa --- /dev/null +++ b/game/modules/tome/class/interface/ActorLife.lua @@ -0,0 +1,39 @@ +-- TE4 - T-Engine 4 +-- 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 + +require "engine.class" +local Base = require "engine.interface.ActorLife" + +--- Handles actors life and death +module(..., package.seeall, class.inherit(Base)) + +--- Remove some HP from an actor +-- If HP is reduced to 0 then remove from the level and call the die method.<br/> +-- When an actor dies its dead property is set to true, to wait until garbage collection deletes it +-- @return true/false if the actor died and the actual damage done +function _M:takeHit(value, src, death_note) + if self.onTakeHit then value = self:onTakeHit(value, src) end + self.life = self.life - value + self.changed = true + if self.life <= self.die_at then + if src.on_kill and src:on_kill(self) then return false, value end + return self:die(src, death_note), value + end + return false, value +end \ No newline at end of file diff --git a/game/modules/tome/class/interface/PartyDeath.lua b/game/modules/tome/class/interface/PartyDeath.lua index 904f004833a3f021edb82db4aae3721212056956..9c4621f823a9560a83905d755be2569baefd5f9e 100644 --- a/game/modules/tome/class/interface/PartyDeath.lua +++ b/game/modules/tome/class/interface/PartyDeath.lua @@ -114,8 +114,7 @@ function _M:onPartyDeath(src, death_note) end game:playSound("actions/death") - - game.log("#{bold}#"..msg.."#{normal}#") + game.delayed_death_message = "#{bold}#"..msg.."#{normal}#" if (not game.player.easy_mode_lifes or game.player.easy_mode_lifes <= 0) and not game.player.infinite_lifes then profile.chat.uc_ext:sendKillerLink(msg, src) end diff --git a/game/modules/tome/data/gfx/shaders/shield.frag b/game/modules/tome/data/gfx/shaders/shield.frag index bc30f75c53a16f794d18c298e34027466dfe479b..14a983e7ebf0344665b78ee09828c1e05372454e 100644 --- a/game/modules/tome/data/gfx/shaders/shield.frag +++ b/game/modules/tome/data/gfx/shaders/shield.frag @@ -33,6 +33,7 @@ void main(void) // Impact float it = tick - impact_tick; + float vaadjust = aadjust; if (it < impact_time) { float v = (impact_time - it) / impact_time; float il = distance(impact / ll, (vec2(0.5) - gl_TexCoord[0].xy) / ll); @@ -40,11 +41,11 @@ void main(void) v *= v * v; float ic = (1.0 - length(uv - impact)) * v * 3.0; c.rgb = mix(c.rgb, impact_color, ic); - aadjust *= 1.0 + v * 3.0; + vaadjust *= 1.0 + v * 3.0; } } - c.a *= aadjust; + c.a *= vaadjust; if (l <= 1.0) c.a = max(0.15, c.a);