From 4a960790c316885cfda0518eead67e52da1af989 Mon Sep 17 00:00:00 2001 From: oc Date: Fri, 28 Jun 2019 16:36:20 +0800 Subject: [PATCH] syntax error in editor & B in replay --- _server/editor_multi.js | 11 +++++++++++ libs/actions.js | 7 ++++--- libs/control.js | 1 + libs/ui.js | 17 ++++++++++++++--- 4 files changed, 30 insertions(+), 6 deletions(-) diff --git a/_server/editor_multi.js b/_server/editor_multi.js index 069855cc..ecfd6b7d 100644 --- a/_server/editor_multi.js +++ b/_server/editor_multi.js @@ -81,6 +81,12 @@ editor_multi = function () { _format(); } + editor_multi.hasError = function () { + if (!editor_multi.lintAutocomplete) return false; + return JSHINT.errors.filter(function (e) { + return e.code.startsWith("E") + }).length > 0; + } editor_multi.import = function (id_, args) { var thisTr = document.getElementById(id_); @@ -126,6 +132,11 @@ editor_multi = function () { } editor_multi.confirm = function () { + if (editor_multi.hasError()) { + alert("当前好像存在严重的语法错误,请处理后再保存。\n严重的语法错误可能会导致整个编辑器的崩溃。"); + return; + } + if (!editor_multi.id) { editor_multi.id = ''; return; diff --git a/libs/actions.js b/libs/actions.js index f6f80541..7fd5951f 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -112,9 +112,8 @@ actions.prototype.doRegisteredAction = function (action) { } actions.prototype._checkReplaying = function () { - if (core.isReplaying() && core.status.event.id != 'save' - && (core.status.event.id || "").indexOf('book') != 0 && core.status.event.id != 'viewMaps' - && core.status.event.id != 'toolbox' && core.status.event.id != 'equipbox') + if (core.isReplaying() && + ['save','book','book-detail','viewMaps','toolbox','equipbox','text'].indexOf(core.status.event.id)<0) return true; return false; } @@ -175,6 +174,8 @@ actions.prototype._sys_onkeyUp_replay = function (e) { core.toolboxReplay(); else if (e.keyCode == 81) // Q core.equipboxReplay(); + else if (e.keyCode == 66) // B + core.drawStatistics(); else if (e.keyCode >= 49 && e.keyCode <= 51) // 1-3 core.setReplaySpeed(e.keyCode - 48); else if (e.keyCode == 52) // 4 diff --git a/libs/control.js b/libs/control.js index 54201a90..7476d52c 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1202,6 +1202,7 @@ control.prototype.bookReplay = function () { if (core.isMoving() || core.status.replay.animate || (core.status.event.id && core.status.event.id != 'viewMaps')) return core.drawTip("请等待当前事件的处理结束"); + if (!core.hasItem('book')) return core.drawTip('你没有怪物手册'); // 从“浏览地图”页面打开 if (core.status.event.id=='viewMaps') diff --git a/libs/ui.js b/libs/ui.js index 47fbc876..94c9bbdd 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -539,7 +539,8 @@ ui.prototype.drawText = function (contents, callback) { ui.prototype._drawText_setContent = function (contents, callback) { // 合并进 insertAction - if ((core.status.event && core.status.event.id=='action') || core.isReplaying()) { + if ((core.status.event && core.status.event.id=='action') + || (!core.hasFlag('__replayText__') && core.isReplaying())) { core.insertAction(contents,null,null,callback); return; } @@ -1866,11 +1867,19 @@ ui.prototype._drawBookDetail_turnAndCriticals = function (enemy, floorId, texts) var damageInfo = core.getDamageInfo(enemy, null, null, null, floorId); texts.push("战斗回合数:"+((damageInfo||{}).turn||0)); // 临界表 - var criticals = core.enemys.nextCriticals(enemy, 10, null, null, floorId).map(function (v) { + var criticals = core.enemys.nextCriticals(enemy, 8, null, null, floorId).map(function (v) { return core.formatBigNumber(v[0])+":"+core.formatBigNumber(v[1]); }); while (criticals[0]=='0:0') criticals.shift(); - texts.push("临界表:"+JSON.stringify(criticals)) + texts.push("临界表:"+JSON.stringify(criticals)); + var prevInfo = core.getDamageInfo(enemy, {atk: core.status.hero.atk-1}, null, null, floorId); + if (prevInfo != null && damageInfo != null) { + if (damageInfo.damage != null) damageInfo = damageInfo.damage; + if (prevInfo.damage != null) prevInfo = prevInfo.damage; + if (prevInfo > damageInfo) { + texts.push("(当前攻击力正位于临界点上)") + } + } } ui.prototype._drawBookDetail_drawContent = function (enemy, contents, pos) { @@ -2564,6 +2573,7 @@ ui.prototype.drawStatistics = function (floorIds) { core.ui._drawStatistics_floorId(floorId, obj); }); var statistics = core.status.hero.statistics; + core.setFlag("__replayText__", true); core.drawText([ this._drawStatistics_generateText(obj, "全塔", obj.total), this._drawStatistics_generateText(obj, "当前", obj.current), @@ -2581,6 +2591,7 @@ ui.prototype.drawStatistics = function (floorIds) { "4. 在自定义道具(例如其他宝石)后,需在脚本编辑的drawStatistics中注册,不然不会进行统计。\n"+ "5. 所有统计信息仅供参考,如有错误,概不负责。" ]) + core.removeFlag("__replayText__"); } ui.prototype._drawStatistics_buildObj = function () {