From 919368fb93f0c087555886306f18ad749eb1afb7 Mon Sep 17 00:00:00 2001 From: sruon Date: Tue, 3 Feb 2026 20:34:12 -0700 Subject: [PATCH] Critical WS tests --- .../s2c/0x028_battle2/weaponskills.lua | 136 +++++++++++++++++- 1 file changed, 135 insertions(+), 1 deletion(-) diff --git a/scripts/tests/packets/s2c/0x028_battle2/weaponskills.lua b/scripts/tests/packets/s2c/0x028_battle2/weaponskills.lua index a00ce146f10..47557f93826 100644 --- a/scripts/tests/packets/s2c/0x028_battle2/weaponskills.lua +++ b/scripts/tests/packets/s2c/0x028_battle2/weaponskills.lua @@ -6,6 +6,7 @@ local packets = ['Sequence'] = { test = function(player, mob) + stub('xi.combat.physicalHitRate.getPhysicalHitRate', 1) player:changeJob(xi.job.DNC) player:setLevel(99) player:addItem(xi.item.TERPSICHORE_99) @@ -161,10 +162,10 @@ local packets = ['Guarded WS'] = { test = function(player, mob) + stub('xi.combat.physicalHitRate.getPhysicalHitRate', 1) player:gotoZone(xi.zone.DYNAMIS_SAN_DORIA) player:changeJob(xi.job.DNC) player:setLevel(99) - player:setMod(xi.mod.ACC, 1000) player:addItem(xi.item.TERPSICHORE_99) player:equipItem(xi.item.TERPSICHORE_99, nil, xi.slot.MAIN) player:setTP(3000) @@ -352,6 +353,139 @@ local packets = }, }, }, + ['Guaranteed critical WS'] = + { + test = function(player, mob) + stub('xi.combat.physicalHitRate.getPhysicalHitRate', 1) + -- True Strike is guaranteed to crit + mob:setUnkillable(true) + player:changeJob(xi.job.WHM) + player:setLevel(99) + player:setSkillLevel(xi.skill.CLUB, 1750) + player:addItem(xi.item.ASH_CLUB) + player:equipItem(xi.item.ASH_CLUB, nil, xi.slot.MAIN) + player:setTP(3000) + player.actions:engage(mob) + player.actions:useWeaponskill(mob, xi.weaponskill.TRUE_STRIKE) + xi.test.world:skipTime(1) + end, + + expected = + { + { + m_uID = ph.TEST_CHAR, + trg_sum = 1, + res_sum = 0, + cmd_no = xi.action.category.WEAPONSKILL_START, + cmd_arg = xi.action.fourCC.SKILL_USE, + info = 0, + target = + { + { + m_uID = ph.TEST_MOB, + result_sum = 1, + result = + { + { + miss = 0, + kind = 0, + sub_kind = 0, + info = 0, + scale = 0, + value = xi.weaponskill.TRUE_STRIKE, + message = xi.msg.basic.READIES_WS, + bit = 0, + has_proc = false, + has_react = false, + }, + }, + }, + }, + }, + { + m_uID = ph.TEST_CHAR, + trg_sum = 1, + res_sum = 0, + cmd_no = xi.action.category.WEAPONSKILL_FINISH, + cmd_arg = xi.weaponskill.TRUE_STRIKE, + info = 0, + target = + { + { + m_uID = ph.TEST_MOB, + result_sum = 1, + result = + { + { + miss = 0, + kind = 3, + sub_kind = 82, + info = 2, + scale = ph.IGNORE, + value = ph.IGNORE, + message = xi.msg.basic.DAMAGE, + bit = 0, + has_proc = false, + has_react = false, + }, + }, + }, + }, + }, + }, + }, + ['Eventually critical WS'] = + { + test = function(player, mob) + stub('xi.combat.physicalHitRate.getPhysicalHitRate', 1) + mob:setUnkillable(true) + player:changeJob(xi.job.MNK) + player:setLevel(99) + player:addItem(xi.item.VERETHRAGNA_99) + player:equipItem(xi.item.VERETHRAGNA_99, nil, xi.slot.MAIN) + player.actions:engage(mob) + xi.test.world:skipTime(1) + + -- Surely we'll get at least 1 crit in 10 attempts... + for i = 1, 10 do + player:setTP(3000) + player.actions:useWeaponskill(mob, xi.weaponskill.VICTORY_SMITE) + xi.test.world:skipTime(1) + end + end, + + expected = + { + m_uID = ph.TEST_CHAR, + trg_sum = 1, + res_sum = 0, + cmd_no = xi.action.category.WEAPONSKILL_FINISH, + cmd_arg = xi.weaponskill.VICTORY_SMITE, + info = 0, + target = + { + { + m_uID = ph.TEST_MOB, + result_sum = 1, + result = + { + { + miss = 0, + kind = 3, + sub_kind = 29, + info = 2, + scale = ph.IGNORE, + value = ph.IGNORE, + message = xi.msg.basic.DAMAGE, + bit = 0, + has_proc = false, + has_react = false, + }, + }, + }, + }, + }, + }, } return packets