feat:增加即捡即用道具效果的事件块
This commit is contained in:
parent
15f6ed2a83
commit
d53e72513b
@ -618,14 +618,16 @@ return code;
|
|||||||
|
|
||||||
// itemEffect 事件编辑器入口之一
|
// itemEffect 事件编辑器入口之一
|
||||||
itemEffect_m
|
itemEffect_m
|
||||||
: '拾取即捡即用物品的效果' BGNL? '数值提升项' itemEffectList+ '此道具cls须为items' BEND
|
: '拾取即捡即用物品的效果' '播放音效' EvalString? BGNL? '数值提升项' itemEffectList+ '此道具cls须为items' BEND
|
||||||
|
|
||||||
|
|
||||||
/* itemEffect_m
|
/* itemEffect_m
|
||||||
tooltip : 道具效果
|
tooltip : 道具效果
|
||||||
default : []
|
default : ['item.mp3']
|
||||||
|
allSounds : ['EvalString_0']
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
var code = '{"value": {\n'+itemEffectList_0+'\n}}';
|
EvalString_0 = EvalString_0 && ('"sound": "' + EvalString_0 + '",');
|
||||||
|
var code = '{' + EvalString_0 + '"value": {\n' + itemEffectList_0 + '\n}}';
|
||||||
return code;
|
return code;
|
||||||
*/;
|
*/;
|
||||||
|
|
||||||
@ -641,7 +643,7 @@ itemEffectKnown
|
|||||||
|
|
||||||
/* itemEffectKnown
|
/* itemEffectKnown
|
||||||
tooltip : 数值增加项
|
tooltip : 数值增加项
|
||||||
default : ['atk', 10]
|
default : ['atk', 10, false]
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
if (Bool_0) ItemEffect_List_0 += ':o';
|
if (Bool_0) ItemEffect_List_0 += ':o';
|
||||||
if (!/^[+-]?\d+(\.\d+)?$/.test(EvalString_0)) EvalString_0 = '"' + EvalString_0 + '"';
|
if (!/^[+-]?\d+(\.\d+)?$/.test(EvalString_0)) EvalString_0 = '"' + EvalString_0 + '"';
|
||||||
@ -654,7 +656,7 @@ itemEffectUnknown
|
|||||||
|
|
||||||
/* itemEffectUnknown
|
/* itemEffectUnknown
|
||||||
tooltip : 数值增加项
|
tooltip : 数值增加项
|
||||||
default : ['speed', 10]
|
default : ['speed', 10, false]
|
||||||
helpUrl : /_docs/#/instruction
|
helpUrl : /_docs/#/instruction
|
||||||
if (Bool_0) EvalString_0 += ':o';
|
if (Bool_0) EvalString_0 += ':o';
|
||||||
if (!/^[+-]?\d+(\.\d+)?$/.test(EvalString_1)) EvalString_1 = '"' + EvalString_1 + '"';
|
if (!/^[+-]?\d+(\.\d+)?$/.test(EvalString_1)) EvalString_1 = '"' + EvalString_1 + '"';
|
||||||
|
|||||||
@ -92,16 +92,17 @@ ActionParser.prototype.parse = function (obj,type) {
|
|||||||
var text_choices = null;
|
var text_choices = null;
|
||||||
var knownItemListKeys = MotaActionBlocks['ItemEffect_List'].options.map(function (one) { return one[1]; })
|
var knownItemListKeys = MotaActionBlocks['ItemEffect_List'].options.map(function (one) { return one[1]; })
|
||||||
Object.keys(obj).sort().forEach(function (key) {
|
Object.keys(obj).sort().forEach(function (key) {
|
||||||
|
var addValue = obj[key];
|
||||||
var noNeed = key.endsWith(':o');
|
var noNeed = key.endsWith(':o');
|
||||||
if (noNeed) key = key.substring(0, key.length - 2);
|
if (noNeed) key = key.substring(0, key.length - 2);
|
||||||
var one = knownItemListKeys.indexOf(key) >= 0 ? 'itemEffectKnown' : 'itemEffectUnknown';
|
var one = knownItemListKeys.indexOf(key) >= 0 ? 'itemEffectKnown' : 'itemEffectUnknown';
|
||||||
text_choices = MotaActionBlocks[one].xmlText([
|
text_choices = MotaActionBlocks[one].xmlText([
|
||||||
key, obj[key], noNeed, text_choices
|
key, addValue, noNeed, text_choices
|
||||||
]);
|
]);
|
||||||
})
|
})
|
||||||
return text_choices;
|
return text_choices;
|
||||||
}
|
}
|
||||||
return MotaActionBlocks['itemEffect_m'].xmlText([buildItemEffect(obj.value)]);
|
return MotaActionBlocks['itemEffect_m'].xmlText([obj.sound, buildItemEffect(obj.value)]);
|
||||||
|
|
||||||
case 'doorInfo':
|
case 'doorInfo':
|
||||||
if(!obj) obj={};
|
if(!obj) obj={};
|
||||||
|
|||||||
@ -35,17 +35,17 @@ items.prototype.getItemEffect = function (itemId, itemNum) {
|
|||||||
const itemEffectEvent = core.material.items[itemId].itemEffectEvent;
|
const itemEffectEvent = core.material.items[itemId].itemEffectEvent;
|
||||||
if (itemEffectEvent) {
|
if (itemEffectEvent) {
|
||||||
const { value } = itemEffectEvent;
|
const { value } = itemEffectEvent;
|
||||||
for (var i = 0; i < itemNum; ++i) {
|
for (let statusName in value) {
|
||||||
for (let statusName in value) {
|
let statusValue, ratio, needRatio;
|
||||||
let statusValue, ratio, needRatio;
|
const effect = value[statusName];
|
||||||
const effect = value[statusName];
|
if (statusName.endsWith(':o')) {
|
||||||
if (statusName.endsWith(':o')) {
|
needRatio = true;
|
||||||
needRatio = true;
|
statusName = statusName.slice(0, -2);
|
||||||
statusName = statusName.slice(0, -2);
|
}
|
||||||
}
|
ratio = core.status.thisMap.ratio || 1;
|
||||||
if (core.status.hero.hasOwnProperty(statusName)) {
|
if (core.status.hero.hasOwnProperty(statusName)) {
|
||||||
|
for (var i = 0; i < itemNum; ++i) {
|
||||||
try {
|
try {
|
||||||
ratio = core.status.thisMap.ratio || 1;
|
|
||||||
statusValue = eval(effect);
|
statusValue = eval(effect);
|
||||||
}
|
}
|
||||||
catch (e) {
|
catch (e) {
|
||||||
|
|||||||
@ -4293,5 +4293,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 =
|
|||||||
// todolist 清怪检测,重开杖,吸噬
|
// todolist 清怪检测,重开杖,吸噬
|
||||||
// todolist 修复已知的插件bug
|
// todolist 修复已知的插件bug
|
||||||
// todolist 添加鸽窝样板的快速读取撤回 和 优化美工
|
// todolist 添加鸽窝样板的快速读取撤回 和 优化美工
|
||||||
|
// todolist 音效连续播放的优化(与自动清有关)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
Loading…
Reference in New Issue
Block a user