Page 1 of 1

Deep wound makes the target kill itself

Posted: Sun Feb 13, 2011 4:29 am
by marvalis
Deep wound when used like in bleeding edge makes the target do bleeding damage to itself.
Red ant does 25 bleeding damage to red ant.
Red ant killed red ant!
right...

Code: Select all

newEffect{
	name = "DEEP_WOUND",
	desc = "Deep Wound",
	long_desc = function(self, eff) return ("Huge cut that bleeds, doing %0.2f physical damage per turn and decreasing all heals received by %d%%."):format(eff.power, eff.heal_factor) end,
	type = "physical",
	status = "detrimental",
	parameters = {power=10, heal_factor=30},
	on_gain = function(self, err) return "#Target# starts to bleed.", "+Deep Wounds" end,
	on_lose = function(self, err) return "#Target# stops bleeding.", "-Deep Wounds" end,
	activate = function(self, eff)
		eff.healid = self:addTemporaryValue("healing_factor", -eff.heal_factor / 100)
	end,
	on_timeout = function(self, eff)
		DamageType:get(DamageType.PHYSICAL).projector(eff.src or self, self.x, self.y, DamageType.PHYSICAL, eff.power)
	end,
	deactivate = function(self, eff)
		self:removeTemporaryValue("healing_factor", eff.healid)
	end,
}
newTalent{
name = "Bleeding Edge",
type = {"technique/battle-tactics", 3},
require = techs_req_high3,
points = 5,
cooldown = 12,
stamina = 24,
tactical = { ATTACK = 1, DISABLE = 2 },
action = function(self, t)
local tg = {type="hit", range=self:getTalentRange(t)}
local x, y, target = self:getTarget(tg)
if not x or not y or not target then return nil end
if math.floor(core.fov.distance(self.x, self.y, x, y)) > 1 then return nil end

local hit = self:attackTarget(target, nil, self:combatTalentWeaponDamage(t, 1, 1.7), true)
if hit then
if target:checkHit(self:combatAttackDex(), target:combatPhysicalResist(), 0, 95, 5) and target:canBe("cut") then
local sw = self:getInven("MAINHAND")
if sw then
sw = sw[1] and sw[1].combat
end
sw = sw or self.combat
local dam = self:combatDamage(sw)
local damrange = self:combatDamageRange(sw)
dam = rng.range(dam, dam * damrange)
dam = dam * self:combatTalentWeaponDamage(t, 2, 3.2)

target:setEffect(target.EFF_DEEP_WOUND, 7, {heal_factor=self:getTalentLevel(t) * 10, power=dam / 7})
end
end
return true
end,
info = function(self, t)
return ([[Lashes at the target, doing %d%% weapon damage.
If the attack hits the target will bleed for %d%% weapon damage over 7 turns and all healing will be reduced by %d%%.]]):
format(100 * self:combatTalentWeaponDamage(t, 1, 1.7), 100 * self:combatTalentWeaponDamage(t, 2, 3.2), self:getTalentLevel(t) * 10)
end,
}

Re: Deep wound makes the target kill itself

Posted: Sun Feb 13, 2011 2:38 pm
by Widget
I don't think that's a bug. It's to do with the fact that the bleeding effect is applied to the target, so an active effect attached to the Red ant is dealing damage to the Red ant. Basically, as far as the game's concerned the source of the damage is the target itself.

Re: Deep wound makes the target kill itself

Posted: Sun Feb 13, 2011 4:08 pm
by Zaive
You sure? When you get poisoned by an enemy it always says that enemy is dealing damage to you during the poison effect, not you to yourself.

Re: Deep wound makes the target kill itself

Posted: Tue Feb 15, 2011 12:35 am
by yufra
Looks like the issue is in the setEffect line, and the third argument table should have "src=self".

Re: Deep wound makes the target kill itself

Posted: Tue Feb 15, 2011 1:41 pm
by darkgod
fixed