Skip to content
Snippets Groups Projects
Commit 14d19962 authored by DarkGod's avatar DarkGod
Browse files

New "Combat:attackTargetWith:beforeArmor" hook

parent 9fcb1be0
No related branches found
No related tags found
No related merge requests found
......@@ -492,6 +492,8 @@ function _M:attackTargetWith(target, weapon, damtype, mult, force_dam)
repelled = true
end
local no_procs = false
if repelled then
self:logCombat(target, "#Target# repels an attack from #Source#.")
elseif self:checkEvasion(target) then
......@@ -547,6 +549,16 @@ function _M:attackTargetWith(target, weapon, damtype, mult, force_dam)
print("[ATTACK] dagger accuracy bonus", atk, def, "=", bonus, "apr ==>", apr)
end
local hd = {"Combat:attackTargetWith:beforeArmor", target=target, weapon=weapon, damtype=damtype, mult=mult, dam=dam, apr=apr, atk=atk, def=def, armor=armor}
if self:triggerHook(hd) then
dam = hd.dam
damtype = hd.damtype
apr = hd.apr
armor = hd.armor
mult = hd.mult
no_procs = hd.no_procs
end
armor = math.max(0, armor - apr)
dam = math.max(dam * pres - armor, 0) + (dam * (1 - pres))
print("[ATTACK] after armor", dam)
......@@ -646,7 +658,9 @@ function _M:attackTargetWith(target, weapon, damtype, mult, force_dam)
end
]]
hitted = self:attackTargetHitProcs(target, weapon, dam, apr, armor, damtype, mult, atk, def, hitted, crit, evaded, repelled, old_target_life)
if not no_procs then
hitted = self:attackTargetHitProcs(target, weapon, dam, apr, armor, damtype, mult, atk, def, hitted, crit, evaded, repelled, old_target_life)
end
-- Visual feedback
if hitted then game.level.map:particleEmitter(target.x, target.y, 1, "melee_attack", {color=target.blood_color}) end
......
......@@ -54,7 +54,7 @@ newEntity{
newEntity{ base = "BASE_NPC_GWELGOROTH",
name = "gwelgoroth", color=colors.AQUAMARINE,
desc = _t[[Gwelgoroth are mighty air elementals, torn away from their home world by a powerful magic.]],
desc = _t[[Gwelgoroth are mighty air elementals, a pure incarnation of lightning and thunder.]],
level_range = {10, nil}, exp_worth = 1,
rarity = 1,
max_life = resolvers.rngavg(70,80),
......@@ -69,7 +69,7 @@ newEntity{ base = "BASE_NPC_GWELGOROTH",
newEntity{ base = "BASE_NPC_GWELGOROTH",
name = "greater gwelgoroth", color=colors.STEEL_BLUE,
resolvers.nice_tile{image="invis.png", add_mos = {{image="npc/elemental_air_greater_gwelgoroth.png", display_h=2, display_y=-1}}},
desc = _t[[Gwelgoroth are mighty air elementals, torn away from their home world by a powerful magic.]],
desc = _t[[Gwelgoroth are mighty air elementals, a pure incarnation of lightning and thunder.]],
level_range = {12, nil}, exp_worth = 1,
rarity = 3,
max_life = resolvers.rngavg(70,80), life_rating = 10,
......@@ -86,7 +86,7 @@ newEntity{ base = "BASE_NPC_GWELGOROTH",
newEntity{ base = "BASE_NPC_GWELGOROTH",
name = "ultimate gwelgoroth", color=colors.ROYAL_BLUE,
resolvers.nice_tile{image="invis.png", add_mos = {{image="npc/elemental_air_ultimate_gwelgoroth.png", display_h=2, display_y=-1}}},
desc = _t[[Gwelgoroth are mighty air elementals, torn away from their home world by a powerful magic.]],
desc = _t[[Gwelgoroth are mighty air elementals, a pure incarnation of lightning and thunder.]],
level_range = {15, nil}, exp_worth = 1,
rarity = 5,
rank = 3,
......
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