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