diff --git a/_server/blockly/MotaAction.g4 b/_server/blockly/MotaAction.g4 index 4fc0c32f..0ec2654b 100644 --- a/_server/blockly/MotaAction.g4 +++ b/_server/blockly/MotaAction.g4 @@ -1000,7 +1000,7 @@ function_s /* function_s -tooltip : function: 自定义JS脚本\n可以双击进行多行编辑,常见可能会被用到的系统API请参见文档的附录 +tooltip : 可双击多行编辑,请勿使用异步代码。常见API参见文档附录。 helpUrl : https://ckcz123.github.io/mota-js/#/event?id=function%EF%BC%9A%E8%87%AA%E5%AE%9A%E4%B9%89js%E8%84%9A%E6%9C%AC default : ["alert(core.getStatus(\"atk\"));"] colour : this.dataColor diff --git a/docs/api.md b/docs/api.md index fbd09055..179774bf 100644 --- a/docs/api.md +++ b/docs/api.md @@ -43,7 +43,8 @@ core.material.items core.debug() -将攻防设置为10000,近似于无敌模式。 +开启调试模式。此模式下可以按Ctrl键进行穿墙,并忽略一切事件。 +此模式下不可回放录像和上传成绩。 core.updateStatusBar() diff --git a/docs/start.md b/docs/start.md index 4fe8ecc9..180d2002 100644 --- a/docs/start.md +++ b/docs/start.md @@ -30,6 +30,8 @@ * “JS代码压缩工具”能对JS代码进行压缩,从而减少IO请求数和文件大小。 * “伤害和临界值计算器”是一个很便捷的小工具,能对怪物的伤害和临界值进行计算。 +!> **整个造塔过程中,启动服务必须全程处于开启状态!切不可手滑关闭,否则做的都是无用功!** + ## 绘制地图 有两种绘制地图的方式:从头绘制地图;从RMXP中导入已有的地图。 @@ -186,7 +188,7 @@ HTML5的塔都是可以进行控制台调试的。 - `core.status.hero` 获得当前勇士状态信息。例如`core.status.hero.atk`就是当前勇士的攻击力数值。 - `core.material.enemys` 获得所有怪物信息。例如`core.material.enemys.greenSlime`就是获得绿色史莱姆的属性数据。 - `core.material.items` 获得所有道具的信息。例如`core.material.items.pickaxe`就是获得破墙镐的信息。 -- `core.debug()` 无敌模式;使用此命令将会把攻防都置为10000,方便进行乱撞。 +- `core.debug()` 开启调试模式;此模式下可以按住Ctrl键进行穿墙。 - `core.updateStatusBar()` 立刻更新状态栏和地图显伤。 - `core.setStatus('atk', 1000)` 直接设置勇士的某项属性。本句等价于 `core.status.hero.atk = 1000`。 - `core.getStatus('atk')` 返回勇士当前某项属性数值。本句等价于 `core.status.hero.atk`。 diff --git a/libs/actions.js b/libs/actions.js index f9148392..65260f5b 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -25,6 +25,7 @@ actions.prototype.onkeyDown = function (e) { core.status.holdingKeys.push(e.keyCode); this.pressKey(e.keyCode); } else { + if (e.keyCode==17) core.status.ctrlDown = true; this.keyDown(e.keyCode); } } @@ -60,6 +61,7 @@ actions.prototype.onkeyUp = function(e) { } this.keyUp(e.keyCode); } else { + if (e.keyCode==17) core.status.ctrlDown = false; this.keyUp(e.keyCode); } } @@ -337,8 +339,14 @@ actions.prototype.keyUp = function(keyCode, fromReplay) { core.ui.drawHelp(); break; case 82: // R - if (core.status.heroStop) - core.ui.drawReplay(); + if (core.status.heroStop) { + if (core.hasFlag('debug')) { + core.drawText("\t[系统提示]调试模式下无法回放录像"); + } + else { + core.ui.drawReplay(); + } + } break; case 33: case 34: // PAGEUP/PAGEDOWN if (core.status.heroStop) { @@ -1703,6 +1711,10 @@ actions.prototype.clickSyncSave = function (x,y) { }); break; case 4: + if (core.hasFlag('debug')) { + core.drawText("\t[系统提示]调试模式下无法下载录像"); + break; + } core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route", JSON.stringify({ 'name': core.firstData.name, 'hard': core.status.hard, diff --git a/libs/control.js b/libs/control.js index 7c15fb88..48437c91 100644 --- a/libs/control.js +++ b/libs/control.js @@ -621,6 +621,7 @@ control.prototype.moveAction = function (callback) { if (core.status.event.id!='ski') core.status.route.push(direction); core.status.automaticRoute.moveStepBeforeStop = []; + core.status.automaticRoute.lastDirection = core.getHeroLoc('direction'); if (canMove) // 非箭头:触发 core.trigger(x + scan[direction].x, y + scan[direction].y); core.drawHero(direction, x, y); @@ -676,7 +677,7 @@ control.prototype.turnHero = function() { ////// 让勇士开始移动 ////// control.prototype.moveHero = function (direction, callback) { // 如果正在移动,直接return - if (core.status.heroMoving>0) return; + if (core.status.heroMoving!=0) return; if (core.isset(direction)) core.setHeroLoc('direction', direction); if (!core.isset(callback)) { // 如果不存在回调函数,则使用heroMoveTrigger @@ -685,8 +686,18 @@ control.prototype.moveHero = function (direction, callback) { var doAction = function () { if (!core.status.heroStop) { - core.moveAction(); - setTimeout(doAction, 50); + if (core.hasFlag('debug') && core.status.ctrlDown) { + if (core.status.heroMoving!=0) return; + core.status.heroMoving=-1; + core.eventMoveHero([core.getHeroLoc('direction')], 100, function () { + core.status.heroMoving=0; + doAction(); + }); + } + else { + core.moveAction(); + setTimeout(doAction, 50); + } } else { core.stopHero(); @@ -1371,8 +1382,11 @@ control.prototype.doEffect = function (expression) { } } -////// 作弊 ////// +////// 开启debug模式 ////// control.prototype.debug = function() { + core.setFlag('debug', true); + core.insertAction(["\t[调试模式开启]此模式下按住Ctrl键可以穿墙并忽略一切事件。\n同时,录像将失效,也无法上传成绩。"]); + /* core.setStatus('hp', 999999); core.setStatus('atk', 10000); core.setStatus('def', 10000); @@ -1389,6 +1403,7 @@ control.prototype.debug = function() { core.status.hero.flyRange.push(i); core.updateStatusBar(); core.drawTip("作弊成功"); + */ } ////// 开始播放 ////// diff --git a/libs/core.js b/libs/core.js index 888725f0..8eee43fd 100644 --- a/libs/core.js +++ b/libs/core.js @@ -107,6 +107,7 @@ function core() { // 按下键的时间:为了判定双击 'downTime': null, + 'ctrlDown': false, // 路线&回放 'route': [], diff --git a/libs/events.js b/libs/events.js index a0018f7b..09da3f66 100644 --- a/libs/events.js +++ b/libs/events.js @@ -228,6 +228,11 @@ events.prototype.gameOver = function (ending, fromReplay) { core.restart(); }); } + else if (core.hasFlag('debug')) { + core.drawText("\t[系统提示]调试模式下无法上传成绩", function () { + core.restart(); + }) + } else { confirmUpload(); } diff --git a/libs/ui.js b/libs/ui.js index ef9adc03..0d42b692 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -668,8 +668,8 @@ ui.prototype.drawChoices = function(content, choices) { if (choices.length>0) { if (!core.isset(core.status.event.selection)) core.status.event.selection=0; - if (core.status.event.selection<0) core.status.event.selection=0; - if (core.status.event.selection>=choices.length) core.status.event.selection=choices.length-1; + while (core.status.event.selection<0) core.status.event.selection+=choices.length; + while (core.status.event.selection>=choices.length) core.status.event.selection-=choices.length; var len = core.canvas.ui.measureText(core.replaceText(choices[core.status.event.selection].text || choices[core.status.event.selection])).width; core.strokeRect('ui', 208-len/2-5, choice_top + 32 * core.status.event.selection - 20, len+10, 28, "#FFD700", 2); } diff --git a/project/data.js b/project/data.js index 63a4c455..15d26b0a 100644 --- a/project/data.js +++ b/project/data.js @@ -49,11 +49,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = }, "flyRange": [], "loc": {"direction": "up", "x": 6, "y": 10}, - "flags": { - "poison": false, - "weak": false, - "curse": false, - }, + "flags": {}, "steps": 0, }, "startText": [ diff --git a/常用工具/便捷PS工具.exe b/常用工具/便捷PS工具.exe index 78a9c25e..3f5deca0 100644 Binary files a/常用工具/便捷PS工具.exe and b/常用工具/便捷PS工具.exe differ diff --git a/更新说明.txt b/更新说明.txt index 0a123cf2..fb516de6 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -6,13 +6,13 @@ 衰弱可以减少攻防的比例 √ 地图数据统计 支持 status:x 获得当前坐标 √ +core.debug()改成调试模式,可以Ctrl穿墙 √ 最大存档个数提到main处理 √ 新建地图可以保留楼层属性 √ 地图编辑器可用PageUp和PageDown切换楼层 √ 道具描述过长时可以自动换行 √ 除Autotile外均可自动注册 √ 重写大部分教程,新增大量拓展描述 √ -便捷PS工具偶尔的闪退问题 大量细节进行优化,所有已知的bug进行了修复 √ -----------------------------------------------------------------------