From 5ff253c1346dd097e8e4cce9c0b9235a8c00b33b Mon Sep 17 00:00:00 2001 From: Xaver-DaRed Date: Wed, 20 May 2026 02:01:10 +0200 Subject: [PATCH] Fix Light shot --- scripts/actions/abilities/light_shot.lua | 70 ++++++++++++------------ scripts/specs/core/CStatusEffect.lua | 5 ++ 2 files changed, 40 insertions(+), 35 deletions(-) diff --git a/scripts/actions/abilities/light_shot.lua b/scripts/actions/abilities/light_shot.lua index 7ac71334642..6b2d91f1fee 100644 --- a/scripts/actions/abilities/light_shot.lua +++ b/scripts/actions/abilities/light_shot.lua @@ -6,6 +6,15 @@ ---@type TAbility local abilityObject = {} +local diaInfo = +{ + [1] = 10, + [3] = 15, + [5] = 20, + [7] = 25, + [9] = 30, +} + abilityObject.onAbilityCheck = function(player, target, ability) --ranged weapon/ammo: You do not have an appropriate ranged weapon equipped. --no card: cannot perform that action. @@ -37,53 +46,44 @@ abilityObject.onUseAbility = function(player, target, ability, action) return xi.effect.SLEEP_I end - duration = duration * resist + if target:addStatusEffect(xi.effect.SLEEP_I, { power = 1, duration = math.floor(duration * resist), origin = player }) then + ability:setMsg(xi.msg.basic.JA_ENFEEB_IS) + else + ability:setMsg(xi.msg.basic.JA_NO_EFFECT_2) + end - local effects = {} + local _ = player:delItem(xi.item.LIGHT_CARD, 1) or player:delItem(xi.item.TRUMP_CARD, 1) + target:updateClaim(player) + -- Boost dia effect local dia = target:getStatusEffect(xi.effect.DIA) - - if dia ~= nil then - table.insert(effects, dia) + if not dia then + return xi.effect.SLEEP_I end - local threnody = target:getStatusEffect(xi.effect.THRENODY) + local diaOwner = dia:getOriginID() + local diaPower = dia:getPower() + local diaSubpower = dia:getSubPower() + local diaTier = dia:getTier() + local startTime = dia:getStartTime() - if threnody ~= nil and threnody:getSubPower() == xi.mod.DARK_MEVA then - table.insert(effects, threnody) + -- Already boosted + if diaSubpower > diaInfo[diaTier] then + return xi.effect.SLEEP_I end - if #effects > 0 then - local effect = effects[math.random(1, #effects)] - -- TODO: duration here overwrites all previous values, this logic needs to be verified - duration = effect:getDuration() - local startTime = effect:getStartTime() - local tick = effect:getTick() - local power = effect:getPower() - local subpower = effect:getSubPower() - local tier = effect:getTier() - local effectId = effect:getEffectType() - local subId = effect:getSubType() - power = power * 1.5 - subpower = subpower * 1.5 - target:delStatusEffectSilent(effectId) - target:addStatusEffect(effectId, { power = power, duration = duration, origin = player, tick = tick, subType = subId, subPower = subpower, tier = tier }) + diaPower = diaPower + 1 + diaSubpower = diaSubpower + math.floor(100 * 28 / 1024) -- TODO: Change ATTP, DEFP and similar mods from base 100 to base 10k - local newEffect = target:getStatusEffect(effectId) - if newEffect then - newEffect:setStartTime(startTime) - end - end + target:delStatusEffectSilent(xi.effect.DIA) + target:addStatusEffect(xi.effect.DIA, { power = diaPower, duration = dia:getDuration(), origin = player, tick = dia:getTick(), subType = dia:getSubType(), subPower = diaSubpower, tier = diaTier }) - if target:addStatusEffect(xi.effect.SLEEP_I, { power = 1, duration = duration, origin = player }) then - ability:setMsg(xi.msg.basic.JA_ENFEEB_IS) - else - ability:setMsg(xi.msg.basic.JA_NO_EFFECT_2) + local newEffect = target:getStatusEffect(xi.effect.DIA) + if newEffect then + newEffect:setStartTime(startTime) + newEffect:setOriginID(diaOwner) end - local _ = player:delItem(xi.item.LIGHT_CARD, 1) or player:delItem(xi.item.TRUMP_CARD, 1) - target:updateClaim(player) - return xi.effect.SLEEP_I end diff --git a/scripts/specs/core/CStatusEffect.lua b/scripts/specs/core/CStatusEffect.lua index 027a2af136a..491e1597307 100644 --- a/scripts/specs/core/CStatusEffect.lua +++ b/scripts/specs/core/CStatusEffect.lua @@ -149,3 +149,8 @@ end ---@return integer function CStatusEffect:getOriginID() end + +---@param originId integer +---@return nil +function CStatusEffect:setOriginID(originId) +end