From 5afa98f24861dc90ed4b84464b9c23739af49f39 Mon Sep 17 00:00:00 2001 From: Ketsui Date: Tue, 17 Oct 2023 12:40:20 +0700 Subject: [PATCH] Pass wsID to xi.weaponskills.takeWeaponskillDamage() Before this patch, PUP's Automaton's ranged attack and weaponskill shows 0 damage done because of an error in xi.weaponskills.takeWeaponskillDamage(): [map][error] luautils::onUseWeaponSkill: ./scripts/globals/weaponskills.lua:1012: bad argument #1 to 'lshift' (number expected, got nil) Strangely enough, Atonement still correctly shows its damage even though it causes the same error, fix this by passing wsID to xi.weaponskills.takeWeaponskillDamage() as expected. --- scripts/actions/weaponskills/atonement.lua | 1 + scripts/globals/automatonweaponskills.lua | 2 ++ 2 files changed, 3 insertions(+) diff --git a/scripts/actions/weaponskills/atonement.lua b/scripts/actions/weaponskills/atonement.lua index 45986cb69c3..0183d1f7e1f 100644 --- a/scripts/actions/weaponskills/atonement.lua +++ b/scripts/actions/weaponskills/atonement.lua @@ -45,6 +45,7 @@ weaponskillObject.onUseWeaponSkill = function(player, target, wsID, tp, primary, } local calcParams = { + wsID = wsID, criticalHit = false, tpHitsLanded = 0, extraHitsLanded = 0, diff --git a/scripts/globals/automatonweaponskills.lua b/scripts/globals/automatonweaponskills.lua index 459eaa770b0..400c7208af4 100644 --- a/scripts/globals/automatonweaponskills.lua +++ b/scripts/globals/automatonweaponskills.lua @@ -190,6 +190,7 @@ xi.autows.doAutoPhysicalWeaponskill = function(attacker, target, wsID, tp, prima } local calcParams = {} + calcParams.wsID = wsID calcParams.weaponDamage = xi.weaponskills.getMeleeDmg(attacker, attack.weaponType, wsParams.kick) calcParams.attackInfo = attack calcParams.fSTR = utils.clamp(attacker:getStat(xi.mod.STR) - target:getStat(xi.mod.VIT), -10, 10) @@ -282,6 +283,7 @@ xi.autows.doAutoRangedWeaponskill = function(attacker, target, wsID, wsParams, t local calcParams = { + wsID = wsID, weaponDamage = { wsParams.weaponDamage or rangedDamage }, attackInfo = attack, fSTR = utils.clamp(attacker:getStat(xi.mod.STR) - target:getStat(xi.mod.VIT), -10, 10),