From 86fbd7ae54f1dd39337290a183695905ec365f38 Mon Sep 17 00:00:00 2001 From: oc Date: Fri, 14 Dec 2018 23:23:47 +0800 Subject: [PATCH] moveOneStep in functions --- _server/data.comment.js | 6 ++++++ _server/functions.comment.js | 6 ++++++ libs/actions.js | 7 +++++++ libs/control.js | 16 +++------------- libs/events.js | 2 ++ libs/ui.js | 6 +++++- libs/utils.js | 2 +- project/data.js | 3 ++- project/functions.js | 18 ++++++++++++++++++ 9 files changed, 50 insertions(+), 16 deletions(-) diff --git a/_server/data.comment.js b/_server/data.comment.js index ec0d4f11..788dd247 100644 --- a/_server/data.comment.js +++ b/_server/data.comment.js @@ -658,6 +658,12 @@ var data_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "_type": "checkbox", "_bool": "bool", "_data": "是否在经过领域/夹击/路障等伤害后禁用快捷商店。" + }, + "checkConsole": { + "_leaf": true, + "_type": "checkbox", + "_bool": "bool", + "_data": "是否检查控制台的开启情况。" } } } diff --git a/_server/functions.comment.js b/_server/functions.comment.js index ae97a7cd..9b8c79dd 100644 --- a/_server/functions.comment.js +++ b/_server/functions.comment.js @@ -162,6 +162,12 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = "_type": "textarea", "_lint": true, "_data": "阻激夹域的伤害值计算" + }, + "moveOneStep": { + "_leaf": true, + "_type": "textarea", + "_lint": true, + "_data": "勇士每走一步的操作" } } }, diff --git a/libs/actions.js b/libs/actions.js index 917774c5..d50443b8 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -655,6 +655,13 @@ actions.prototype.longClick = function (x, y, fromEvent) { core.doAction(); return true; } + // 长按楼传器的箭头可以快速翻页 + if (core.status.event.id=='fly') { + if ((x==10 || x==11) && (y==5 || y==9)) { + this.clickFly(x, y); + return true; + } + } } else if (!fromEvent) { core.waitHeroToStop(function () { diff --git a/libs/control.js b/libs/control.js index 0a6b4883..c623a804 100644 --- a/libs/control.js +++ b/libs/control.js @@ -387,6 +387,8 @@ control.prototype.resetStatus = function(hero, hard, floorId, route, maps, value 'currTime': 0, 'hp': 0, "battle": 0, + 'money': 0, + 'experience': 0, 'battleDamage': 0, 'poisonDamage': 0, 'extraDamage': 0, @@ -1036,19 +1038,7 @@ control.prototype.jumpHero = function (ex, ey, time, callback) { ////// 每移动一格后执行的事件 ////// control.prototype.moveOneStep = function() { - core.status.hero.steps++; - // 中毒状态 - if (core.hasFlag('poison')) { - core.status.hero.statistics.poisonDamage += core.values.poisonDamage; - core.status.hero.hp -= core.values.poisonDamage; - if (core.status.hero.hp<=0) { - core.status.hero.hp=0; - core.updateStatusBar(); - core.events.lose(); - return; - } - core.updateStatusBar(); - } + return this.controldata.moveOneStep(); } ////// 停止勇士的一切行动,等待勇士行动结束后,再执行callback ////// diff --git a/libs/events.js b/libs/events.js index 9d380fee..030ea2e7 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1203,6 +1203,8 @@ events.prototype.doAction = function() { ////// 往当前事件列表之前添加一个或多个事件 ////// events.prototype.insertAction = function (action, x, y, callback) { + if (core.hasFlag("__statistics__")) return; + if (core.status.event.id != 'action') { this.doEvents(action, x, y, callback); } diff --git a/libs/ui.js b/libs/ui.js index 33351c7d..d632b299 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -2566,6 +2566,8 @@ ui.prototype.drawStatistics = function () { var temp = core.clone(core.status.hero); + core.setFlag("__statistics__", true); + if (core.isset(total.count[id])) { var hp=0, atk=0, def=0, mdef=0; @@ -2573,6 +2575,7 @@ ui.prototype.drawStatistics = function () { var ratio = floor.item_ratio||1; if (core.isset(core.items.itemEffect[id])) { try { + // 需要检查是否是测试状态... eval(core.items.itemEffect[id]); } catch (e) {} @@ -2673,7 +2676,8 @@ ui.prototype.drawStatistics = function () { +",总游戏时长"+formatTime(statistics.totalTime) +"。\n瞬间移动次数:"+statistics.moveDirectly+",共计少走"+statistics.ignoreSteps+"步。" +"\n\n总计通过血瓶恢复生命值为"+core.formatBigNumber(statistics.hp)+"点。\n\n" - +"总计打死了"+statistics.battle+"个怪物,受到的伤害为"+core.formatBigNumber(statistics.battleDamage+statistics.poisonDamage+statistics.extraDamage) + +"总计打死了"+statistics.battle+"个怪物,得到了"+core.formatBigNumber(statistics.money)+"金币,"+core.formatBigNumber(statistics.experience)+"点经验。\n\n" + +"受到的总伤害为"+core.formatBigNumber(statistics.battleDamage+statistics.poisonDamage+statistics.extraDamage) +",其中战斗伤害"+core.formatBigNumber(statistics.battleDamage)+"点" +(core.flags.enableDebuff?(",中毒伤害"+core.formatBigNumber(statistics.poisonDamage)+"点"):"") +",领域/夹击/阻击/血网伤害"+core.formatBigNumber(statistics.extraDamage)+"点。", diff --git a/libs/utils.js b/libs/utils.js index 45313e71..8cb58dce 100644 --- a/libs/utils.js +++ b/libs/utils.js @@ -839,9 +839,9 @@ utils.prototype.decodeCanvas = function (arr, width, height) { } utils.prototype.consoleOpened = function () { + if (!core.flags.checkConsole) return false; if (window.Firebug && window.Firebug.chrome && window.Firebug.chrome.isInitialized) return true; - if (!core.platform.isPC) return false; var threshold = 160; var zoom = Math.min(window.outerWidth/window.innerWidth, window.outerHeight/window.innerHeight); return window.outerWidth - zoom*window.innerWidth > threshold diff --git a/project/data.js b/project/data.js index 75900628..a1c7d4d8 100644 --- a/project/data.js +++ b/project/data.js @@ -398,6 +398,7 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "canGoDeadZone": false, "enableMoveDirectly": true, "enableDisabledShop": true, - "disableShopOnDamage": false + "disableShopOnDamage": false, + "checkConsole": false } } \ No newline at end of file diff --git a/project/functions.js b/project/functions.js index 9e06e527..8bde3593 100644 --- a/project/functions.js +++ b/project/functions.js @@ -158,9 +158,11 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = if (core.hasItem('coin')) money *= 2; if (core.hasFlag('curse')) money=0; core.status.hero.money += money; + core.status.hero.statistics.money += money; var experience =enemy.experience; if (core.hasFlag('curse')) experience=0; core.status.hero.experience += experience; + core.status.hero.statistics.experience += experience; var hint = "打败 " + enemy.name; if (core.flags.enableMoney) hint += ",金币+" + money; @@ -1005,6 +1007,22 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = } } } +}, + "moveOneStep": function () { + // 勇士每走一步后执行的操作 + core.status.hero.steps++; + // 中毒状态:扣血 + if (core.hasFlag('poison')) { + core.status.hero.statistics.poisonDamage += core.values.poisonDamage; + core.status.hero.hp -= core.values.poisonDamage; + if (core.status.hero.hp<=0) { + core.status.hero.hp=0; + core.updateStatusBar(); + core.events.lose(); + return; + } + core.updateStatusBar(); + } } }, "ui": {