commit
dd9fbae5ae
@ -1666,12 +1666,12 @@ MotaActionFunctions.parse = function(obj,type) {
|
||||
}
|
||||
|
||||
MotaActionFunctions.EvalString_pre = function(EvalString){
|
||||
if (EvalString.indexOf('__door_name__')!==-1) throw new Error('请修改__door_name__,建议如开MT1层的[3,3]点的门, 则使用flag:MT1_3_3作为开门变量');
|
||||
if (EvalString.indexOf('__door__')!==-1) throw new Error('请修改开门变量__door__,如door1,door2,door3等依次向后。请勿存在两个门使用相同的开门变量。');
|
||||
return EvalString.replace(/([^\\])"/g,'$1\\"').replace(/^"/g,'\\"').replace(/""/g,'"\\"');
|
||||
}
|
||||
|
||||
MotaActionFunctions.IdString_pre = function(IdString){
|
||||
if (IdString.indexOf('__door_name__')!==-1) throw new Error('请修改__door_name__,建议如开MT1层的[3,3]点的门, 则使用flag:MT1_3_3作为开门变量');
|
||||
if (IdString.indexOf('__door__')!==-1) throw new Error('请修改开门变量__door__,如door1,door2,door3等依次向后。请勿存在两个门使用相同的开门变量。');
|
||||
if (IdString && !(/^[0-9a-zA-Z_][0-9a-zA-Z_\-:]*$/.test(IdString)))throw new Error('id: '+IdString+'中包含了0-9 a-z A-Z _ - :之外的字符');
|
||||
return IdString;
|
||||
}
|
||||
|
||||
@ -183,8 +183,8 @@ editor_blockly = function () {
|
||||
],'afterBattle'),
|
||||
'<label text="打怪开门"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"type": "setValue", "name": "flag:__door_name__", "value": "flag:__door_name__+1"},
|
||||
{"type": "if", "condition": "flag:__door_name__==2",
|
||||
{"type": "setValue", "name": "flag:__door__", "value": "flag:__door__+1"},
|
||||
{"type": "if", "condition": "flag:__door__==2",
|
||||
"true": [
|
||||
{"type": "openDoor", "loc": [10,5]}
|
||||
],
|
||||
@ -193,23 +193,7 @@ editor_blockly = function () {
|
||||
],'afterBattle'),
|
||||
'<label text="杀死魔龙后隐藏其余图块"></label>',
|
||||
MotaActionFunctions.actionParser.parse([
|
||||
{"type": "setValue", "name": "flag:y", "value": "core.status.event.data.y-2"},
|
||||
{"type": "setValue", "name": "flag:x", "value": "core.status.event.data.x-1"},
|
||||
{"type": "hide", "loc": ["flag:x", "flag:y"]},
|
||||
{"type": "setValue", "name": "flag:x", "value": "core.status.event.data.x"},
|
||||
{"type": "hide", "loc": ["flag:x", "flag:y"]},
|
||||
{"type": "setValue", "name": "flag:x", "value": "core.status.event.data.x+1"},
|
||||
{"type": "hide", "loc": ["flag:x", "flag:y"]},
|
||||
{"type": "setValue", "name": "flag:y", "value": "core.status.event.data.y-1"},
|
||||
{"type": "hide", "loc": ["flag:x", "flag:y"]},
|
||||
{"type": "setValue", "name": "flag:x", "value": "core.status.event.data.x"},
|
||||
{"type": "hide", "loc": ["flag:x", "flag:y"]},
|
||||
{"type": "setValue", "name": "flag:x", "value": "core.status.event.data.x-1"},
|
||||
{"type": "hide", "loc": ["flag:x", "flag:y"]},
|
||||
{"type": "setValue", "name": "flag:y", "value": "core.status.event.data.y"},
|
||||
{"type": "hide", "loc": ["flag:x", "flag:y"]},
|
||||
{"type": "setValue", "name": "flag:x", "value": "core.status.event.data.x+1"},
|
||||
{"type": "hide", "loc": ["flag:x", "flag:y"]},
|
||||
{"type": "function", "function": "function(){var x=core.status.event.data.x,y=core.status.event.data.y;if(core.isset(x)&&core.isset(y)){core.insertAction([{type:'hide',loc:[[x-1,y-2],[x,y-2],[x+1,y-2],[x-1,y-1],[x,y-1],[x+1,y-1],[x-1,y],[x+1,y]]}]);}}"},
|
||||
],'afterBattle'),
|
||||
'<label text="获得圣水后变成墙"></label>',
|
||||
MotaActionFunctions.actionParser.parse({
|
||||
|
||||
@ -43,7 +43,7 @@
|
||||
|
||||
// 在该点的事件events中:
|
||||
"x,y": [
|
||||
{"type": "openDoor", "loc": [x,y]} // 直接使用开门事件即可。
|
||||
{"type": "openDoor", "loc": [x,y]} // 直接使用开门事件,坐标需写当前点坐标。
|
||||
]
|
||||
```
|
||||
|
||||
|
||||
@ -1437,6 +1437,8 @@ core.insertAction([
|
||||
},
|
||||
```
|
||||
|
||||
!> 多个机关门请分别设置开门变量如door1, door2等等。请勿存在两个机关门用相同的变量!
|
||||
|
||||
同样,为了实现类似于RMXP中,到达某一层后自动触发某段事件的效果,样板中还存在`firstArrive`事件。
|
||||
|
||||
当且仅当勇士第一次到达某层时,将会触发此事件。可以利用此事件来显示一些剧情,或再让它调用 `{"type": "trigger"}` 来继续调用其他的事件。
|
||||
@ -1527,9 +1529,9 @@ core.insertAction([
|
||||
}
|
||||
|
||||
// 在封印时,可以调用setValue将该flag置为真,然后调用自定义脚本 core.afterLoadData() 即可。
|
||||
"x,y": [ // 封印
|
||||
{"type": "setValue", "name": "flag:fengyin", "value": "true"},
|
||||
{"type": "function", "function": function() {
|
||||
"x,y": [
|
||||
{"type": "setValue", "name": "flag:fengyin", "value": "true"}, // 封印
|
||||
{"type": "function", "function": function() { // 手动调用自定义JS脚本 core.afterLoadData()
|
||||
core.afterLoadData();
|
||||
}}
|
||||
]
|
||||
|
||||
@ -871,7 +871,13 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
|
||||
core.stopAutomaticRoute();
|
||||
var speed=30;
|
||||
if (needKey) {
|
||||
var doorId = id;
|
||||
if (!(doorId.substring(doorId.length-4)=="Door")) {
|
||||
doorId=doorId+"Door";
|
||||
speed=70;
|
||||
}
|
||||
var key = id.replace("Door", "Key");
|
||||
if (needKey && (key=="specialKey" || core.isset(core.material.items[key]))) {
|
||||
var key = id.replace("Door", "Key");
|
||||
if (!core.hasItem(key)) {
|
||||
if (key != "specialKey")
|
||||
@ -887,11 +893,6 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
// open
|
||||
core.playSound("door.mp3");
|
||||
var state = 0;
|
||||
var doorId = id;
|
||||
if (!(doorId.substring(doorId.length-4)=="Door")) {
|
||||
doorId=doorId+"Door";
|
||||
speed=100;
|
||||
}
|
||||
var door = core.material.icons.animates[doorId];
|
||||
core.status.replay.animate=true;
|
||||
core.removeGlobalAnimate(x,y);
|
||||
@ -907,7 +908,7 @@ events.prototype.openDoor = function (id, x, y, needKey, callback) {
|
||||
}
|
||||
core.canvas.event.clearRect(32 * x, 32 * y, 32, 32);
|
||||
core.canvas.event.drawImage(core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||
}, speed)
|
||||
}, speed / core.status.replay.speed)
|
||||
}
|
||||
|
||||
////// 战斗 //////
|
||||
|
||||
Loading…
Reference in New Issue
Block a user