[b28] Foresight does not protect from effects
Posted: Mon Jul 11, 2011 7:45 pm
Intuitively, if my temporal warden avoids an attack with the foresight talent, it should also protect from additional effects that come with the attack, like stun from stunning blow, or freeze from freeze. At least with stunning blow however, I just got stunned by a Minotaur while avoiding the damage.
The problem seems to be that EFF_FORESIGHT is checked in Actor.onTakeHit(), so it does not actually avoid the hit, it only negates all damage.
techniques/2hweapon 229-234
Actor 1085-1089 (onTakeHit function)
The evasion talent (from cunning/survival) actually works correctly, here's the part in Combat.lua where it is checked for. So I'd suggest doing something similar for foresight, only that instead of checking a chance, EFF_FORESIGHT would get removed...
Combat 202-211
The problem seems to be that EFF_FORESIGHT is checked in Actor.onTakeHit(), so it does not actually avoid the hit, it only negates all damage.
techniques/2hweapon 229-234
Code: Select all
local speed, hit = self:attackTargetWith(target, weapon.combat, nil, self:combatTalentWeaponDamage(t, 1, 1.5))
-- Try to stun !
if hit then
if target:checkHit(self:combatAttackStr(weapon.combat), target:combatPhysicalResist(), 0, 95, 5 - self:getTalentLevel(t) / 2) and target:canBe("stun") then
target:setEffect(target.EFF_STUNNED, 2 + self:getTalentLevel(t), {})
Code: Select all
if self:hasEffect(self.EFF_FORESIGHT) and value >= (self.max_life / 10) then
self:removeEffect(self.EFF_FORESIGHT)
game.logSeen(self, "%s avoids the attack.", self.name:capitalize())
value = 0
end
Combat 202-211
Code: Select all
--- Try to totally evade an attack
function _M:checkEvasion(target)
if not target:attr("evasion") then return end
local evasion = target:attr("evasion")
print("checkEvasion", evasion, target.level, self.level)
evasion = evasion * (target.level / self.level)
print("=> evasion chance", evasion)
return rng.percent(evasion)
end