From fd4b60dfd2a12cdcd3d8576f12ef13971d7af233 Mon Sep 17 00:00:00 2001 From: xiekaidong Date: Fri, 2 Jun 2023 20:22:54 +0800 Subject: [PATCH] =?UTF-8?q?=E5=A4=9A=E6=AE=B5=E4=BC=A4=E5=AE=B3=E9=9F=B3?= =?UTF-8?q?=E6=95=88?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- lua/app/module/battle/component/battle_unit_comp.lua | 12 +++++++++++- lua/app/module/battle/helper/battle_helper.lua | 2 +- 2 files changed, 12 insertions(+), 2 deletions(-) diff --git a/lua/app/module/battle/component/battle_unit_comp.lua b/lua/app/module/battle/component/battle_unit_comp.lua index 83997f09..9240e0b8 100644 --- a/lua/app/module/battle/component/battle_unit_comp.lua +++ b/lua/app/module/battle/component/battle_unit_comp.lua @@ -1402,7 +1402,17 @@ function BattleUnitComp:onSkillTakeEffect(skill, isFinalBlock, validEffectIdx) end local soundHit = skill:getSoundHit() if soundHit then - BattleHelper:playSkillSound(soundHit, 0) + local blocks = skill:getEffectBlock() + if blocks then + local soundIndex = 1 + for i, endIdx in ipairs(blocks) do + if endIdx == effectEndIdx then + soundIndex = i + break + end + end + BattleHelper:playSkillSound(soundHit[soundIndex], 0) + end end end end diff --git a/lua/app/module/battle/helper/battle_helper.lua b/lua/app/module/battle/helper/battle_helper.lua index 99229286..9a2128fd 100644 --- a/lua/app/module/battle/helper/battle_helper.lua +++ b/lua/app/module/battle/helper/battle_helper.lua @@ -242,7 +242,7 @@ function BattleHelper:recycleBuffEffect(buffEffect) end function BattleHelper:playSkillSound(name, delay) - if self.skillSoundPath == nil then + if self.skillSoundPath == nil or not name then return end local soundFullPath = self.skillSoundPath[name]