feat:即捡即用事件块-音效

This commit is contained in:
lizhuoyuan 2025-02-08 15:37:08 +08:00
parent d53e72513b
commit eaae6884ce
2 changed files with 20 additions and 18 deletions

View File

@ -493,26 +493,27 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
core.clearContinueAutomaticRoute();
},
"afterGetItem": function (itemId, x, y, isGentleClick) {
// 获得一个道具后触发的事件
// itemId获得的道具IDx和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获得的道具IDx和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) {

View File

@ -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"
}