Skip to content
Snippets Groups Projects
Commit 32ee810e authored by DarkGod's avatar DarkGod
Browse files

Combat:combatSpeed can take an additional speed

Fixed Skirmisher's Swift Shot abuse
parent d77af346
No related branches found
No related tags found
No related merge requests found
......@@ -63,6 +63,7 @@ end
-- one_shot = true(fire one shot), multishot (# of targets to hit)
-- limit_shots = maximum # of shots to fire
-- ignore_weapon_range = true (fire all weapons even if out of range of target)
-- add_speed = add to combat_physspeed for this attack
-- returns a table of target data containing a list of target spots {x=tx, y=ty, ammo=a.combat}
-- entries may include main = {}, off = {}, psi = {}
function _M:archeryAcquireTargets(tg, params)
......@@ -266,7 +267,7 @@ function _M:archeryAcquireTargets(tg, params)
end
if any > 0 then
local sound = (weaponC or pf_weaponC).sound
local speed = self:combatSpeed(weaponC or pf_weaponC)
local speed = self:combatSpeed(weaponC or pf_weaponC, params.add_speed or 0)
print("[SHOOT] speed", speed or 1, "=>", game.energy_to_act * (speed or 1))
if not params.no_energy then self:useEnergy(game.energy_to_act * (speed or 1)) end
if sound then game:playSoundNear(self, sound) end
......
......@@ -1338,9 +1338,9 @@ function _M:combatAPR(weapon)
end
--- Gets the weapon speed
function _M:combatSpeed(weapon)
function _M:combatSpeed(weapon, add)
weapon = weapon or self.combat or {}
return (weapon.physspeed or 1) / math.max(self.combat_physspeed, 0.1)
return (weapon.physspeed or 1) / math.max(self.combat_physspeed + (add or 0), 0.1)
end
--- Gets the crit rate
......
......@@ -70,12 +70,8 @@ newTalent {
format(self:getSpeed('archery') * 50)
end,
action = function(self, t)
local old_speed = self.combat_physspeed
self.combat_physspeed = old_speed * 2
local targets = self:archeryAcquireTargets(nil, {one_shot=true})
local targets = self:archeryAcquireTargets(nil, {one_shot=true, add_speed=self.combat_physspeed})
if not targets then
self.combat_physspeed = old_speed
return
end
......@@ -86,8 +82,6 @@ newTalent {
if hurricane_cd then
self.talents_cd["T_SKIRMISHER_HURRICANE_SHOT"] = math.max(0, hurricane_cd - 1)
end
self.combat_physspeed = old_speed
return true
end,
info = function(self, t)
......
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