优化默认系统事件
This commit is contained in:
parent
50a0eda71f
commit
1faad822fb
@ -278,9 +278,8 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"values": [
|
||||
"null",
|
||||
"openDoor",
|
||||
"passNet",
|
||||
"changeLight",
|
||||
"pushBox",
|
||||
"ski",
|
||||
"custom"
|
||||
]
|
||||
},
|
||||
|
||||
@ -70,23 +70,11 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_lint": true,
|
||||
"_data": "道具后脚本"
|
||||
},
|
||||
"afterChangeLight": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_lint": true,
|
||||
"_data": "改变亮灯后"
|
||||
},
|
||||
"afterPushBox": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_lint": true,
|
||||
"_data": "推箱子后"
|
||||
},
|
||||
"afterPassNet": {
|
||||
"_leaf": true,
|
||||
"_type": "textarea",
|
||||
"_lint": true,
|
||||
"_data": "特殊地形后"
|
||||
}
|
||||
}
|
||||
},
|
||||
|
||||
@ -658,7 +658,7 @@ control.prototype._moveAction_moving = function (callback) {
|
||||
core.events._trigger(nowx, nowy);
|
||||
|
||||
// 检查该点是否是滑冰
|
||||
if (core.getBgNumber() == 167) {
|
||||
if (core.onSki()) {
|
||||
core.insertAction("滑冰事件", null, null, null, true);
|
||||
}
|
||||
|
||||
|
||||
@ -317,7 +317,7 @@ events.prototype._trigger = function (x, y) {
|
||||
eval(block.event.script);
|
||||
} catch (e) { main.log(e); }
|
||||
|
||||
if (block.event.trigger) {
|
||||
if (block.event.trigger && block.event.trigger != 'null') {
|
||||
var noPass = block.event.noPass, trigger = block.event.trigger;
|
||||
if (noPass) core.clearAutomaticRouteNode(x, y);
|
||||
|
||||
@ -708,33 +708,6 @@ events.prototype.visitFloor = function (floorId) {
|
||||
core.getFlag("__visited__")[floorId] = true;
|
||||
}
|
||||
|
||||
events.prototype._sys_passNet = function (data, callback) {
|
||||
this.passNet(data);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
////// 经过一个路障 //////
|
||||
events.prototype.passNet = function (data) {
|
||||
if (!core.hasItem('shoes')) {
|
||||
// 血网 lavaNet 移动到 checkBlock 中处理
|
||||
if (data.event.id == 'poisonNet') { // 毒网
|
||||
core.insertAction({"type":"insert","name":"毒衰咒处理","args":[0]});
|
||||
}
|
||||
else if (data.event.id == 'weakNet') { // 衰网
|
||||
core.insertAction({"type":"insert","name":"毒衰咒处理","args":[1]});
|
||||
}
|
||||
else if (data.event.id == 'curseNet') { // 咒网
|
||||
core.insertAction({"type":"insert","name":"毒衰咒处理","args":[2]});
|
||||
}
|
||||
}
|
||||
this.afterPassNet(data.x, data.y, data.event.id);
|
||||
core.updateStatusBar();
|
||||
}
|
||||
|
||||
events.prototype.afterPassNet = function (x, y, id) {
|
||||
if (this.eventdata.afterPassNet) this.eventdata.afterPassNet(x, y, id);
|
||||
}
|
||||
|
||||
events.prototype._sys_pushBox = function (data, callback) {
|
||||
this.pushBox(data);
|
||||
if (callback) callback();
|
||||
@ -749,7 +722,15 @@ events.prototype.pushBox = function (data) {
|
||||
nx = data.x + core.utils.scan[direction].x, ny = data.y + core.utils.scan[direction].y;
|
||||
|
||||
// 检测能否推上去
|
||||
if (!core.canMoveHero() || !core.canMoveHero(data.x, data.y, direction)) return;
|
||||
if (!core.canMoveHero()) return;
|
||||
var canGoDeadZone = core.flags.canGoDeadZone;
|
||||
core.flags.canGoDeadZone = false;
|
||||
if (!core.canMoveHero(data.x, data.y, direction)) {
|
||||
core.flags.canGoDeadZone = canGoDeadZone;
|
||||
return;
|
||||
}
|
||||
core.flags.canGoDeadZone = canGoDeadZone;
|
||||
|
||||
var nextId = core.getBlockId(nx, ny);
|
||||
if (nextId != null && nextId != 'flower') return;
|
||||
|
||||
@ -784,22 +765,17 @@ events.prototype.afterPushBox = function () {
|
||||
return this.eventdata.afterPushBox();
|
||||
}
|
||||
|
||||
events.prototype._sys_changeLight = function (data, callback) {
|
||||
core.events.changeLight(data.event.id, data.x, data.y);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
////// 改变亮灯(感叹号)的事件 //////
|
||||
events.prototype.changeLight = function (id, x, y) {
|
||||
if (id != null && id != 'light') return;
|
||||
core.setBlock(core.getNumberById('darkLight'), x, y);
|
||||
return this.eventdata.afterChangeLight(x, y);
|
||||
}
|
||||
|
||||
events.prototype._sys_ski = function (data, callback) {
|
||||
core.insertAction(["V2.6后,请将滑冰放在背景层!"], data.x, data.y, callback);
|
||||
}
|
||||
|
||||
/// 当前是否在冰上
|
||||
events.prototype.onSki = function (number) {
|
||||
if (number == null) number = core.getBgNumber();
|
||||
var block = core.getBlockByNumber(number);
|
||||
return block && block.event && block.event.trigger == 'ski';
|
||||
}
|
||||
|
||||
events.prototype._sys_action = function (data, callback) {
|
||||
var ev = core.clone(data.event.data), ex = data.x, ey = data.y;
|
||||
// 检查是否需要改变朝向
|
||||
|
||||
@ -596,7 +596,7 @@ maps.prototype._canMoveDirectly_bfs = function (sx, sy, locs, number, ans) {
|
||||
if (!core.inArray(canMoveArray[x][y], direction)) continue;
|
||||
var nx = x + core.utils.scan[direction].x, ny = y + core.utils.scan[direction].y, nindex = nx + "," + ny;
|
||||
if (visited[nindex]) continue;
|
||||
if (bgMap[ny][nx] == 167) continue;
|
||||
if (core.onSki(bgMap[ny][nx])) continue;
|
||||
if (!this._canMoveDirectly_checkNextPoint(blocksObj, nx, ny)) continue;
|
||||
visited[nindex] = visited[now] + 1;
|
||||
// if (nx == ex && ny == ey) return visited[nindex];
|
||||
|
||||
@ -163,7 +163,7 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.getBgNumber() == 167",
|
||||
"condition": "core.onSki()",
|
||||
"true": [
|
||||
{
|
||||
"type": "if",
|
||||
|
||||
@ -404,10 +404,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
if (todo.length > 0) core.insertAction(todo, x, y);
|
||||
|
||||
if (callback) callback();
|
||||
},
|
||||
"afterChangeLight": function(x,y) {
|
||||
// 改变亮灯之后,可以触发的事件
|
||||
|
||||
},
|
||||
"afterPushBox": function () {
|
||||
// 推箱子后的事件
|
||||
@ -421,13 +417,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
}
|
||||
*/
|
||||
}
|
||||
},
|
||||
"afterPassNet": function (x, y, id) {
|
||||
// 经过特殊地形后的事件;x和y为当前坐标,id为当前的图块id
|
||||
|
||||
// 这是个一次性血网的例子
|
||||
// if (id == 'lavaNet') core.removeBlock(x, y);
|
||||
|
||||
},
|
||||
},
|
||||
"enemys": {
|
||||
@ -1077,7 +1066,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
enemy = core.material.enemys[id];
|
||||
|
||||
// 血网
|
||||
if (id == 'lavaNet' && block.event.trigger == 'passNet' && !core.hasItem('shoes')) {
|
||||
if (id == 'lavaNet' && !core.hasItem('shoes')) {
|
||||
damage[loc] = (damage[loc] || 0) + core.values.lavaDamage;
|
||||
type[loc] = "血网伤害";
|
||||
}
|
||||
|
||||
@ -10,10 +10,10 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"8": {"cls":"terrains","id":"blueShopRight"},
|
||||
"9": {"cls":"terrains","id":"pinkShopLeft"},
|
||||
"10": {"cls":"terrains","id":"pinkShopRight"},
|
||||
"11": {"cls":"animates","id":"lavaNet","canPass":true,"trigger":"passNet"},
|
||||
"12": {"cls":"animates","id":"poisonNet","canPass":true,"trigger":"passNet"},
|
||||
"13": {"cls":"animates","id":"weakNet","canPass":true,"trigger":"passNet"},
|
||||
"14": {"cls":"animates","id":"curseNet","canPass":true,"trigger":"passNet"},
|
||||
"11": {"cls":"animates","id":"lavaNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 血网的伤害效果移动到 checkBlock 中处理\n\n\t// 如果要做一次性血网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})();"},
|
||||
"12": {"cls":"animates","id":"poisonNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行毒处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [0] });\n\t}\n\n\t// 如果要做一次性毒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()"},
|
||||
"13": {"cls":"animates","id":"weakNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行衰处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [1] });\n\t}\n\n\t// 如果要做一次性衰网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()"},
|
||||
"14": {"cls":"animates","id":"curseNet","canPass":true,"trigger":"null","script":"(function () {\n\t// 直接插入公共事件进行咒处理\n\tif (!core.hasItem('shoes')) {\n\t\tcore.insertAction({ \"type\": \"insert\", \"name\": \"毒衰咒处理\", \"args\": [2] });\n\t}\n\n\t// 如果要做一次性咒网,可直接注释掉下面这句话:\n\t// core.removeBlock(core.getHeroLoc('x'), core.getHeroLoc('y'));\n})()"},
|
||||
"15": {"cls":"animates","id":"blueWater"},
|
||||
"16": {"cls":"animates","id":"water"},
|
||||
"20": {"cls":"autotile","id":"autotile"},
|
||||
@ -109,7 +109,7 @@ var maps_90f36752_8815_4be8_b32b_d7fad1d0542e =
|
||||
"162": {"cls":"terrains","id":"arrowDown","canPass":true,"cannotOut":["left","right","up"],"cannotIn":["down"]},
|
||||
"163": {"cls":"terrains","id":"arrowLeft","canPass":true,"cannotOut":["up","down","right"],"cannotIn":["left"]},
|
||||
"164": {"cls":"terrains","id":"arrowRight","canPass":true,"cannotOut":["up","down","left"],"cannotIn":["right"]},
|
||||
"165": {"cls":"terrains","id":"light","trigger":"changeLight","canPass":true},
|
||||
"165": {"cls":"terrains","id":"light","trigger":"null","canPass":true,"script":"(function () {\n\tcore.setBlock(core.getNumberById('darkLight'), core.getHeroLoc('x'), core.getHeroLoc('y'));\n})();"},
|
||||
"166": {"cls":"terrains","id":"darkLight"},
|
||||
"167": {"cls":"terrains","id":"ski","trigger":"ski","canPass":true},
|
||||
"168": {"cls":"terrains","id":"flower","canPass":true},
|
||||
|
||||
Loading…
Reference in New Issue
Block a user