Page 1 of 1

[1.6b]Counter Shot

Posted: Mon Sep 23, 2019 12:11 am
by nsrr
Bug
Counter Shot (Buckler Training #4) does not fire a counter shot when deflecting a projectile, as the talent states.

Fix
Update mod/class/Actor.lua:on_project_acquire to trigger the talent if it is know when a projectile is deflected, as below.

Code: Select all

function _M:on_project_acquire(tx, ty, who, t, x, y, damtype, dam, particles, is_projectile, mods)
   if is_projectile and self:attr("projectile_evasion") and rng.percent(self.projectile_evasion) then
      if self:knowTalent(self.T_SKIRMISHER_COUNTER_SHOT) then
          local tal = self:getTalentFromId(self.T_SKIRMISHER_COUNTER_SHOT)
          tal.doCounter(self, tal, who)
      end
      local spread = self.projectile_evasion_spread or 1
      mods.x = x + rng.range(-spread, spread)
      mods.y = y + rng.range(-spread, spread)

      local dir = game.level.map:compassDirection(mods.x-x, mods.y-y)
      if not dir then
         dir = "but fumbles!"
      else
         dir = "to the "..dir.."!"
      end
      self:logCombat(who, "#Source# deflects the projectile from #Target# %s", dir)
      return true
   end
end
Edit: Corrected the talent id in the fixed code. I forgot that Skirmisher talents all have defined short_names with 'SKIRMISHER' at the beginig for some reason.

Re: [1.6b]Counter Shot

Posted: Wed Oct 09, 2019 9:55 am
by darkgod
fixed