debug mode

This commit is contained in:
oc 2018-05-19 00:36:13 +08:00
parent 467c25837e
commit 303fb53dbf
11 changed files with 49 additions and 17 deletions

View File

@ -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

View File

@ -43,7 +43,8 @@ core.material.items
core.debug()
将攻防设置为10000近似于无敌模式。
开启调试模式。此模式下可以按Ctrl键进行穿墙并忽略一切事件。
此模式下不可回放录像和上传成绩。
core.updateStatusBar()

View File

@ -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`

View File

@ -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,

View File

@ -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("作弊成功");
*/
}
////// 开始播放 //////

View File

@ -107,6 +107,7 @@ function core() {
// 按下键的时间:为了判定双击
'downTime': null,
'ctrlDown': false,
// 路线&回放
'route': [],

View File

@ -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();
}

View File

@ -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);
}

View File

@ -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": [

Binary file not shown.

View File

@ -6,13 +6,13 @@
衰弱可以减少攻防的比例 √
地图数据统计
支持 status:x 获得当前坐标 √
core.debug()改成调试模式可以Ctrl穿墙 √
最大存档个数提到main处理 √
新建地图可以保留楼层属性 √
地图编辑器可用PageUp和PageDown切换楼层 √
道具描述过长时可以自动换行 √
除Autotile外均可自动注册 √
重写大部分教程,新增大量拓展描述 √
便捷PS工具偶尔的闪退问题
大量细节进行优化所有已知的bug进行了修复 √
-----------------------------------------------------------------------