Skip to content
Snippets Groups Projects
Commit 4f29141b authored by DarkGod's avatar DarkGod
Browse files

Merge branch 'master' into 'master'

Master

Fixed archery to properly do on_hit, on_crit, and on_kill effects for ranged weapons and ammo.  It now properly handles single and multiple effects from a single weapon or ammo.
parents a8a870e4 d8c87756
No related branches found
No related tags found
No related merge requests found
......@@ -390,34 +390,70 @@ local function archery_projectile(tx, ty, tg, self, tmp)
self:callTalent(self.T_WEAPON_FOLDING, "doWeaponFolding", target)
end
-- Special effect
if hitted and weapon and weapon.special_on_hit and weapon.special_on_hit.fct and (not target.dead or weapon.special_on_hit.on_kill) then
weapon.special_on_hit.fct(weapon, self, target)
-- Special weapon effects (passing the special definition to facilitate encapsulating multiple special effects)
if hitted and weapon and weapon.special_on_hit then
local specials = weapon.special_on_hit
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct and (not target.dead or special.on_kill) then
special.fct(weapon, self, target, dam, special)
end
end
end
-- Special effect... AMMO!
if hitted and ammo and ammo.special_on_hit and ammo.special_on_hit.fct and (not target.dead or ammo.special_on_hit.on_kill) then
ammo.special_on_hit.fct(ammo, self, target)
-- Special ammo effects (passing the special definition to facilitate encapsulating multiple special effects)
if hitted and ammo and ammo.special_on_hit then
local specials = ammo.special_on_hit
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct and (not target.dead or special.on_kill) then
special.fct(ammo, self, target, dam, special)
end
end
end
-- Special effect on crit
if crit and weapon and weapon.special_on_crit and weapon.special_on_crit.fct and (not target.dead or weapon.special_on_crit.on_kill) then
weapon.special_on_crit.fct(weapon, self, target)
--Special effect on crit
if hitted and crit and weapon and weapon.special_on_crit then
local specials = weapon.special_on_crit
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct and (not target.dead or special.on_kill) then
special.fct(weapon, self, target, dam, special)
end
end
end
-- Special effect on crit AMMO!
if crit and ammo and ammo.special_on_crit and ammo.special_on_crit.fct and (not target.dead or ammo.special_on_crit.on_kill) then
ammo.special_on_crit.fct(ammo, self, target)
--Special effect on crit AMMO!
if hitted and crit and ammo and ammo.special_on_crit then
local specials = ammo.special_on_crit
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct and (not target.dead or special.on_kill) then
special.fct(ammo, self, target, dam, special)
end
end
end
-- Special effect on kill
if hitted and weapon and weapon.special_on_kill and weapon.special_on_kill.fct and target.dead then
weapon.special_on_kill.fct(weapon, self, target)
if hitted and weapon and weapon.special_on_kill and target.dead then
local specials = weapon.special_on_kill
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct then
special.fct(weapon, self, target, dam, special)
end
end
end
-- Special effect on kill A-A-A-AMMMO!
if hitted and ammo and ammo.special_on_kill and ammo.special_on_kill.fct and target.dead then
ammo.special_on_kill.fct(ammo, self, target)
if hitted and ammo and ammo.special_on_kill and target.dead then
local specials = ammo.special_on_kill
if specials.fct then specials = {specials} end
for _, special in ipairs(specials) do
if special.fct then
special.fct(ammo, self, target, dam, special)
end
end
end
-- Siege Arrows
......
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