From f5a5beef878809f38bb114de5989bd568925c61f Mon Sep 17 00:00:00 2001 From: DarkGod <darkgod@net-core.org> Date: Sun, 3 Nov 2013 16:10:59 +0100 Subject: [PATCH] Archery launchers can now have a damage multiplier and an on fire callback --- game/modules/tome/class/GameState.lua | 5 +++-- game/modules/tome/class/Object.lua | 1 + game/modules/tome/class/interface/Archery.lua | 3 ++- 3 files changed, 6 insertions(+), 3 deletions(-) diff --git a/game/modules/tome/class/GameState.lua b/game/modules/tome/class/GameState.lua index 2ecb05633b..08c4f208b5 100644 --- a/game/modules/tome/class/GameState.lua +++ b/game/modules/tome/class/GameState.lua @@ -1951,10 +1951,11 @@ function _M:canEventGridRadius(level, x, y, radius, min) else return list end end -function _M:findEventGrid(level) +function _M:findEventGrid(level, checker) local x, y = rng.range(1, level.map.w - 2), rng.range(1, level.map.h - 2) local tries = 0 - while not self:canEventGrid(level, x, y) and tries < 100 do + local can = checker or self.canEventGrid + while not can(self, level, x, y) and tries < 100 do x, y = rng.range(1, level.map.w - 2), rng.range(1, level.map.h - 2) tries = tries + 1 end diff --git a/game/modules/tome/class/Object.lua b/game/modules/tome/class/Object.lua index 6b03c0900f..b15a218222 100644 --- a/game/modules/tome/class/Object.lua +++ b/game/modules/tome/class/Object.lua @@ -535,6 +535,7 @@ function _M:getTextualDesc(compare_with) compare_fields(combat, compare_with, field, "block", "%+d", "Block value: ", 1, false, false, add_table) + compare_fields(combat, compare_with, field, "dam_mult", "%d%%", "Dam. multiplier: ", 100, false, false, add_table) compare_fields(combat, compare_with, field, "range", "%+d", "Firing range: ", 1, false, false, add_table) compare_fields(combat, compare_with, field, "capacity", "%d", "Capacity: ", 1, false, false, add_table) compare_fields(combat, compare_with, field, "shots_reloaded_per_turn", "%+d", "Reload speed: ", 1, false, false, add_table) diff --git a/game/modules/tome/class/interface/Archery.lua b/game/modules/tome/class/interface/Archery.lua index 4b8d23b094..8e155ec408 100644 --- a/game/modules/tome/class/interface/Archery.lua +++ b/game/modules/tome/class/interface/Archery.lua @@ -218,7 +218,7 @@ local function archery_projectile(tx, ty, tg, self, tmp) dam, crit = self:physicalCrit(dam, ammo, target, atk, def, tg.archery.crit_chance or 0, tg.archery.crit_power or 0) print("[ATTACK ARCHERY] after crit", dam) - dam = dam * mult + dam = dam * mult * (weapon.dam_mult or 1) print("[ATTACK ARCHERY] after mult", dam) if self:isAccuracyEffect(ammo, "mace") then @@ -512,6 +512,7 @@ function _M:archeryShoot(targets, talent, tg, params) for i = 1, #targets do local tg = table.clone(tg) tg.archery.ammo = targets[i].ammo + if realweapon.on_archery_trigger then realweapon.on_archery_trigger(realweapon, self, tg, params, targets[i], talent) end self:projectile(tg, targets[i].x, targets[i].y, archery_projectile) end end -- GitLab