录像容错 & 构造录像
This commit is contained in:
parent
8d7a1f078f
commit
36cf38fb45
@ -47,7 +47,7 @@ events.prototype._startGame_start = function (hard, seed, route, callback) {
|
|||||||
core.setHeroLoc('x', -1);
|
core.setHeroLoc('x', -1);
|
||||||
core.setHeroLoc('y', -1);
|
core.setHeroLoc('y', -1);
|
||||||
|
|
||||||
if (seed != null) {
|
if (seed != null && seed > 0) {
|
||||||
core.setFlag('__seed__', seed);
|
core.setFlag('__seed__', seed);
|
||||||
core.setFlag('__rand__', seed);
|
core.setFlag('__rand__', seed);
|
||||||
}
|
}
|
||||||
@ -2004,7 +2004,7 @@ events.prototype._action_choices = function (data, x, y, prefix) {
|
|||||||
if (data.choices.length == 0) return this.doAction();
|
if (data.choices.length == 0) return this.doAction();
|
||||||
if (core.isReplaying()) {
|
if (core.isReplaying()) {
|
||||||
var action = core.status.replay.toReplay.shift();
|
var action = core.status.replay.toReplay.shift();
|
||||||
if (action.indexOf('choices:') == 0) {
|
if (action.indexOf('choices:') == 0 && !(action == 'choices:none' && !data.timeout)) {
|
||||||
var index = action.substring(8);
|
var index = action.substring(8);
|
||||||
if (index == 'none' || ((index = parseInt(index)) >= 0) && index % 100 < data.choices.length) {
|
if (index == 'none' || ((index = parseInt(index)) >= 0) && index % 100 < data.choices.length) {
|
||||||
this.__action_choices_replaying(data, index);
|
this.__action_choices_replaying(data, index);
|
||||||
@ -2016,7 +2016,7 @@ events.prototype._action_choices = function (data, x, y, prefix) {
|
|||||||
// 容错录像
|
// 容错录像
|
||||||
if (main.replayChecking) {
|
if (main.replayChecking) {
|
||||||
// 录像验证系统中选择第一项
|
// 录像验证系统中选择第一项
|
||||||
core.status.replay.toReplay.unshift(action); // 首先归还刚才读出的下一步操作
|
if (action != 'choices:none') core.status.replay.toReplay.unshift(action); // 首先归还刚才读出的下一步操作
|
||||||
core.events.__action_choices_replaying(data, 0)
|
core.events.__action_choices_replaying(data, 0)
|
||||||
} else {
|
} else {
|
||||||
// 正常游戏中弹窗选择
|
// 正常游戏中弹窗选择
|
||||||
@ -2025,7 +2025,7 @@ events.prototype._action_choices = function (data, x, y, prefix) {
|
|||||||
core.control._replay_error(action);
|
core.control._replay_error(action);
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
core.status.replay.toReplay.unshift(action); // 首先归还刚才读出的下一步操作
|
if (action != 'choices:none') core.status.replay.toReplay.unshift(action); // 首先归还刚才读出的下一步操作
|
||||||
core.events.__action_choices_replaying(data, core.clamp(parseInt(value), 0, data.choices.length - 1))
|
core.events.__action_choices_replaying(data, core.clamp(parseInt(value), 0, data.choices.length - 1))
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
@ -2061,7 +2061,9 @@ events.prototype.__action_choices_replaying = function (data, index) {
|
|||||||
// 检查
|
// 检查
|
||||||
var choice = data.choices[index];
|
var choice = data.choices[index];
|
||||||
if (choice.need != null && choice.need != '' && !core.calValue(choice.need)) {
|
if (choice.need != null && choice.need != '' && !core.calValue(choice.need)) {
|
||||||
// 无法选择此项:直接忽略
|
// 无法选择此项
|
||||||
|
core.control._replay_error(action);
|
||||||
|
return;
|
||||||
} else {
|
} else {
|
||||||
core.insertAction(choice.action);
|
core.insertAction(choice.action);
|
||||||
}
|
}
|
||||||
@ -2084,7 +2086,7 @@ events.prototype._action_confirm = function (data, x, y, prefix) {
|
|||||||
core.status.event.ui = {"text": core.replaceText(data.text, prefix), "yes": data.yes, "no": data.no};
|
core.status.event.ui = {"text": core.replaceText(data.text, prefix), "yes": data.yes, "no": data.no};
|
||||||
if (core.isReplaying()) {
|
if (core.isReplaying()) {
|
||||||
var action = core.status.replay.toReplay.shift();
|
var action = core.status.replay.toReplay.shift();
|
||||||
if (action.indexOf('choices:') == 0) {
|
if (action.indexOf('choices:') == 0 && !(action == 'choices:none' && !data.timeout)) {
|
||||||
var index = action.substring(8);
|
var index = action.substring(8);
|
||||||
if (index == 'none' || ((index = parseInt(index)) >= 0) && index % 100 < 2) {
|
if (index == 'none' || ((index = parseInt(index)) >= 0) && index % 100 < 2) {
|
||||||
this.__action_confirm_replaying(data, index);
|
this.__action_confirm_replaying(data, index);
|
||||||
@ -2094,7 +2096,7 @@ events.prototype._action_confirm = function (data, x, y, prefix) {
|
|||||||
}
|
}
|
||||||
} else {
|
} else {
|
||||||
// 录像中未记录选了哪个,则选默认值,而不是直接报错
|
// 录像中未记录选了哪个,则选默认值,而不是直接报错
|
||||||
core.status.replay.toReplay.unshift(action);
|
if (action != 'choices:none') core.status.replay.toReplay.unshift(action);
|
||||||
this.__action_confirm_replaying(data, data["default"] ? 0 : 1);
|
this.__action_confirm_replaying(data, data["default"] ? 0 : 1);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@ -2340,25 +2342,20 @@ events.prototype._action_sleep = function (data, x, y, prefix) {
|
|||||||
events.prototype._action_wait = function (data, x, y, prefix) {
|
events.prototype._action_wait = function (data, x, y, prefix) {
|
||||||
if (core.isReplaying()) {
|
if (core.isReplaying()) {
|
||||||
var code = core.status.replay.toReplay.shift();
|
var code = core.status.replay.toReplay.shift();
|
||||||
if (code.indexOf("input:") == 0) {
|
if (code.indexOf("input:") == 0 && !(code == "input:none" && !data.timeout)) {
|
||||||
if (code == "input:none") {
|
if (code == "input:none") {
|
||||||
core.status.route.push("input:none");
|
core.status.route.push("input:none");
|
||||||
core.setFlag("type", -1);
|
core.setFlag("type", -1);
|
||||||
core.setFlag("timeout", 0);
|
core.setFlag("timeout", 0);
|
||||||
this.__action_wait_afterGet(data);
|
if (this.__action_wait_afterGet(data) || !data.forceChild) return core.doAction();
|
||||||
} else {
|
} else {
|
||||||
var value = parseInt(code.substring(6));
|
var value = parseInt(code.substring(6));
|
||||||
core.status.route.push("input:" + value);
|
core.status.route.push("input:" + value);
|
||||||
this.__action_wait_getValue(value);
|
this.__action_wait_getValue(value);
|
||||||
this.__action_wait_afterGet(data);
|
if (this.__action_wait_afterGet(data) || !data.forceChild) return core.doAction();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
core.control._replay_error(action);
|
||||||
main.log("录像文件出错!当前需要一个 input: 项,实际为 " + code);
|
|
||||||
core.stopReplay();
|
|
||||||
core.insertAction(["录像文件出错,请在控制台查看报错信息。", {"type": "exit"}]);
|
|
||||||
}
|
|
||||||
core.doAction();
|
|
||||||
return;
|
return;
|
||||||
} else if (data.timeout) {
|
} else if (data.timeout) {
|
||||||
core.status.event.interval = setTimeout(function() {
|
core.status.event.interval = setTimeout(function() {
|
||||||
|
|||||||
@ -866,20 +866,21 @@ utils.prototype.rand = function (num) {
|
|||||||
////// 生成随机数(录像方法) //////
|
////// 生成随机数(录像方法) //////
|
||||||
utils.prototype.rand2 = function (num) {
|
utils.prototype.rand2 = function (num) {
|
||||||
num = num || 2147483648;
|
num = num || 2147483648;
|
||||||
|
if (num <= 0) num = 1;
|
||||||
|
|
||||||
var value;
|
var value;
|
||||||
if (core.isReplaying()) {
|
if (core.isReplaying()) {
|
||||||
var action = core.status.replay.toReplay.shift();
|
var action = core.status.replay.toReplay.shift();
|
||||||
if (action.indexOf("random:") == 0) {
|
if (action.indexOf("random:") == 0) {
|
||||||
value = parseInt(action.substring(7));
|
value = parseInt(action.substring(7));
|
||||||
if (isNaN(value) || value >= num) {
|
if (isNaN(value) || value >= num || value < 0) {
|
||||||
core.control._replay_error(action);
|
core.control._replay_error(action);
|
||||||
return 0;
|
return 0;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
core.control._replay_error(action);
|
console.warn('错误!当前需要一个random:项。将重新随机生成!');
|
||||||
return 0;
|
value = Math.floor(Math.random() * num);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else {
|
else {
|
||||||
|
|||||||
@ -1164,7 +1164,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a =
|
|||||||
|
|
||||||
// 检查HP上限
|
// 检查HP上限
|
||||||
if (core.flags.statusBarItems.indexOf('enableHPMax') >= 0) {
|
if (core.flags.statusBarItems.indexOf('enableHPMax') >= 0) {
|
||||||
core.setStatus('hp', Math.min(core.getStatus('hpmax'), core.getStatus('hp')));
|
core.setStatus('hp', Math.min(core.getRealStatus('hpmax'), core.getStatus('hp')));
|
||||||
}
|
}
|
||||||
|
|
||||||
// 设置楼层名
|
// 设置楼层名
|
||||||
|
|||||||
Binary file not shown.
|
Before Width: | Height: | Size: 26 KiB After Width: | Height: | Size: 18 KiB |
Loading…
Reference in New Issue
Block a user