diff --git a/project/functions.js b/project/functions.js index 6ebf53ee..d03b95fe 100644 --- a/project/functions.js +++ b/project/functions.js @@ -493,26 +493,27 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = core.clearContinueAutomaticRoute(); }, "afterGetItem": function (itemId, x, y, isGentleClick) { - // 获得一个道具后触发的事件 - // itemId:获得的道具ID;x和y是该道具所在的坐标 - // isGentleClick:是否是轻按触发的 - if (itemId.endsWith('Potion') && core.material.items[itemId].cls == 'items') - core.playSound('回血'); - else if (itemId.endsWith('Gem') && core.material.items[itemId].cls == 'items') - core.playSound('宝石') - else - core.playSound('获得道具'); + // 获得一个道具后触发的事件 + // itemId:获得的道具ID;x和y是该道具所在的坐标 + // isGentleClick:是否是轻按触发的 - var todo = []; - // 检查该点的获得道具后事件。 - if (core.status.floorId == null) return; - var event = core.floors[core.status.floorId].afterGetItem[x + "," + y]; - if (event && (event instanceof Array || !isGentleClick || !event.disableOnGentleClick)) { - core.unshift(todo, event); - } + let sound = '获得道具'; + const itemInfo = core.material.items[itemId]; + if (itemInfo.itemEffectEvent && itemInfo.itemEffectEvent.hasOwnProperty('sound')) { + sound = itemInfo.itemEffectEvent.sound; + } + core.playSound(sound); - if (todo.length > 0) core.insertAction(todo, x, y); - }, + var todo = []; + // 检查该点的获得道具后事件。 + if (core.status.floorId == null) return; + var event = core.floors[core.status.floorId].afterGetItem[x + "," + y]; + if (event && (event instanceof Array || !isGentleClick || !event.disableOnGentleClick)) { + core.unshift(todo, event); + } + + if (todo.length > 0) core.insertAction(todo, x, y); +}, "afterPushBox": function () { // 推箱子后的事件 if (core.searchBlock('box').length == 0) { diff --git a/project/items.js b/project/items.js index 299e9a98..0995b0a3 100644 --- a/project/items.js +++ b/project/items.js @@ -27,6 +27,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "useItemEffect": "core.status.hero.atk += core.values.redGem", "canUseItemEffect": "true", "itemEffectEvent": { + "sound": "item.mp3", "value": { "atk:o": "core.values.redGem" }