diff --git a/API列表.txt b/API列表.txt index 8b5cbccd..58dd32ca 100644 --- a/API列表.txt +++ b/API列表.txt @@ -1037,7 +1037,7 @@ core.follow(name) / core.unfollow(name) 跟随和取消跟随都会调用core.gatherFollowers()来聚集所有的跟随者。 -core.setValue(name, value, prefix) / core.addValue(name, value, prefix) +core.setValue(name, operator, value, prefix) / core.addValue(name, value, prefix) 设置/增减某个数值。name可以是status:xxx,item:xxx或flag:xxx。 value可以是一个表达式,将调用core.calValue()计算。prefix为前缀,独立开关使用,脚本中一般忽略。 diff --git a/_docs/api.md b/_docs/api.md index d3f6027d..89d992f0 100644 --- a/_docs/api.md +++ b/_docs/api.md @@ -1036,7 +1036,7 @@ core.follow(name) / core.unfollow(name) 跟随和取消跟随都会调用core.gatherFollowers()来聚集所有的跟随者。 -core.setValue(name, value, prefix) / core.addValue(name, value, prefix) +core.setValue(name, operator, value, prefix) / core.addValue(name, value, prefix) 设置/增减某个数值。name可以是status:xxx,item:xxx或flag:xxx。 value可以是一个表达式,将调用core.calValue()计算。prefix为前缀,独立开关使用,脚本中一般忽略。 diff --git a/_docs/event.md b/_docs/event.md index 731e0ac1..fd39afb1 100644 --- a/_docs/event.md +++ b/_docs/event.md @@ -491,27 +491,6 @@ value是一个表达式,将通过这个表达式计算出的结果赋值给nam 在刷新的情况下,如果hp被设置成了0或以下,将触发lose事件,直接死亡。 -### addValue:增减勇士的某个属性、道具个数,或某个变量/Flag的值 - -和`{"type": "setValue"}`的写法完全相同,不过此项是可以直接将值加减到原始数值上。 - -即下面的写法是等价的: - -``` js -[ - {"type": "setValue", "name": "status:atk", "value": "status:atk+10" } // 攻击提高10点 - {"type": "addVakue", "name": "status:atk", "value": "10" } // 和上面写法等价 - {"type": "setValue", "name": "item:yellowKey", "value": "item:yellowKey-3" } // 黄钥匙个数-3 - {"type": "addValue", "name": "item:yellowKey", "value": "-3" } // 和上面写法等价 - {"type": "setValue", "name": "flag:door2", "value": "flag:door2+1" } // 将变量door值+1 - {"type": "addValue", "name": "flag:door2", "value": "01" } // 和上面写法等价 -] -``` - -![](img/events/14.jpg) - -从V2.6.5开始,当设置了`"norefresh": true`后可以不刷新状态栏、地图显伤和自动事件,从而加速事件执行。 - ### setEnemy:设置怪物属性 使用`{"type":"setEnemy"}`可以设置某个怪物的某个属性 @@ -1672,7 +1651,7 @@ text为提示文字,可以在这里给输入提示文字。这里同样可以 ], "false": [ // 条件不成立则执行false里的事件 "你当前攻击力为${status:atk}, 不足500!\n给你增加100点攻击力!", - {"type": "addValue", "name": "status:atk", "value": "100"}, // 攻击力加100, 接着会执行revisit事件 + {"type": "setValue", "name": "status:atk", "operator": "+=", "value": "100"}, // 攻击力加100, 接着会执行revisit事件 ] }, {"type", "revisit"}, // 立刻重启本事件, 直到攻击力大于500后结束 @@ -1874,7 +1853,7 @@ yes和no均为必填项,即用户点击确认或取消后执行的事件。 [ {"type":"while", "condition": "flag:i<=10", // 循环处理;注意flag未设置则默认为0 "data":[ - {"type": "addValue", "name": "flag:i", "value": "1"}, // 递增i + {"type": "setValue", "name": "flag:i", "operator": "+=", "value": "1"}, // 递增i "${flag:i}", // 输出i {"type": "sleep","time":1000}, // 等待1秒 ] @@ -1908,7 +1887,7 @@ yes和no均为必填项,即用户点击确认或取消后执行的事件。 [ {"type":"while", "condition": "true", // 循环处理;永远为真 "data":[ - {"type": "addValue", "name": "flag:i", "value": "1"}, // 递增i + {"type": "setValue", "name": "flag:i", "operator": "+=", "value": "1"}, // 递增i "${flag:i}", // 输出i {"type": "sleep","time":1000}, // 等待1秒 {"type": "if", "condition": "flag:i<10", // 测试i是否小于10 diff --git a/_server/MotaAction.g4 b/_server/MotaAction.g4 index f92f9481..ff52e465 100644 --- a/_server/MotaAction.g4 +++ b/_server/MotaAction.g4 @@ -330,7 +330,6 @@ action | setText_s | tip_s | setValue_s - | addValue_s | setEnemy_s | setFloor_s | setGlobalAttribute_s @@ -579,28 +578,18 @@ return code; */; setValue_s - : '数值操作' ':' '名称' idString_e '值' expression '不刷新状态栏' Bool Newline + : '数值操作' ':' '名称' idString_e AssignOperator_List expression '不刷新状态栏' Bool Newline /* setValue_s tooltip : setValue:设置勇士的某个属性、道具个数, 或某个变量/Flag的值 helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setvalue%EF%BC%9A%E8%AE%BE%E7%BD%AE%E5%8B%87%E5%A3%AB%E7%9A%84%E6%9F%90%E4%B8%AA%E5%B1%9E%E6%80%A7%E3%80%81%E9%81%93%E5%85%B7%E4%B8%AA%E6%95%B0%EF%BC%8C%E6%88%96%E6%9F%90%E4%B8%AA%E5%8F%98%E9%87%8Fflag%E7%9A%84%E5%80%BC colour : this.dataColor +if (AssignOperator_List_0 && AssignOperator_List_0 != '=') { + AssignOperator_List_0 = ', "operator": "' + AssignOperator_List_0 + '"'; +} else AssignOperator_List_0 = ''; Bool_0 = Bool_0 ? ', "norefresh": true' : ''; -var code = '{"type": "setValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"' + Bool_0 + '},\n'; -return code; -*/; - -addValue_s - : '数值增减' ':' '名称' idString_e '+=' expression '不刷新状态栏' Bool Newline - - -/* addValue_s -tooltip : addValue:增减勇士的某个属性、道具个数, 或某个变量/Flag的值 -helpUrl : https://h5mota.com/games/template/_docs/#/event?id=addValue%ef%bc%9a%e5%a2%9e%e5%87%8f%e5%8b%87%e5%a3%ab%e7%9a%84%e6%9f%90%e4%b8%aa%e5%b1%9e%e6%80%a7%e3%80%81%e9%81%93%e5%85%b7%e4%b8%aa%e6%95%b0%ef%bc%8c%e6%88%96%e6%9f%90%e4%b8%aa%e5%8f%98%e9%87%8f%2fFlag%e7%9a%84%e5%80%bc -colour : this.dataColor -Bool_0 = Bool_0 ? ', "norefresh": true' : ''; -var code = '{"type": "addValue", "name": "'+idString_e_0+'", "value": "'+expression_0+'"' + Bool_0 + '},\n'; +var code = '{"type": "setValue", "name": "'+idString_e_0+'"'+AssignOperator_List_0+', "value": "'+expression_0+'"' + Bool_0 + '},\n'; return code; */; @@ -612,7 +601,7 @@ setEnemy_s /* setEnemy_s tooltip : setEnemy:设置某个怪物的属性 default : ["greenSlime", "atk", "0"] -helpUrl : https://h5mota.com/games/template/_docs/#/event?id=addValue%ef%bc%9a%e5%a2%9e%e5%87%8f%e5%8b%87%e5%a3%ab%e7%9a%84%e6%9f%90%e4%b8%aa%e5%b1%9e%e6%80%a7%e3%80%81%e9%81%93%e5%85%b7%e4%b8%aa%e6%95%b0%ef%bc%8c%e6%88%96%e6%9f%90%e4%b8%aa%e5%8f%98%e9%87%8f%2fFlag%e7%9a%84%e5%80%bc +helpUrl : https://h5mota.com/games/template/_docs/#/event?id=setEnemy%ef%bc%9a%e5%a2%9e%e5%87%8f%e5%8b%87%e5%a3%ab%e7%9a%84%e6%9f%90%e4%b8%aa%e5%b1%9e%e6%80%a7%e3%80%81%e9%81%93%e5%85%b7%e4%b8%aa%e6%95%b0%ef%bc%8c%e6%88%96%e6%9f%90%e4%b8%aa%e5%8f%98%e9%87%8f%2fFlag%e7%9a%84%e5%80%bc colour : this.dataColor var code = '{"type": "setEnemy", "id": "'+IdString_0+'", "name": "'+EnemyId_List_0+'", "value": "'+expression_0+'"},\n'; return code; @@ -2713,6 +2702,10 @@ Arithmetic_List : '+'|'-'|'*'|'/'|'^'|'=='|'!='|'>'|'<'|'>='|'<='|'和'|'或' ; +AssignOperator_List + : '='|'+='|'-='|'*='|'/='|'**='|'//='|'%=' + ; + Weather_List : '无'|'雨'|'雪'|'雾' /*Weather_List ['null','rain','snow','fog']*/; @@ -3366,15 +3359,7 @@ ActionParser.prototype.parseAction = function() { break case "setValue": this.next = MotaActionBlocks['setValue_s'].xmlText([ - this.tryToUseEvFlag_e('idString_e', [data.name]), - MotaActionBlocks['evalString_e'].xmlText([data.value]), - data.norefresh || false, - this.next]); - break; - case "setValue2": - case "addValue": - this.next = MotaActionBlocks['addValue_s'].xmlText([ - this.tryToUseEvFlag_e('idString_e', [data.name]), + this.tryToUseEvFlag_e('idString_e', [data.name]), data["operator"]||'=', MotaActionBlocks['evalString_e'].xmlText([data.value]), data.norefresh || false, this.next]); diff --git a/_server/editor_blockly.js b/_server/editor_blockly.js index 95e35786..8445df48 100644 --- a/_server/editor_blockly.js +++ b/_server/editor_blockly.js @@ -97,11 +97,8 @@ editor_blockly = function () { ]), ], '数据相关':[ - MotaActionBlocks['addValue_s'].xmlText([ - MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false - ]), MotaActionBlocks['setValue_s'].xmlText([ - MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false + MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '=', '', false ]), MotaActionBlocks['setEnemy_s'].xmlText(), MotaActionBlocks['setFloor_s'].xmlText(), @@ -220,11 +217,8 @@ editor_blockly = function () { MotaActionBlocks['unknown_s'].xmlText(), ], '值块':[ - MotaActionBlocks['addValue_s'].xmlText([ - MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false - ]), MotaActionBlocks['setValue_s'].xmlText([ - MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '', false + MotaActionBlocks['idString_1_e'].xmlText(['status','生命']), '=', '', false ]), MotaActionBlocks['expression_arithmetic_0'].xmlText(), MotaActionBlocks['evFlag_e'].xmlText(), @@ -254,8 +248,8 @@ editor_blockly = function () { {"text": "黄钥匙(\\\${9+flag:shop_times}金币)", "color": [255,255,0,1], "action": [ {"type": "if", "condition": "status:money>=9+flag:shop_times", "true": [ - {"type": "addValue", "name": "status:money", "value": "-(9+flag:shop_times)"}, - {"type": "addValue", "name": "item:yellowKey", "value": "1"}, + {"type": "setValue", "name": "status:money", "operator": "-=", "value": "9+flag:shop_times"}, + {"type": "setValue", "name": "item:yellowKey", "operator": "+=", "value": "1"}, ], "false": [ "\\t[老人,man]你的金钱不足!", @@ -270,7 +264,7 @@ editor_blockly = function () { ]} ] }, - {"type": "addValue", "name": "flag:shop_times", "value": "1"}, + {"type": "setValue", "name": "flag:shop_times", "operator": "+=", "value": "1"}, {"type": "revisit"} ], 'event'), '', @@ -293,7 +287,7 @@ editor_blockly = function () { ],'afterBattle'), '', MotaActionFunctions.actionParser.parse([ - {"type": "addValue", "name": "flag:__door__", "value": "1"}, + {"type": "setValue", "name": "flag:__door__", "operator": "+=", "value": "1"}, {"type": "if", "condition": "flag:__door__==2", "true": [ {"type": "openDoor", "loc": [10,5]} @@ -313,7 +307,7 @@ editor_blockly = function () { {"type": "if", "condition": "flag:hasSuperPotion", "true": [], "false": [ - {"type":"setValue", "name":"status:hp", "value":"status:hp*2"}, + {"type":"setValue", "name":"status:hp", "operator": "*=", "value": "2"}, {"type":"setBlock", "number": 1}, {"type":"setValue", "name":"flag:hasSuperPotion", "value": "true"} ] @@ -755,7 +749,7 @@ function omitedcheckUpdateFunction(event) { 'comment_s', 'show_s', 'hide_s', - 'addValue_s', + 'setValue_s', 'if_s', 'battle_s', 'openDoor_s', diff --git a/_server/editor_mappanel.js b/_server/editor_mappanel.js index 77c43ffc..f810e748 100644 --- a/_server/editor_mappanel.js +++ b/_server/editor_mappanel.js @@ -472,7 +472,7 @@ editor_mappanel_wrapper = function (editor) { }; bindSpecialDoor.enemys.forEach(function (loc) { editor.currentFloorData.afterBattle[loc] = [ - {"type": "addValue", "name": doorFlag, "value": "1"} + {"type": "setValue", "name": doorFlag, "operator": "+=", "value": "1"} ] }); editor.file.saveFloorFile(function (err) { diff --git a/libs/events.js b/libs/events.js index 61f91306..b1daadb1 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1127,7 +1127,7 @@ events.prototype.__precompile_getArray = function () { "closeDoor", "battle", "trigger", "insert" ]; var values = [ - "setValue", "setValue2", "addValue", "setEnemy", "setFloor", "setGlobalValue", + "setValue", "setEnemy", "setFloor", "setGlobalValue", ]; var uievents = [ "clearMap", "fillText", "fillBoldText", "fillRect", "strokeRect", "strokeCircle", @@ -1618,25 +1618,7 @@ events.prototype._action_setVolume = function (data, x, y, prefix) { } events.prototype._action_setValue = function (data, x, y, prefix) { - this.setValue(data.name, data.value, prefix); - if (!data.norefresh) { - if (core.status.hero.hp <= 0) { - core.status.hero.hp = 0; - core.updateStatusBar(); - core.events.lose(); - } else { - core.updateStatusBar(); - } - } - core.doAction(); -} - -events.prototype._action_setValue2 = function (data, x, y, prefix) { - this._action_addValue(data, x, y, prefix); -} - -events.prototype._action_addValue = function (data, x, y, prefix) { - this.addValue(data.name, data.value, prefix); + this.setValue(data.name, data.operator, data.value, prefix); if (!data.norefresh) { if (core.status.hero.hp <= 0) { core.status.hero.hp = 0; @@ -2459,9 +2441,19 @@ events.prototype.unfollow = function (name) { } ////// 数值操作 ////// -events.prototype.setValue = function (name, value, prefix, add) { - var value = core.calValue(value, prefix); - if (add) value += core.calValue(name, prefix); +events.prototype.setValue = function (name, operator, value, prefix) { + value = core.calValue(value, prefix); + var originValue = core.calValue(name, prefix); + switch (operator) { + case '+=': value = originValue + value; break; + case '-=': value = originValue - value; break; + case '*=': value = originValue * value; break; + case '/=': value = originValue / value; break; + case '**=': value = Math.pow(originValue, value); break; + case '//=': value = Math.trunc(originValue / value); break; + case '%=': value = originValue % value; break; + default: break; + } this._setValue_setStatus(name, value); this._setValue_setItem(name, value); this._setValue_setFlag(name, value); @@ -2498,7 +2490,7 @@ events.prototype._setValue_setGlobal = function (name, value) { ////// 数值增减 ////// events.prototype.addValue = function (name, value, prefix) { - this.setValue(name, value, prefix, true); + this.setValue(name, '+=', value, prefix); } ////// 执行一个表达式的effect操作 ////// diff --git a/project/data.js b/project/data.js index bc4b0cf5..20da56b0 100644 --- a/project/data.js +++ b/project/data.js @@ -370,17 +370,19 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = }, { "need": "20", - "title": "第二级", + "title": "", "action": [ { "type": "setValue", "name": "status:atk", - "value": "status:atk+10" + "operator": "+=", + "value": "10" }, { "type": "setValue", "name": "status:def", - "value": "status:def+10" + "operator": "+=", + "value": "10" } ] }, diff --git a/project/events.js b/project/events.js index 57aec84c..c9c7fae6 100644 --- a/project/events.js +++ b/project/events.js @@ -15,7 +15,8 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = { "type": "setValue", "name": "status:atk", - "value": "status:atk+1*flag:arg1" + "operator": "+=", + "value": "1*flag:arg1" } ] }, @@ -25,7 +26,8 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = { "type": "setValue", "name": "status:def", - "value": "status:def+2*flag:arg1" + "operator": "+=", + "value": "2*flag:arg1" } ] }, @@ -35,7 +37,8 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = { "type": "setValue", "name": "status:hp", - "value": "status:hp+200*flag:arg1" + "operator": "+=", + "value": "200*flag:arg1" } ] } @@ -97,14 +100,16 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "text": ">=1:直接扣数值" }, { - "type": "addValue", + "type": "setValue", "name": "status:atk", - "value": "-core.values.weakValue" + "operator": "-=", + "value": "core.values.weakValue" }, { - "type": "addValue", + "type": "setValue", "name": "status:def", - "value": "-core.values.weakValue" + "operator": "-=", + "value": "core.values.weakValue" } ], "false": [ @@ -273,13 +278,15 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "condition": "item:yellowKey >= 1", "true": [ { - "type": "addValue", + "type": "setValue", "name": "item:yellowKey", - "value": "-1" + "operator": "-=", + "value": "1" }, { - "type": "addValue", + "type": "setValue", "name": "status:money", + "operator": "+=", "value": "10" } ], @@ -303,13 +310,15 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 = "condition": "item:blueKey >= 1", "true": [ { - "type": "addValue", + "type": "setValue", "name": "item:blueKey", - "value": "-1" + "operator": "-=", + "value": "1" }, { - "type": "addValue", + "type": "setValue", "name": "status:money", + "operator": "+=", "value": "50" } ], diff --git a/project/floors/sample1.js b/project/floors/sample1.js index 0deb02d0..69621071 100644 --- a/project/floors/sample1.js +++ b/project/floors/sample1.js @@ -32,7 +32,7 @@ main.floors.sample1= [ 0, 0, 0, 0, 0, 0, 0,164, 0, 0,163, 0, 0], [ 1, 1, 1, 1, 0, 20, 0, 0, 0,162, 0,161, 0], [ 1, 0,123, 1, 0, 20,124, 0,121, 0,122, 0,126], - [ 1, 0, 0, 1, 88, 20, 86, 0, 0, 0, 0, 0,122] + [ 1, 0, 0, 1, 88, 20, 86, 0, 0, 0, 0, 0, 0] ], "firstArrive": [], "events": { @@ -111,12 +111,14 @@ main.floors.sample1= { "type": "setValue", "name": "status:atk", - "value": "status:atk/10" + "operator": "/=", + "value": "10" }, { "type": "setValue", "name": "status:def", - "value": "status:def/10" + "operator": "/=", + "value": "10" }, { "type": "hide", @@ -344,7 +346,8 @@ main.floors.sample1= { "type": "setValue", "name": "flag:man_times", - "value": "flag:man_times+1" + "operator": "+=", + "value": "1" }, "\t[老人,man]在文字中使用$+{}可以计算并显示一个表达式的结果。\n", "\t[老人,man]例如:\n你的当前攻击力是${status:atk},防御力是${status:def}。\n攻防和的十倍是${10*(status:atk+status:def)},攻防之积是${status:atk*status:def}。\n你有${item:yellowKey}把黄钥匙,${item:blueKey}把蓝钥匙,${item:redKey}把红钥匙。\n你有${item:pickaxe}个破,${item:bomb}个炸,${item:centerFly}个飞。\n这是你第${flag:man_times}次和我对话。", @@ -353,43 +356,51 @@ main.floors.sample1= { "type": "setValue", "name": "status:atk", - "value": "status:atk*1.5" + "operator": "*=", + "value": "1.5" }, { "type": "setValue", "name": "status:def", - "value": "status:def*1.5" + "operator": "*=", + "value": "1.5" }, { "type": "setValue", "name": "status:hp", - "value": "status:hp+10*(status:atk+status:def)" + "operator": "+=", + "value": "10*(status:atk+status:def)" }, "\t[老人,man]再送你500金币,1000经验,1破2炸3飞!", { "type": "setValue", "name": "status:money", - "value": "status:money+500" + "operator": "+=", + "value": "500" }, { "type": "setValue", "name": "status:experience", - "value": "status:experience+1000" + "operator": "+=", + "value": "1000" }, { "type": "setValue", "name": "item:pickaxe", - "value": "item:pickaxe+1" + "operator": "+=", + "value": "1" }, { "type": "setValue", "name": "item:bomb", - "value": "item:bomb+2" + "operator": "+=", + "value": "2" }, { "type": "setValue", "name": "item:centerFly", - "value": "item:centerFly+3" + "operator": "+=", + "value": "3" }, "\t[老人,man]status:xxx 代表勇士的某个属性。\n其中xxx可取hp, atk, def, mdef, money,experience这几项。\n\nitem:xxx 代表勇士的某个道具的个数。\nxxx为道具ID,具体可参见items.js中的定义。\n\nflag:xxx 代表某个自定义Flag或变量。\nxxx为Flag/变量名,可以自行定义,由字母、数字和下划线组成。\n未定义过而直接取用的Flag默认值为false。", "\t[老人,man]你现在可以重新和我进行对话,进一步看到属性值的改变。" @@ -413,7 +424,8 @@ main.floors.sample1= { "type": "setValue", "name": "item:bigKey", - "value": "item:bigKey+1" + "operator": "+=", + "value": "1" }, "\t[老人,woman]我先走了,拜拜~", { @@ -439,12 +451,14 @@ main.floors.sample1= { "type": "setValue", "name": "status:money", - "value": "status:money-(9+flag:woman_times)" + "operator": "-=", + "value": "9+flag:woman_times" }, { "type": "setValue", "name": "item:yellowKey", - "value": "item:yellowKey+1" + "operator": "+=", + "value": "1" } ], "false": [ @@ -466,12 +480,14 @@ main.floors.sample1= { "type": "setValue", "name": "status:money", - "value": "status:money-(18+2*flag:woman_times)" + "operator": "-=", + "value": "18+2*flag:woman_times" }, { "type": "setValue", "name": "item:blueKey", - "value": "item:blueKey+1" + "operator": "+=", + "value": "1" } ], "false": [ @@ -493,12 +509,14 @@ main.floors.sample1= { "type": "setValue", "name": "status:money", - "value": "status:money-(36+4*flag:woman_times)" + "operator": "-=", + "value": "36+4*flag:woman_times" }, { "type": "setValue", "name": "item:redKey", - "value": "item:redKey+1" + "operator": "+=", + "value": "1" } ], "false": [ @@ -527,7 +545,8 @@ main.floors.sample1= { "type": "setValue", "name": "flag:woman_times", - "value": "flag:woman_times+1" + "operator": "+=", + "value": "1" }, { "type": "revisit" @@ -547,7 +566,8 @@ main.floors.sample1= { "type": "setValue", "name": "status:atk", - "value": "status:atk+flag:input" + "operator": "+=", + "value": "flag:input" }, { "type": "tip", @@ -559,153 +579,6 @@ main.floors.sample1= }, "\t[老人,womanMagician]具体可参见样板中本事件的写法。" ], - "10,12": null, - "12,12": [ - { - "type": "switch", - "condition": "flag:woman_times", - "caseList": [ - { - "case": "0", - "action": [ - "\t[老人,woman]现在使用switch改写这个例子" - ] - }, - { - "case": "8", - "action": [ - "\t[老人,woman]你购买的钥匙已经够多了,再继续卖给你的话我会有危险的。", - "\t[老人,woman]看在你贡献给我这么多钱的份上,送你一把大黄门钥匙吧,希望你能好好用它。", - { - "type": "setValue", - "name": "item:bigKey", - "value": "item:bigKey+1" - }, - "\t[老人,woman]我先走了,拜拜~", - { - "type": "hide", - "time": 500 - }, - { - "type": "exit" - } - ] - }, - { - "case": "default", - "action": [ - { - "type": "comment", - "text": "当没有符合的值的场合执行此事件" - }, - { - "type": "choices", - "text": "\t[老人,woman]少年,你需要钥匙吗?\n我这里有大把的!", - "choices": [ - { - "text": "黄钥匙(${9+flag:woman_times}金币)", - "action": [ - { - "type": "if", - "condition": "status:money>=9+flag:woman_times", - "true": [ - { - "type": "setValue", - "name": "status:money", - "value": "status:money-(9+flag:woman_times)" - }, - { - "type": "setValue", - "name": "item:yellowKey", - "value": "item:yellowKey+1" - } - ], - "false": [ - "\t[老人,woman]你的金钱不足!", - { - "type": "revisit" - } - ] - } - ] - }, - { - "text": "蓝钥匙(${18+2*flag:woman_times}金币)", - "action": [ - { - "type": "if", - "condition": "status:money>=18+2*flag:woman_times", - "true": [ - { - "type": "setValue", - "name": "status:money", - "value": "status:money-(18+2*flag:woman_times)" - }, - { - "type": "setValue", - "name": "item:blueKey", - "value": "item:blueKey+1" - } - ], - "false": [ - "\t[老人,woman]你的金钱不足!", - { - "type": "revisit" - } - ] - } - ] - }, - { - "text": "红钥匙(${36+4*flag:woman_times}金币)", - "action": [ - { - "type": "if", - "condition": "status:money>=36+4*flag:woman_times", - "true": [ - { - "type": "setValue", - "name": "status:money", - "value": "status:money-(36+4*flag:woman_times)" - }, - { - "type": "setValue", - "name": "item:redKey", - "value": "item:redKey+1" - } - ], - "false": [ - "\t[老人,woman]你的金钱不足!", - { - "type": "revisit" - } - ] - } - ] - }, - { - "text": "离开", - "action": [ - { - "type": "exit" - } - ] - } - ] - } - ] - } - ] - }, - { - "type": "setValue", - "name": "flag:woman_times", - "value": "flag:woman_times+1" - }, - { - "type": "revisit" - } - ] }, "changeFloor": { "4,12": { @@ -727,14 +600,16 @@ main.floors.sample1= { "type": "setValue", "name": "flag:door", - "value": "flag:door+1" + "operator": "+=", + "value": "1" } ], "11,6": [ { "type": "setValue", "name": "flag:door", - "value": "flag:door+1" + "operator": "+=", + "value": "1" } ] }, diff --git a/project/items.js b/project/items.js index 0abb08a9..68c5ec33 100644 --- a/project/items.js +++ b/project/items.js @@ -429,7 +429,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = { "type": "setValue", "name": "status:atk", - "value": "status:atk+1" + "operator": "+=", + "value": "1" } ] }, @@ -439,7 +440,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = { "type": "setValue", "name": "status:def", - "value": "status:def+2" + "operator": "+=", + "value": "2" } ] }, @@ -449,7 +451,8 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = { "type": "setValue", "name": "status:hp", - "value": "status:hp+200" + "operator": "+=", + "value": "200" } ] } @@ -476,12 +479,14 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = { "type": "setValue", "name": "item:lifeWand", - "value": "item:lifeWand-flag:input" + "operator": "-=", + "value": "flag:input" }, { "type": "setValue", "name": "status:hp", - "value": "status:hp+flag:input*100" + "operator": "+=", + "value": "flag:input*100" }, "成功使用${flag:input}次生命魔杖,恢复${flag:input*100}点生命。" ], diff --git a/v2.x-final更新.txt b/v2.x-final更新.txt index 065948d4..c30d8086 100644 --- a/v2.x-final更新.txt +++ b/v2.x-final更新.txt @@ -18,7 +18,7 @@ (已完成!) 17. “设置画布属性”的基准线建议增加'hanging'和'ideographic'这两种模式 18. 建议修复“绘制多行文本”时行距比字号大不太多会导致各行下缘丢失的bug(加大行距又会导致第一行的纵坐标难以估计),此bug在道具商店和1.3倍行距英文看的很明显 19.(来自群友)建议给第一代全局商店的子选项像“显示选择项”一样提供图标、颜色和出现条件(注意长按的适配) -20. 很多事件对应的脚本有默认参数,但在事件中省略参数却会变成0,建议修复 +(已完成!) 20. 很多事件对应的脚本有默认参数,但在事件中省略参数却会变成0,建议修复 (已完成!) defaultGround全局可用 (已完成!) 对floorIds和图片进行检测 @@ -30,7 +30,10 @@ 绿钥匙进状态栏 图块ID不可全数字 怪物详细信息富文本化 -for和forEach事件 +(已完成!) for和forEach事件 +转向:顺时针/逆时针/反向 +事件转向 +(已完成!) 合并数值操作事件 (不处理) 0. 部分文案的修改,如“地图编辑器”(启动服务.exe中)、“enemys”、“snipe” @@ -64,7 +67,7 @@ for和forEach事件 (不处理) 28. 勇士的移动帧只有2,建议改为允许作者指定 (不处理) 29. 建议加一对“勇士开始抖动”和“勇士停止抖动”事件指令,来让勇士像图块一样原地抖动(即全局动画)。目前这个效果还只能通过隐藏勇士(或切换透明行走图)并转变图块/图层块来实现且只能用于事件处理中QAQ 30. 建议加一个“视角锁定”事件指令,从而允许用事件改变勇士位置、朝向或行走图时不会使视角重置到以其为中心,用于一些演出效果 -31. 楼层切换事件(绿点)一旦使用blockly编辑就会无视全塔属性的切换时间,只能手动在表格中删除时间(数据相关“楼层切换”事件指令也有这个问题,有群友还希望这个默认时间能像步时和音量一样由玩家设定来节约拆塔时间)。使用blockly编辑也无法做出“ignore:true”的效果(用来覆盖全塔属性的禁止穿透),建议优化 +(已完成!) 31. 楼层切换事件(绿点)一旦使用blockly编辑就会无视全塔属性的切换时间,只能手动在表格中删除时间(数据相关“楼层切换”事件指令也有这个问题,有群友还希望这个默认时间能像步时和音量一样由玩家设定来节约拆塔时间)。使用blockly编辑也无法做出“ignore:true”的效果(用来覆盖全塔属性的禁止穿透),建议优化 (已完成!) 32. (关于CC的来回回档优化版)据其称,清空存档后会出现bug,此外他使用了W键导致二倍斩失效了(js的switch语句遇到duplicate cases居然不报错吗...) (已完成!) 33. (疑似已被CC修复)楼传平面塔模式在记录离开位置时会错误地把读档也算作离开 (已完成!) 34. (接上)还有很多像这样在楼层切换中对读档处理不当的问题,如天气色调bgm(前两者应当像bgm一样提供keep勾选项) @@ -103,7 +106,7 @@ for和forEach事件 (已修复!) 65. “显隐贴图”的参数应为像素坐标而不是网格坐标,请修正在线文档的描述。同时建议加个淡入淡出时间参数,还建议贴图能像图片一样有透明度和被移动 (不处理) 66. 读档建议换个和floor.mp3不一样的音效 (不处理) 67. “画面震动”事件希望不要光左右晃,至少做成QQ窗口抖动的效果吧w -68. “自动存档”事件希望加一个“读此档后打断当前事件”的勾选项,否则这种自动存档用于强制战斗之前就没什么意义了,读了档还是会强制战斗。录像兼容性方面,不知道如果这种自动存档只用于事件开头是不是就不会有问题 +(不处理) 68. “自动存档”事件希望加一个“读此档后打断当前事件”的勾选项,否则这种自动存档用于强制战斗之前就没什么意义了,读了档还是会强制战斗。录像兼容性方面,不知道如果这种自动存档只用于事件开头是不是就不会有问题 (已修复!) 69. “等待用户操作”虽然提供了场合块但还不支持将多个按键的场合合并(比如空格、回车和C键一般会被作者予以合并,执行内容如果只是大致相同也值得合并,在块内再行分歧),希望支持一下 70. “显隐勇士”事件指令希望加个淡入淡出时间参数 (不处理,请用等待事件) 1. 希望给core.drawTip()和core.playSound()出个同步版本,目前只有异步版本,后者如果要模拟同步就得绑在一个透明动画上