增加moveAction,重写core.trigger,删除滑冰事件
This commit is contained in:
parent
32cadcc280
commit
d1257b7ab3
@ -385,6 +385,7 @@ action
|
||||
| screenFlash_s
|
||||
| setWeather_s
|
||||
| move_s
|
||||
| moveAction_s
|
||||
| moveHero_s
|
||||
| jump_s
|
||||
| jumpHero_s
|
||||
@ -732,16 +733,19 @@ return code;
|
||||
*/;
|
||||
|
||||
trigger_s
|
||||
: '触发事件' 'x' PosString ',' 'y' PosString '不结束当前事件' Bool Newline
|
||||
: '触发系统事件' 'x' PosString? ',' 'y' PosString? Newline
|
||||
|
||||
|
||||
/* trigger_s
|
||||
tooltip : trigger: 立即触发另一个地点的事件
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=trigger%EF%BC%9A%E7%AB%8B%E5%8D%B3%E8%A7%A6%E5%8F%91%E5%8F%A6%E4%B8%80%E4%B8%AA%E5%9C%B0%E7%82%B9%E7%9A%84%E4%BA%8B%E4%BB%B6
|
||||
default : ["0","0",false]
|
||||
default : ["",""]
|
||||
colour : this.eventColor
|
||||
Bool_0 = Bool_0 ?', "keep": true':'';
|
||||
var code = '{"type": "trigger", "loc": ['+PosString_0+','+PosString_1+']'+Bool_0+'},\n';
|
||||
var floorstr = '';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
var code = '{"type": "trigger"'+floorstr+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -764,7 +768,7 @@ return code;
|
||||
*/;
|
||||
|
||||
insert_2_s
|
||||
: '插入事件' 'x' PosString ',' 'y' PosString Event_List? '楼层' IdString? '参数列表' JsonEvalString? Newline
|
||||
: '插入事件' 'x' PosString? ',' 'y' PosString? Event_List? '楼层' IdString? '参数列表' JsonEvalString? Newline
|
||||
|
||||
|
||||
/* insert_2_s
|
||||
@ -781,7 +785,11 @@ if (JsonEvalString_0) {
|
||||
if (Event_List_0 && Event_List_0 !=='null')
|
||||
Event_List_0 = ', "which": "'+Event_List_0+'"';
|
||||
else Event_List_0 = '';
|
||||
var code = '{"type": "insert", "loc": ['+PosString_0+','+PosString_1+']'+Event_List_0+IdString_0+JsonEvalString_0+'},\n';
|
||||
var floorstr = '';
|
||||
if (PosString_0 && PosString_1) {
|
||||
floorstr = ', "loc": ['+PosString_0+','+PosString_1+']';
|
||||
}
|
||||
var code = '{"type": "insert"'+floorstr+Event_List_0+IdString_0+JsonEvalString_0+'},\n';
|
||||
return code;
|
||||
*/;
|
||||
|
||||
@ -1566,8 +1574,21 @@ var code = '{"type": "move"'+floorstr+IntString_0+Bool_0+Bool_1+', "steps": '+JS
|
||||
return code;
|
||||
*/;
|
||||
|
||||
moveAction_s
|
||||
: '勇士前进一格或撞击' Newline
|
||||
|
||||
|
||||
/* moveAction_s
|
||||
tooltip : moveAction: 前进一格或撞击
|
||||
helpUrl : https://h5mota.com/games/template/_docs/#/event?id=move%EF%BC%9A%E8%AE%A9%E6%9F%90%E4%B8%AAnpc%E6%80%AA%E7%89%A9%E7%A7%BB%E5%8A%A8
|
||||
colour : this.dataColor
|
||||
return '{"type": "moveAction"},\n';
|
||||
*/;
|
||||
|
||||
|
||||
|
||||
moveHero_s
|
||||
: '移动勇士' '动画时间' IntString? '不等待执行完毕' Bool BGNL? StepString Newline
|
||||
: '无视地形移动勇士' '动画时间' IntString? '不等待执行完毕' Bool BGNL? StepString Newline
|
||||
|
||||
|
||||
/* moveHero_s
|
||||
@ -3187,7 +3208,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
this.next = MotaActionBlocks['move_s'].xmlText([
|
||||
data.loc[0],data.loc[1],data.time,data.keep||false,data.async||false,this.StepString(data.steps),this.next]);
|
||||
break;
|
||||
case "moveHero": // 移动勇士
|
||||
case "moveAction": // 前进一格或撞击
|
||||
this.next = MotaActionBlocks['moveAction_s'].xmlText([this.next]);
|
||||
break;
|
||||
case "moveHero": // 无视地形移动勇士
|
||||
this.next = MotaActionBlocks['moveHero_s'].xmlText([
|
||||
data.time,data.async||false,this.StepString(data.steps),this.next]);
|
||||
break;
|
||||
@ -3336,9 +3360,10 @@ ActionParser.prototype.parseAction = function() {
|
||||
data.loc[0],data.loc[1],this.next]);
|
||||
}
|
||||
break;
|
||||
case "trigger": // 触发另一个事件;当前事件会被立刻结束。需要另一个地点的事件是有效的
|
||||
case "trigger": // 触发另一个事件
|
||||
data.loc = data.loc || [];
|
||||
this.next = MotaActionBlocks['trigger_s'].xmlText([
|
||||
data.loc[0],data.loc[1],data.keep,this.next]);
|
||||
data.loc[0],data.loc[1],this.next]);
|
||||
break;
|
||||
case "insert": // 强制插入另一个点的事件在当前事件列表执行,当前坐标和楼层不会改变
|
||||
if (data.args instanceof Array) {
|
||||
@ -3350,6 +3375,7 @@ ActionParser.prototype.parseAction = function() {
|
||||
data.name, data.args||"", this.next]);
|
||||
}
|
||||
else {
|
||||
data.loc = data.loc || [];
|
||||
this.next = MotaActionBlocks['insert_2_s'].xmlText([
|
||||
data.loc[0],data.loc[1],data.which,data.floorId||'',data.args||"",this.next]);
|
||||
}
|
||||
|
||||
@ -107,6 +107,7 @@ editor_blockly = function () {
|
||||
MotaActionBlocks['input_s'].xmlText(),
|
||||
MotaActionBlocks['input2_s'].xmlText(),
|
||||
MotaActionBlocks['update_s'].xmlText(),
|
||||
MotaActionBlocks['moveAction_s'].xmlText(),
|
||||
MotaActionBlocks['moveHero_s'].xmlText(),
|
||||
MotaActionBlocks['jumpHero_s'].xmlText(),
|
||||
MotaActionBlocks['changeFloor_s'].xmlText(),
|
||||
|
||||
@ -25,13 +25,6 @@ var events_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = {
|
||||
"_event": "commonEvent",
|
||||
"_data": "毒衰咒处理"
|
||||
},
|
||||
"滑冰事件": {
|
||||
"_leaf": true,
|
||||
"_type": "event",
|
||||
"_range": "thiseval instanceof Array",
|
||||
"_event": "commonEvent",
|
||||
"_data": "滑冰事件"
|
||||
},
|
||||
}
|
||||
if (obj[key]) return obj[key];
|
||||
return {
|
||||
|
||||
@ -584,7 +584,6 @@ control.prototype.setAutoHeroMove = function (steps) {
|
||||
control.prototype.setHeroMoveInterval = function (callback) {
|
||||
if (core.status.heroMoving > 0) return;
|
||||
if (core.status.replay.speed == 24) {
|
||||
core.moveOneStep(core.nextX(), core.nextY());
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
@ -601,15 +600,14 @@ control.prototype.setHeroMoveInterval = function (callback) {
|
||||
if (core.status.heroMoving>=8) {
|
||||
clearInterval(core.interval.heroMoveInterval);
|
||||
core.status.heroMoving = 0;
|
||||
core.moveOneStep(core.nextX(), core.nextY());
|
||||
if (callback) callback();
|
||||
}
|
||||
}, core.values.moveSpeed / 8 * toAdd / core.status.replay.speed);
|
||||
}
|
||||
|
||||
////// 每移动一格后执行的事件 //////
|
||||
control.prototype.moveOneStep = function(x, y) {
|
||||
return this.controldata.moveOneStep(x, y);
|
||||
control.prototype.moveOneStep = function (callback) {
|
||||
return this.controldata.moveOneStep(callback);
|
||||
}
|
||||
|
||||
////// 实际每一步的行走过程 //////
|
||||
@ -625,7 +623,7 @@ control.prototype._moveAction_noPass = function (canMove, callback) {
|
||||
core.status.route.push(core.getHeroLoc('direction'));
|
||||
core.status.automaticRoute.moveStepBeforeStop = [];
|
||||
core.status.automaticRoute.lastDirection = core.getHeroLoc('direction');
|
||||
if (canMove) core.events._trigger(core.nextX(), core.nextY());
|
||||
if (canMove) core.trigger(core.nextX(), core.nextY());
|
||||
core.drawHero();
|
||||
|
||||
if (core.status.automaticRoute.moveStepBeforeStop.length==0) {
|
||||
@ -637,31 +635,14 @@ control.prototype._moveAction_noPass = function (canMove, callback) {
|
||||
|
||||
control.prototype._moveAction_moving = function (callback) {
|
||||
core.setHeroMoveInterval(function () {
|
||||
core.setHeroLoc('x', core.nextX(), true);
|
||||
core.setHeroLoc('y', core.nextY(), true);
|
||||
|
||||
var direction = core.getHeroLoc('direction');
|
||||
core.control._moveAction_popAutomaticRoute();
|
||||
core.status.route.push(direction);
|
||||
|
||||
// 无事件的道具(如血瓶)需要优先于阻激夹域判定
|
||||
var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
|
||||
var block = core.getBlock(nowx,nowy);
|
||||
var hasTrigger = false;
|
||||
if (block!=null && block.block.event.trigger=='getItem' &&
|
||||
!core.floors[core.status.floorId].afterGetItem[nowx+","+nowy]) {
|
||||
hasTrigger = true;
|
||||
core.events._trigger(nowx, nowy);
|
||||
}
|
||||
// 执行该点的阻激夹域事件
|
||||
core.checkBlock();
|
||||
|
||||
// 执行该点事件
|
||||
if (!hasTrigger)
|
||||
core.events._trigger(nowx, nowy);
|
||||
|
||||
// 检查该点是否是滑冰
|
||||
if (core.onSki()) {
|
||||
core.insertAction("滑冰事件", null, null, null, true);
|
||||
}
|
||||
|
||||
|
||||
core.moveOneStep();
|
||||
if (callback) callback();
|
||||
});
|
||||
}
|
||||
|
||||
124
libs/events.js
124
libs/events.js
@ -300,16 +300,22 @@ events.prototype.doSystemEvent = function (type, data, callback) {
|
||||
}
|
||||
|
||||
////// 触发(x,y)点的事件 //////
|
||||
events.prototype._trigger = function (x, y) {
|
||||
if (core.status.gameOver) return;
|
||||
if (core.status.event.id == 'action') {
|
||||
core.insertAction({"type": "trigger", "loc": [x, y]}, x, y, null, true);
|
||||
events.prototype.trigger = function (x, y, callback) {
|
||||
var _executeCallback = function () {
|
||||
// 因为trigger之后还有可能触发其他同步脚本(比如阻激夹域检测)
|
||||
// 所以这里强制callback被异步触发
|
||||
if (callback) {
|
||||
setTimeout(callback, 1); // +1是为了录像检测系统
|
||||
}
|
||||
return;
|
||||
}
|
||||
if (core.status.event.id) return;
|
||||
if (core.status.gameOver) return _executeCallback();
|
||||
if (core.status.event.id && core.status.event.id != 'action') return _executeCallback();
|
||||
|
||||
var inAction = core.status.event.id == 'action';
|
||||
|
||||
var block = core.getBlock(x, y);
|
||||
if (block == null) return;
|
||||
if (block == null) return _executeCallback();
|
||||
block = block.block;
|
||||
|
||||
// 执行该点的脚本
|
||||
@ -322,11 +328,24 @@ events.prototype._trigger = function (x, y) {
|
||||
if (noPass) core.clearAutomaticRouteNode(x, y);
|
||||
|
||||
// 转换楼层能否穿透
|
||||
if (trigger == 'changeFloor' && !noPass && this._trigger_ignoreChangeFloor(block))
|
||||
if (!inAction && trigger == 'changeFloor' && !noPass && this._trigger_ignoreChangeFloor(block))
|
||||
return;
|
||||
core.status.automaticRoute.moveDirectly = false;
|
||||
this.doSystemEvent(trigger, block);
|
||||
if (inAction) {
|
||||
// 切换事件点的坐标
|
||||
this.setEvents(null, block.x, block.y);
|
||||
if (block.event.trigger == 'action') {
|
||||
this.insertAction(block.event.data);
|
||||
}
|
||||
else {
|
||||
this.doSystemEvent(block.event.trigger, block, _executeCallback);
|
||||
return;
|
||||
}
|
||||
} else {
|
||||
this.doSystemEvent(trigger, block);
|
||||
}
|
||||
}
|
||||
return _executeCallback();
|
||||
}
|
||||
|
||||
events.prototype._trigger_ignoreChangeFloor = function (block) {
|
||||
@ -370,7 +389,8 @@ events.prototype.battle = function (id, x, y, force, callback) {
|
||||
if (!this.beforeBattle(id, x, y))
|
||||
return core.clearContinueAutomaticRoute(callback);
|
||||
// 战后事件
|
||||
this.afterBattle(id, x, y, callback);
|
||||
this.afterBattle(id, x, y);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
////// 战斗前触发的事件 //////
|
||||
@ -379,8 +399,8 @@ events.prototype.beforeBattle = function (enemyId, x, y) {
|
||||
}
|
||||
|
||||
////// 战斗结束后触发的事件 //////
|
||||
events.prototype.afterBattle = function (enemyId, x, y, callback) {
|
||||
return this.eventdata.afterBattle(enemyId, x, y, callback);
|
||||
events.prototype.afterBattle = function (enemyId, x, y) {
|
||||
return this.eventdata.afterBattle(enemyId, x, y);
|
||||
}
|
||||
|
||||
events.prototype._sys_openDoor = function (data, callback) {
|
||||
@ -408,7 +428,7 @@ events.prototype.openDoor = function (x, y, needKey, callback) {
|
||||
setTimeout(function () {
|
||||
core.status.replay.animate = false;
|
||||
core.events.afterOpenDoor(id, x, y, callback);
|
||||
});
|
||||
}, 1); // +1是为了录像检测系统
|
||||
} else {
|
||||
this._openDoor_animate(id, x, y, callback);
|
||||
}
|
||||
@ -472,7 +492,8 @@ events.prototype._openDoor_animate = function (id, x, y, callback) {
|
||||
delete core.animateFrame.asyncId[animate];
|
||||
if (!locked) core.unLockControl();
|
||||
core.status.replay.animate = false;
|
||||
core.events.afterOpenDoor(id, x, y, callback);
|
||||
core.events.afterOpenDoor(id, x, y);
|
||||
if (callback) callback();
|
||||
return;
|
||||
}
|
||||
core.drawImage('event', core.material.images.animates, 32 * state, 32 * door, 32, 32, 32 * x, 32 * y, 32, 32);
|
||||
@ -481,8 +502,8 @@ events.prototype._openDoor_animate = function (id, x, y, callback) {
|
||||
}
|
||||
|
||||
////// 开一个门后触发的事件 //////
|
||||
events.prototype.afterOpenDoor = function (doorId, x, y, callback) {
|
||||
return this.eventdata.afterOpenDoor(doorId, x, y, callback);
|
||||
events.prototype.afterOpenDoor = function (doorId, x, y) {
|
||||
return this.eventdata.afterOpenDoor(doorId, x, y);
|
||||
}
|
||||
|
||||
events.prototype._sys_getItem = function (data, callback) {
|
||||
@ -519,11 +540,12 @@ events.prototype.getItem = function (id, num, x, y, isGentleClick, callback) {
|
||||
itemHint.push(id);
|
||||
}
|
||||
|
||||
this.afterGetItem(id, x, y, isGentleClick, callback);
|
||||
this.afterGetItem(id, x, y, isGentleClick);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
events.prototype.afterGetItem = function (id, x, y, isGentleClick, callback) {
|
||||
this.eventdata.afterGetItem(id, x, y, isGentleClick, callback);
|
||||
events.prototype.afterGetItem = function (id, x, y, isGentleClick) {
|
||||
this.eventdata.afterGetItem(id, x, y, isGentleClick);
|
||||
}
|
||||
|
||||
////// 获得面前的物品(轻按) //////
|
||||
@ -736,30 +758,17 @@ events.prototype.pushBox = function (data) {
|
||||
var nextId = core.getBlockId(nx, ny);
|
||||
if (nextId != null && nextId != 'flower') return;
|
||||
|
||||
core.setBlock(nextId == null ? 169 : 170, nx, ny);
|
||||
core.setBlock(nextId == null ? 'box' : 'boxed', nx, ny);
|
||||
|
||||
if (data.event.id == 'box')
|
||||
core.removeBlock(data.x, data.y);
|
||||
else
|
||||
core.setBlock(168, data.x, data.y);
|
||||
this._pushBox_moveHero(direction);
|
||||
}
|
||||
|
||||
events.prototype._pushBox_moveHero = function (direction) {
|
||||
core.status.replay.animate = true;
|
||||
core.lockControl();
|
||||
setTimeout(function () {
|
||||
core.moveHero(direction, function () {
|
||||
core.status.replay.animate = false;
|
||||
core.status.route.pop();
|
||||
core.events.afterPushBox();
|
||||
// 可能有阻击...
|
||||
if (core.status.event.id == null) {
|
||||
core.unLockControl();
|
||||
core.replay();
|
||||
}
|
||||
});
|
||||
});
|
||||
core.setBlock('flower', data.x, data.y);
|
||||
// 勇士前进一格,然后触发推箱子后事件
|
||||
core.insertAction([
|
||||
{"type": "moveAction"},
|
||||
{"type": "function", "function": "function() { core.afterPushBox(); }"}
|
||||
]);
|
||||
}
|
||||
|
||||
////// 推箱子后的事件 //////
|
||||
@ -768,7 +777,8 @@ events.prototype.afterPushBox = function () {
|
||||
}
|
||||
|
||||
events.prototype._sys_ski = function (data, callback) {
|
||||
core.insertAction(["V2.6后,请将滑冰放在背景层!"], data.x, data.y, callback);
|
||||
core.insertAction(["V2.6后,请将滑冰放在背景层!"], data.x, data.y);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
/// 当前是否在冰上
|
||||
@ -795,7 +805,8 @@ events.prototype._sys_action = function (data, callback) {
|
||||
|
||||
events.prototype._sys_custom = function (data, callback) {
|
||||
core.insertAction(["请使用\r[yellow]core.registerSystemEvent('custom', func)\r来处理自己添加的系统触发器!"],
|
||||
data.x, data.y, callback);
|
||||
data.x, data.y);
|
||||
if (callback) callback();
|
||||
}
|
||||
|
||||
// ------ 自定义事件的处理 ------ //
|
||||
@ -1341,6 +1352,26 @@ events.prototype._action_move = function (data, x, y, prefix) {
|
||||
this.__action_doAsyncFunc(data.async, core.moveBlock, loc[0], loc[1], data.steps, data.time, data.keep);
|
||||
}
|
||||
|
||||
events.prototype._action_moveAction = function (data, x, y, prefix) {
|
||||
// 检查下一个点是否可通行
|
||||
if (core.canMoveHero()) {
|
||||
var nx = core.nextX(), ny = core.nextY();
|
||||
// 检查noPass决定是撞击还是移动
|
||||
if (core.noPass(nx, ny)) {
|
||||
core.insertAction([
|
||||
{"type": "trigger", "loc": [nx, ny]}
|
||||
]);
|
||||
} else {
|
||||
// 先移动一格,然后尝试触发事件
|
||||
core.insertAction([
|
||||
{"type": "moveHero", "steps": ["forward"]},
|
||||
{"type": "function", "function": "function() { core.moveOneStep(core.doAction); }", "async": true},
|
||||
]);
|
||||
}
|
||||
}
|
||||
core.doAction();
|
||||
}
|
||||
|
||||
events.prototype._action_moveHero = function (data, x, y, prefix) {
|
||||
this.__action_doAsyncFunc(data.async, core.eventMoveHero, data.steps, data.time);
|
||||
}
|
||||
@ -1516,18 +1547,7 @@ events.prototype._action_battle = function (data, x, y, prefix) {
|
||||
|
||||
events.prototype._action_trigger = function (data, x, y, prefix) {
|
||||
var loc = this.__action_getLoc(data.loc, x, y, prefix);
|
||||
var block = core.getBlock(loc[0], loc[1]);
|
||||
if (block != null && block.block.event.trigger) {
|
||||
block = block.block;
|
||||
this.setEvents(data.keep ? null : [], block.x, block.y);
|
||||
if (block.event.trigger == 'action')
|
||||
this.insertAction(block.event.data);
|
||||
else {
|
||||
core.doSystemEvent(block.event.trigger, block, core.doAction);
|
||||
return;
|
||||
}
|
||||
}
|
||||
core.doAction();
|
||||
core.trigger(loc[0], loc[1], core.doAction);
|
||||
}
|
||||
|
||||
events.prototype._action_insert = function (data, x, y, prefix) {
|
||||
|
||||
@ -156,91 +156,6 @@ var events_c12a15a8_c380_4b28_8144_256cba95f760 =
|
||||
]
|
||||
}
|
||||
],
|
||||
"滑冰事件": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "公共事件:滑冰事件"
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.onSki()",
|
||||
"true": [
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.canMoveHero()",
|
||||
"true": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "检测下一个点是否可通行"
|
||||
},
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:nx",
|
||||
"value": "core.nextX()"
|
||||
},
|
||||
{
|
||||
"type": "setValue",
|
||||
"name": "flag:ny",
|
||||
"value": "core.nextY()"
|
||||
},
|
||||
{
|
||||
"type": "if",
|
||||
"condition": "core.noPass(flag:nx, flag:ny)",
|
||||
"true": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "不可通行,触发下一个点的事件"
|
||||
},
|
||||
{
|
||||
"type": "trigger",
|
||||
"loc": [
|
||||
"flag:nx",
|
||||
"flag:ny"
|
||||
]
|
||||
}
|
||||
],
|
||||
"false": [
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "可通行,先移动到下个点,然后检查阻激夹域,并尝试触发该点事件"
|
||||
},
|
||||
{
|
||||
"type": "moveHero",
|
||||
"time": 80,
|
||||
"steps": [
|
||||
"forward"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.checkBlock();\n}"
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "【触发事件】如果该点存在事件则会立刻结束当前事件"
|
||||
},
|
||||
{
|
||||
"type": "trigger",
|
||||
"loc": [
|
||||
"flag:nx",
|
||||
"flag:ny"
|
||||
]
|
||||
},
|
||||
{
|
||||
"type": "comment",
|
||||
"text": "如果该点不存在事件,则继续检测该点是否是滑冰点"
|
||||
},
|
||||
{
|
||||
"type": "function",
|
||||
"function": "function(){\ncore.insertAction(\"滑冰事件\",null,null,null,true)\n}"
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
]
|
||||
}
|
||||
],
|
||||
"回收钥匙商店": [
|
||||
{
|
||||
"type": "comment",
|
||||
|
||||
@ -234,7 +234,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
|
||||
return true;
|
||||
},
|
||||
"afterBattle": function (enemyId, x, y, callback) {
|
||||
"afterBattle": function (enemyId, x, y) {
|
||||
// 战斗结束后触发的事件
|
||||
|
||||
var enemy = core.material.enemys[enemyId];
|
||||
@ -379,10 +379,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
else
|
||||
core.clearContinueAutomaticRoute();
|
||||
|
||||
if (callback) callback();
|
||||
|
||||
},
|
||||
"afterOpenDoor": function (doorId, x, y, callback) {
|
||||
"afterOpenDoor": function (doorId, x, y) {
|
||||
// 开一个门后触发的事件
|
||||
|
||||
var todo = [];
|
||||
@ -396,10 +394,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.continueAutomaticRoute();
|
||||
else
|
||||
core.clearContinueAutomaticRoute();
|
||||
|
||||
if (callback) callback();
|
||||
},
|
||||
"afterGetItem": function (itemId, x, y, isGentleClick, callback) {
|
||||
"afterGetItem": function (itemId, x, y, isGentleClick) {
|
||||
// 获得一个道具后触发的事件
|
||||
// itemId:获得的道具ID;x和y是该道具所在的坐标
|
||||
// isGentleClick:是否是轻按触发的
|
||||
@ -413,8 +409,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
}
|
||||
|
||||
if (todo.length > 0) core.insertAction(todo, x, y);
|
||||
|
||||
if (callback) callback();
|
||||
},
|
||||
"afterPushBox": function () {
|
||||
// 推箱子后的事件
|
||||
@ -1218,17 +1212,15 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
cache: {} // clear cache
|
||||
};
|
||||
},
|
||||
"moveOneStep": function (x, y) {
|
||||
// 勇士每走一步后执行的操作,x,y为要移动到的坐标。
|
||||
"moveOneStep": function (callback) {
|
||||
// 勇士每走一步后执行的操作。callback为行走完毕后的回调
|
||||
// 这个函数执行在“刚走完”的时候,即还没有检查该点的事件和领域伤害等。
|
||||
// 请注意:瞬间移动不会执行该函数。如果要控制能否瞬间移动有三种方法:
|
||||
// 1. 将全塔属性中的cannotMoveDirectly这个开关勾上,即可在全塔中全程禁止使用瞬移。
|
||||
// 2, 将楼层属性中的cannotMoveDirectly这个开关勾上,即禁止在该层楼使用瞬移。
|
||||
// 3. 将flag:cannotMoveDirectly置为true,即可使用flag控制在某段剧情范围内禁止瞬移。
|
||||
|
||||
// 设置当前坐标,增加步数
|
||||
core.setHeroLoc('x', x, true);
|
||||
core.setHeroLoc('y', y, true);
|
||||
// 增加步数
|
||||
core.status.hero.steps++;
|
||||
// 更新跟随者状态,并绘制
|
||||
core.updateFollowers();
|
||||
@ -1241,6 +1233,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
core.status.hero.hp = 0;
|
||||
core.updateStatusBar();
|
||||
core.events.lose();
|
||||
return;
|
||||
} else {
|
||||
core.updateStatusBar();
|
||||
}
|
||||
@ -1253,6 +1246,31 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
||||
// 检查自动事件
|
||||
core.checkAutoEvents();
|
||||
|
||||
// ------ 检查目标点事件 ------ //
|
||||
// 无事件的道具(如血瓶)需要优先于阻激夹域判定
|
||||
var nowx = core.getHeroLoc('x'), nowy = core.getHeroLoc('y');
|
||||
var block = core.getBlock(nowx, nowy);
|
||||
var hasTrigger = false;
|
||||
if (block!=null && block.block.event.trigger=='getItem' &&
|
||||
!core.floors[core.status.floorId].afterGetItem[nowx+","+nowy]) {
|
||||
hasTrigger = true;
|
||||
core.trigger(nowx, nowy, callback);
|
||||
}
|
||||
// 执行目标点的阻激夹域事件
|
||||
core.checkBlock();
|
||||
|
||||
// 执行目标点的script和事件
|
||||
if (!hasTrigger)
|
||||
core.trigger(nowx, nowy, callback);
|
||||
|
||||
// 检查该点是否是滑冰
|
||||
if (core.onSki()) {
|
||||
// 延迟到事件最后执行,因为这之前可能有阻激夹域动画
|
||||
core.insertAction({"type": "moveAction"}, null, null, null, true);
|
||||
}
|
||||
|
||||
// ------ 检查目标点事件 END ------ //
|
||||
|
||||
// 如需强行终止行走可以在这里条件判定:
|
||||
// core.stopAutomaticRoute();
|
||||
},
|
||||
|
||||
@ -11,7 +11,7 @@
|
||||
10. 建议给“转变图块”事件增加一个淡入时间参数,用于原本是空地或空气墙的情况,目前这种效果必须借助存在安全隐患的红点
|
||||
(已完成!) 11. 建议修复勇士后退时跟随者的鬼畜行为,并推出一套能够对跟随者位置和朝向进行读写的API甚至事件,且允许这些信息被计入存档,以实现一些演出效果甚至游戏要素,如新新2用公主占位防冰块
|
||||
(已完成!) 12. “设置怪物属性”事件的下拉框目前只支持一部分,另一部分只能通过手敲json再解析来得到,希望提供完整支持
|
||||
13. 建议给core.moveAction(callback)提供对应的事件,用于在事件中让勇士像事件外一样移动,从而正常触发跑毒和阻激夹域捕等
|
||||
(已完成!) 13. 建议给core.moveAction(callback)提供对应的事件,用于在事件中让勇士像事件外一样移动,从而正常触发跑毒和阻激夹域捕等
|
||||
(已完成!) 14. core.openShop()和对应的事件,建议在用于公共事件时简单地退化为“插入公共事件”而不要打断当前事件,把决定权交给作者
|
||||
(已完成!) 15. “等待用户操作”虽然提供了场合块但还不支持将多个按键的场合合并(比如空格、回车和C键一般会被作者予以合并,执行内容如果只是大致相同也值得合并,在块内由作者根据flag再行分歧),建议支持一下
|
||||
(已完成!) 16. “绘制描边文本”事件建议加一个“描边颜色”参数,目前只能描黑边
|
||||
@ -47,7 +47,7 @@
|
||||
像素高分辨率问题
|
||||
(已完成!) 道具效果优化,删除部分道具相关的开关
|
||||
(已完成!) 素材列表选择
|
||||
油漆桶,动态更改地图大小
|
||||
(已完成!) 油漆桶,动态更改地图大小
|
||||
地图拉框选择复制剪切删除
|
||||
|
||||
-------------
|
||||
@ -117,7 +117,7 @@
|
||||
(已完成!) 60. “设置怪物属性”事件的下拉框目前只支持一部分,另一部分只能通过手敲json再解析来得到,希望提供完整支持
|
||||
(已完成!) 61. 在事件编辑器中进行地图选点时,有些事件指令虽然只能用于同楼层,但实际生效时勇士可能已经不在当前正在编辑的楼层(比如在一个楼层切换事件指令后)了,所以希望地图选点始终提供楼层下拉表
|
||||
(文档相关给秋橙) 62. 希望在线文档介绍一下楼层和startText的独立开关的flag表示
|
||||
63. 希望给core.moveAction(callback)函数提供一个对应的事件指令,用于在事件流处理中让勇士进行一些有游戏性意义(即非纯演出)的移动。如果做不到的话希望参照本文的46号issue作为原生脚本勾选async的例子讲解如何使用
|
||||
(已完成!) 63. 希望给core.moveAction(callback)函数提供一个对应的事件指令,用于在事件流处理中让勇士进行一些有游戏性意义(即非纯演出)的移动。如果做不到的话希望参照本文的46号issue作为原生脚本勾选async的例子讲解如何使用
|
||||
(已完成!) 64. “打开全局商店”事件指令建议在用于公共事件版商店时简单地退化为“插入公共事件”而不要打断当前事件流,由作者在这个公共事件结尾去决定“立刻结束当前事件”还是不结束
|
||||
(已修复!) 65. “显隐贴图”的参数应为像素坐标而不是网格坐标,请修正在线文档的描述。同时建议加个淡入淡出时间参数,还建议贴图能像图片一样有透明度和被移动
|
||||
(不处理) 66. 读档建议换个和floor.mp3不一样的音效
|
||||
|
||||
Loading…
Reference in New Issue
Block a user