Skip to content
Snippets Groups Projects
Commit 69c429e7 authored by DarkGod's avatar DarkGod
Browse files

Combat:attackTarget() returns total damage done

als, nothing to see
parent 2cb94104
No related branches found
No related tags found
No related merge requests found
......@@ -170,6 +170,8 @@ function _M:attackTarget(target, damtype, mult, noenergy, force_unarmed)
break_stealth = true
end
local totaldam = 0
if not speed and not self:attr("disarmed") and not self:isUnarmed() and not force_unarmed then
local double_weapon
-- All weapons in main hands
......@@ -179,7 +181,8 @@ function _M:attackTarget(target, damtype, mult, noenergy, force_unarmed)
if combat and not o.archery then
if o.double_weapon and not double_weapon then double_weapon = o end
print("[ATTACK] attacking with (mainhand)", o.name)
local s, h = self:attackTargetWith(target, combat, damtype, mult)
local s, h, _curdam = self:attackTargetWith(target, combat, damtype, mult)
if _curdam then totaldam = totaldam + _curdam end
speed = math.max(speed or 0, s)
hit = hit or h
if hit and not sound then sound = combat.sound
......@@ -205,7 +208,8 @@ function _M:attackTarget(target, damtype, mult, noenergy, force_unarmed)
else
offhand = true
print("[ATTACK] attacking with (offhand)", o.name)
local s, h = self:attackTargetWith(target, combat, damtype, offmult)
local s, h, _curdam = self:attackTargetWith(target, combat, damtype, offmult)
if _curdam then totaldam = totaldam + _curdam end
speed = math.max(speed or 0, s)
hit = hit or h
if hit and not sound then sound = combat.sound
......@@ -220,7 +224,8 @@ function _M:attackTarget(target, damtype, mult, noenergy, force_unarmed)
if not speed and self.combat then
print("[ATTACK] attacking with innate combat")
local combat = self:getObjectCombat(nil, "barehand")
local s, h = self:attackTargetWith(target, combat, damtype, mult)
local s, h, _curdam = self:attackTargetWith(target, combat, damtype, mult)
if _curdam then totaldam = totaldam + _curdam end
speed = math.max(speed or 0, s)
hit = hit or h
if hit and not sound then sound = combat.sound
......@@ -249,7 +254,7 @@ function _M:attackTarget(target, damtype, mult, noenergy, force_unarmed)
-- Cancel stealth!
if break_stealth then self:breakStealth() end
self:breakLightningSpeed()
return hit
return hit, totaldam
end
--- Determines the combat field to use for this item
......
game/modules/tome/data/gfx/shockbolt/stars/eyal.png

251 KiB | W: | H:

game/modules/tome/data/gfx/shockbolt/stars/eyal.png

346 KiB | W: | H:

game/modules/tome/data/gfx/shockbolt/stars/eyal.png
game/modules/tome/data/gfx/shockbolt/stars/eyal.png
game/modules/tome/data/gfx/shockbolt/stars/eyal.png
game/modules/tome/data/gfx/shockbolt/stars/eyal.png
  • 2-up
  • Swipe
  • Onion skin
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