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

knockback breaths/balls will not do multiple knockbacks

git-svn-id: http://svn.net-core.org/repos/t-engine4@782 51575b47-30f0-44d4-a5cc-537603b46e54
parent 505dd3e9
No related branches found
No related tags found
No related merge requests found
......@@ -94,6 +94,7 @@ function _M:project(t, x, y, damtype, dam, particles)
end
-- Now project on each grid, one type
local tmp = {}
if type(damtype) == "function" then
local stop = false
for px, ys in pairs(grids) do
......@@ -113,13 +114,13 @@ function _M:project(t, x, y, damtype, dam, particles)
-- Friendly fire ?
if px == self.x and py == self.y then
if t.friendlyfire then
DamageType:get(damtype).projector(self, px, py, damtype, dam)
DamageType:get(damtype).projector(self, px, py, damtype, dam, tmp)
if particles then
game.level.map:particleEmitter(px, py, 1, particles.type)
end
end
else
DamageType:get(damtype).projector(self, px, py, damtype, dam)
DamageType:get(damtype).projector(self, px, py, damtype, dam, tmp)
if particles then
game.level.map:particleEmitter(px, py, 1, particles.type)
end
......
......@@ -303,10 +303,11 @@ newDamageType{
-- Physical damage + repulsion; checks for spell power against physical resistance
newDamageType{
name = "spellknockback", type = "SPELLKNOCKBACK",
projector = function(src, x, y, type, dam)
DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam)
projector = function(src, x, y, type, dam, tmp)
local target = game.level.map(x, y, Map.ACTOR)
if target then
if target and not tmp[target] then
tmp[target] = true
DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam)
if target:checkHit(src:combatSpellpower(), target:combatPhysicalResist(), 0, 95, 15) and target:canBe("knockback") then
target:knockback(src.x, src.y, 3)
game.logSeen(target, "%s is knocked back!", target.name:capitalize())
......@@ -320,10 +321,11 @@ newDamageType{
-- Physical damage + repulsion; checks for spell power against physical resistance
newDamageType{
name = "physknockback", type = "PHYSKNOCKBACK",
projector = function(src, x, y, type, dam)
DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam.dam)
projector = function(src, x, y, type, dam, tmp)
local target = game.level.map(x, y, Map.ACTOR)
if target then
if target and not tmp[target] then
tmp[target] = true
DamageType:get(DamageType.PHYSICAL).projector(src, x, y, DamageType.PHYSICAL, dam.dam)
if target:checkHit(src:combatAttackStr(), target:combatPhysicalResist(), 0, 95, 15) and target:canBe("knockback") then
target:knockback(src.x, src.y, dam.dist)
game.logSeen(target, "%s is knocked back!", target.name:capitalize())
......
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