diff --git a/README.md b/README.md index 1882e388..aef141e7 100644 --- a/README.md +++ b/README.md @@ -48,6 +48,7 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! │ ├─ 便捷PS工具.exe # 能只用复制和粘贴来快速对素材进行PS操作。 http://github.com/ckcz123/ps/ │ ├─ 地图生成器.exe # 能从一张截图识别出来具体的数字数组,方便复刻已有的塔。 http://github.com/ckcz123/map_generator/ │ └─ 伤害和临界值计算器.exe # 一个能帮助计算怪物的伤害和临界值的小工具。 http://github.com/ckcz123/magic-tower-calculator/ +├── /启动服务(mac版).app/ # 启动服务的mac版本。 ├── editor.html # 可视化地图编辑工具 ├── index.html # 主程序,游戏的入口 ├── main.js # JS程序的入口,将动态对所需JS进行加载 @@ -57,6 +58,24 @@ HTML5 canvas制作的魔塔样板,支持全平台游戏! ## 更新说明 +### 2018.5.27 V2.3 + +* [x] 启动服务和便捷PS工具(Mac版) +* [x] 地图编辑器可以右键复制或移动图块 +* [x] 事件:while循环处理 +* [x] 事件:等待用户操作并获得按键或点击信息 +* [x] 地图数据统计 +* [x] 衰弱可以减少攻防的比例 +* [x] 便捷PS工具可以批量导入素材 +* [x] 除Autotile外均可自动注册 +* [x] 支持status:x获得当前坐标 +* [x] core.debug()改成调试模式,可以Ctrl穿墙 +* [x] 新建地图可以保留楼层属性 +* [x] 地图编辑器可用PageUp和PageDown切换楼层 +* [x] 提供大量素材,可直接取用 +* [x] 重写大部分教程,新增大量拓展描述 +* [x] 大量细节进行优化,所有已知的bug进行了修复 + ### 2018.5.6 V2.2 * [x] 事件坐标可用变量指定("loc": ["flag:x", "flag:y"]) diff --git a/_server/editor_mode.js b/_server/editor_mode.js index e306464e..bc8ff3e1 100644 --- a/_server/editor_mode.js +++ b/_server/editor_mode.js @@ -456,7 +456,7 @@ editor_mode = function (editor) { printe("该楼层已存在!"); return; } - if (!/^[a-zA-Z_]*[a-zA-Z0-9_]*$/.test(newFileName)) { + if (!/^[a-zA-Z_][a-zA-Z0-9_]*$/.test(newFileName.value)) { printe("楼层名不合法!请使用字母、数字、下划线,且不能以数字开头!"); return; } diff --git a/docs/V2.0.md b/docs/V2.0.md index be3e150e..a0305936 100644 --- a/docs/V2.0.md +++ b/docs/V2.0.md @@ -1,6 +1,6 @@ # V2.0版本介绍 -?> 目前版本**v2.2.1**,上次更新时间:* {docsify-updated} * +?> 目前版本**v2.3**,上次更新时间:* {docsify-updated} * 目前样板已经更新到V2.0版本以上,本章将对V2.0的一些内容进行介绍。 diff --git a/docs/api.md b/docs/api.md index c0814730..c5809c08 100644 --- a/docs/api.md +++ b/docs/api.md @@ -1,6 +1,6 @@ # 附录: API列表 -?> 目前版本**v2.2.1**,上次更新时间:* {docsify-updated} * +?> 目前版本**v2.3**,上次更新时间:* {docsify-updated} * **这里只列出所有可能会被造塔者用到的常用API,更多的有关内容请在代码内进行查询。** diff --git a/docs/element.md b/docs/element.md index bc08e3e0..731e72b8 100644 --- a/docs/element.md +++ b/docs/element.md @@ -1,6 +1,6 @@ # 元件说明 -?> 目前版本**v2.2.1**,上次更新时间:* {docsify-updated} * +?> 目前版本**v2.3**,上次更新时间:* {docsify-updated} * 在本章中,将对样板里的各个元件进行说明。各个元件主要包括道具、门、怪物、楼梯等等。 @@ -243,6 +243,35 @@ floorId指定的是目标楼层的唯一标识符(ID)。 !> iOS平台以及部分浏览器不支持获得当前网络状态,此时即使在使用Wifi也必须要用户点击“音乐开关”才能播放音乐。 +## 录像 + +HTML5魔塔一大亮点就是存在录像系统,可以很方便进行录像回放。 + +当你在游戏的过程中,随着你的操作,录像也会被依次记录。游戏结束后将提示是否下载录像,上传成绩时也会上传你的录像信息。 + +在菜单栏-同步存档中,可以直接对当前录像进行下载。 + +!> 录像记录的是你当前的路线(本质上是模拟键盘操作),是一个纯文本文件,占用空间很小! + +录像的回放主要有两种方式: + +1. 保存成的录像文件(.h5route文件):在标题界面点录像回放,再选择文件即可。 +2. 游戏过程中时的当前录像:随时按R可以进行回放;手机端则长按任何位置3秒以上调出虚拟键盘,再按R。 + +录像播放过程中,可以进行如下操作: + +- **暂停/播放:** 按空格可以随时暂停或播放录像。 +- **加速:** 按X可以加速录像播放,最高可达6倍速。 +- **减速:** 按Z可以减速录像播放,最低可达0.3倍速。 +- **停止:** 按ESC可以立刻停止录像播放,并返回正常游戏。 +- **回退:** 按A可以回退到上一个录像节点(录像播放过程中每50步存一个录像节点)。 +- **存档:** 按S可以在录像播放过程中进行存档。 +- **查看手册:** 按C可以在录像播放过程中查看怪物手册。 + +上述操作在手机端均有工具栏的对应按钮可点击操作。 + +如果录像出现问题,请加群539113091找小艾反馈Bug。 + ## 操作说明 本塔主要支持鼠标(触摸屏)操作和键盘操作。 @@ -259,6 +288,7 @@ floorId指定的是目标楼层的唯一标识符(ID)。 键盘操作快捷键如下: - **[CTRL]** 跳过对话 +- **[Z]** 转向 - **[X]** 打开/关闭怪物手册 - **[G]** 打开/关闭楼层传送器 - **[A]** 读取自动存档 @@ -267,7 +297,6 @@ floorId指定的是目标楼层的唯一标识符(ID)。 - **[T]** 打开/关闭工具栏 - **[ESC]** 打开/关闭系统菜单 - **[H]** 打开帮助页面 -- **[Z]** 转向 - **[R]** 回放录像 - **[SPACE]** 轻按(仅在轻按开关打开时有效) - **[1]** 快捷使用破墙镐 diff --git a/docs/event.md b/docs/event.md index 6fdf9468..3eb4023c 100644 --- a/docs/event.md +++ b/docs/event.md @@ -1,6 +1,6 @@ # 事件 -?> 目前版本**v2.2.1**,上次更新时间:* {docsify-updated} * +?> 目前版本**v2.3**,上次更新时间:* {docsify-updated} * 本章内将对样板所支持的事件进行介绍。 diff --git a/docs/index.md b/docs/index.md index 02dd5118..8dfe96f6 100644 --- a/docs/index.md +++ b/docs/index.md @@ -1,6 +1,6 @@ # HTML5 魔塔样板说明文档 -?> 目前版本**v2.2.1**,上次更新时间:* {docsify-updated} * +?> 目前版本**v2.3**,上次更新时间:* {docsify-updated} * 众所周知,魔塔的趋势是向移动端发展,贴吧中也常常能见到“求手机魔塔”的帖子。然而现有的工具中,NekoRPG有着比较大的局限性,游戏感较差,更是完全没法在iOS上运行。而一些APP的魔塔虽然可用,但是必须要下载安装,对于Android和iOS还必须开发不同的版本,非常麻烦。 diff --git a/docs/personalization.md b/docs/personalization.md index 91993245..7d95980d 100644 --- a/docs/personalization.md +++ b/docs/personalization.md @@ -1,6 +1,6 @@ # 个性化 -?> 目前版本**v2.2.1**,上次更新时间:* {docsify-updated} * +?> 目前版本**v2.3**,上次更新时间:* {docsify-updated} * 有时候只靠样板本身可能是不够的。我们需要一些个性化、自定义的素材,道具效果,怪物属性,等等。 diff --git a/docs/start.md b/docs/start.md index 180d2002..20b50a23 100644 --- a/docs/start.md +++ b/docs/start.md @@ -1,6 +1,6 @@ # 快速上手 -?> 目前版本**v2.2.1**,上次更新时间:* {docsify-updated} * +?> 目前版本**v2.3**,上次更新时间:* {docsify-updated} * 在这一节中,将详细介绍做一部塔的流程。现在,让我们来做一部单层塔! @@ -9,6 +9,7 @@ 你需要有满足如下条件才能进行制作: - Windows 8以上操作系统;Windows 7需要安装.Net Framework 4.0。(能打开同目录下的“启动服务.exe”即可) + - Mac系统则需OS X 10.7及以上,能正确打开启动服务(Mac版).app即可。 - Chrome浏览器。其他浏览器可能会导致本地服务器产生闪退等现象。 - 强烈推荐安装一个很好的文本编辑器:VSCode。在某些需要直接修改文件的场合,可能会非常重要。 @@ -18,7 +19,7 @@ ## 启动HTTP服务 -在根目录下有一个“启动服务.exe”,运行之。 +在根目录下有一个“启动服务.exe”,运行之。(Mac版本则双击运行“启动服务(Mac版).app”) ![启动服务](img/server.png) diff --git a/drawMapGUI.html b/drawMapGUI.html deleted file mode 100644 index 99a75938..00000000 --- a/drawMapGUI.html +++ /dev/null @@ -1 +0,0 @@ - \ No newline at end of file diff --git a/libs/actions.js b/libs/actions.js index 1fa43e52..c0c3c823 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -315,8 +315,11 @@ actions.prototype.keyUp = function(keyCode, fromReplay) { core.load(true); break; case 69: // E + /* + // Cursor is unnecessary! if (core.status.heroStop) core.ui.drawCursor(); + */ break; case 84: // T if (core.status.heroStop) @@ -1553,7 +1556,7 @@ actions.prototype.clickSettings = function (x,y) { break; case 4: core.status.event.selection=1; - core.ui.drawConfirmBox("你确定要重新开始吗?", function () { + core.ui.drawConfirmBox("你确定要返回标题页面吗?", function () { core.ui.closePanel(); core.restart(); }, function () { diff --git a/libs/actions.min.js b/libs/actions.min.js new file mode 100644 index 00000000..43e59332 --- /dev/null +++ b/libs/actions.min.js @@ -0,0 +1 @@ +function actions(){this.init()}actions.prototype.init=function(){};actions.prototype.onkeyDown=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!="save"&&(core.status.event.id||"").indexOf("book")!=0){return}if(!core.isset(core.status.holdingKeys)){core.status.holdingKeys=[]}var c={37:true,38:true,39:true,40:true}[a.keyCode];if(c&&!core.status.lockControl){for(var b=0;bd){c=b;d=a[b]}}e=[{x:0,y:1},{x:-1,y:0},{x:0,y:-1},{x:1,y:0},false][c];if(e){e.x+=f.x;e.y+=f.y;core.status.stepPostfix.push(e);core.fillPosWithPoint(e)}};actions.prototype.onup=function(){if(core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!="save"&&(core.status.event.id||"").indexOf("book")!=0){return}clearTimeout(core.timeout.onDownTimeout);core.timeout.onDownTimeout=null;clearInterval(core.interval.onDownInterval);core.interval.onDownInterval=null;if(core.status.stepPostfix.length>0){var g=[];var a={"0":{"1":"down","-1":"up"},"-1":{"0":"left"},"1":{"0":"right"}};for(var b=1;b=1000){this.longClick(e,f)}else{this.onclick(e,f,g)}core.status.downTime=null}};actions.prototype.getClickLoc=function(f,g){var d={x:0,y:0};var c=32;c=c*core.domStyle.scale;switch(core.domStyle.screenMode){case"vertical":d.x=0;d.y=core.dom.statusBar.offsetHeight+3;break;case"horizontal":case"bigScreen":d.x=core.dom.statusBar.offsetWidth+3;d.y=0;break}var a=core.dom.gameGroup.offsetLeft+d.x;var e=core.dom.gameGroup.offsetTop+d.y;var b={x:f-a,y:g-e,size:c};return b};actions.prototype.onclick=function(b,c,a){if(core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!="save"&&(core.status.event.id||"").indexOf("book")!=0){return}a=a||[];if(b<0||c<0||b>12||c>12){return}if(core.status.usingCenterFly){if(b!=12-core.getHeroLoc("x")||c!=12-core.getHeroLoc("y")){core.clearMap("ui",(12-core.getHeroLoc("x"))*32,(12-core.getHeroLoc("y"))*32,32,32)}else{if(core.canUseItem("centerFly")){core.useItem("centerFly");core.clearMap("ui",core.getHeroLoc("x")*32,core.getHeroLoc("y")*32,32,32);return}else{core.drawTip("当前不能使用中心对称飞行器");core.clearMap("ui",(12-core.getHeroLoc("x"))*32,(12-core.getHeroLoc("y"))*32,32,32)}}core.status.usingCenterFly=false}if(!core.status.lockControl){core.setAutomaticRoute(b,c,a);return}if(core.status.event.id=="book"){this.clickBook(b,c);return}if(core.status.event.id=="book-detail"){this.clickBookDetail(b,c);return}if(core.status.event.id=="fly"){this.clickFly(b,c);return}if(core.status.event.id=="viewMaps"){this.clickViewMaps(b,c);return}if(core.status.event.id=="switchs"){this.clickSwitchs(b,c);return}if(core.status.event.id=="settings"){this.clickSettings(b,c);return}if(core.status.event.id=="shop"){this.clickShop(b,c);return}if(core.status.event.id=="selectShop"){this.clickQuickShop(b,c);return}if(core.status.event.id=="toolbox"){this.clickToolbox(b,c);return}if(core.status.event.id=="save"||core.status.event.id=="load"||core.status.event.id=="replayLoad"){this.clickSL(b,c);return}if(core.status.event.id=="confirmBox"){this.clickConfirmBox(b,c);return}if(core.status.event.id=="keyBoard"){this.clickKeyBoard(b,c);return}if(core.status.event.id=="about"){this.clickAbout(b,c);return}if(core.status.event.id=="action"){this.clickAction(b,c);return}if(core.status.event.id=="text"){core.drawText();return}if(core.status.event.id=="syncSave"){this.clickSyncSave(b,c);return}if(core.status.event.id=="syncSelect"){this.clickSyncSelect(b,c);return}if(core.status.event.id=="localSaveSelect"){this.clickLocalSaveSelect(b,c);return}if(core.status.event.id=="storageRemove"){this.clickStorageRemove(b,c);return}if(core.status.event.id=="cursor"){this.clickCursor(b,c);return}if(core.status.event.id=="replay"){this.clickReplay(b,c);return}};actions.prototype.onmousewheel=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying&&core.status.event.id!="save"&&(core.status.event.id||"").indexOf("book")!=0){return}if(core.status.lockControl&&core.status.event.id=="fly"){if(a==1){core.ui.drawFly(core.status.event.data+1)}if(a==-1){core.ui.drawFly(core.status.event.data-1)}return}if(core.status.lockControl&&core.status.event.id=="book"){if(a==1){core.ui.drawBook(core.status.event.data-6)}if(a==-1){core.ui.drawBook(core.status.event.data+6)}return}if(core.status.lockControl&&(core.status.event.id=="save"||core.status.event.id=="load")){if(a==1){core.ui.drawSLPanel(core.status.event.data-10)}if(a==-1){core.ui.drawSLPanel(core.status.event.data+10)}return}if(core.status.lockControl&&core.status.event.id=="viewMaps"){if(a==1){this.clickViewMaps(6,2)}if(a==-1){this.clickViewMaps(6,10)}return}};actions.prototype.longClick=function(b,c,a){if(!core.isPlaying()){return false}if(core.status.lockControl){if(core.status.event.id=="text"){core.drawText();return true}if(core.status.event.id=="action"&&core.status.event.data.type=="text"){core.doAction();return true}}else{if(!a){core.waitHeroToStop(function(){core.ui.drawKeyBoard()})}}return false};actions.prototype.keyDownCtrl=function(){if(core.status.event.id=="text"){core.drawText();return}if(core.status.event.id=="action"&&core.status.event.data.type=="text"){core.doAction();return}};actions.prototype.clickConfirmBox=function(a,b){if((a==4||a==5)&&b==7&&core.isset(core.status.event.data.yes)){core.status.event.data.yes()}if((a==7||a==8)&&b==7&&core.isset(core.status.event.data.no)){core.status.event.data.no()}};actions.prototype.keyUpConfirmBox=function(a){if(a==37){core.status.event.selection=0;core.ui.drawConfirmBox(core.status.event.ui,core.status.event.data.yes,core.status.event.data.no)}if(a==39){core.status.event.selection=1;core.ui.drawConfirmBox(core.status.event.ui,core.status.event.data.yes,core.status.event.data.no)}if(a==13||a==32||a==67){if(core.status.event.selection==0&&core.isset(core.status.event.data.yes)){core.status.event.selection=null;core.status.event.data.yes()}if(core.status.event.selection==1&&core.isset(core.status.event.data.no)){core.status.event.selection=null;core.status.event.data.no()}}};actions.prototype.clickAction=function(d,e){if(core.status.event.data.type=="text"){core.doAction();return}if(core.status.event.data.type=="wait"){core.setFlag("type",1);core.setFlag("x",d);core.setFlag("y",e);core.status.route.push("input:"+(10000+100*d+e));core.doAction();return}if(core.status.event.data.type=="choices"){var b=core.status.event.data.current;var a=b.choices;if(a.length==0){return}if(d>=5&&d<=7){var c=6-parseInt((a.length-1)/2);if(e>=c&&e0){if(c==38){core.status.event.selection--;core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices)}if(c==40){core.status.event.selection++;core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices)}}}};actions.prototype.keyUpAction=function(c){if(core.status.event.data.type=="text"&&(c==13||c==32||c==67)){core.doAction();return}if(core.status.event.data.type=="wait"){core.setFlag("type",0);core.setFlag("keycode",c);core.status.route.push("input:"+c);core.doAction();return}if(core.status.event.data.type=="choices"){var b=core.status.event.data.current;var a=b.choices;if(a.length>0){if(c==13||c==32||c==67){core.status.route.push("choices:"+core.status.event.selection);core.insertAction(a[core.status.event.selection].action);core.doAction()}}}};actions.prototype.clickBook=function(d,e){if((d==3||d==4)&&e==12){core.ui.drawBook(core.status.event.data-6);return}if((d==8||d==9)&&e==12){core.ui.drawBook(core.status.event.data+6);return}if(d>=10&&d<=12&&e==12){if(core.status.event.selection==null){core.ui.closePanel()}else{core.status.boxAnimateObjs=[];core.ui.drawMaps(core.status.event.selection)}return}var a=core.status.event.data;if(core.isset(a)&&e<12){var c=parseInt(a/6);var b=6*c+parseInt(e/2);core.ui.drawBook(b);core.ui.drawBookDetail(b)}return};actions.prototype.keyDownBook=function(a){if(a==37){core.ui.drawBook(core.status.event.data-6)}if(a==38){core.ui.drawBook(core.status.event.data-1)}if(a==39){core.ui.drawBook(core.status.event.data+6)}if(a==40){core.ui.drawBook(core.status.event.data+1)}if(a==33){core.ui.drawBook(core.status.event.data-6)}if(a==34){core.ui.drawBook(core.status.event.data+6)}return};actions.prototype.keyUpBook=function(b){if(b==27||b==88){if(core.status.event.selection==null){core.ui.closePanel()}else{core.status.boxAnimateObjs=[];core.ui.drawMaps(core.status.event.selection)}return}if(b==13||b==32||b==67){var a=core.status.event.data;if(core.isset(a)){this.clickBook(6,2*(a%6))}return}};actions.prototype.clickBookDetail=function(){core.clearMap("data",0,0,416,416);core.status.event.id="book"};actions.prototype.clickFly=function(e,f){if((e==10||e==11)&&f==9){core.ui.drawFly(core.status.event.data-1)}if((e==10||e==11)&&f==5){core.ui.drawFly(core.status.event.data+1)}if(e>=5&&e<=7&&f==12){core.ui.closePanel()}if(e>=0&&e<=9&&f>=3&&f<=11){var b=core.status.hero.flyRange.indexOf(core.status.floorId);var c=core.status.event.data=8){a--;while(a>=0&&a!=b&&core.floors[core.floorIds[a]].cannotViewMap){a--}if(a>=0){core.ui.drawMaps(a)}}else{core.clearMap("data",0,0,416,416);core.setOpacity("data",1);core.ui.closePanel()}}};actions.prototype.keyDownViewMaps=function(a){if(a==37||a==38||a==33){this.clickViewMaps(6,2)}else{if(a==39||a==40||a==34){this.clickViewMaps(6,10)}}return};actions.prototype.keyUpViewMaps=function(a){if(a==27||a==13||a==32||a==67){core.clearMap("data",0,0,416,416);core.setOpacity("data",1);core.ui.closePanel()}if(a==88){core.openBook(false)}return};actions.prototype.clickShop=function(x,y){var shop=core.status.event.data.shop;var choices=shop.choices;if(x>=5&&x<=7){var topIndex=6-parseInt(choices.length/2);if(y>=topIndex&&yeval(use)){core.drawTip("你的"+use_text+"不足");return false}core.status.event.data.actions.push(y-topIndex);eval(use+"-="+need);core.setStatus("money",money);core.setStatus("experience",experience);choice.effect.split(";").forEach(function(t){core.doEffect(t)});core.updateStatusBar();shop.times++;core.events.openShop(core.status.event.data.id)}else{if(y==topIndex+choices.length){if(core.status.event.data.actions.length>0){core.status.route.push("shop:"+core.status.event.data.id+":"+core.status.event.data.actions.join(""))}core.status.event.data.actions=[];core.status.boxAnimateObjs=[];if(core.status.event.data.fromList){core.ui.drawQuickShop()}else{core.ui.closePanel()}}else{return false}}}return true};actions.prototype.keyDownShop=function(a){if(a==38){core.status.event.selection--;core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices)}if(a==40){core.status.event.selection++;core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices)}};actions.prototype.keyUpShop=function(b){if(b==27||b==88){if(core.status.event.data.actions.length>0){core.status.route.push("shop:"+core.status.event.data.id+":"+core.status.event.data.actions.join(""))}core.status.event.data.actions=[];core.status.boxAnimateObjs=[];if(core.status.event.data.fromList){core.ui.drawQuickShop()}else{core.ui.closePanel()}return}var c=core.status.event.data.shop;var a=c.choices;if(b==13||b==32||b==67){var d=6-parseInt(a.length/2);this.clickShop(6,d+core.status.event.selection)}return};actions.prototype.clickQuickShop=function(e,f){var c=core.status.shops,a=Object.keys(c);if(e>=5&&e<=7){var d=6-parseInt(a.length/2);if(f>=d&&f=10&&b<=12&&c==12){core.ui.closePanel();return}if(b>=10&&b<=12&&c<=1){if(!core.isset(core.status.event.data)){return}if(!core.flags.enableDeleteItem){core.drawTip("不支持删除道具!");return}core.removeItem(core.status.event.data);core.status.event.data=null;core.ui.drawToolbox();return}var a=0;if(c==4||c==5||c==9||c==10){a=parseInt(b/2)}else{a=6+parseInt(b/2)}if(c>=9){a+=100}this.clickToolboxIndex(a)};actions.prototype.clickToolboxIndex=function(b){var d=null;var a=b;if(a<100){d=Object.keys(core.status.hero.items.tools).sort()}else{a-=100;d=Object.keys(core.status.hero.items.constants).sort()}if(d==null){return}if(a>=d.length){return}var c=d[a];if(c==core.status.event.data){core.events.useItem(c)}else{core.ui.drawToolbox(b)}};actions.prototype.keyDownToolbox=function(c){if(!core.isset(core.status.event.data)){return}var d=Object.keys(core.status.hero.items.tools).sort();var a=Object.keys(core.status.hero.items.constants).sort();var b=core.status.event.selection;if(c==37){if((b>0&&b<100)||b>100){this.clickToolboxIndex(b-1);return}if(b==100&&d.length>0){this.clickToolboxIndex(d.length-1);return}}if(c==38){if((b>5&&b<100)||b>105){this.clickToolboxIndex(b-6);return}if(b>=100&&b<=105){if(d.length>6){this.clickToolboxIndex(Math.min(d.length-1,b-100+6))}else{if(d.length>0){this.clickToolboxIndex(Math.min(d.length-1,b-100))}}return}}if(c==39){if((b=100&&b0){this.clickToolboxIndex(100);return}}if(c==40){if(b<=5){if(d.length>6){this.clickToolboxIndex(Math.min(d.length-1,b+6))}else{if(a.length>0){this.clickToolboxIndex(100+Math.min(a.length-1,b))}}return}if(b>5&&b<100&&a.length>0){this.clickToolboxIndex(100+Math.min(a.length-1,b-6));return}if(b>=100&&b<=105&&a.length>6){this.clickToolboxIndex(Math.min(100+a.length-1,b+6));return}}};actions.prototype.keyUpToolbox=function(a){if(a==84||a==27||a==88){core.ui.closePanel();return}if(!core.isset(core.status.event.data)){return}if(a==13||a==32||a==67){this.clickToolboxIndex(core.status.event.selection);return}if(a==46){if(!core.isset(core.status.event.data)){return}if(!core.flags.enableDeleteItem){core.drawTip("不支持删除道具!");return}core.removeItem(core.status.event.data);core.status.event.data=null;core.ui.drawToolbox();return}};actions.prototype.clickSL=function(e,f){var b=core.status.event.data;var d=parseInt(b/10),c=b%10;if((e==3||e==4)&&f==12){core.ui.drawSLPanel(10*(d-1)+c);return}if((e==8||e==9)&&f==12){core.ui.drawSLPanel(10*(d+1)+c);return}if(e>=10&&e<=12&&f==12){core.ui.closePanel();if(!core.isPlaying()){core.showStartAnimate()}return}if(e>=0&&e<=2&&f==12){core.status.event.selection=!core.status.event.selection;core.ui.drawSLPanel(b);return}var a=null;if(f>=1&&f<=4){if(e>=1&&e<=3){a="autoSave"}if(e>=5&&e<=7){a=5*d+1}if(e>=9&&e<=11){a=5*d+2}}if(f>=7&&f<=10){if(e>=1&&e<=3){a=5*d+3}if(e>=5&&e<=7){a=5*d+4}if(e>=9&&e<=11){a=5*d+5}}if(a!=null){if(core.status.event.selection){if(a=="autoSave"){core.drawTip("无法删除自动存档!")}else{core.removeLocalStorage("save"+a);core.ui.drawSLPanel(b)}}else{core.doSL(a,core.status.event.id)}}};actions.prototype.keyDownSL=function(b){var a=core.status.event.data;var d=parseInt(a/10),c=a%10;if(b==37){if(c==0){core.ui.drawSLPanel(10*(d-1)+5)}else{core.ui.drawSLPanel(a-1)}return}if(b==38){if(c<3){core.ui.drawSLPanel(10*(d-1)+c+3)}else{core.ui.drawSLPanel(a-3)}return}if(b==39){if(c==5){core.ui.drawSLPanel(10*(d+1)+1)}else{core.ui.drawSLPanel(a+1)}return}if(b==40){if(c>=3){core.ui.drawSLPanel(10*(d+1)+c-3)}else{core.ui.drawSLPanel(a+3)}return}if(b==33){core.ui.drawSLPanel(10*(d-1)+c);return}if(b==34){core.ui.drawSLPanel(10*(d+1)+c);return}};actions.prototype.keyUpSL=function(b){var a=core.status.event.data;var d=parseInt(a/10),c=a%10;if(b==27||b==88||(core.status.event.id=="save"&&b==83)||(core.status.event.id=="load"&&b==68)){core.ui.closePanel();if(!core.isPlaying()){core.showStartAnimate()}return}if(b==13||b==32||b==67){if(c==0){core.doSL("autoSave",core.status.event.id)}else{core.doSL(5*d+c,core.status.event.id)}return}if(b==46){if(c==0){core.drawTip("无法删除自动存档!")}else{core.removeLocalStorage("save"+(5*d+c));core.ui.drawSLPanel(a)}}};actions.prototype.clickSwitchs=function(d,e){if(d<5||d>7){return}var a=core.status.event.ui.choices;var c=6-parseInt((a.length-1)/2);if(e>=c&&e7){return}var a=core.status.event.ui.choices;var c=6-parseInt((a.length-1)/2);if(e>=c&&e7){return}var a=core.status.event.ui.choices;var c=6-parseInt((a.length-1)/2);if(e>=c&&e=1;g--){if(core.getLocalStorage("save"+g,null)==null){h=g}else{break}}core.setLocalStorage("save"+h,f);core.drawText("同步成功!\n单存档已覆盖至存档"+h)}},function(){});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,seed:core.getFlag("seed"),route:core.encodeRoute(core.status.route)}));break;case 5:core.status.event.selection=0;core.ui.drawStorageRemove();break;case 6:core.status.event.selection=3;core.ui.drawSettings();break}}return};actions.prototype.keyDownSyncSave=function(a){if(a==38){core.status.event.selection--;core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices)}if(a==40){core.status.event.selection++;core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices)}};actions.prototype.keyUpSyncSave=function(b){if(b==27||b==88){core.status.event.selection=2;core.ui.drawSettings();return}var a=core.status.event.ui.choices;if(b==13||b==32||b==67){var c=6-parseInt((a.length-1)/2);this.clickSyncSave(6,c+core.status.event.selection)}};actions.prototype.clickSyncSelect=function(d,e){if(d<5||d>7){return}var a=core.status.event.ui.choices;var c=6-parseInt((a.length-1)/2);if(e>=c&&e7){return}var a=core.status.event.ui.choices;var g=6-parseInt((a.length-1)/2);var e=null;if(j>=g&&j=1;d--){e=core.getLocalStorage("save"+d,null);if(core.isset(e)){break}}break;case 2:break}}if(core.isset(e)){var b={name:core.firstData.name,version:core.firstData.version,data:e};core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5save",JSON.stringify(b))}core.status.event.selection=2;core.ui.drawSyncSave()};actions.prototype.keyDownLocalSaveSelect=function(a){if(a==38){core.status.event.selection--;core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices)}if(a==40){core.status.event.selection++;core.ui.drawChoices(core.status.event.ui.text,core.status.event.ui.choices)}};actions.prototype.keyUpLocalSaveSelect=function(b){if(b==27||b==88){core.status.event.selection=0;core.ui.drawSettings();return}var a=core.status.event.ui.choices;if(b==13||b==32||b==67){var c=6-parseInt((a.length-1)/2);this.clickLocalSaveSelect(6,c+core.status.event.selection)}};actions.prototype.clickStorageRemove=function(e,f){if(e<5||e>7){return}var a=core.status.event.ui.choices;var d=6-parseInt((a.length-1)/2);if(f>=d&&f7){return}var a=core.status.event.ui.choices;var i=6-parseInt((a.length-1)/2);if(k>=i&&k=1&&b<=11){core.ui.closePanel();core.keyUp(112+b-1)}if(c==4&&b>=1&&b<=10){core.ui.closePanel();core.keyUp(b==10?48:48+b)}var a=[["Q","W","E","R","T","Y","U","I","O","P"],["A","S","D","F","G","H","J","K","L"],["Z","X","C","V","B","N","M"],];if(c==5&&b>=1&&b<=10){core.ui.closePanel();core.keyUp(a[0][b-1].charCodeAt(0))}if(c==6&&b>=1&&b<=9){core.ui.closePanel();core.keyUp(a[1][b-1].charCodeAt(0))}if(c==7&&b>=1&&b<=7){core.ui.closePanel();core.keyUp(a[2][b-1].charCodeAt(0))}if(c==8&&b>=1&&b<=11){core.ui.closePanel();if(b==1){core.keyUp(189)}if(b==2){core.keyUp(187)}if(b==3){core.keyUp(219)}if(b==4){core.keyUp(221)}if(b==5){core.keyUp(220)}if(b==6){core.keyUp(186)}if(b==7){core.keyUp(222)}if(b==8){core.keyUp(188)}if(b==9){core.keyUp(190)}if(b==10){core.keyUp(191)}if(b==11){core.keyUp(192)}}if(c==9&&b>=1&&b<=10){core.ui.closePanel();if(b==1){core.keyUp(27)}if(b==2){core.keyUp(9)}if(b==3){core.keyUp(20)}if(b==4){core.keyUp(16)}if(b==5){core.keyUp(17)}if(b==6){core.keyUp(18)}if(b==7){core.keyUp(32)}if(b==8){core.keyUp(8)}if(b==9){core.keyUp(13)}if(b==10){core.keyUp(46)}}if(c==10&&b>=9&&b<=11){core.ui.closePanel()}};actions.prototype.clickCursor=function(a,b){if(a==core.status.automaticRoute.cursorX&&b==core.status.automaticRoute.cursorY){core.ui.closePanel();core.onclick(a,b,[]);return}core.status.automaticRoute.cursorX=a;core.status.automaticRoute.cursorY=b;core.ui.drawCursor()};actions.prototype.keyDownCursor=function(a){if(a==37){core.status.automaticRoute.cursorX--;core.ui.drawCursor();return}if(a==38){core.status.automaticRoute.cursorY--;core.ui.drawCursor();return}if(a==39){core.status.automaticRoute.cursorX++;core.ui.drawCursor();return}if(a==40){core.status.automaticRoute.cursorY++;core.ui.drawCursor();return}};actions.prototype.keyUpCursor=function(a){if(a==27||a==88){core.ui.closePanel();return}if(a==13||a==32||a==67||a==69){core.ui.closePanel();core.onclick(core.status.automaticRoute.cursorX,core.status.automaticRoute.cursorY,[]);return}};actions.prototype.clickAbout=function(){if(core.isPlaying()){core.ui.closePanel()}else{core.restart()}}; \ No newline at end of file diff --git a/libs/control.min.js b/libs/control.min.js new file mode 100644 index 00000000..8ac134b6 --- /dev/null +++ b/libs/control.min.js @@ -0,0 +1 @@ +function control(){this.init()}control.prototype.init=function(){};control.prototype.setRequestAnimationFrame=function(){(function(){var c=0;var d=["webkit","moz"];for(var e=0;ecore.animateFrame.speed&&core.isset(core.status.globalAnimateObjs)){for(var c=0;ccore.animateFrame.speed&&core.isset(core.status.boxAnimateObjs)&&core.status.boxAnimateObjs.length>0){core.drawBoxAnimate();core.animateFrame.boxTime=g}if(g-core.animateFrame.moveTime>16&&core.isset(core.status.heroMoving)&&core.status.heroMoving>0){var h=core.getHeroLoc("x"),i=core.getHeroLoc("y"),e=core.getHeroLoc("direction");if(core.status.heroMoving<=4){core.drawHero(e,h,i,"leftFoot",4*core.status.heroMoving*b[e].x,4*core.status.heroMoving*b[e].y)}else{if(core.status.heroMoving<=8){core.drawHero(e,h,i,"rightFoot",4*core.status.heroMoving*b[e].x,4*core.status.heroMoving*b[e].y)}}core.animateFrame.moveTime=g}if(core.isPlaying()&&g-core.animateFrame.weather.time>30){if(core.animateFrame.weather.type=="rain"&&core.animateFrame.weather.level>0){core.clearMap("weather",0,0,416,416);core.canvas.weather.strokeStyle="rgba(174,194,224,0.8)";core.canvas.weather.lineWidth=1;core.canvas.weather.lineCap="round";core.animateFrame.weather.nodes.forEach(function(j){core.canvas.weather.beginPath();core.canvas.weather.moveTo(j.x,j.y);core.canvas.weather.lineTo(j.x+j.l*j.xs,j.y+j.l*j.ys);core.canvas.weather.stroke();j.x+=j.xs;j.y+=j.ys;if(j.x>416||j.y>416){j.x=Math.random()*416;j.y=-10}});core.canvas.weather.fill()}else{if(core.animateFrame.weather.type=="snow"&&core.animateFrame.weather.level>0){core.clearMap("weather",0,0,416,416);core.canvas.weather.fillStyle="rgba(255, 255, 255, 0.8)";core.canvas.weather.beginPath();if(!core.isset(core.animateFrame.weather.data)){core.animateFrame.weather.data=0}core.animateFrame.weather.data+=0.01;var d=core.animateFrame.weather.data;core.animateFrame.weather.nodes.forEach(function(j){core.canvas.weather.moveTo(j.x,j.y);core.canvas.weather.arc(j.x,j.y,j.r,0,Math.PI*2,true);j.x+=Math.sin(d)*2;j.y+=Math.cos(d+j.d)+1+j.r/2;if(j.x>416+5||j.x<-5||j.y>416){if(Math.random()>1/3){j.x=Math.random()*416;j.y=-10}else{if(Math.sin(d)>0){j.x=-5;j.y=Math.random()*416}else{j.x=416+5;j.y=Math.random()*416}}}});core.canvas.weather.fill()}}core.animateFrame.weather.time=g}window.requestAnimationFrame(a)};window.requestAnimationFrame(a)};control.prototype.showStartAnimate=function(a){core.dom.startPanel.style.opacity=1;core.dom.startPanel.style.display="block";core.dom.startTop.style.opacity=1;core.dom.startTop.style.display="block";core.dom.startButtonGroup.style.display="none";core.dom.startButtons.style.display="block";core.dom.levelChooseButtons.style.display="none";core.dom.curtain.style.background="#000000";core.dom.curtain.style.opacity=0;core.status.played=false;core.clearStatus();core.clearMap("all");var b=1;var c=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(c);core.dom.startTop.style.display="none";core.dom.startButtonGroup.style.display="block";if(core.isset(a)){a()}}core.dom.startTop.style.opacity=b},20)};control.prototype.hideStartAnimate=function(a){var b=1;var c=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(c);core.dom.startPanel.style.display="none";if(core.isset(a)){a()}}core.dom.startPanel.style.opacity=b},20)};control.prototype.isPlaying=function(){return core.isset(core.status.played)&&core.status.played};control.prototype.clearStatus=function(){for(var a in core.timeout){clearTimeout(core.timeout[a]);core.timeout[a]=null}for(var a in core.interval){clearInterval(core.interval[a]);core.interval[a]=null}core.status={};core.clearStatusBar();core.resize(main.dom.body.clientWidth,main.dom.body.clientHeight)};control.prototype.resetStatus=function(c,b,a,e,d){var f=0;if(core.isset(core.status)&&core.isset(core.status.hero)&&core.isset(core.status.hero.statistics)&&core.isset(e)){f=core.status.hero.statistics.totalTime}this.clearStatus();core.status=core.clone(core.initStatus);core.status.played=true;core.status.floorId=a;core.status.maps=core.clone(d);core.material.enemys=core.clone(core.enemys.getEnemys());core.status.hero=core.clone(c);if(!core.isset(core.status.hero.statistics)){core.status.hero.statistics={totalTime:f,currTime:0,hp:0,battleDamage:0,poisonDamage:0,extraDamage:0,moveDirectly:0,ignoreSteps:0,}}core.status.hero.statistics.totalTime=Math.max(core.status.hero.statistics.totalTime,f);core.status.hero.statistics.start=null;core.status.hard=b;if(core.isset(e)){core.status.route=e}core.status.saveIndex=core.getLocalStorage("saveIndex2",1)};control.prototype.startGame=function(b,a){console.log("开始游戏");this.resetStatus(core.firstData.hero,b,core.firstData.floorId,null,core.initStatus.maps);core.changeFloor(core.status.floorId,null,core.firstData.hero.loc,null,function(){if(core.isset(a)){a()}},true);setTimeout(function(){var c=new FormData();c.append("type","people");c.append("name",core.firstData.name);c.append("version",core.firstData.version);c.append("platform",core.platform.isPC?"PC":core.platform.isAndroid?"Android":core.platform.isIOS?"iOS":"");c.append("hard",b);c.append("hardCode",core.getFlag("hard",0));core.utils.http("POST","/games/upload.php",c)})};control.prototype.restart=function(){this.showStartAnimate();if(core.bgms.length>0){core.playBgm(core.bgms[0])}};control.prototype.clearAutomaticRouteNode=function(a,b){if(core.status.event.id==null){core.canvas.ui.clearRect(a*32+5,b*32+5,27,27)}};control.prototype.stopAutomaticRoute=function(){if(!core.status.played){return}core.status.automaticRoute.autoHeroMove=false;core.status.automaticRoute.autoStep=0;core.status.automaticRoute.destStep=0;core.status.automaticRoute.movedStep=0;core.status.automaticRoute.autoStepRoutes=[];core.status.automaticRoute.destX=null;core.status.automaticRoute.destY=null;core.status.automaticRoute.lastDirection=null;core.stopHero();if(core.status.automaticRoute.moveStepBeforeStop.length==0){core.canvas.ui.clearRect(0,0,416,416)}};control.prototype.continueAutomaticRoute=function(){var a=core.status.automaticRoute.moveStepBeforeStop;if(a.length===0||(a.length===1&&a[0].step===1)){core.status.automaticRoute.moveStepBeforeStop=[]}else{core.setAutoHeroMove(a)}};control.prototype.clearContinueAutomaticRoute=function(){core.canvas.ui.clearRect(0,0,416,416);core.status.automaticRoute.moveStepBeforeStop=[]};control.prototype.setAutomaticRoute=function(a,b,h){if(!core.status.played||core.status.lockControl){return}if(core.status.automaticRoute.autoHeroMove){var c=core.status.automaticRoute.destX,d=core.status.automaticRoute.destY;core.stopAutomaticRoute();if(c==a&&d==b){core.status.automaticRoute.moveDirectly=true;setTimeout(function(){if(core.status.automaticRoute.moveDirectly&&core.status.heroMoving==0){var j=core.canMoveDirectly(a,b);if(j>0){core.clearMap("hero",0,0,416,416);core.setHeroLoc("x",a);core.setHeroLoc("y",b);core.drawHero();core.status.route.push("move:"+a+":"+b);core.status.hero.statistics.moveDirectly++;core.status.hero.statistics.ignoreSteps+=j}}core.status.automaticRoute.moveDirectly=false},100)}return}if(a==core.status.hero.loc.x&&b==core.status.hero.loc.y&&h.length==0){if(core.timeout.turnHeroTimeout==null){core.timeout.turnHeroTimeout=setTimeout(function(){core.turnHero();clearTimeout(core.timeout.turnHeroTimeout);core.timeout.turnHeroTimeout=null},250)}else{clearTimeout(core.timeout.turnHeroTimeout);core.timeout.turnHeroTimeout=null;core.getNextItem()}return}var g=0;var i=null;var f;if(!(f=core.automaticRoute(a,b))){if(a==core.status.hero.loc.x&&b==core.status.hero.loc.y){f=[]}else{core.canvas.ui.clearRect(0,0,416,416);return}}f=f.concat(h);core.status.automaticRoute.destX=a;core.status.automaticRoute.destY=b;core.canvas.ui.save();core.canvas.ui.clearRect(0,0,416,416);core.canvas.ui.fillStyle="#bfbfbf";core.canvas.ui.strokeStyle="#bfbfbf";core.canvas.ui.lineWidth=8;for(var e=0;e12||t<0||t>12){continue}var l=13*s+t;if(core.isset(v[l])){continue}var c=1;var k,j=core.getBlock(s,t);if(j!=null){k=j.block.event.id;if(k=="light"){c=100}if(k.substring(k.length-3)=="Net"){c=core.values.lavaDamage}if(!core.flags.potionWhileRouting&&k.substring(k.length-6)=="Potion"){c=20}if(j.block.event.trigger=="changeFloor"){c=10}}if(core.status.checkBlock.damage[l]>0){c=core.status.checkBlock.damage[l]}if(s==d&&t==e){v[l]=h;break}if(core.noPassExists(s,t)){continue}v[l]=h;u.push(169*(n+c)+l)}if(core.isset(v[13*d+e])){break}}if(!core.isset(v[13*d+e])){return false}var q=d,r=e;while(q!=x||r!=y){var g=v[13*q+r];a.push({direction:g,x:q,y:r});q-=w[g].x;r-=w[g].y}a.reverse();return a};control.prototype.fillPosWithPoint=function(a){core.fillRect("ui",a.x*32+12,a.y*32+12,8,8,"#bfbfbf")};control.prototype.setAutoHeroMove=function(a){a=a||core.status.automaticRoute.autoStepRoutes;if(a.length==0){return}core.status.automaticRoute.autoStepRoutes=a;core.status.automaticRoute.autoHeroMove=true;core.status.automaticRoute.autoStep=1;core.status.automaticRoute.destStep=a[0].step;core.moveHero(a[0].direction)};control.prototype.setHeroMoveInterval=function(b,e,f,a){if(core.status.heroMoving>0){return}core.status.heroMoving=1;var c={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};var d=1;if(core.status.replay.speed>3){d=2}core.interval.heroMoveInterval=window.setInterval(function(){core.status.heroMoving+=d;if(core.status.heroMoving>=8){core.setHeroLoc("x",e+c[b].x);core.setHeroLoc("y",f+c[b].y);core.moveOneStep();core.clearMap("hero",0,0,416,416);core.drawHero(b);clearInterval(core.interval.heroMoveInterval);core.status.heroMoving=0;if(core.isset(a)){a()}}},12.5*d/core.status.replay.speed)};control.prototype.moveAction=function(a){if(core.interval.openDoorAnimate!=null){return}if(core.status.heroMoving>0){return}var e={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};var c=core.getHeroLoc("direction");var f=core.getHeroLoc("x");var g=core.getHeroLoc("y");var d=core.noPass(f+e[c].x,g+e[c].y),b=core.canMoveHero();if(d||!b){if(core.status.event.id!="ski"){core.status.route.push(c)}core.status.automaticRoute.moveStepBeforeStop=[];core.status.automaticRoute.lastDirection=core.getHeroLoc("direction");if(b){core.trigger(f+e[c].x,g+e[c].y)}core.drawHero(c,f,g);if(core.status.automaticRoute.moveStepBeforeStop.length==0){core.clearContinueAutomaticRoute();core.stopAutomaticRoute()}if(core.isset(a)){a()}}else{core.setHeroMoveInterval(c,f,g,function(){if(core.status.automaticRoute.autoHeroMove){core.status.automaticRoute.movedStep++;core.status.automaticRoute.lastDirection=core.getHeroLoc("direction");if(core.status.automaticRoute.destStep==core.status.automaticRoute.movedStep){if(core.status.automaticRoute.autoStep==core.status.automaticRoute.autoStepRoutes.length){core.clearContinueAutomaticRoute();core.stopAutomaticRoute()}else{core.status.automaticRoute.movedStep=0;core.status.automaticRoute.destStep=core.status.automaticRoute.autoStepRoutes[core.status.automaticRoute.autoStep].step;core.setHeroLoc("direction",core.status.automaticRoute.autoStepRoutes[core.status.automaticRoute.autoStep].direction);core.status.automaticRoute.autoStep++}}}else{if(core.status.heroStop){core.drawHero()}}if(core.status.event.id!="ski"){core.status.route.push(c)}core.trigger(core.getHeroLoc("x"),core.getHeroLoc("y"));core.checkBlock();if(core.isset(a)){a()}})}};control.prototype.turnHero=function(){if(core.status.hero.loc.direction=="up"){core.status.hero.loc.direction="right"}else{if(core.status.hero.loc.direction=="right"){core.status.hero.loc.direction="down"}else{if(core.status.hero.loc.direction=="down"){core.status.hero.loc.direction="left"}else{if(core.status.hero.loc.direction=="left"){core.status.hero.loc.direction="up"}}}}core.drawHero();core.canvas.ui.clearRect(0,0,416,416);core.status.route.push("turn")};control.prototype.moveHero=function(b,a){if(core.status.heroMoving!=0){return}if(core.isset(b)){core.setHeroLoc("direction",b)}if(!core.isset(a)){core.status.heroStop=false;core.status.automaticRoute.moveDirectly=false;var c=function(){if(!core.status.heroStop){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;c()})}else{core.moveAction();setTimeout(c,50)}}else{core.stopHero()}};c()}else{core.moveAction(function(){a()})}};control.prototype.eventMoveHero=function(f,g,b){g=g||100;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);var c=[];f.forEach(function(h){if(typeof h=="string"){c.push(h)}else{if(!core.isset(h.value)){c.push(h.direction)}else{for(var j=0;j12||m<0||m>12){continue}if(!r&&Math.abs(c)+Math.abs(d)>o){continue}core.status.checkBlock.damage[13*l+m]+=e.value}}}if(core.enemys.hasSpecial(e.special,18)){for(var c=-1;c<=1;c++){for(var d=-1;d<=1;d++){if(c==0&&d==0){continue}var l=p+c,m=q+d;if(l<0||l>12||m<0||m>12||Math.abs(c)+Math.abs(d)>1){continue}core.status.checkBlock.damage[13*l+m]+=e.value}}}}}}core.status.checkBlock.betweenAttack=[];for(var p=0;p<13;p++){for(var q=0;q<13;q++){var f=false;if(p>0&&p<12){var h=core.status.checkBlock.map[13*(p-1)+q],i=core.status.checkBlock.map[13*(p+1)+q];if(core.isset(h)&&core.isset(i)&&h==i){var e=core.material.enemys[h];if(core.isset(e)&&core.enemys.hasSpecial(e.special,16)){f=true}}}if(q>0&&q<12){var h=core.status.checkBlock.map[13*p+q-1],i=core.status.checkBlock.map[13*p+q+1];if(core.isset(h)&&core.isset(i)&&h==i){var e=core.material.enemys[h];if(core.isset(e)&&core.enemys.hasSpecial(e.special,16)){f=true}}}if(f){core.status.checkBlock.betweenAttack[13*p+q]=true;var j=core.status.hero.hp-core.status.checkBlock.damage[13*p+q];if(j>1){core.status.checkBlock.damage[13*p+q]+=Math.floor((j+(core.flags.betweenAttackCeil?0:1))/2)}}}}};control.prototype.checkBlock=function(){var i=core.getHeroLoc("x"),j=core.getHeroLoc("y");var a=core.status.checkBlock.damage[13*i+j];if(a>0){core.status.hero.hp-=a;var h=[];var g={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};for(var b in g){var e=i+g[b].x,f=j+g[b].y;if(e<0||e>12||f<0||f>12){continue}var d=core.status.checkBlock.map[13*e+f];if(core.isset(d)){var c=core.material.enemys[d];if(core.isset(c)&&core.enemys.hasSpecial(c.special,18)){h.push({direction:b,x:e,y:f})}}}if(core.status.checkBlock.betweenAttack[13*i+j]&&a>0){core.drawTip("受到夹击,生命变成一半")}else{if(core.status.checkBlock.map[13*i+j]=="lavaNet"){core.drawTip("受到血网伤害"+a+"点")}else{if(h.length>0&&a>0){core.drawTip("受到阻击伤害"+a+"点")}else{if(a>0){core.drawTip("受到领域伤害"+a+"点")}}}}if(a>0){core.playSound("zone.mp3");core.drawAnimate("zone",i,j)}core.status.hero.statistics.extraDamage+=a;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose();return}h=h.filter(function(n){var o=n.x,p=n.y,k=n.direction;var l=o+g[k].x,m=p+g[k].y;return l>=0&&l<=12&&m>=0&&m<=12&&core.getBlock(l,m,core.status.floorId,false)==null});core.updateStatusBar();if(h.length>0){core.snipe(h)}}};control.prototype.snipe=function(c){var b={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};c.forEach(function(j){var k=j.x,l=j.y,h=j.direction;j.nx=k+b[j.direction].x;j.ny=l+b[j.direction].y;core.removeGlobalAnimate(k,l);var d=core.getBlock(k,l).block;var e=d.event.cls;var i=d.event.height||32;j.animate=d.event.animate||1;j.blockIcon=core.material.icons[e][d.event.id];j.blockImage=core.material.images[e];j.height=i;var g=core.enemys.getDamage(d.event.id);var f="#000000";if(g==null){g="???";f="#FF0000"}else{if(g<=0){f="#00FF00"}else{if(g=core.values.animateSpeed){e++;f=0}c.forEach(function(n){var o=n.x,p=n.y,i=n.direction;var j=b[i].x*2*g,k=b[i].y*2*g;var l=32*o+j,m=32*p+k;core.clearMap("fg",l-2*b[i].x,m-2*b[i].y,32,32);core.canvas.event.clearRect(l-2*b[i].x,m-2*b[i].y,32,32);core.canvas.event2.clearRect(l-2*b[i].x,m-2*b[i].y-32,32,32);core.drawBlock(n.block,e,j,k);if(core.hasItem("book")){core.setFillStyle("fg","#000000");core.canvas.fg.fillText(n.damage,l+2,m+30);core.canvas.fg.fillText(n.damage,l,m+30);core.canvas.fg.fillText(n.damage,l+2,m+32);core.canvas.fg.fillText(n.damage,l,m+32);core.setFillStyle("fg",n.color);core.canvas.fg.fillText(n.damage,l+1,m+31)}});if(g==16){clearInterval(d);a();if(core.status.event.id==null){core.unLockControl()}}},h/16)})}};control.prototype.setWeather=function(d,c){if(d!="rain"&&d!="snow"){core.clearMap("weather",0,0,416,416);core.animateFrame.weather.type=null;core.animateFrame.weather.level=0;core.animateFrame.weather.nodes=[];return}c=parseInt(c);if(d==core.animateFrame.weather.type&&(!core.isset(c)||20*c==core.animateFrame.weather.level)){return}if(!core.isset(c)){c=5}if(c<1){c=1}if(c>10){c=10}c*=20;core.clearMap("weather",0,0,416,416);core.animateFrame.weather.type=d;core.animateFrame.weather.level=c;core.animateFrame.weather.nodes=[];if(d=="rain"){for(var b=0;b1){c[3]=1}if(f==0){core.dom.curtain.style.background=core.arrayToRGB(c);core.dom.curtain.style.opacity=c[3];core.status.curtainColor=c;if(core.isset(a)){a()}return}var e=0;core.status.replay.animate=true;var b=setInterval(function(){e++;var g=d[3]+(c[3]-d[3])*e/25;var j=parseInt(d[0]+(c[0]-d[0])*e/25);var i=parseInt(d[1]+(c[1]-d[1])*e/25);var h=parseInt(d[2]+(c[2]-d[2])*e/25);core.dom.curtain.style.background=core.arrayToRGB([j,i,h]);core.dom.curtain.style.opacity=g;if(e>=25){clearInterval(b);core.status.curtainColor=c;core.status.replay.animate=false;if(core.isset(a)){a()}}},f/25)};control.prototype.updateFg=function(){if(!core.isset(core.status.thisMap)||!core.isset(core.status.thisMap.blocks)){return}var i=core.status.thisMap.blocks;core.clearMap("fg",0,0,416,416);if(!core.hasItem("book")){return}core.setFont("fg","bold 11px Arial");var g=core.status.hero.hp;if(core.flags.displayEnemyDamage||core.flags.displayCritical){core.canvas.fg.textAlign="left";for(var a=0;a0){d=d[0]}d=core.formatBigNumber(d[0]);if(d=="???"){d="?"}core.setFillStyle("fg","#000000");core.canvas.fg.fillText(d,32*j+2,32*(k+1)-2-10);core.canvas.fg.fillText(d,32*j,32*(k+1)-2-10);core.canvas.fg.fillText(d,32*j+2,32*(k+1)-10);core.canvas.fg.fillText(d,32*j,32*(k+1)-10);core.setFillStyle("fg","#FFFFFF");core.canvas.fg.fillText(d,32*j+1,32*(k+1)-1-10)}}}}if(core.flags.displayExtraDamage){core.canvas.fg.textAlign="center";for(var j=0;j<13;j++){for(var k=0;k<13;k++){var e=core.status.checkBlock.damage[13*j+k];if(e>0){e=core.formatBigNumber(e);core.setFillStyle("fg","#000000");core.canvas.fg.fillText(e,32*j+17,32*(k+1)-13);core.canvas.fg.fillText(e,32*j+15,32*(k+1)-15);core.canvas.fg.fillText(e,32*j+17,32*(k+1)-15);core.canvas.fg.fillText(e,32*j+15,32*(k+1)-13);core.setFillStyle("fg","#FF7F00");core.canvas.fg.fillText(e,32*j+16,32*(k+1)-14)}}}}};control.prototype.doEffect=function(b){var a=b.split("+=");if(a.length!=2){return}var d=a[0],f=core.calValue(a[1]);if(d.indexOf("status:")==0){var e=d.substring(7);core.setStatus(e,core.getStatus(e)+f)}else{if(d.indexOf("item:")==0){var c=d.substring(5);core.setItem(c,core.itemCount(c)+f)}}};control.prototype.debug=function(){core.setFlag("debug",true);core.insertAction(["\t[调试模式开启]此模式下按住Ctrl键可以穿墙并忽略一切事件。\n同时,录像将失效,也无法上传成绩。"])};control.prototype.startReplay=function(a){core.status.replay.replaying=true;core.status.replay.pausing=false;core.status.replay.speed=1;core.status.replay.toReplay=core.clone(a);core.status.replay.totalList=core.clone(a);core.status.replay.steps=0;core.status.replay.save=[];core.updateStatusBar();core.drawTip("开始播放");this.replay();return};control.prototype.triggerReplay=function(){if(core.status.event.id=="save"){return}if(core.status.replay.pausing){this.resumeReplay()}else{this.pauseReplay()}};control.prototype.pauseReplay=function(){if(core.status.event.id=="save"){return}if(!core.status.replay.replaying){return}core.status.replay.pausing=true;core.updateStatusBar();core.drawTip("暂停播放")};control.prototype.resumeReplay=function(){if(core.status.event.id=="save"){return}if(!core.status.replay.replaying){return}core.status.replay.pausing=false;core.updateStatusBar();core.drawTip("恢复播放");core.replay()};control.prototype.speedUpReplay=function(){if(core.status.event.id=="save"){return}if(!core.status.replay.replaying){return}var a=core.status.replay.speed>=3?3:core.status.replay.speed>=2?2:1;core.status.replay.speed=parseInt(10*core.status.replay.speed+a)/10;if(core.status.replay.speed>6){core.status.replay.speed=6}core.drawTip("x"+core.status.replay.speed+"倍")};control.prototype.speedDownReplay=function(){if(core.status.event.id=="save"){return}if(!core.status.replay.replaying){return}var a=core.status.replay.speed>3?3:core.status.replay.speed>2?2:1;core.status.replay.speed=parseInt(10*core.status.replay.speed-a)/10;if(core.status.replay.speed<0.3){core.status.replay.speed=0.3}core.drawTip("x"+core.status.replay.speed+"倍")};control.prototype.stopReplay=function(){if(core.status.event.id=="save"){return}if(!core.status.replay.replaying){return}core.status.replay.toReplay=[];core.status.replay.totalList=[];core.status.replay.replaying=false;core.status.replay.pausing=false;core.status.replay.speed=1;core.status.replay.steps=0;core.status.replay.save=[];core.updateStatusBar();core.drawTip("停止播放并恢复游戏")};control.prototype.rewindReplay=function(){if(core.status.event.id=="save"){return}if(!core.status.replay.replaying){return}if(!core.status.replay.pausing){core.drawTip("请先暂停录像");return}if(core.status.replay.animate){core.drawTip("请等待当前事件的处理结束");return}if(core.status.replay.save.length==0){core.drawTip("无法再回到上一个节点");return}var b=core.status.replay.save;var a=b.pop();core.loadData(a.data,function(){core.status.replay={replaying:true,pausing:true,animate:false,toReplay:a.replay.toReplay,totalList:a.replay.totalList,speed:a.replay.speed,steps:a.replay.steps,save:b};core.updateStatusBar();core.drawTip("成功回退到上一个节点")})};control.prototype.saveReplay=function(){if(!core.status.replay.replaying){return}if(!core.status.replay.pausing){core.drawTip("请先暂停录像");return}if(core.status.replay.animate||core.isset(core.status.event.id)){core.drawTip("请等待当前事件的处理结束");return}core.lockControl();core.status.event.id="save";var c=core.status.saveIndex;var b=parseInt((c-1)/5),a=c-5*b;core.ui.drawSLPanel(10*b+a)};control.prototype.bookReplay=function(){if(!core.status.replay.replaying){return}if(!core.status.replay.pausing){core.drawTip("请先暂停录像");return}if(core.status.replay.animate||core.isset(core.status.event.id)){core.drawTip("请等待当前事件的处理结束");return}core.lockControl();core.status.event.id="book";core.useItem("book")};control.prototype.replay=function(){if(!core.status.replay.replaying){return}if(core.status.replay.pausing){return}if(core.status.replay.animate){return}if(core.status.replay.toReplay.length==0){core.stopReplay();core.insertAction("录像回放完毕!");return}core.status.replay.steps++;if(core.status.replay.steps%50==0){core.status.replay.save.push({data:core.saveData(),replay:{totalList:core.clone(core.status.replay.totalList),toReplay:core.clone(core.status.replay.toReplay),speed:core.status.replay.speed,steps:core.status.replay.steps}})}var a=core.status.replay.toReplay.shift();if(a=="up"||a=="down"||a=="left"||a=="right"){core.moveHero(a,function(){setTimeout(function(){core.replay()})});return}else{if(a.indexOf("item:")==0){var h=a.substring(5);if(core.canUseItem(h)){var s=Object.keys(core.status.hero.items.tools).sort();var d=Object.keys(core.status.hero.items.constants).sort();var g;if((g=s.indexOf(h))>=0||(g=d.indexOf(h)+100)>=100){core.ui.drawToolbox(g);setTimeout(function(){core.ui.closePanel();core.useItem(h,function(){core.replay()})},750/core.status.replay.speed)}return}}else{if(a.indexOf("fly:")==0){var e=a.substring(4);var r=core.status.hero.flyRange.indexOf(e);var k=core.status.hero.flyRange.indexOf(core.status.floorId);if(core.hasItem("fly")&&r>=0&&k>=0){core.ui.drawFly(r);setTimeout(function(){core.ui.closePanel();var w=r0){var n=core.status.shops[o];if(core.isset(n)&&n.visited){var c=n.choices;var t=6-parseInt(c.length/2);core.status.event.selection=parseInt(m.shift());core.events.openShop(o,false);var p=setInterval(function(){if(!core.actions.clickShop(6,t+core.status.event.selection)){clearInterval(p);core.stopReplay();core.drawTip("录像文件出错");return}if(m.length==0){clearInterval(p);core.actions.clickShop(6,t+c.length);core.replay();return}core.status.event.selection=parseInt(m.shift());core.events.openShop(o,false)},750/core.status.replay.speed);return}}}else{if(a=="turn"){core.turnHero();core.replay();return}else{if(a=="getNext"){if(core.flags.enableGentleClick&&core.getBlock(core.nextX(),core.nextY())!=null){var i=core.nextX(),j=core.nextY();var b=core.getBlock(i,j);if(b!=null&&b.block.event.trigger=="getItem"){core.getItem(b.block.event.id,1,i,j);core.status.route.push("getNext");core.replay();return}}}else{if(a.indexOf("move:")==0){var l=a.substring(5).split(":");var u=parseInt(l[0]),v=parseInt(l[1]);var f=core.canMoveDirectly(u,v);if(f>0){core.clearMap("hero",0,0,416,416);core.setHeroLoc("x",u);core.setHeroLoc("y",v);core.drawHero();core.status.route.push("move:"+u+":"+v);core.status.hero.statistics.moveDirectly++;core.status.hero.statistics.ignoreSteps+=f;core.replay();return}}else{if(a.indexOf("key:")==0){core.actions.keyUp(parseInt(a.substring(4)),true);core.replay();return}}}}}}}}core.stopReplay();core.insertAction("录像文件出错")};control.prototype.checkStatus=function(b,c,a){if(c&&core.status.event.id==b){core.ui.closePanel();return false}if(c&&core.status.lockControl){return false}if(core.isset(a)&&a&&!core.hasItem(b)){core.drawTip("你没有"+core.material.items[b].name);return false}if(!core.status.heroStop){core.drawTip("请先停止勇士行动");return false}core.lockControl();core.status.event.id=b;return true};control.prototype.openBook=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying){return}if(core.status.event.id=="book"&&core.isset(core.status.event.selection)){core.status.boxAnimateObjs=[];core.ui.drawMaps(core.status.event.selection);return}if(core.status.event.id=="viewMaps"){a=false;core.status.event.selection=core.status.event.data}if(!core.checkStatus("book",a,true)){return}core.useItem("book")};control.prototype.useFly=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying){return}if(!core.checkStatus("fly",a,true)){return}if(core.flags.flyNearStair&&!core.nearStair()){core.drawTip("只有在楼梯边才能使用传送器");core.unLockControl();core.status.event.data=null;core.status.event.id=null;return}if(!core.canUseItem("fly")){core.drawTip("楼层传送器好像失效了");core.unLockControl();core.status.event.data=null;core.status.event.id=null;return}core.useItem("fly");return};control.prototype.openToolbox=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying){return}if(!core.checkStatus("toolbox",a)){return}core.ui.drawToolbox()};control.prototype.openQuickShop=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying){return}if(!core.checkStatus("selectShop",a)){return}core.ui.drawQuickShop()};control.prototype.save=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying){return}if(!core.checkStatus("save",a)){return}var d=core.status.saveIndex;var c=parseInt((d-1)/5),b=d-5*c;core.ui.drawSLPanel(10*c+b)};control.prototype.load=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying){return}var d=core.getLocalStorage("saveIndex2",1);var c=parseInt((d-1)/5),b=d-5*c;if(!core.isPlaying()){core.status.event={id:"load",data:null};core.status.lockControl=true;core.dom.startPanel.style.display="none";core.ui.drawSLPanel(10*c+b);return}if(!core.checkStatus("load",a)){return}core.ui.drawSLPanel(10*c+b)};control.prototype.openSettings=function(a){if(core.isset(core.status.replay)&&core.status.replay.replaying){return}if(!core.checkStatus("settings",a)){return}core.ui.drawSettings()};control.prototype.autosave=function(a){if(core.status.event.id!=null){return}var b=null;if(a){b=core.status.route.pop()}core.setLocalStorage("autoSave",core.saveData());if(a&&core.isset(b)){core.status.route.push(b)}};control.prototype.doSL=function(b,e){if(e=="save"){if(b=="autoSave"){core.drawTip("不能覆盖自动存档!");return}if(core.setLocalStorage("save"+b,core.saveData())){core.ui.closePanel();core.drawTip("存档成功!");if(b!="autoSave"){core.status.saveIndex=b;core.setLocalStorage("saveIndex2",core.status.saveIndex)}}else{core.drawTip("存储空间不足,请覆盖已有的存档或在菜单栏中进行清理")}return}else{if(e=="load"){var a=core.getLocalStorage(b=="autoSave"?b:"save"+b,null);if(!core.isset(a)){core.drawTip("无效的存档");return}if(a.version!=core.firstData.version){if(confirm("存档版本不匹配!\n你想回放此存档的录像吗?")){core.dom.startPanel.style.display="none";var d=a.hero.flags.seed;core.resetStatus(core.firstData.hero,a.hard,core.firstData.floorId,null,core.initStatus.maps);core.events.setInitData(a.hard);core.setFlag("seed",d);core.setFlag("rand",d);core.changeFloor(core.status.floorId,null,core.firstData.hero.loc,null,function(){core.startReplay(core.decodeRoute(a.route))},true)}return}core.ui.closePanel();core.loadData(a,function(){core.drawTip("读档成功");if(b!="autoSave"){core.status.saveIndex=b;core.setLocalStorage("saveIndex2",core.status.saveIndex)}});return}else{if(e=="replayLoad"){var a=core.getLocalStorage(b=="autoSave"?b:"save"+b,null);if(!core.isset(a)){core.drawTip("无效的存档");return}if(a.version!=core.firstData.version){core.drawTip("存档版本不匹配");return}if(a.hard!=core.status.hard){core.drawTip("游戏难度不匹配!");return}var c=core.subarray(core.status.route,core.decodeRoute(a.route));if(!core.isset(c)||a.hero.flags.seed!=core.getFlag("seed")){core.drawTip("无法从此存档回放录像");return}core.loadData(a,function(){core.startReplay(c);core.drawTip("回退到存档节点")})}}}};control.prototype.syncSave=function(f){var e=null;if(f=="all"){e=[];for(var c=1;c<=5*(main.savePages||30);c++){var a=core.getLocalStorage("save"+c,null);if(core.isset(a)){e.push(a)}}}else{for(var c=5*(main.savePages||30);c>=1;c--){e=core.getLocalStorage("save"+c,null);if(core.isset(e)){break}}}if(!core.isset(e)){core.drawText("没有要同步的存档");return}core.ui.drawWaiting("正在同步,请稍后...");var b=new FormData();b.append("type","save");b.append("name",core.firstData.name);var d=JSON.stringify(e);b.append("data",d);core.http("POST","/games/sync.php",b,function(g){var h=JSON.parse(g);if(h.code<0){core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因:"+h.msg)}else{core.drawText("同步成功!\n\n您的存档编号: "+h.code+"\n您的存档密码: "+h.msg+"\n\n请牢记以上两个信息(如截图等),在从服务器\n同步存档时使用。")}},function(g){core.drawText("出错啦!\n无法同步存档到服务器。\n错误原因:"+g)})};control.prototype.syncLoad=function(){var b=prompt("请输入存档编号:");if(b==null||b==""){core.ui.drawSyncSave();return}var c=prompt("请输入存档密码:");if(c==null||c==""){core.ui.drawSyncSave();return}core.ui.drawWaiting("正在同步,请稍后...");var a=new FormData();a.append("type","load");a.append("name",core.firstData.name);a.append("id",b);a.append("password",c);core.http("POST","/games/sync.php",a,function(d){var g=JSON.parse(d);switch(g.code){case 0:var d=JSON.parse(g.msg);if(d instanceof Array){core.status.event.selection=1;core.ui.drawConfirmBox("所有本地存档都将被覆盖,确认?",function(){for(var h=1;h<=5*(main.savePages||30);h++){if(h<=d.length){core.setLocalStorage("save"+h,d[h-1])}else{core.removeLocalStorage("save"+h)}}core.drawText("同步成功!\n你的本地所有存档均已被覆盖。")},function(){core.status.event.selection=0;core.ui.drawSyncSave()})}else{var f=5*(main.savePages||30);for(var e=5*(main.savePages||30);e>=1;e--){if(core.getLocalStorage("save"+e,null)==null){f=e}else{break}}core.setLocalStorage("save"+f,d);core.drawText("同步成功!\n单存档已覆盖至存档"+f)}break;case -1:core.drawText("出错啦!\n存档编号"+b+"不存在!");break;case -2:core.drawText("出错啦!\n存档密码错误!");break;default:core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因:"+g.msg);break}},function(d){core.drawText("出错啦!\n无法从服务器同步存档。\n错误原因:"+d)})};control.prototype.saveData=function(){var a={floorId:core.status.floorId,hero:core.clone(core.status.hero),hard:core.status.hard,maps:core.maps.save(core.status.maps),route:core.encodeRoute(core.status.route),shops:{},version:core.firstData.version,time:new Date().getTime()};for(var b in core.status.shops){a.shops[b]={times:core.status.shops[b].times||0,visited:core.status.shops[b].visited||false}}core.events.beforeSaveData(a);return a};control.prototype.loadData=function(b,a){core.resetStatus(b.hero,b.hard,b.floorId,core.decodeRoute(b.route),core.maps.load(b.maps));for(var d in core.status.shops){if(core.isset(b.shops[d])){core.status.shops[d].times=b.shops[d].times;core.status.shops[d].visited=b.shops[d].visited}}var c=core.getFlag("heroIcon","hero.png");if(core.isset(core.material.images.images[c])){core.material.images.hero.src=core.material.images.images[c].src;core.material.icons.hero.height=core.material.images.images[c].height/4}core.events.afterLoadData(b);core.changeFloor(b.floorId,null,b.hero.loc,0,function(){if(core.isset(a)){a()}},true)};control.prototype.setStatus=function(a,b){if(core.isset(core.status.hero.loc[a])){core.status.hero.loc[a]=b}else{core.status.hero[a]=b}};control.prototype.getStatus=function(a){if(core.isset(core.status.hero.loc[a])){return core.status.hero.loc[a]}return core.status.hero[a]};control.prototype.getLvName=function(){if(core.status.hero.lv>core.firstData.levelUp.length){return core.status.hero.lv}return core.firstData.levelUp[core.status.hero.lv-1].name||core.status.hero.lv};control.prototype.setFlag=function(a,b){if(!core.isset(core.status.hero)){return}core.status.hero.flags[a]=b};control.prototype.getFlag=function(b,a){if(!core.isset(core.status.hero)){return a}var c=core.status.hero.flags[b];if(core.isset(c)){return c}return a};control.prototype.hasFlag=function(a){if(core.getFlag(a)){return true}return false};control.prototype.lockControl=function(){core.status.lockControl=true};control.prototype.unLockControl=function(){core.status.lockControl=false};control.prototype.playBgm=function(a){if(main.mode!="play"){return}if(!core.musicStatus.bgmStatus){return}if(!core.isset(core.material.bgms[a])){return}if(core.material.bgms[a]=="loading"){core.material.bgms[a]="starting";return}try{if(core.musicStatus.playingBgm==a&&core.musicStatus.isPlaying){return}if(core.isset(core.musicStatus.playingBgm)&&core.musicStatus.isPlaying){core.material.bgms[core.musicStatus.playingBgm].pause()}core.material.bgms[a].volume=core.musicStatus.volume;core.material.bgms[a].play();core.musicStatus.playingBgm=a;core.musicStatus.isPlaying=true}catch(b){console.log("无法播放BGM "+a);console.log(b);core.musicStatus.playingBgm=null}};control.prototype.pauseBgm=function(){try{if(core.isset(core.musicStatus.playingBgm)){core.material.bgms[core.musicStatus.playingBgm].pause()}core.musicStatus.isPlaying=false}catch(a){console.log("无法暂停BGM "+bgm);console.log(a)}};control.prototype.resumeBgm=function(){if(main.mode!="play"){return}if(!core.musicStatus.bgmStatus){return}try{if(core.isset(core.musicStatus.playingBgm)){core.material.bgms[core.musicStatus.playingBgm].play();core.musicStatus.isPlaying=true}else{if(core.bgms.length>0){if(core.isset(core.floors[core.status.floorId].bgm)){core.playBgm(core.floors[core.status.floorId].bgm)}else{core.playBgm(core.bgms[0])}core.musicStatus.isPlaying=true}}}catch(a){console.log("无法恢复BGM "+bgm);console.log(a)}};control.prototype.playSound=function(d){if(main.mode!="play"){return}if(!core.musicStatus.soundStatus){return}if(!core.isset(core.material.sounds[d])){return}try{if(core.musicStatus.audioContext!=null){var f=core.musicStatus.audioContext.createBufferSource();f.buffer=core.material.sounds[d];f.connect(core.musicStatus.gainNode);try{f.start(0)}catch(a){try{f.noteOn(0)}catch(b){}}}else{core.material.sounds[d].volume=core.musicStatus.volume;core.material.sounds[d].play()}}catch(c){console.log("无法播放SE "+d);console.log(c)}};control.prototype.clearStatusBar=function(){var a=["floor","lv","hp","atk","def","mdef","money","experience","up","yellowKey","blueKey","redKey","poison","weak","curse","hard"];a.forEach(function(b){core.statusBar[b].innerHTML=" "});core.statusBar.image.book.style.opacity=0.3;core.statusBar.image.fly.style.opacity=0.3};control.prototype.updateStatusBar=function(){core.events.checkLvUp();if(core.flags.enableHPMax){core.setStatus("hp",Math.min(core.getStatus("hpmax"),core.getStatus("hp")))}core.updateCheckBlock();var b=core.getLvName();core.statusBar.lv.innerHTML=b;if(/^[+-]?\d+$/.test(b)){core.statusBar.lv.style.fontStyle="italic"}else{core.statusBar.lv.style.fontStyle="normal"}var c=["hpmax","hp","atk","def","mdef","money","experience"];c.forEach(function(d){if(core.isset(core.status.hero[d])){core.status.hero[d]=Math.floor(core.status.hero[d])}core.statusBar[d].innerHTML=core.formatBigNumber(core.getStatus(d))});if(core.flags.enableLevelUp&&core.status.hero.lvh&&h9){C=C*9/k}var u;x="3px #fff solid";J="3px #fff solid";var V=(a-U)/4.22;var b=1-V/100;if(U=0}if(typeof a=="number"){return a!=0&&(a%100==b||this.hasSpecial(parseInt(a/100),b))}return false};enemys.prototype.getSpecialText=function(b){var a=core.material.enemys[b];if(!core.isset(a)){return[]}var c=a.special;var d=[];if(this.hasSpecial(c,1)){d.push("先攻")}if(this.hasSpecial(c,2)){d.push("魔攻")}if(this.hasSpecial(c,3)){d.push("坚固")}if(this.hasSpecial(c,4)){d.push("2连击")}if(this.hasSpecial(c,5)){d.push("3连击")}if(this.hasSpecial(c,6)){d.push((a.n||4)+"连击")}if(this.hasSpecial(c,7)){d.push("破甲")}if(this.hasSpecial(c,8)){d.push("反击")}if(this.hasSpecial(c,9)){d.push("净化")}if(this.hasSpecial(c,10)){d.push("模仿")}if(this.hasSpecial(c,11)){d.push("吸血")}if(this.hasSpecial(c,12)){d.push("中毒")}if(this.hasSpecial(c,13)){d.push("衰弱")}if(this.hasSpecial(c,14)){d.push("诅咒")}if(this.hasSpecial(c,15)){d.push("领域")}if(this.hasSpecial(c,16)){d.push("夹击")}if(this.hasSpecial(c,17)){d.push("仇恨")}if(this.hasSpecial(c,18)){d.push("阻击")}if(this.hasSpecial(c,19)){d.push("自爆")}if(this.hasSpecial(c,20)){d.push("无敌")}if(this.hasSpecial(c,21)){d.push("退化")}if(this.hasSpecial(c,22)){d.push("固伤")}if(this.hasSpecial(c,23)){d.push("重生")}return d};enemys.prototype.getSpecialHint=function(a,e){if(!core.isset(e)){var c=[];for(var d=1;d<100;d++){if(this.hasSpecial(a.special,d)){var b=this.getSpecialHint(a,d);if(b!=""){c.push(b)}}}return c}switch(e){case 1:return"先攻:怪物首先攻击";case 2:return"魔攻:怪物无视勇士的防御";case 3:return"坚固:勇士每回合最多只能对怪物造成1点伤害";case 4:return"2连击:怪物每回合攻击2次";case 5:return"3连击:怪物每回合攻击3次";case 6:return(a.n||4)+"连击: 怪物每回合攻击"+(a.n||4)+"次";case 7:return"破甲:战斗前,怪物附加角色防御的"+Math.floor(100*core.values.breakArmor||0)+"%作为伤害";case 8:return"反击:战斗时,怪物每回合附加角色攻击的"+Math.floor(100*core.values.counterAttack||0)+"%作为伤害,无视角色防御";case 9:return"净化:战斗前,怪物附加勇士魔防的"+core.values.purify+"倍作为伤害";case 10:return"模仿:怪物的攻防和勇士攻防相等";case 11:return"吸血:战斗前,怪物首先吸取角色的"+Math.floor(100*a.value||0)+"%生命作为伤害"+(a.add?",并把伤害数值加到自身生命上":"");case 12:return"中毒:战斗后,勇士陷入中毒状态,每一步损失生命"+core.values.poisonDamage+"点";case 13:return"衰弱:战斗后,勇士陷入衰弱状态,攻防暂时下降"+core.values.weakValue+"点";case 14:return"诅咒:战斗后,勇士陷入诅咒状态,战斗无法获得金币和经验";case 15:return"领域:经过怪物周围"+(a.range||1)+"格时自动减生命"+(a.value||0)+"点";case 16:return"夹击:经过两只相同的怪物中间,勇士生命值变成一半";case 17:return"仇恨:战斗前,怪物附加之前积累的仇恨值作为伤害"+(core.flags.hatredDecrease?";战斗后,释放一半的仇恨值":"")+"。(每杀死一个怪物获得"+(core.values.hatred||0)+"点仇恨值)";case 18:return"阻击:经过怪物的十字领域时自动减生命"+(a.value||0)+"点,同时怪物后退一格";case 19:return"自爆:战斗后勇士的生命值变成1";case 20:return"无敌:勇士无法打败怪物,除非拥有十字架";case 21:return"退化:战斗后勇士永久下降"+(a.atkValue||0)+"点攻击和"+(a.defValue||0)+"点防御";case 22:return"固伤:战斗前,怪物对勇士造成"+(a.damage||0)+"点固定伤害,无视勇士魔防。";case 23:return"重生:怪物被击败后,角色转换楼层则怪物将再次出现";default:break}return""};enemys.prototype.canBattle=function(b){var a=this.getDamage(b);return a!=null&&a=1;m--){var i=Math.ceil(f/m)+e;if(i<=b){break}if(i!=l){var j=this.getDamageInfo(g,core.status.hero.hp,i,core.status.hero.def,core.status.hero.mdef);if(j==null){break}d.push([i-b,c.damage-j.damage]);l=i}if(d.length>=k){break}}}else{l=c.damage;for(var a=b+1;a<=f+e;a++){var j=this.getDamageInfo(g,core.status.hero.hp,a,core.status.hero.def,core.status.hero.mdef);if(j==null){break}if(l>j.damage){l=j.damage;d.push([a-b,c.damage-j.damage]);if(d.length>=k){break}}}}if(d.length==0){d.push([0,0])}return d};enemys.prototype.getDefDamage=function(c,a){a=a||1;var b=core.material.enemys[c];var e=this.calDamage(b,core.status.hero.hp,core.status.hero.atk,core.status.hero.def,core.status.hero.mdef);var d=this.calDamage(b,core.status.hero.hp,core.status.hero.atk,core.status.hero.def+a,core.status.hero.mdef);if(e==null||d==null){return"???"}return e-d};enemys.prototype.getDamageInfo=function(l,e,c,d,f){if(typeof l=="string"){l=core.material.enemys[l]}var j=l.hp,h=l.atk,i=l.def,k=l.special;e=Math.max(0,e);c=Math.max(0,c);d=Math.max(0,d);f=Math.max(0,f);if(this.hasSpecial(k,20)&&!core.hasItem("cross")){return null}var g=0;if(this.hasSpecial(k,11)){var o=e*l.value;o=Math.floor(o)||0;if(l.add){j+=o}g+=o}if(this.hasSpecial(k,10)){h=c;i=d}if(this.hasSpecial(k,2)){d=0}if(this.hasSpecial(k,3)&&i=3){l="多属性..."}else{l=l.join(" ")}var c=this.nextCriticals(k);if(c.length>0){c=c[0]}d.push({id:k,name:j.name,hp:i,atk:g,def:h,money:j.money,experience:j.experience,point:j.point||0,special:l,damage:this.getDamage(k),critical:c[0],criticalDamage:c[1],defDamage:this.getDefDamage(k)});m[k]=true}}d.sort(function(n,o){if(n.damage==o.damage){return n.money-o.money}if(n.damage==null){return 1}if(o.damage==null){return -1}return n.damage-o.damage});return d}; \ No newline at end of file diff --git a/libs/events.min.js b/libs/events.min.js new file mode 100644 index 00000000..47ec006a --- /dev/null +++ b/libs/events.min.js @@ -0,0 +1 @@ +function events(){this.init()}events.prototype.init=function(){this.eventdata=functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a.events;this.events={battle:function(c,b,a){b.battle(c.event.id,c.x,c.y);if(b.isset(a)){a()}},getItem:function(c,b,a){b.getItem(c.event.id,1,c.x,c.y);if(b.isset(a)){a()}},openDoor:function(c,b,a){b.openDoor(c.event.id,c.x,c.y,true,function(){if(b.isset(a)){a()}b.replay()})},changeFloor:function(c,b,a){var d={};if(b.isset(c.event.data.loc)){d={x:c.event.data.loc[0],y:c.event.data.loc[1]}}if(b.isset(c.event.data.direction)){d.direction=c.event.data.direction}b.changeFloor(c.event.data.floorId,c.event.data.stair,d,c.event.data.time,function(){if(b.isset(a)){a()}b.replay()})},passNet:function(c,b,a){b.events.passNet(c);if(b.isset(a)){a()}},changeLight:function(c,b,a){b.events.changeLight(c.x,c.y);if(b.isset(a)){a()}},ski:function(c,b,a){b.events.ski();if(b.isset(a)){a()}},pushBox:function(c,b,a){b.events.pushBox(c);if(b.isset(a)){a()}},action:function(c,b,a){b.events.insertAction(c.event.data,c.x,c.y,a)}}};events.prototype.getEvents=function(a){if(!core.isset(a)){return this.events}return this.events[a]};events.prototype.initGame=function(){return this.eventdata.initGame()};events.prototype.startGame=function(a){if(core.status.isStarting){return}core.status.isStarting=true;core.hideStartAnimate(function(){core.drawText(core.clone(core.firstData.startText),function(){if(core.flags.showBattleAnimateConfirm){core.status.event.selection=core.flags.battleAnimate?0:1;core.ui.drawConfirmBox("你想开启战斗动画吗?\n之后可以在菜单栏中开启或关闭。\n(强烈建议新手开启此项)",function(){core.flags.battleAnimate=true;core.setLocalStorage("battleAnimate",true);core.startGame(a);core.utils.__init_seed();core.events.setInitData(a)},function(){core.flags.battleAnimate=false;core.setLocalStorage("battleAnimate",false);core.startGame(a);core.utils.__init_seed();core.events.setInitData(a)})}else{core.startGame(a);core.utils.__init_seed();core.events.setInitData(a)}})})};events.prototype.setInitData=function(a){return this.eventdata.setInitData(a)};events.prototype.win=function(a){return this.eventdata.win(a)};events.prototype.lose=function(a){return this.eventdata.lose(a)};events.prototype.gameOver=function(c,d){core.clearMap("animate",0,0,416,416);core.dom.gif2.innerHTML="";core.clearMap("weather",0,0,416,416);core.animateFrame.weather.type=null;core.animateFrame.weather.level=0;core.animateFrame.weather.nodes=[];core.setFg(null,0);core.ui.closePanel();var a=function(){core.ui.closePanel();core.ui.drawConfirmBox("你想下载录像吗?",function(){var e={name:core.firstData.name,version:core.firstData.version,hard:core.status.hard,seed:core.getFlag("seed"),route:core.encodeRoute(core.status.route)};core.download(core.firstData.name+"_"+core.formatDate2(new Date())+".h5route",JSON.stringify(e));core.restart()},function(){core.restart()})};var b=function(){core.ui.closePanel();if(!core.isset(c)){a();return}var e=function(h){var g=core.status.hero.hp;if(h==undefined){g=1}var f=new FormData();f.append("type","score");f.append("name",core.firstData.name);f.append("version",core.firstData.version);f.append("platform",core.platform.isPC?"PC":core.platform.isAndroid?"Android":core.platform.isIOS?"iOS":"");f.append("hard",core.status.hard);f.append("username",h||"");f.append("ending",c);f.append("lv",core.status.hero.lv);f.append("hp",Math.min(g,Math.pow(2,63)));f.append("atk",core.status.hero.atk);f.append("def",core.status.hero.def);f.append("mdef",core.status.hero.mdef);f.append("money",core.status.hero.money);f.append("experience",core.status.hero.experience);f.append("steps",core.status.hero.steps);f.append("seed",core.getFlag("seed"));f.append("totalTime",Math.floor(core.status.hero.statistics.totalTime/1000));f.append("route",core.encodeRoute(core.status.route));if(main.isCompetition){core.http("POST","/games/competition/upload.php",f)}else{core.http("POST","/games/upload.php",f)}setTimeout(function(){a()},150)};core.ui.drawConfirmBox("你想记录你的ID和成绩吗?",function(){if(main.isCompetition){e("")}else{e(prompt("请输入你的ID:"))}},function(){if(main.isCompetition){a()}else{e(undefined)}});return};if(d){core.drawText("录像回放完毕!",function(){core.restart()})}else{if(core.isset(core.values.maxValidHp)&&core.status.hero.hp>core.values.maxValidHp){core.drawText("作弊可耻!",function(){core.restart()})}else{if(core.hasFlag("debug")){core.drawText("\t[系统提示]调试模式下无法上传成绩",function(){core.restart()})}else{b()}}}};events.prototype.afterChangeFloor=function(a){if(main.mode!="play"){return}return this.eventdata.afterChangeFloor(a)};events.prototype.doEvents=function(b,c,d,a){if(!core.isset(b)){return}if(!(b instanceof Array)){b=[b]}core.waitHeroToStop(function(){core.lockControl();core.status.event={id:"action",data:{list:[{todo:core.clone(b),total:core.clone(b),condition:"false"}],x:c,y:d,callback:a}};core.events.doAction()})};events.prototype.doAction=function(){core.status.boxAnimateObjs=[];clearInterval(core.status.event.interval);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);if(core.status.event.data.list.length==0){var callback=core.status.event.data.callback;core.ui.closePanel();if(core.isset(callback)){callback()}core.replay();return}var current=core.status.event.data.list[0];if(current.todo.length==0){if(core.calValue(current.condition)){current.todo=core.clone(current.total)}else{core.status.event.data.list.shift()}this.doAction();return}var data=current.todo.shift();core.status.event.data.current=data;var x=core.status.event.data.x,y=core.status.event.data.y;if(typeof data=="string"){core.status.event.data.type="text";if(core.status.replay.replaying){core.events.doAction()}else{core.ui.drawTextBox(data)}return}core.status.event.data.type=data.type;switch(data.type){case"text":if(core.status.replay.replaying){core.events.doAction()}else{core.ui.drawTextBox(data.text)}break;case"autoText":if(core.status.replay.replaying){core.events.doAction()}else{core.ui.drawTextBox(data.text);setTimeout(function(){core.events.doAction()},data.time||3000)}break;case"setText":if(data.position=="up"||data.position=="down"||data.position=="center"){core.status.textAttribute.position=data.position}["background","title","text"].forEach(function(t){if(core.isset(data[t])&&(data[t] instanceof Array)&&data[t].length>=3){if(data[t].length==3){data[t].push(1)}core.status.textAttribute[t]=data[t]}});if(core.isset(data.bold)){core.status.textAttribute.bold=data.bold}if(core.isset(data.time)){core.status.textAttribute.time=data.time}core.events.doAction();break;case"tip":core.drawTip(core.replaceText(data.text));core.events.doAction();break;case"show":if(!core.isset(data.loc)){data.loc=[x,y]}if((typeof data.loc[0]=="number"||typeof data.loc[0]=="string")&&(typeof data.loc[1]=="number"||typeof data.loc[1]=="string")){data.loc=[[core.calValue(data.loc[0]),core.calValue(data.loc[1])]]}if(core.isset(data.time)&&data.time>0&&(!core.isset(data.floorId)||data.floorId==core.status.floorId)){core.animateBlock(data.loc,"show",data.time,function(){data.loc.forEach(function(t){core.showBlock(t[0],t[1],data.floorId)});core.events.doAction()})}else{data.loc.forEach(function(t){core.showBlock(t[0],t[1],data.floorId)});this.doAction()}break;case"hide":if(!core.isset(data.loc)){data.loc=[x,y]}if((typeof data.loc[0]=="number"||typeof data.loc[0]=="string")&&(typeof data.loc[1]=="number"||typeof data.loc[1]=="string")){data.loc=[[core.calValue(data.loc[0]),core.calValue(data.loc[1])]]}data.loc.forEach(function(t){core.removeBlock(t[0],t[1],data.floorId)});if(core.isset(data.time)&&data.time>0&&(!core.isset(data.floorId)||data.floorId==core.status.floorId)){core.animateBlock(data.loc,"hide",data.time,function(){core.events.doAction()})}else{this.doAction()}break;case"setBlock":if(core.isset(data.loc)){x=core.calValue(data.loc[0]);y=core.calValue(data.loc[1])}core.setBlock(data.number,x,y,data.floorId);this.doAction();break;case"animate":if(core.isset(data.loc)){if(data.loc=="hero"){x=core.getHeroLoc("x");y=core.getHeroLoc("y")}else{if(data.loc instanceof Array){x=core.calValue(data.loc[0]);y=core.calValue(data.loc[1])}}}core.drawAnimate(data.name,x,y,function(){core.events.doAction()});break;case"move":if(core.isset(data.loc)){x=core.calValue(data.loc[0]);y=core.calValue(data.loc[1])}core.moveBlock(x,y,data.steps,data.time,data.immediateHide,function(){core.events.doAction()});break;case"moveHero":core.eventMoveHero(data.steps,data.time,function(){core.events.doAction()});break;case"changeFloor":var heroLoc={x:core.calValue(data.loc[0]),y:core.calValue(data.loc[1])};if(core.isset(data.direction)){heroLoc.direction=data.direction}core.changeFloor(data.floorId||core.status.floorId,null,heroLoc,data.time,function(){core.lockControl();core.events.doAction()});break;case"changePos":core.clearMap("hero",0,0,416,416);if(core.isset(data.loc)){core.setHeroLoc("x",core.calValue(data.loc[0]));core.setHeroLoc("y",core.calValue(data.loc[1]))}if(core.isset(data.direction)){core.setHeroLoc("direction",data.direction)}core.drawHero();this.doAction();break;case"showImage":if(core.isset(data.loc)&&core.isset(core.material.images.images[data.name])){core.canvas.animate.drawImage(core.material.images.images[data.name],core.calValue(data.loc[0]),core.calValue(data.loc[1]))}else{core.clearMap("animate",0,0,416,416)}this.doAction();break;case"animateImage":if(core.status.replay.replaying){this.doAction()}else{if(core.isset(data.loc)&&core.isset(core.material.images.images[data.name])&&(data.action=="show"||data.action=="hide")){core.events.animateImage(data.action,core.material.images.images[data.name],data.loc,data.time,function(){core.events.doAction()})}else{this.doAction()}}break;case"showGif":if(core.isset(data.loc)&&core.isset(core.material.images.images[data.name])){var gif=new Image();gif.src=core.material.images.images[data.name].src;gif.style.position="absolute";gif.style.left=(core.calValue(data.loc[0])*core.domStyle.scale)+"px";gif.style.top=(core.calValue(data.loc[1])*core.domStyle.scale)+"px";core.dom.gif2.appendChild(gif)}else{core.dom.gif2.innerHTML=""}this.doAction();break;case"moveImage":if(core.status.replay.replaying){this.doAction()}else{if(core.isset(data.from)&&core.isset(data.to)&&core.isset(core.material.images.images[data.name])){core.events.moveImage(core.material.images.images[data.name],data.from,data.to,data.time,function(){core.events.doAction()})}else{this.doAction()}}break;case"setFg":core.setFg(data.color,data.time,function(){core.events.doAction()});break;case"setWeather":core.setWeather(data.name,data.level);this.doAction();break;case"openDoor":var floorId=data.floorId||core.status.floorId;var block=core.getBlock(core.calValue(data.loc[0]),core.calValue(data.loc[1]),floorId);if(block!=null){if(floorId==core.status.floorId){core.openDoor(block.block.event.id,block.block.x,block.block.y,false,function(){core.events.doAction()})}else{core.removeBlock(block.block.x,block.block.y,floorId);this.doAction()}break}this.doAction();break;case"openShop":if(core.status.replay.replaying){core.status.shops[data.id].visited=true;core.status.event.data.list=[];this.doAction()}else{core.events.openShop(data.id)}break;case"disableShop":core.events.disableQuickShop(data.id);this.doAction();break;case"battle":core.battle(data.id,null,null,true,function(){core.events.doAction()});break;case"trigger":var toX=core.calValue(data.loc[0]),toY=core.calValue(data.loc[1]);var block=core.getBlock(toX,toY);if(block!=null){block=block.block;if(core.isset(block.event)&&block.event.trigger=="action"){core.status.event.data.list=[{todo:core.clone(block.event.data),total:core.clone(block.event.data),condition:"false"}];core.status.event.data.x=block.x;core.status.event.data.y=block.y}}this.doAction();break;case"playSound":if(!core.status.replay.replaying){core.playSound(data.name)}this.doAction();break;case"playBgm":core.playBgm(data.name);this.doAction();break;case"pauseBgm":core.pauseBgm();this.doAction();break;case"resumeBgm":core.resumeBgm();this.doAction();break;case"setVolume":data.value=parseInt(data.value||0);if(data.value>100){data.value=100}data.value=data.value/100;core.musicStatus.volume=data.value;if(core.isset(core.musicStatus.playingBgm)){core.material.bgms[core.musicStatus.playingBgm].volume=data.value}core.musicStatus.gainNode.gain.value=data.value;this.doAction();break;case"setValue":try{var value=core.calValue(data.value);if(data.name.indexOf("status:")==0){value=parseFloat(value);core.setStatus(data.name.substring(7),value)}if(data.name.indexOf("item:")==0){value=parseInt(value);var itemId=data.name.substring(5);if(value>core.itemCount(itemId)){core.getItem(itemId,value-core.itemCount(itemId))}else{core.setItem(itemId,value)}}if(data.name.indexOf("flag:")==0){core.setFlag(data.name.substring(5),value)}}catch(e){console.log(e)}if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose()}else{core.updateStatusBar();this.doAction()}break;case"setHeroIcon":this.setHeroIcon(data.name);this.doAction();break;case"input":var value;if(core.status.replay.replaying){var action=core.status.replay.toReplay.shift();if(action.indexOf("input:")==0){value=parseInt(action.substring(6))}else{core.stopReplay();core.drawTip("录像文件出错");return}}else{core.interval.onDownInterval="tmp";value=prompt(core.replaceText(data.text))}value=Math.abs(parseInt(value)||0);core.status.route.push("input:"+value);core.setFlag("input",value);this.doAction();break;case"if":if(core.calValue(data.condition)){core.events.insertAction(data["true"])}else{core.events.insertAction(data["false"])}this.doAction();break;case"choices":if(core.status.replay.replaying){if(core.status.replay.toReplay.length==0){core.status.replay.replaying=false;core.drawTip("录像回放完毕")}else{var action=core.status.replay.toReplay.shift(),index;if(action.indexOf("choices:")==0&&((index=parseInt(action.substring(8)))>=0)&&index=10000){core.setFlag("type",1);core.setFlag("x",parseInt((value-10000)/100));core.setFlag("y",value%100)}else{core.setFlag("type",0);core.setFlag("keycode",value)}core.events.doAction()}else{core.stopReplay();core.drawTip("录像文件出错")}}break;case"revisit":var block=core.getBlock(x,y);if(block!=null){block=block.block;if(core.isset(block.event)&&block.event.trigger=="action"){core.status.event.data.list=[{todo:core.clone(block.event.data),total:core.clone(block.event.data),condition:"false"}]}}this.doAction();break;case"exit":core.status.event.data.list=[];core.events.doAction();break;default:core.status.event.data.type="text";core.ui.drawTextBox("\t[警告]出错啦!\n"+data.type+" 事件不被支持...")}return};events.prototype.insertAction=function(a,c,d,b){if(core.status.event.id==null){this.doEvents(a,c,d,b)}else{core.unshift(core.status.event.data.list[0].todo,a);if(core.isset(c)){core.status.event.data.x=c}if(core.isset(d)){core.status.event.data.y=d}if(core.isset(b)){core.status.event.data.callback=b}}};events.prototype.getNextItem=function(){if(!core.status.heroStop||!core.flags.enableGentleClick){return}var b=core.nextX(),c=core.nextY();var a=core.getBlock(b,c);if(a==null){return}if(a.block.event.trigger=="getItem"){core.getItem(a.block.event.id,1,b,c);core.status.route.push("getNext")}};events.prototype.getItem=function(d,e,f,g,a){core.playSound("item.mp3");var c=core.material.items[d].cls;core.items.getItemEffect(d,e);core.removeBlock(f,g);var h="获得 "+core.material.items[d].name;if(e>1){h+="x"+e}if(c==="items"){h+=core.items.getItemEffectTip(d)}core.drawTip(h,core.material.icons.items[d]);core.canvas.event.clearRect(f*32,g*32,32,32);core.updateStatusBar();var b=core.floors[core.status.floorId].afterGetItem[f+","+g];if(core.isset(b)){core.events.doEvents(b,f,g,a)}else{if(core.isset(a)){a()}}};events.prototype.openDoor=function(d,i,j,f,a){if(core.interval.openDoorAnimate!=null){return}if(!core.terrainExists(i,j,d)&&d!="lava"&&d!="star"){if(core.isset(a)){a()}return}if(core.status.automaticRoute.moveStepBeforeStop.length==0){core.status.automaticRoute.moveStepBeforeStop=core.status.automaticRoute.autoStepRoutes.slice(core.status.automaticRoute.autoStep-1,core.status.automaticRoute.autoStepRoutes.length);if(core.status.automaticRoute.moveStepBeforeStop.length>=1){core.status.automaticRoute.moveStepBeforeStop[0].step-=core.status.automaticRoute.movedStep}}core.stopAutomaticRoute();var g=30;var c=d;if(c.length<4||c.substring(c.length-4)!="Door"){c=c+"Door";g=70}if(!core.isset(core.material.icons.animates[c])){if(core.isset(a)){a()}return}var e=d.replace("Door","Key");if(f&&(e=="specialKey"||core.isset(core.material.items[e]))){var e=d.replace("Door","Key");if(!core.hasItem(e)){if(e!="specialKey"){core.drawTip("你没有"+core.material.items[e].name)}else{core.drawTip("无法开启此门")}core.clearContinueAutomaticRoute();return}core.autosave(true);core.removeItem(e)}core.playSound("door.mp3");var h=0;var b=core.material.icons.animates[c];core.status.replay.animate=true;core.removeGlobalAnimate(i,j);core.interval.openDoorAnimate=window.setInterval(function(){h++;if(h==4){clearInterval(core.interval.openDoorAnimate);core.interval.openDoorAnimate=null;core.removeBlock(i,j);core.status.replay.animate=false;core.events.afterOpenDoor(d,i,j,a);return}core.canvas.event.clearRect(32*i,32*j,32,32);core.canvas.event.drawImage(core.material.images.animates,32*h,32*b,32,32,32*i,32*j,32,32)},g/core.status.replay.speed)};events.prototype.battle=function(c,d,e,b,a){if(core.status.automaticRoute.moveStepBeforeStop.length==0){core.status.automaticRoute.moveStepBeforeStop=core.status.automaticRoute.autoStepRoutes.slice(core.status.automaticRoute.autoStep-1,core.status.automaticRoute.autoStepRoutes.length);if(core.status.automaticRoute.moveStepBeforeStop.length>=1){core.status.automaticRoute.moveStepBeforeStop[0].step-=core.status.automaticRoute.movedStep}}core.stopHero();core.stopAutomaticRoute();if(!core.enemys.canBattle(c)&&!b){core.drawTip("你打不过此怪物!");core.clearContinueAutomaticRoute();return}if(!core.isset(core.status.event.id)){core.autosave(true)}if(core.flags.battleAnimate&&!core.status.replay.replaying){core.waitHeroToStop(function(){core.ui.drawBattleAnimate(c,function(){core.events.afterBattle(c,d,e,a)})})}else{if(core.flags.equipment&&core.getFlag("sword","sword0")!="sword0"){core.playSound("zone.mp3");core.drawAnimate("sword",d,e)}else{core.playSound("attack.mp3");core.drawAnimate("hand",d,e)}core.events.afterBattle(c,d,e,a)}};events.prototype.trigger=function(g,h){var d=core.status.thisMap.blocks;var e;for(var a=0;a=1||e<=0){clearInterval(a);core.clearMap("data",0,0,416,416);core.setOpacity("data",1);core.status.replay.animate=false;if(core.isset(b)){b()}}},f/10)};events.prototype.moveImage=function(g,d,j,i,b){i=i||1000;clearInterval(core.interval.tipAnimate);core.setAlpha("data",1);core.setOpacity("data",1);core.status.replay.animate=true;var e=core.calValue(d[0]),f=core.calValue(d[1]),k=core.calValue(j[0]),l=core.calValue(j[1]);var h=0;var c=function(){core.clearMap("data",0,0,416,416);var m=parseInt(e+(k-e)*h/64);var n=parseInt(f+(l-f)*h/64);core.canvas.data.drawImage(g,m,n)};c();var a=setInterval(function(){h++;c();if(h>=64){clearInterval(a);core.clearMap("data",0,0,416,416);core.status.replay.animate=false;if(core.isset(b)){b()}}},i/64)};events.prototype.openShop=function(shopId,needVisited){var shop=core.status.shops[shopId];shop.times=shop.times||0;shop.visited=shop.visited||false;if(needVisited&&!shop.visited){if(shop.times==0){core.drawTip("该商店尚未开启")}else{core.drawTip("该商店已失效")}return}shop.visited=true;var selection=core.status.event.selection;var actions=[];if(core.isset(core.status.event.data)&&core.isset(core.status.event.data.actions)){actions=core.status.event.data.actions}var fromList;if(core.isset(core.status.event.data)&&core.isset(core.status.event.data.fromList)){fromList=core.status.event.data.fromList}core.ui.closePanel();core.lockControl();core.status.event.id="shop";core.status.event.data={id:shopId,shop:shop,actions:actions,fromList:fromList};core.status.event.selection=selection;var content="\t["+shop.name+","+shop.icon+"]";var times=shop.times,need=eval(shop.need);content=content+shop.text.replace(/\${([^}]+)}/g,function(word,value){return eval(value)});var use=shop.use=="experience"?"经验":"金币";var choices=[];for(var i=0;i=core.firstData.levelUp.length){return}var need=core.firstData.levelUp[core.status.hero.lv].need;if(!core.isset(need)){return}if(core.status.hero.experience>=need){core.status.hero.lv++;var effect=core.firstData.levelUp[core.status.hero.lv-1].effect;if(typeof effect=="string"){if(effect.indexOf("function")==0){eval("("+effect+")()")}else{effect.split(";").forEach(function(t){core.doEffect(t)})}}else{if(effect instanceof Function){effect()}}this.checkLvUp()}};events.prototype.useItem=function(b){core.ui.closePanel();if(b=="book"){core.openBook(false);return}if(b=="fly"){core.useFly(false);return}if(b=="centerFly"){core.status.usingCenterFly=true;var a="rgba(255,0,0,0.5)";if(core.canUseItem("centerFly")){a="rgba(0,255,0,0.5)"}core.fillRect("ui",(12-core.getHeroLoc("x"))*32,(12-core.getHeroLoc("y"))*32,32,32,a);core.drawTip("请确认当前中心对称飞行器的位置");return}if(core.canUseItem(b)){core.useItem(b)}else{core.drawTip("当前无法使用"+core.material.items[b].name)}};events.prototype.addPoint=function(a){return this.eventdata.addPoint(a)};events.prototype.afterBattle=function(b,c,d,a){return this.eventdata.afterBattle(b,c,d,a)};events.prototype.afterOpenDoor=function(b,c,d,a){return this.eventdata.afterOpenDoor(b,c,d,a)};events.prototype.passNet=function(a){if(core.hasItem("shoes")){return}if(a.event.id=="lavaNet"){}if(a.event.id=="poisonNet"){if(core.hasFlag("poison")){return}core.setFlag("poison",true)}if(a.event.id=="weakNet"){if(core.hasFlag("weak")){return}core.setFlag("weak",true);var d=core.values.weakValue;var b=d>=1?d:Math.floor(d*core.status.hero.atk);var c=d>=1?d:Math.floor(d*core.status.hero.def);core.setFlag("weakAtk",b);core.setFlag("weakDef",c);core.status.hero.atk-=b;core.status.hero.def-=c}if(a.event.id=="curseNet"){if(core.hasFlag("curse")){return}core.setFlag("curse",true)}core.updateStatusBar()};events.prototype.changeLight=function(c,d){var a=core.getBlock(c,d);if(a==null){return}var b=a.index;a=a.block;if(a.event.id!="light"){return}a.id=166;a.event={cls:"terrains",id:"darkLight",noPass:true};core.drawBlock(a);this.afterChangeLight(c,d)};events.prototype.afterChangeLight=function(a,b){return this.eventdata.afterChangeLight(a,b)};events.prototype.ski=function(a){if(!core.isset(a)){a=core.status.automaticRoute.lastDirection||core.getHeroLoc("direction")}if(core.status.event.id!="ski"){core.waitHeroToStop(function(){core.status.event.id="ski";core.events.ski(a)})}else{core.moveHero(a,function(){if(core.status.event.id=="ski"){core.status.event.id=null;core.unLockControl();core.replay()}})}};events.prototype.pushBox=function(b){if(b.event.id!="box"&&b.event.id!="boxed"){return}var f={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};var c=core.getHeroLoc("direction"),d=b.x+f[c].x,e=b.y+f[c].y;if(d<0||d>12||e<0||e>12){return}var a=core.getBlock(d,e,null,false);if(a!=null&&!(core.isset(a.block.event)&&a.block.event.id=="flower")){return}if(a==null){core.status.thisMap.blocks.push(core.maps.initBlock(d,e,169));a=core.getBlock(d,e)}else{a.block.id=170;a.block.event=core.maps.initBlock(null,null,170).event}core.drawBlock(a.block);if(b.event.id=="box"){core.removeBlock(b.x,b.y)}else{b.id=168;b.event=core.maps.initBlock(null,null,168).event;core.drawBlock(b)}core.updateStatusBar();core.status.replay.animate=true;core.moveHero(c,function(){core.status.replay.animate=false;core.status.route.pop();core.events.afterPushBox();core.replay()})};events.prototype.afterPushBox=function(){return this.eventdata.afterPushBox()};events.prototype.afterUseBomb=function(){return this.eventdata.afterUseBomb()};events.prototype.beforeSaveData=function(a){return this.eventdata.beforeSaveData(a)};events.prototype.afterLoadData=function(a){return this.eventdata.afterLoadData(a)}; \ No newline at end of file diff --git a/libs/icons.min.js b/libs/icons.min.js new file mode 100644 index 00000000..26e6b975 --- /dev/null +++ b/libs/icons.min.js @@ -0,0 +1 @@ +function icons(){this.init()}icons.prototype.init=function(){this.icons=icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1};icons.prototype.getIcons=function(){return this.icons}; \ No newline at end of file diff --git a/libs/items.min.js b/libs/items.min.js new file mode 100644 index 00000000..807d8f3d --- /dev/null +++ b/libs/items.min.js @@ -0,0 +1 @@ +function items(){this.init()}items.prototype.init=function(){this.items=items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.items;this.itemEffect=items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffect;this.itemEffectTip=items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.itemEffectTip;this.useItemEffect=items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.useItemEffect;this.canUseItemEffect=items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a.canUseItemEffect};items.prototype.getItems=function(){return this.items};items.prototype.getItemEffect=function(itemId,itemNum){var itemCls=core.material.items[itemId].cls;if(itemCls==="items"){var ratio=parseInt(core.floors[core.status.floorId].item_ratio)||1;var curr_hp=core.status.hero.hp;if(itemId in this.itemEffect){eval(this.itemEffect[itemId])}core.status.hero.statistics.hp+=core.status.hero.hp-curr_hp}else{core.addItem(itemId,itemNum)}};items.prototype.getItemEffectTip=function(itemId){var itemCls=core.material.items[itemId].cls;if(itemCls==="items"){var ratio=parseInt(core.floors[core.status.floorId].item_ratio)||1;if(itemId in this.itemEffectTip){return eval(this.itemEffectTip[itemId])||""}}return""};items.prototype.useItem=function(itemId,callback){if(!this.canUseItem(itemId)){if(core.isset(callback)){callback()}return}var itemCls=core.material.items[itemId].cls;if(itemId in this.useItemEffect){eval(this.useItemEffect[itemId])}core.updateStatusBar();if(itemId!="book"&&itemId!="fly"){core.status.route.push("item:"+itemId)}if(itemCls=="tools"){core.status.hero.items[itemCls][itemId]--}if(core.status.hero.items[itemCls][itemId]==0){delete core.status.hero.items[itemCls][itemId]}if(core.isset(callback)){callback()}};items.prototype.canUseItem=function(itemId){if(!core.hasItem(itemId)){return false}if(itemId in this.canUseItemEffect){return eval(this.canUseItemEffect[itemId])}return false};items.prototype.itemCount=function(b){if(!core.isset(b)||!core.isset(core.material.items[b])){return 0}var a=core.material.items[b].cls;if(a=="items"){return 0}return core.isset(core.status.hero.items[a][b])?core.status.hero.items[a][b]:0};items.prototype.hasItem=function(a){return core.itemCount(a)>0};items.prototype.setItem=function(b,c){var a=core.material.items[b].cls;if(a=="items"){return}if(!core.isset(core.status.hero.items[a])){core.status.hero.items[a]={}}core.status.hero.items[a][b]=c;if(a!="keys"&&c==0){delete core.status.hero.items[a][b]}};items.prototype.removeItem=function(b){if(!core.hasItem(b)){return false}var a=core.material.items[b].cls;core.status.hero.items[a][b]--;if(a!="keys"&&core.status.hero.items[a][b]==0){delete core.status.hero.items[a][b]}core.updateStatusBar();return true};items.prototype.addItem=function(c,d){var b=core.material.items[c];var a=b.cls;if(a=="items"){return}if(!core.isset(core.status.hero.items[a])){core.status.hero.items[a]={};core.status.hero.items[a][c]=0}else{if(!core.isset(core.status.hero.items[a][c])){core.status.hero.items[a][c]=0}}core.status.hero.items[a][c]+=d}; \ No newline at end of file diff --git a/libs/loader.min.js b/libs/loader.min.js new file mode 100644 index 00000000..0d0576e9 --- /dev/null +++ b/libs/loader.min.js @@ -0,0 +1 @@ +function loader(){this.init()}loader.prototype.init=function(){};loader.prototype.setStartProgressVal=function(a){core.dom.startTopProgress.style.width=a+"%"};loader.prototype.setStartLoadTipText=function(a){core.dom.startTopLoadTips.innerHTML=a};loader.prototype.load=function(a){core.loader.loadIcons();core.loader.loadImages(core.materials,core.material.images,function(){core.material.images.images={};var b=core.clone(core.images);if(b.indexOf("hero.png")<0){b.push("hero.png")}core.loader.loadImages(b,core.material.images.images,function(){core.material.images.autotile={};core.loader.loadImages(Object.keys(core.material.icons.autotile),core.material.images.autotile,function(){core.loader.loadAnimates();core.loader.loadMusic();if(core.isset(a)){a()}})})})};loader.prototype.loadIcons=function(){this.loadImage("icons.png",function(a,b){var c=core.cropImage(b);for(var d in core.statusBar.icons){if(typeof core.statusBar.icons[d]=="number"){core.statusBar.icons[d]=c[core.statusBar.icons[d]];if(core.isset(core.statusBar.image[d])){core.statusBar.image[d].src=core.statusBar.icons[d].src}}}})};loader.prototype.loadImages=function(d,f,a){if(d.length==0){if(core.isset(a)){a()}return}var c=0;for(var b=0;b0){core.playBgm(core.bgms[0])}}; \ No newline at end of file diff --git a/libs/maps.min.js b/libs/maps.min.js new file mode 100644 index 00000000..44ad9e26 --- /dev/null +++ b/libs/maps.min.js @@ -0,0 +1 @@ +function maps(){this.init()}maps.prototype.init=function(){this.blocksInfo=maps_90f36752_8815_4be8_b32b_d7fad1d0542e};maps.prototype.loadFloor=function(c,d){var b=core.floors[c];var a={};a.floorId=b.floorId;a.name=b.name;a.title=b.title;a.canFlyTo=b.canFlyTo;if(!core.isset(d)){d=b.map}var e=function(m,n,h){var g=[];for(var k=0;k<13;k++){for(var l=0;l<13;l++){var f=n.initBlock(l,k,m[k][l]);n.addInfo(f);n.addEvent(f,l,k,h.events[l+","+k]);n.addChangeFloor(f,l,k,h.changeFloor[l+","+k]);if(core.isset(f.event)){g.push(f)}}}return g};if(main.mode=="editor"){main.editor.mapIntoBlocks=function(g,f){return e(g,core.maps,f)}}a.blocks=e(d,this,b);return a};maps.prototype.initBlock=function(d,e,b){var a=null;b=""+b;if(b.length>2){if(b.indexOf(":f")==b.length-2){b=b.substring(0,b.length-2);a=false}else{if(b.indexOf(":t")==b.length-2){b=b.substring(0,b.length-2);a=true}}}b=parseInt(b);var c={x:d,y:e,id:b};if(a!=null){c.enable=a}if(b in this.blocksInfo){c.event=JSON.parse(JSON.stringify(this.blocksInfo[b]))}return c};maps.prototype.addInfo=function(a){if(core.isset(a.event)){if(a.event.cls.indexOf("enemy")==0&&!core.isset(a.event.trigger)){a.event.trigger="battle"}if(a.event.cls=="items"&&!core.isset(a.event.trigger)){a.event.trigger="getItem"}if(!core.isset(a.event.noPass)){if(a.event.cls.indexOf("enemy")==0||a.event.cls.indexOf("npc")==0||a.event.cls=="terrains"){a.event.noPass=true}}if(!core.isset(a.event.animate)){if(a.event.cls=="enemys"||a.event.cls=="npcs"){a.event.animate=2}if(a.event.cls=="animates"||a.event.cls=="enemy48"||a.event.cls=="npc48"){a.event.animate=4}}a.event.height=32;if(a.event.cls=="enemy48"||a.event.cls=="npc48"){a.event.height=48}}};maps.prototype.addEvent=function(a,d,e,b){if(!core.isset(b)){return}if(!core.isset(a.event)){a.event={cls:"terrains",id:"none",noPass:false}}if(typeof b=="string"){b={data:[b]}}else{if(b instanceof Array){b={data:b}}}if(!core.isset(b.data)){b.data=[]}if(core.isset(b.noPass)){a.event.noPass=b.noPass}if(!core.isset(a.enable)&&core.isset(b.enable)){a.enable=b.enable}if(!core.isset(a.event.trigger)){if(core.isset(b.trigger)){a.event.trigger=b.trigger}else{a.event.trigger="action"}}else{if(core.isset(b.trigger)&&b.trigger!="checkBlock"){a.event.trigger=b.trigger}}for(var c in b){if(c!="enable"&&c!="trigger"&&c!="noPass"&&core.isset(b[c])){a.event[c]=core.clone(b[c])}}};maps.prototype.addChangeFloor=function(a,d,e,b,c){if(!core.isset(b)){return}this.addEvent(a,d,e,{trigger:"changeFloor",data:b},c)};maps.prototype.initMaps=function(b){var d={};for(var c=0;c=0){return false}}var h=core.getBlock(k,l,c);if(h!=null){nowId=h.block.event.id;var i=nowId.slice(0,5).toLowerCase()=="arrow";if(i){var g=nowId.slice(5).toLowerCase();if(b!=g){return false}}}var j={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};var f=core.getBlock(k+j[b].x,l+j[b].y,c);if(f!=null){nextId=f.block.event.id;var d=nextId.slice(0,5).toLowerCase()=="arrow";if(d){var e=nextId.slice(5).toLowerCase();if((j[b].x+j[e].x)==0&&(j[b].y+j[e].y)==0){return false}}}return true};maps.prototype.canMoveDirectly=function(a,b){if(!core.flags.enableMoveDirectly){return 0}if(core.hasFlag("poison")){return 0}var e=core.getHeroLoc("x"),f=core.getHeroLoc("y");if(e==a&&f==b){return 0}if(core.getBlock(e,f)!=null||core.status.checkBlock.damage[13*e+f]>0){return 0}var m=[],l=[];m[13*e+f]=0;l.push(13*e+f);var d=[[-1,0],[1,0],[0,1],[0,-1]];while(l.length>0){var g=l.shift(),h=parseInt(g/13),i=g%13;for(var c in d){var j=h+d[c][0],k=i+d[c][1];if(j<0||j>=13||k<0||k>=13||m[13*j+k]||core.getBlock(j,k)!=null||core.status.checkBlock.damage[13*j+k]>0){continue}m[13*j+k]=m[13*h+i]+1;if(j==a&&k==b){return m[13*j+k]}l.push(13*j+k)}}return 0};maps.prototype.drawBlock=function(b,a,f,g){var e=b.event.cls,h=b.event.height||32;var c=core.material.icons[e][b.event.id];var d=core.material.images[e];a=(a||0)%(b.event.animate||1);f=f||0;g=g||0;core.canvas.event.clearRect(b.x*32+f,b.y*32+g,32,32);core.canvas.event.drawImage(d,a*32,c*h+h-32,32,32,b.x*32+f,b.y*32+g,32,32);if(h>32){core.canvas.event2.clearRect(b.x*32+f,b.y*32+32-h+g,32,h-32);core.canvas.event2.drawImage(d,a*32,c*h,32,h-32,b.x*32+f,b.y*32+32-h+g,32,h-32)}};maps.prototype.drawMap=function(d,a){core.clearMap("all");core.removeGlobalAnimate(null,null,true);var b=function(){var g=core.floors[d].defaultGround||"ground";var e=core.material.icons.terrains[g];var f=core.material.images.terrains;for(var i=0;i<13;i++){for(var j=0;j<13;j++){core.canvas.bg.drawImage(f,0,e*32,32,32,i*32,j*32,32,32)}}var h=[];if(core.isset(core.floors[d].images)){h=core.floors[d].images;if(typeof h=="string"){h=[[0,0,h]]}}h.forEach(function(s){var r=416,q=1;var k=parseInt(s[0]),l=parseInt(s[1]),o=s[2];if(core.isset(k)&&core.isset(l)&&core.isset(core.material.images.images[o])){k*=32;l*=32;var n=core.material.images.images[o];if(!s[3]){core.canvas.bg.drawImage(n,k*q,l*q,Math.min(r-k*q,q*n.width),Math.min(r-l*q,q*n.height));if(/.*\.gif/i.test(o)){core.dom.gif.innerHTML="";var m=new Image();m.src=core.material.images.images[o].src;m.style.position="absolute";m.style.left=(k*core.domStyle.scale)+"px";m.style.top=(l*core.domStyle.scale)+"px";core.dom.gif.appendChild(m)}}else{core.canvas.event2.drawImage(n,k*q,l*q,Math.min(r-k*q,q*n.width),Math.min(r-l*q,q*n.height))}}})};if(main.mode=="editor"){main.editor.drawMapBg=function(){core.clearMap("bg",0,0,416,416);b()}}else{b()}core.status.floorId=d;core.status.thisMap=core.status.maps[d];var c=function(){var i=core.status.maps[core.status.floorId];var h=i.blocks;var g=core.maps.getMapArray(h);for(var e=0;e12||u>12){return 1}else{return n[u][t]==i?1:0}};var b=function(F,G){var v=n[G][F];var E=[];for(var w=0;w<4;w++){var u=0;var C=w%2,D=~~(w/2);for(var z=0;z<4;z++){var A=z%2,B=~~(z/2);var t=g(v,F+C+A-1,G+D+B-1);u+=t*(Math.pow(2,3-z))}E.push(u)}return E};var h=function(z,A){var v=[];var w=b(z,A);for(var u=0;u<4;u++){var t=l[w[u]];v.push(t[3-u])}return v};var r=a.x,s=a.y;var o=h(r,s);if(o[0]==13){if(o[1]==16){o[1]=14}if(o[2]==31){o[2]=19}}if(o[1]==18){if(o[0]==15){o[0]=17}if(o[3]==36){o[3]=24}}if(o[2]==43){if(o[0]==25){o[0]=37}if(o[3]==46){o[3]=44}}if(o[3]==48){if(o[1]==30){o[1]=42}if(o[2]==45){o[2]=47}}for(var j=0;j<4;j++){var k=o[j];var e=r*p+p/2*(j%2),f=s*p+p/2*(~~(j/2));d(c,e+m,f+q,core.material.images.autotile[a.event.id],k,p)}};maps.prototype.noPassExists=function(c,d,b){var a=core.getBlock(c,d,b);if(a==null){return false}return core.isset(a.block.event.noPass)&&a.block.event.noPass};maps.prototype.noPass=function(a,b){return a<0||a>12||b<0||b>12||this.noPassExists(a,b)};maps.prototype.npcExists=function(c,d,b){var a=this.getBlock(c,d,b);if(a==null){return false}return a.block.event.cls.indexOf("npc")==0};maps.prototype.terrainExists=function(d,e,c,b){var a=this.getBlock(d,e,b);if(a==null){return false}return a.block.event.cls=="terrains"&&(core.isset(c)?a.block.event.id==c:true)};maps.prototype.stairExists=function(c,d,b){var a=this.getBlock(c,d,b);if(a==null){return false}return a.block.event.cls=="terrains"&&(a.block.event.id=="upFloor"||a.block.event.id=="downFloor")};maps.prototype.nearStair=function(){var a=core.getHeroLoc("x"),b=core.getHeroLoc("y");return this.stairExists(a,b)||this.stairExists(a-1,b)||this.stairExists(a,b-1)||this.stairExists(a+1,b)||this.stairExists(a,b+1)};maps.prototype.enemyExists=function(d,e,c,b){var a=this.getBlock(d,e,b);if(a==null){return false}return a.block.event.cls.indexOf("enemy")==0&&(core.isset(c)?a.block.event.id==c:true)};maps.prototype.getBlock=function(e,f,b,d){if(!core.isset(b)){b=core.status.floorId}if(!core.isset(d)){d=true}var a=core.status.maps[b].blocks;for(var c=0;c=core.values.animateSpeed){b++;c=0;if(b>=d){b=0}}if(k.length==0){if(j){n=0}else{n-=0.06}core.setOpacity("animate",n);core.clearMap("animate",l,m-i+32,32,i);core.canvas.animate.drawImage(g,b*32,f*i,32,i,l,m-i+32,32,i);if(n<=0){clearInterval(a);core.clearMap("animate",0,0,416,416);core.setOpacity("animate",1);core.status.replay.animate=false;if(core.isset(h)){h()}}}else{p++;l+=o[k[0]].x*2;m+=o[k[0]].y*2;core.clearMap("animate",l-32,m-32,96,96);core.canvas.animate.drawImage(g,b*32,f*i,32,i,l,m-i+32,32,i);if(p==16){p=0;k.shift()}}},r/16/core.status.replay.speed)};maps.prototype.animateBlock=function(e,h,g,b){if(h!="hide"){h="show"}core.clearMap("animate",0,0,416,416);if(typeof e[0]=="number"&&typeof e[1]=="number"){e=[e]}var d=[];e.forEach(function(j){var i=core.getBlock(j[0],j[1],core.status.floorId,false);if(i==null){return}i=i.block;d.push({x:j[0],y:j[1],height:i.event.height||32,blockIcon:core.material.icons[i.event.cls][i.event.id],blockImage:core.material.images[i.event.cls]})});if(d.length==0){if(core.isset(b)){b()}return}core.status.replay.animate=true;var c=function(){d.forEach(function(i){core.canvas.animate.drawImage(i.blockImage,0,i.blockIcon*i.height,32,i.height,i.x*32,i.y*32+32-i.height,32,i.height)})};var f=0;if(h=="hide"){f=1}core.setOpacity("animate",f);c();var a=window.setInterval(function(){if(h=="show"){f+=0.1}else{f-=0.1}core.setOpacity("animate",f);if(f>=1||f<=0){clearInterval(a);core.clearMap("animate",0,0,416,416);core.setOpacity("animate",1);core.status.replay.animate=false;if(core.isset(b)){b()}}},g/10/core.status.replay.speed)};maps.prototype.showBlock=function(c,d,b){b=b||core.status.floorId;var a=core.getBlock(c,d,b,false);if(a==null){return}a=a.block;if(core.isset(a.enable)&&!a.enable){a.enable=true;if(b==core.status.floorId&&core.isset(a.event)){core.drawBlock(a);core.addGlobalAnimate(a);core.syncGlobalAnimate()}core.updateStatusBar()}};maps.prototype.removeBlock=function(e,f,b){b=b||core.status.floorId;var a=core.getBlock(e,f,b,false);if(a==null){return}var d=a.index;if(b==core.status.floorId){core.removeGlobalAnimate(e,f);core.canvas.event.clearRect(e*32,f*32,32,32);var c=32;if(core.isset(a.block.event)){c=a.block.event.height||32}if(c>32){core.canvas.event2.clearRect(e*32,f*32+32-c,32,c-32)}}core.removeBlockById(d,b);core.updateStatusBar()};maps.prototype.removeBlockById=function(e,d){var b=core.status.maps[d].blocks,a=b[e];var g=a.x,h=a.y;var c=core.floors[d].events[g+","+h];if(!core.isset(c)){c=core.floors[d].changeFloor[g+","+h]}var f=false;if(core.isset(a.event)&&a.event.cls.indexOf("enemy")==0&&core.enemys.hasSpecial(core.material.enemys[a.event.id].special,23)){f=true}if(!f&&!core.isset(c)){b.splice(e,1);return}a.enable=false};maps.prototype.removeBlockByIds=function(a,b){b.sort(function(c,d){return d-c}).forEach(function(c){core.removeBlockById(c,a)})};maps.prototype.setBlock=function(c,e,f,b){b=b||core.status.floorId;if(!core.isset(c)||!core.isset(e)||!core.isset(f)){return}var d=core.getBlock(e,f,b,false);var a=core.maps.initBlock(e,f,c);core.maps.addInfo(a);core.maps.addEvent(a,e,f,core.floors[b].events[e+","+f]);core.maps.addChangeFloor(a,e,f,core.floors[b].changeFloor[e+","+f]);if(core.isset(a.event)){if(d==null){core.status.maps[b].blocks.push(a)}else{d.block.id=data.number;d.block.event=a.event}if(b==core.status.floorId){core.drawMap(b)}}};maps.prototype.addGlobalAnimate=function(a){if(main.mode=="editor"&&main.editor.disableGlobalAnimate){return}if(!core.isset(a.event)||!core.isset(a.event.animate)||a.event.animate==1){return}var c=core.clone(a);c.status=0;core.status.globalAnimateObjs.push(c)};maps.prototype.removeGlobalAnimate=function(c,d,a){if(main.mode=="editor"&&main.editor.disableGlobalAnimate){return}if(a){core.status.globalAnimateObjs=[];return}for(var b=0;b0.6||d<0){if(b){core.clearMap("data",5,5,400,a);core.setOpacity("data",1);clearInterval(core.interval.tipAnimate);return}else{if(!core.isset(core.timeout.getItemTipTimeout)){core.timeout.getItemTipTimeout=window.setTimeout(function(){b=true;core.timeout.getItemTipTimeout=null},750)}d=0.6;core.setOpacity("data",d)}}},30)};ui.prototype.drawText=function(b,a){if(core.isset(b)){if((core.isset(core.status.event)&&core.status.event.id=="action")||(core.isset(core.status.replay)&&core.status.replay.replaying)){core.insertAction(b,null,null,a);return}if(typeof b=="string"){b=[{content:b}]}else{if(b instanceof Object&&core.isset(b.content)){b=[b]}else{if(!(b instanceof Array)){core.drawTip("出错了");console.log(b);return}}}core.status.event={id:"text",data:{list:b,callback:a}};core.lockControl();core.stopAutomaticRoute();setTimeout(function(){core.drawText()},30);return}if(core.status.event.data.list.length==0){var a=core.status.event.data.callback;core.ui.closePanel(false);if(core.isset(a)){a()}return}var c=core.status.event.data.list.shift();if(typeof c=="string"){core.ui.drawTextBox(c)}else{core.ui.drawTextBox(c.content,c.id)}};ui.prototype.drawTextBox=function(c){clearInterval(core.status.event.interval);var n=null,r=null,o=null,l=null,m=32,a=null;if(c.indexOf("\t[")==0||c.indexOf("\\t[")==0){var p=c.indexOf("]");if(p>=0){var x=c.substring(2,p);if(c.indexOf("\\t[")==0){x=c.substring(3,p)}c=c.substring(p+1);var w=x.split(",");if(w.length==1){n=w[0];if(n!="hero"){if(core.isset(core.material.enemys[n])){r=core.material.enemys[n].name;if(core.isset(core.material.icons.enemy48[n])){o=core.material.images.enemy48;l=core.material.icons.enemy48[n];m=48;a=4}else{o=core.material.images.enemys;l=core.material.icons.enemys[n];m=32;a=2}}else{r=n;n="npc";o=null;l=null}}}else{n="npc";r=w[0];if(core.isset(core.material.icons.npc48[w[1]])){o=core.material.images.npc48;l=core.material.icons.npc48[w[1]];m=48;a=4}else{o=core.material.images.npcs;l=core.material.icons.npcs[w[1]];m=32;a=2}}}}var y=core.status.textAttribute||core.initStatus.textAttribute;var s=y.position,t=null,u=null,C=m-32;if(c.indexOf("\b[")==0||c.indexOf("\\b[")==0){var p=c.indexOf("]");if(p>=0){var x=c.substring(2,p);if(c.indexOf("\\b[")==0){x=c.substring(3,p)}c=c.substring(p+1);var w=x.split(",");if(w[0]=="up"||w[0]=="center"||w[0]=="down"){s=w[0];if(core.status.event.id=="action"){t=core.status.event.data.x;u=core.status.event.data.y}if(w.length>=2){if(w[1]=="hero"){t=core.getHeroLoc("x");u=core.getHeroLoc("y");C=core.material.icons.hero.height-32}else{if(w.length>=3){t=parseInt(w[1]);u=parseInt(w[2])}}}}}}c=core.replaceText(c);var b=core.canvas.ui.createPattern(core.material.ground,"repeat");core.status.boxAnimateObjs=[];core.clearMap("ui",0,0,416,416);var q=10,v=416-2*q;var d=q+25;if(n=="hero"||core.isset(l)){d=q+63}var A=v-(d-q)-13;var h="16px Verdana";if(y.bold){h="bold "+h}var f=core.splitLines("ui",c,A,h);var i=20+21*(f.length+1)+(n=="hero"?core.material.icons.hero.height-10:core.isset(r)?m-10:0);var B=6,D=22;var z;if(s=="center"){z=parseInt((416-i)/2)}else{if(s=="up"){if(t==null||u==null){z=5}else{z=32*u-i-C-D}}else{if(s=="down"){if(t==null||u==null){z=416-i-5}else{z=32*u+32+D}}}}core.setAlpha("ui",y.background[3]);core.setFillStyle("ui",core.arrayToRGB(y.background));core.setStrokeStyle("ui","#FFFFFF");core.fillRect("ui",q,z,v,i);core.strokeRect("ui",q-1,z-1,v+1,i+1,"#FFFFFF",2);var B=9;if(s=="up"&&core.isset(t)&&core.isset(u)){core.canvas.ui.clearRect(32*t+B,z+i-1,32-2*B,2);core.canvas.ui.beginPath();core.canvas.ui.moveTo(32*t+B-1,z+i-1);core.canvas.ui.lineTo(32*t+16,z+i+D-2);core.canvas.ui.lineTo(32*t+32-B+1,z+i-1);core.canvas.ui.moveTo(32*t+B-1,z+i-1);core.canvas.ui.closePath();core.canvas.ui.fill();core.drawLine("ui",32*t+B,z+i,32*t+16,z+i+D-2);core.drawLine("ui",32*t+32-B,z+i,32*t+16,z+i+D-2)}if(s=="down"&&core.isset(t)&&core.isset(u)){core.canvas.ui.clearRect(32*t+B,z-2,32-2*B,3);core.canvas.ui.beginPath();core.canvas.ui.moveTo(32*t+B-1,z+1);core.canvas.ui.lineTo(32*t+16-1,z-D+2);core.canvas.ui.lineTo(32*t+32-B-1,z+1);core.canvas.ui.moveTo(32*t+B-1,z+1);core.canvas.ui.closePath();core.canvas.ui.fill();core.drawLine("ui",32*t+B,z,32*t+16,z-D+2);core.drawLine("ui",32*t+32-B,z,32*t+16,z-D+2)}core.canvas.ui.textAlign="left";var e=z+35;if(core.isset(n)){e=z+57;core.setAlpha("ui",y.title[3]);core.setFillStyle("ui",core.arrayToRGB(y.title));core.setStrokeStyle("ui",core.arrayToRGB(y.title));if(n=="hero"){var j=core.material.icons.hero.height;core.strokeRect("ui",q+15-1,z+40-1,34,j+2,null,2);core.fillText("ui",core.status.hero.name,d,z+30,null,"bold 22px Verdana");core.clearMap("ui",q+15,z+40,32,j);core.fillRect("ui",q+15,z+40,32,j,b);var k=core.material.icons.hero.down;core.canvas.ui.drawImage(core.material.images.hero,k.stop*32,k.loc*j,32,j,q+15,z+40,32,j)}else{core.fillText("ui",r,d,z+30,null,"bold 22px Verdana");if(core.isset(l)){core.strokeRect("ui",q+15-1,z+40-1,34,m+2,null,2);core.status.boxAnimateObjs=[];core.status.boxAnimateObjs.push({bgx:q+15,bgy:z+40,bgWidth:32,bgHeight:m,x:q+15,y:z+40,height:m,animate:a,image:o,pos:l*m});core.drawBoxAnimate()}}}var g=function(E){core.clearMap("ui",d,e-18,A,z+i-e+10);core.setAlpha("ui",y.background[3]);core.setFillStyle("ui",core.arrayToRGB(y.background));core.fillRect("ui",d,e-18,A,z+i-e+10);core.setAlpha("ui",y.text[3]);core.setFillStyle("ui",core.arrayToRGB(y.text));var F=core.splitLines("ui",E,A,h);for(var G=0;G=0){var z=g.substring(2,t);g=g.substring(t+1);var y=z.split(",");if(y.length==1){r=y[0];if(r!="hero"){if(core.isset(core.material.enemys[r])){x=core.material.enemys[r].name;if(core.isset(core.material.icons.enemy48[r])){s=core.material.images.enemy48;p=core.material.icons.enemy48[r];q=48;a=4}else{s=core.material.images.enemys;p=core.material.icons.enemys[r];q=32;a=2}}else{x=r;r="npc";s=null;p=null}}}else{r="npc";x=y[0];if(core.isset(core.material.icons.npc48[y[1]])){s=core.material.images.npc48;p=core.material.icons.npc48[y[1]];q=48;a=4}else{s=core.material.images.npcs;p=core.material.icons.npcs[y[1]];q=32;a=2}}}}g=core.replaceText(g);if(r=="hero"||core.isset(p)){h=u+60}k=core.splitLines("ui",g,C-(h-u)-10,"bold 15px Verdana");var d=0;if(x!=null){d+=25}d+=k.length*20;l+=d}var B=c-l;core.fillRect("ui",u,B,C,l,b);core.strokeRect("ui",u-1,B-1,C+1,l+1,"#FFFFFF",2);if(core.isset(k)){var j=B+35;if(core.isset(r)){core.canvas.ui.textAlign="center";j=B+55;var A=u+C/2;if(r=="hero"||core.isset(p)){A+=22}if(r=="hero"){var m=core.material.icons.hero.height;core.strokeRect("ui",u+15-1,B+30-1,34,m+2,"#DDDDDD",2);core.fillText("ui",core.status.hero.name,A,B+27,"#FFD700","bold 19px Verdana");core.clearMap("ui",u+15,B+30,32,m);core.fillRect("ui",u+15,B+30,32,m,b);var n=core.material.icons.hero.down;core.canvas.ui.drawImage(core.material.images.hero,n.stop*32,n.loc*m,32,m,u+15,B+30,32,m)}else{core.fillText("ui",x,A,B+27,"#FFD700","bold 19px Verdana");if(core.isset(p)){core.strokeRect("ui",u+15-1,B+30-1,34,q+2,"#DDDDDD",2);core.status.boxAnimateObjs=[];core.status.boxAnimateObjs.push({bgx:u+15,bgy:B+30,bgWidth:32,bgHeight:q,x:u+15,y:B+30,height:q,animate:a,image:s,pos:p*q});core.drawBoxAnimate()}}}core.canvas.ui.textAlign="left";for(var o=0;o0){if(!core.isset(core.status.event.selection)){core.status.event.selection=0}while(core.status.event.selection<0){core.status.event.selection+=f.length}while(core.status.event.selection>=f.length){core.status.event.selection-=f.length}var v=core.canvas.ui.measureText(core.replaceText(f[core.status.event.selection].text||f[core.status.event.selection])).width;core.strokeRect("ui",208-v/2-5,e+32*core.status.event.selection-20,v+10,28,"#FFD700",2)}return};ui.prototype.drawConfirmBox=function(l,n,j){core.lockControl();core.status.event.id="confirmBox";core.status.event.data={yes:n,no:j};core.status.event.ui=l;if(!core.isset(core.status.event.selection)||core.status.event.selection>1){core.status.event.selection=1}if(core.status.event.selection<0){core.status.event.selection=0}var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",a);core.setFont("ui","bold 19px Verdana");var c=l.split("\n");var g=c.length;var h=0;for(var d in c){h=Math.max(h,core.canvas.ui.measureText(c[d]).width)}var e=Math.min(208-40-parseInt(h/2),100);var m=140-(g-1)*30;var k=416-2*e,b=416-140-m;if(core.isPlaying()){core.fillRect("ui",e,m,k,b,a)}if(core.isPlaying()){core.strokeRect("ui",e-1,m-1,k+1,b+1,"#FFFFFF",2)}core.canvas.ui.textAlign="center";for(var d in c){core.fillText("ui",c[d],208,m+50+d*30,"#FFFFFF")}core.fillText("ui","确定",208-38,m+b-35,"#FFFFFF","bold 17px Verdana");core.fillText("ui","取消",208+38,m+b-35);var f=core.canvas.ui.measureText("确定").width;if(core.status.event.selection==0){core.strokeRect("ui",208-38-parseInt(f/2)-5,m+b-35-20,f+10,28,"#FFD700",2)}if(core.status.event.selection==1){core.strokeRect("ui",208+38-parseInt(f/2)-5,m+b-35-20,f+10,28,"#FFD700",2)}};ui.prototype.drawSwitchs=function(){core.status.event.id="switchs";var a=["背景音乐:"+(core.musicStatus.bgmStatus?"[ON]":"[OFF]"),"背景音效:"+(core.musicStatus.soundStatus?"[ON]":"[OFF]"),"战斗动画: "+(core.flags.battleAnimate?"[ON]":"[OFF]"),"怪物显伤: "+(core.flags.displayEnemyDamage?"[ON]":"[OFF]"),"临界显伤: "+(core.flags.displayCritical?"[ON]":"[OFF]"),"领域显伤: "+(core.flags.displayExtraDamage?"[ON]":"[OFF]"),"下载离线版本","返回主菜单"];this.drawChoices(null,a)};ui.prototype.drawSettings=function(){core.status.event.id="settings";this.drawChoices(null,["系统设置","快捷商店","浏览地图","同步存档","返回标题","数据统计","操作帮助","关于本塔","返回游戏"])};ui.prototype.drawQuickShop=function(){core.status.event.id="selectShop";var d=core.status.shops,c=Object.keys(d);var a=[];for(var b=0;b0){E-=h-C}if(E<0){E=0}core.clearMap("data",M,P+A+10,z,40);core.canvas.data.textAlign="left";core.fillText("data",E,M,P+A+10+26,"#DDDDDD","bold 16px Verdana");if(core.enemys.hasSpecial(G,8)){m-=Math.floor(core.values.counterAttack*h);if(m<0){l+=m;m=0}core.clearMap("data",w,P+A+10,z,40);core.canvas.data.textAlign="right";core.fillText("data",l,v,P+A+10+26,"#DDDDDD","bold 16px Verdana");if(core.flags.enableMDef){core.clearMap("data",w,P+A+10+3*x,z,40);core.fillText("data",m,v,P+A+10+26+3*x)}}}else{core.drawLine("data",u+A+6,P+A+n+(e-32)-6,u+A+e-6,P+A+6,"#FF0000",4);setTimeout(function(){core.clearMap("data",u+A,P+A,e,n+e-32)},250);var i=B-k;if(i<0){i=0}m-=i;if(m<0){l+=m;m=0}core.clearMap("data",w,P+A+10,z,40);core.canvas.data.textAlign="right";core.fillText("data",l,v,P+A+10+26,"#DDDDDD","bold 16px Verdana");if(core.flags.enableMDef){core.clearMap("data",w,P+A+10+3*x,z,40);core.fillText("data",m,v,P+A+10+26+3*x)}}Q++;if(Q>=R){Q=0}if(l<=0||E<=0){clearInterval(c);core.status.boxAnimateObjs=[];core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.clearMap("data",0,0,416,416);if(core.status.event.id=="battle"){core.unLockControl();core.status.event.id=null}if(core.isset(f)){f()}return}},500)};ui.prototype.drawWaiting=function(e){core.lockControl();core.status.event.id="waiting";var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",a);core.setFont("ui","bold 17px Verdana");var f=core.canvas.ui.measureText(e).width;var d=Math.max(f+50,220);var c=208-parseInt(d/2),g=208-32-16,b=416-2*g;core.fillRect("ui",c,g,d,b,a);core.strokeRect("ui",c-1,g-1,d+1,b+1,"#FFFFFF",2);core.canvas.ui.textAlign="center";core.fillText("ui",e,208,g+56,"#FFFFFF")};ui.prototype.drawSyncSave=function(){core.status.event.id="syncSave";this.drawChoices(null,["同步存档到服务器","从服务器加载存档","存档至本地文件","从本地文件读档","下载当前录像","清空本地存档","返回主菜单"])};ui.prototype.drawSyncSelect=function(){core.status.event.id="syncSelect";this.drawChoices(null,["同步本地所有存档","只同步最新单存档","返回上级菜单"])};ui.prototype.drawLocalSaveSelect=function(){core.status.event.id="localSaveSelect";this.drawChoices(null,["下载所有存档","只下载最新单存档","返回上级菜单"])};ui.prototype.drawStorageRemove=function(){core.status.event.id="storageRemove";this.drawChoices(null,["清空全部塔的存档","只清空当前塔的存档","返回上级菜单"])};ui.prototype.drawReplay=function(){core.lockControl();core.status.event.id="replay";this.drawChoices(null,["从头回放录像","从存档开始回放","返回游戏"])};ui.prototype.drawPagination=function(b,c){core.setFont("ui","bold 15px Verdana");core.setFillStyle("ui","#DDDDDD");var a=core.canvas.ui.measureText(b+" / "+b).width;core.canvas.ui.textAlign="left";core.fillText("ui",b+" / "+c,parseInt((416-a)/2),403);core.canvas.ui.textAlign="center";if(b>1){core.fillText("ui","上一页",208-80,403)}if(b12){core.status.automaticRoute.cursorX=12}if(!core.isset(core.status.automaticRoute.cursorY)){core.status.automaticRoute.cursorY=core.getHeroLoc("y")}if(core.status.automaticRoute.cursorY<0){core.status.automaticRoute.cursorY=0}if(core.status.automaticRoute.cursorY>12){core.status.automaticRoute.cursorY=12}core.status.event.id="cursor";core.lockControl();core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);var a=4;core.strokeRect("ui",32*core.status.automaticRoute.cursorX+a/2,32*core.status.automaticRoute.cursorY+a/2,32-a,32-a,"#FFD700",a)};ui.prototype.drawBook=function(n){var j=core.enemys.getCurrentEnemys(core.floorIds[core.status.event.selection]);var b=core.canvas.ui.createPattern(core.material.ground,"repeat");clearInterval(core.interval.tipAnimate);core.clearMap("data",0,0,416,416);core.setOpacity("data",1);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",b);core.fillRect("ui",0,0,416,416);core.setAlpha("ui",0.6);core.setFillStyle("ui","#000000");core.fillRect("ui",0,0,416,416);core.setAlpha("ui",1);core.canvas.ui.textAlign="left";core.setFont("ui","bold 15px Verdana");if(j.length==0){core.fillText("ui","本层无怪物",83,222,"#999999","bold 50px Verdana");core.canvas.ui.textAlign="center";core.fillText("ui","返回游戏",370,403,"#DDDDDD","bold 15px Verdana");return}if(n<0){n=0}if(n>=j.length){n=j.length-1}var q=6;var p=parseInt(n/q)+1;var s=parseInt((j.length-1)/q)+1;core.status.event.data=n;var r=(p-1)*q,g=Math.min(p*q,j.length);j=j.slice(r,g);core.status.boxAnimateObjs=[];for(var m=0;m=core.status.hero.hp){d="#FF0000"}if(e<=0){d="#00FF00"}e=core.formatBigNumber(e)}core.fillText("ui",e,f,62*m+50,d,"bold 13px Verdana");core.canvas.ui.textAlign="left";core.fillText("ui","临界",165,62*m+68,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.critical),195,62*m+68,"#DDDDDD","bold 13px Verdana");core.fillText("ui","减伤",255,62*m+68,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.criticalDamage),285,62*m+68,"#DDDDDD","bold 13px Verdana");core.fillText("ui","1防",335,62*m+68,"#DDDDDD","13px Verdana");core.fillText("ui",core.formatBigNumber(h.defDamage),365,62*m+68,"#DDDDDD","bold 13px Verdana");if(n==r+m){core.strokeRect("ui",10,62*m+13,416-10*2,62,"#FFD700")}}core.drawBoxAnimate();this.drawPagination(p,s)};ui.prototype.drawBookDetail=function(n){var j=core.enemys.getCurrentEnemys(core.floorIds[core.status.event.selection]);if(j.length==0){return}if(n<0){n=0}if(n>=j.length){n=j.length-1}var g=j[n];var h=g.id;var l=core.enemys.getSpecialHint(core.material.enemys[h]);if(l.length==0){l.push("该怪物无特殊属性。")}l.push("");var f=core.enemys.nextCriticals(h,10).map(function(i){return i[0]+":"+i[1]});while(f[0]=="0:0"){f.shift()}l.push("临界表:"+JSON.stringify(f));var b=l.join("\n");core.status.event.id="book-detail";clearInterval(core.interval.tipAnimate);core.clearMap("data",0,0,416,416);core.setOpacity("data",1);var o=10,q=416-2*o;var c=o+25;var t=q-(c-o)-13;var e=core.splitLines("data",b,t,"16px Verdana");var k=416-10-Math.min(416-24*(e.length+1)-65,250);var s=(416-k)/2,a=k;core.setAlpha("data",0.9);core.fillRect("data",o,s,q,a,"#000000");core.setAlpha("data",1);core.strokeRect("data",o-1,s-1,q+1,a+1,"#FFFFFF",2);core.canvas.data.textAlign="left";core.fillText("data",g.name,c,s+30,"#FFD700","bold 22px Verdana");var d=s+57;for(var m=0;m=0){var u=r.substring(0,n+1);core.fillText("data",u,c,d,"#FF6A6A","bold 16px Verdana");var p=core.canvas.data.measureText(u).width;core.fillText("data",r.substring(n+1),c+p,d,"#FFFFFF","16px Verdana")}else{core.fillText("data",e[m],c,d,"#FFFFFF","16px Verdana")}d+=24}core.fillText("data","<点击任意位置继续>",270,s+k-13,"#CCCCCC","13px Verdana")};ui.prototype.drawFly=function(b){if(b<0){b=0}if(b>=core.status.hero.flyRange.length){b=core.status.hero.flyRange.length-1}core.status.event.data=b;var a=core.status.hero.flyRange[b];var c=core.status.maps[a].title;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.canvas.ui.textAlign="center";core.fillText("ui","楼层跳跃",208,60,"#FFFFFF","bold 28px Verdana");core.fillText("ui","返回游戏",208,403,"#FFFFFF","bold 15px Verdana");core.fillText("ui",c,356,247,"#FFFFFF","bold 19px Verdana");if(b0){core.fillText("ui","▼",356,247+64,"#FFFFFF","17px Verdana")}core.strokeRect("ui",20,100,273,273,"#FFFFFF",2);this.drawThumbnail(a,"ui",core.status.maps[a].blocks,20,100,273)};ui.prototype.drawMaps=function(c){if(!core.isset(c)){c=core.floorIds.indexOf(core.status.floorId)}if(c<0){c=0}if(c>=core.floorIds.length){c=core.floorIds.length-1}core.lockControl();core.status.event.id="viewMaps";core.status.event.data=c;var a=core.floorIds[c];clearTimeout(core.interval.tipAnimate);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);this.drawThumbnail(a,"ui",core.status.maps[a].blocks,0,0,416);core.clearMap("data",0,0,416,416);core.setOpacity("data",0.2);core.canvas.data.textAlign="left";core.setFont("data","16px Arial");var d=core.floors[a].title;var e=16,f=18,g=e+core.canvas.data.measureText(d).width+16,b=42;core.fillRect("data",5,5,g,b,"#000");core.setOpacity("data",0.5);core.fillText("data",d,e+5,f+15,"#fff")};ui.prototype.drawToolbox=function(f){var n=Object.keys(core.status.hero.items.tools).sort();var b=Object.keys(core.status.hero.items.constants).sort();if(!core.isset(f)){if(n.length>0){f=0}else{if(b.length>0){f=100}else{f=0}}}core.status.event.selection=f;var k;if(f<100){k=n[f]}else{k=b[f-100]}if(!core.hasItem(k)){k=null}core.status.event.data=k;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.setFillStyle("ui","#DDDDDD");core.setStrokeStyle("ui","#DDDDDD");core.canvas.ui.lineWidth=2;core.canvas.ui.strokeWidth=2;core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,130);core.canvas.ui.lineTo(416,130);core.canvas.ui.stroke();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,129);core.canvas.ui.lineTo(0,105);core.canvas.ui.lineTo(72,105);core.canvas.ui.lineTo(102,129);core.canvas.ui.fill();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,290);core.canvas.ui.lineTo(416,290);core.canvas.ui.stroke();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,289);core.canvas.ui.lineTo(0,265);core.canvas.ui.lineTo(72,265);core.canvas.ui.lineTo(102,289);core.canvas.ui.fill();core.canvas.ui.textAlign="left";core.fillText("ui","消耗道具",5,124,"#333333","bold 16px Verdana");core.fillText("ui","永久道具",5,284);if(core.isset(k)){var g=core.material.items[k];core.fillText("ui",g.name,10,32,"#FFD700","bold 20px Verdana");var l=g.text||"该道具暂无描述。";var j=core.splitLines("ui",l,406,"17px Verdana");core.fillText("ui",j[0],10,62,"#FFFFFF","17px Verdana");if(j.length==1){core.fillText("ui","<继续点击该道具即可进行使用>",10,89,"#CCCCCC","14px Verdana")}else{var h=l.substring(j[0].length);core.fillText("ui",h,10,89,"#FFFFFF","17px Verdana")}}core.canvas.ui.textAlign="right";var e=core.material.images.items;for(var c=0;c=e){h=e-1}if(g>5){g=5}d=10*h+g;core.status.event.data=d;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.canvas.ui.textAlign="center";var l=416/6,j=118;var k="#FFD700";if(core.status.event.selection){k="#FF6A6A"}var f=core.status.event.id=="save"?"存档":core.status.event.id=="load"?"读档":core.status.event.id=="replayLoad"?"回放":"";for(var b=0;b<6;b++){var c=5*h+b;var a=core.getLocalStorage(b==0?"autoSave":"save"+c,null);if(b<3){core.fillText("ui",b==0?"自动存档":f+c,(2*b+1)*l,35,"#FFFFFF","bold 17px Verdana");core.strokeRect("ui",(2*b+1)*l-j/2,50,j,j,b==g?k:"#FFFFFF",b==g?6:2);if(core.isset(a)&&core.isset(a.floorId)){this.drawThumbnail(a.floorId,"ui",core.maps.load(a.maps,a.floorId).blocks,(2*b+1)*l-j/2,50,j,a.hero.loc,a.hero.flags.heroIcon||"hero.png");core.fillText("ui",core.formatDate(new Date(a.time)),(2*b+1)*l,65+j,"#FFFFFF","10px Verdana")}else{core.fillRect("ui",(2*b+1)*l-j/2,50,j,j,"#333333",2);core.fillText("ui","空",(2*b+1)*l,117,"#FFFFFF","bold 30px Verdana")}}else{core.fillText("ui",f+c,(2*b-5)*l,230,"#FFFFFF","bold 17px Verdana");core.strokeRect("ui",(2*b-5)*l-j/2,245,j,j,b==g?k:"#FFFFFF",b==g?6:2);if(core.isset(a)&&core.isset(a.floorId)){this.drawThumbnail(a.floorId,"ui",core.maps.load(a.maps,a.floorId).blocks,(2*b-5)*l-j/2,245,j,a.hero.loc,a.hero.flags.heroIcon||"hero.png");core.fillText("ui",core.formatDate(new Date(a.time)),(2*b-5)*l,260+j,"#FFFFFF","10px Verdana")}else{core.fillRect("ui",(2*b-5)*l-j/2,245,j,j,"#333333",2);core.fillText("ui","空",(2*b-5)*l,245+70,"#FFFFFF","bold 30px Verdana")}}}this.drawPagination(h+1,e);if(core.status.event.selection){core.setFillStyle("ui","#FF6A6A")}core.fillText("ui","删除模式",48,403)};ui.prototype.drawThumbnail=function(h,g,f,w,z,v,n,m){core.clearMap(g,w,z,v,v);var k=core.floors[h].defaultGround||"ground";var d=core.material.icons.terrains[k];var e=core.material.images.terrains;var t=v/13;for(var o=0;o<13;o++){for(var r=0;r<13;r++){core.canvas[g].drawImage(e,0,d*32,32,32,w+o*t,z+r*t,t,t)}}var q=[];if(core.isset(core.floors[h].images)){q=core.floors[h].images;if(typeof q=="string"){q=[[0,0,q]]}}q.forEach(function(A){var y=v/416;var b=parseInt(A[0]),i=parseInt(A[1]),x=A[2];if(core.isset(b)&&core.isset(i)&&!A[3]&&core.isset(core.material.images.images[x])){b*=32;i*=32;var j=core.material.images.images[x];core.canvas.ui.drawImage(j,w+b*y,z+i*y,Math.min(v-b*y,y*j.width),Math.min(v-i*y,y*j.height))}});var s=core.maps.getMapArray(f);for(var a in f){var c=f[a];if(core.isset(c.event)&&!(core.isset(c.enable)&&!c.enable)){if(c.event.cls=="autotile"){core.drawAutotile(core.canvas.ui,s,c,t,w,z)}else{if(c.event.id!="none"){var d=core.material.icons[c.event.cls][c.event.id];var e=core.material.images[c.event.cls];var l=c.event.height||32;core.canvas[g].drawImage(e,0,d*l,32,l,w+c.x*t,z+c.y*t+(t-t*l/32),t,t*l/32)}}}}if(core.isset(n)){if(!core.isset(core.material.images.images[m])){m="hero.png"}var p=core.material.icons.hero[n.direction];var l=core.material.images.images[m].height/4;var u=t*l/32;core.canvas[g].drawImage(core.material.images.images[m],p.stop*32,p.loc*l,32,l,w+t*n.x,z+t*n.y+t-u,t,u)}q.forEach(function(A){var y=v/416;var b=parseInt(A[0]),i=parseInt(A[1]),x=A[2];if(core.isset(b)&&core.isset(i)&&A[3]&&core.isset(core.material.images.images[x])){b*=32;i*=32;var j=core.material.images.images[x];core.canvas.ui.drawImage(j,w+b*y,z+i*y,Math.min(v-b*y,y*j.width),Math.min(v-i*y,y*j.height))}})};ui.prototype.drawKeyBoard=function(){core.lockControl();core.status.event.id="keyBoard";core.clearMap("ui",0,0,416,416);var c=16,g=48,f=416-2*c,b=416-2*g;var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.fillRect("ui",c,g,f,b,a);core.strokeRect("ui",c-1,g-1,f+1,b+1,"#FFFFFF",2);core.canvas.ui.textAlign="center";core.fillText("ui","虚拟键盘",208,g+35,"#FFD700","bold 22px Verdana");core.setFont("ui","17px Verdana");core.setFillStyle("ui","#FFFFFF");var e=128-9;var d=[["F1","F2","F3","F4","F5","F6","F7","F8","F9","10","11"],["1","2","3","4","5","6","7","8","9","0"],["Q","W","E","R","T","Y","U","I","O","P"],["A","S","D","F","G","H","J","K","L"],["Z","X","C","V","B","N","M"],["-","=","[","]","\\",";","'",",",".","/","`"],["ES","TA","CA","SH","CT","AL","SP","BS","EN","DE"]];d.forEach(function(j){for(var h=0;h0){var name="";if(key=="yellowDoor"){name="黄门"}else{if(key=="blueDoor"){name="蓝门"}else{if(key=="redDoor"){name="红门"}else{if(key=="steelDoor"){name="铁门"}else{name=core.material.items[key].name}}}}if(core.isset(name)){text+=name+value+"个;"}}});text+="\n\n";text+="共加生命值"+core.formatBigNumber(data.add.hp)+"点,攻击"+core.formatBigNumber(data.add.atk)+"点,防御"+core.formatBigNumber(data.add.def)+"点,魔防"+core.formatBigNumber(data.add.mdef)+"点。";return text};var formatTime=function(time){return core.setTwoDigits(parseInt(time/3600000))+":"+core.setTwoDigits(parseInt(time/60000)%60)+":"+core.setTwoDigits(parseInt(time/1000)%60)};var statistics=core.status.hero.statistics;core.drawText([getText("全塔",total),getText("当前",current),"当前总步数:"+core.status.hero.steps+",当前游戏时长:"+formatTime(statistics.currTime)+",总游戏时长"+formatTime(statistics.totalTime)+"。\n瞬间移动次数:"+statistics.moveDirectly+",共计少走"+statistics.ignoreSteps+"步。\n\n总计通过血瓶恢复生命值为"+core.formatBigNumber(statistics.hp)+"点。\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)+"点。","\t[说明]1. 地图数据统计的效果仅模拟当前立刻获得该道具的效果。\n2. 不会计算“不可被浏览地图”的隐藏层的数据。\n3. 不会计算任何通过事件得到的道具(显示事件、改变图块、或直接增加道具等)。\n4. 在自定义道具(例如其他宝石)后,需在ui.js的drawStatistics中注册,不然不会进行统计。\n5. 所有统计信息仅供参考,如有错误,概不负责。"])};ui.prototype.drawAbout=function(){return this.uidata.drawAbout()};ui.prototype.drawHelp=function(){core.drawText(["\t[键盘快捷键列表][CTRL] 跳过对话\n[Z] 转向\n[X] 打开/关闭怪物手册\n[G] 打开/关闭楼层传送器\n[A] 读取自动存档(回退)\n[S/D] 打开/关闭存/读档页面\n[K] 打开/关闭快捷商店选择列表\n[T] 打开/关闭工具栏\n[ESC] 打开/关闭系统菜单\n[H] 打开帮助页面\n[R] 回放\n[SPACE] 轻按(仅在轻按开关打开时有效)\n[PgUp/PgDn] 浏览地图\n[1] 快捷使用破墙镐\n[2] 快捷使用炸弹/圣锤\n[3] 快捷使用中心对称飞行器","\t[鼠标操作]点状态栏中图标: 进行对应的操作\n点任意块: 寻路并移动\n点任意块并拖动: 指定寻路路线\n单击勇士: 转向\n双击勇士: 轻按(仅在轻按开关打开时有效)\n长按任意位置:跳过剧情对话或打开虚拟键盘\n"])}; \ No newline at end of file diff --git a/libs/utils.min.js b/libs/utils.min.js new file mode 100644 index 00000000..dcf9c21d --- /dev/null +++ b/libs/utils.min.js @@ -0,0 +1 @@ +function utils(){}utils.prototype.init=function(){};utils.prototype.replaceText=function(a){return a.replace(/\${([^}]+)}/g,function(c,b){return core.calValue(b)})};utils.prototype.calValue=function(value){if(typeof value=="number"){return value}if(value instanceof Function){return value()}value=value.replace(/status:([\w\d_]+)/g,"core.getStatus('$1')");value=value.replace(/item:([\w\d_]+)/g,"core.itemCount('$1')");value=value.replace(/flag:([\w\d_]+)/g,"core.getFlag('$1', 0)");return eval(value)};utils.prototype.splitLines=function(a,g,f,c){if(core.isset(c)){core.setFont(a,c)}var b=[];var e=0;for(var d=0;df){b.push(g.substring(e,d));e=d}}}}b.push(g.substring(e));return b};utils.prototype.unshift=function(c,d){if(!(c instanceof Array)||!core.isset(d)){return}if(d instanceof Array){core.clone(d).reverse().forEach(function(a){c.unshift(a)})}else{c.unshift(d)}return c};utils.prototype.setLocalStorage=function(b,c){try{localStorage.setItem(core.firstData.name+"_"+b,JSON.stringify(c));return true}catch(a){console.log(a);return false}};utils.prototype.getLocalStorage=function(b,a){var c=localStorage.getItem(core.firstData.name+"_"+b);if(core.isset(c)){return JSON.parse(c)}return a};utils.prototype.removeLocalStorage=function(a){localStorage.removeItem(core.firstData.name+"_"+a)};utils.prototype.clone=function(b){if(!core.isset(b)){return b}if(b instanceof Date){var a=new Date();a.setTime(b.getTime());return a}if(b instanceof Array){var a=[];for(var c in b){a[c]=core.clone(b[c])}return a}if(b instanceof Function){return b}if(b instanceof Object){var a={};for(var c in b){if(b.hasOwnProperty(c)){a[c]=core.clone(b[c])}}return a}return b};utils.prototype.cropImage=function(e,g){g=g||32;var b=document.createElement("canvas");var c=b.getContext("2d");b.width=g;b.height=g;var a=[];for(var d=0;d=10*e.val){var f=g/e.val;return b+f.toFixed(Math.max(0,Math.floor(4-Math.log10(f+1))))+e.c}}return b+g};utils.prototype.arrayToRGB=function(a){var d=parseInt(a[0])||0,c=parseInt(a[1])||0,b=parseInt(a[2])||0;if(d<0){d=0}if(b<0){b=0}if(c<0){c=0}if(d>255){d=255}if(b>255){b=255}if(c>255){c=255}return"#"+((1<<24)+(d<<16)+(c<<8)+b).toString(16).slice(1)};utils.prototype.encodeRoute=function(d){var a="";var c="",b=0;d.forEach(function(e){if(e=="up"||e=="down"||e=="left"||e=="right"){if(e!=c&&b>0){a+=c.substring(0,1).toUpperCase();if(b>1){a+=b}b=0}c=e;b++}else{if(b>0){a+=c.substring(0,1).toUpperCase();if(b>1){a+=b}b=0}if(e.indexOf("item:")==0){a+="I"+e.substring(5)+":"}else{if(e.indexOf("fly:")==0){a+="F"+e.substring(4)+":"}else{if(e.indexOf("choices:")==0){a+="C"+e.substring(8)}else{if(e.indexOf("shop:")==0){a+="S"+e.substring(5)}else{if(e=="turn"){a+="T"}else{if(e=="getNext"){a+="G"}else{if(e.indexOf("input:")==0){a+="P"+e.substring(6)}else{if(e=="no"){a+="N"}else{if(e.indexOf("move:")==0){a+="M"+e.substring(5)}else{if(e.indexOf("key:")==0){a+="K"+e.substring(4)}else{if(e.indexOf("random:")==0){a+="X"+e.substring(7)}}}}}}}}}}}}});if(b>0){a+=c.substring(0,1).toUpperCase();if(b>1){a+=b}}return a};utils.prototype.decodeRoute=function(j){if(!core.isset(j)){return j}var a=[],g=0;var d=function(c){var i="";while(g0){if(e.shift()!=f.shift()){return null}}return e};utils.prototype.__init_seed=function(){var a=new Date().getTime()%34834795+3534;a=this.__next_rand(a);a=this.__next_rand(a);a=this.__next_rand(a);core.setFlag("seed",a);core.setFlag("rand",a)};utils.prototype.__next_rand=function(a){a=(a%127773)*16807-~~(a/127773)*2836;a+=a<0?2147483647:0;return a};utils.prototype.rand=function(b){var c=core.getFlag("rand");c=this.__next_rand(c);core.setFlag("rand",c);var a=c/2147483647;if(core.isset(b)&&b>0){return Math.floor(a*b)}return a};utils.prototype.rand2=function(b){b=b||2147483648;var c;if(core.status.replay.replaying){var a=core.status.replay.toReplay.shift();if(a.indexOf("random:")==0){c=parseInt(a.substring(7))}else{core.stopReplay();core.drawTip("录像文件出错");return}}else{c=Math.floor(Math.random()*b)}core.status.route.push("random:"+c);return c};utils.prototype.readFile=function(c,a,b){core.platform.successCallback=c;core.platform.errorCallback=a;if(core.isset(window.jsinterface)){window.jsinterface.readFile();return}if(!core.platform.isOnline){alert("离线状态下不支持文件读取!");if(core.isset(a)){a()}return}if(core.platform.fileReader==null){alert("当前浏览器不支持FileReader!");if(core.isset(a)){a()}return}if(core.platform.fileInput==null){core.platform.fileInput=document.createElement("input");core.platform.fileInput.style.opacity=0;core.platform.fileInput.type="file";core.platform.fileInput.onchange=function(){var d=core.platform.fileInput.files;if(d.length==0){if(core.isset(core.platform.errorCallback)){core.platform.errorCallback()}return}if(!b){core.platform.fileReader.readAsText(core.platform.fileInput.files[0])}else{core.platform.fileReader.readAsDataURL(core.platform.fileInput.files[0])}core.platform.fileInput.value=""}}core.platform.fileInput.click()};utils.prototype.readFileContent=function(a){var c=null;if(a.slice(0,4)==="data"){if(core.isset(core.platform.successCallback)){core.platform.successCallback(a)}return}try{c=JSON.parse(a);if(core.isset(c)){if(core.isset(core.platform.successCallback)){core.platform.successCallback(c)}return}}catch(b){console.log(b)}alert("不是有效的JSON文件!");if(core.isset(core.platform.errorCallback)){core.platform.errorCallback()}};utils.prototype.download=function(d,b){if(core.isset(window.jsinterface)){window.jsinterface.download(d,b);return}if(!core.platform.isOnline){alert("离线状态下不支持下载操作!");return}if(core.platform.isIOS){alert("iOS平台下不支持下载操作!");return}if(!core.platform.isPC){if(!core.platform.isChrome||core.platform.isQQ||core.platform.isWeChat){if(core.copy(b)){alert("移动端只有Chrome浏览器支持直接下载文件!\n所有应下载内容已经复制到您的剪切板,请自行创建空白文件并粘贴。")}else{alert("该平台或浏览器暂不支持下载操作!")}return}}if(core.platform.isSafari){alert("你当前使用的是Safari浏览器,不支持直接下载文件。\n即将打开一个新窗口为应下载内容,请自行全选复制然后创建空白文件并粘贴。");var a=new Blob([b],{type:"text/plain;charset=utf-8"});var e=window.URL.createObjectURL(a);var f=window.open(e,"_blank");window.URL.revokeObjectURL(e);return}var a=new Blob([b],{type:"text/plain;charset=utf-8"});if(window.navigator.msSaveOrOpenBlob){window.navigator.msSaveBlob(a,d)}else{var e=window.URL.createObjectURL(a);var c=window.document.createElement("a");c.href=e;c.download=d;document.body.appendChild(c);c.click();document.body.removeChild(c);window.URL.revokeObjectURL(e)}};utils.prototype.copy=function(a){if(core.isset(window.jsinterface)){window.jsinterface.copy(filename,content);return true}if(!core.platform.supportCopy){return false}var d=document.createElement("textarea");d.style.position="fixed";d.style.top=0;d.style.left=0;d.style.width="2em";d.style.height="2em";d.style.padding=0;d.style.border="none";d.style.outline="none";d.style.boxShadow="none";d.style.background="transparent";d.value=a;document.body.appendChild(d);d.select();var c=false;try{c=document.execCommand("copy")}catch(b){c=false}document.body.removeChild(d);return c};utils.prototype.show=function(b,e,a){if(!core.isset(e)){b.style.display="block";return}b.style.display="block";if(main.mode!="play"){b.style.opacity=1;if(core.isset(a)){a()}return}b.style.opacity=0;var c=0;var d=window.setInterval(function(){c+=0.03;b.style.opacity=c;if(c>1){clearInterval(d);if(core.isset(a)){a()}}},e)};utils.prototype.hide=function(c,e,a){if(!core.isset(e)){c.style.display="none";return}if(main.mode!="play"){c.style.display="none";if(core.isset(a)){a()}return}var d=1;var b=window.setInterval(function(){d-=0.03;c.style.opacity=d;if(d<0){c.style.display="none";clearInterval(b);if(core.isset(a)){a()}}},e)};utils.prototype.http=function(f,g,b,e,a,c,d){var h=new XMLHttpRequest();h.open(f,g,true);if(core.isset(c)){h.overrideMimeType(c)}if(core.isset(d)){h.responseType=d}h.onload=function(i){if(h.status==200){if(core.isset(e)){e(h.response)}}else{if(core.isset(a)){a("HTTP "+h.status)}}};h.onabort=function(){if(core.isset(a)){a("Abort")}};h.ontimeout=function(){if(core.isset(a)){a("Timeout")}};h.onerror=function(){if(core.isset(a)){a("Error on Connection")}};if(core.isset(b)){h.send(b)}else{h.send()}}; \ No newline at end of file diff --git a/启动服务(mac版).app/Contents/Info.plist b/启动服务(mac版).app/Contents/Info.plist new file mode 100644 index 00000000..b4d206e5 --- /dev/null +++ b/启动服务(mac版).app/Contents/Info.plist @@ -0,0 +1,50 @@ + + + + + BuildMachineOSBuild + 17E202 + CFBundleDevelopmentRegion + en + CFBundleExecutable + MTBuilder + CFBundleIdentifier + com.xiongdianpku.MTBuilder + CFBundleInfoDictionaryVersion + 6.0 + CFBundleName + MTBuilder + CFBundlePackageType + APPL + CFBundleShortVersionString + 1.0 + CFBundleSupportedPlatforms + + MacOSX + + CFBundleVersion + 1 + DTCompiler + com.apple.compilers.llvm.clang.1_0 + DTPlatformBuild + 9E501 + DTPlatformVersion + GM + DTSDKBuild + 17E189 + DTSDKName + macosx10.13 + DTXcode + 0931 + DTXcodeBuild + 9E501 + LSMinimumSystemVersion + 10.10 + NSHumanReadableCopyright + Copyright © 2018年 熊典. All rights reserved. + NSMainStoryboardFile + Main + NSPrincipalClass + NSApplication + + diff --git a/启动服务(mac版).app/Contents/MacOS/MTBuilder b/启动服务(mac版).app/Contents/MacOS/MTBuilder new file mode 100644 index 00000000..e1450352 Binary files /dev/null and b/启动服务(mac版).app/Contents/MacOS/MTBuilder differ diff --git a/启动服务(mac版).app/Contents/PkgInfo b/启动服务(mac版).app/Contents/PkgInfo new file mode 100644 index 00000000..bd04210f --- /dev/null +++ b/启动服务(mac版).app/Contents/PkgInfo @@ -0,0 +1 @@ +APPL???? \ No newline at end of file diff --git a/启动服务(mac版).app/Contents/Resources/Assets.car b/启动服务(mac版).app/Contents/Resources/Assets.car new file mode 100644 index 00000000..86f979d4 Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Assets.car differ diff --git a/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/3Jh-0i-2oC-view-FlG-D0-fB4.nib b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/3Jh-0i-2oC-view-FlG-D0-fB4.nib new file mode 100644 index 00000000..44914f1c Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/3Jh-0i-2oC-view-FlG-D0-fB4.nib differ diff --git a/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/8cO-Uq-prt-view-GPE-0I-haQ.nib b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/8cO-Uq-prt-view-GPE-0I-haQ.nib new file mode 100644 index 00000000..c1318db7 Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/8cO-Uq-prt-view-GPE-0I-haQ.nib differ diff --git a/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist new file mode 100644 index 00000000..c77a88d5 Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/Info.plist differ diff --git a/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib new file mode 100644 index 00000000..df58a14a Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/MainMenu.nib differ diff --git a/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSViewController-3Jh-0i-2oC.nib b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSViewController-3Jh-0i-2oC.nib new file mode 100644 index 00000000..41c972f5 Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSViewController-3Jh-0i-2oC.nib differ diff --git a/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib new file mode 100644 index 00000000..d32450b1 Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib differ diff --git a/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-QqD-oc-2tR.nib b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-QqD-oc-2tR.nib new file mode 100644 index 00000000..469ed9ac Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/NSWindowController-QqD-oc-2tR.nib differ diff --git a/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib new file mode 100644 index 00000000..843e49ec Binary files /dev/null and b/启动服务(mac版).app/Contents/Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib differ diff --git a/启动服务(mac版).app/Contents/_CodeSignature/CodeResources b/启动服务(mac版).app/Contents/_CodeSignature/CodeResources new file mode 100644 index 00000000..2a1e8d3a --- /dev/null +++ b/启动服务(mac版).app/Contents/_CodeSignature/CodeResources @@ -0,0 +1,252 @@ + + + + + files + + Resources/Assets.car + + Y8vFWeV9aMFK2k/Fmvn1VKDb4G4= + + Resources/Base.lproj/Main.storyboardc/3Jh-0i-2oC-view-FlG-D0-fB4.nib + + EN/jmkBY5XqitaaV2kWybEgMtTE= + + Resources/Base.lproj/Main.storyboardc/8cO-Uq-prt-view-GPE-0I-haQ.nib + + vZO5vWZuRi0vaSFqKPCW1qksfDE= + + Resources/Base.lproj/Main.storyboardc/Info.plist + + 71E/nyD1JC6i4rw6+kjjVgE/fZA= + + Resources/Base.lproj/Main.storyboardc/MainMenu.nib + + lC9mNWqzXYAYynusmnCrDuM3hvI= + + Resources/Base.lproj/Main.storyboardc/NSViewController-3Jh-0i-2oC.nib + + jBRfznhMbiKUnUxlCD1QLUegGsc= + + Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib + + S9xl+rRRrH6aWKPTrX11XmKhYtA= + + Resources/Base.lproj/Main.storyboardc/NSWindowController-QqD-oc-2tR.nib + + a5hup3BYBUycbe+iJd/nx+VQ/rA= + + Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib + + 7osH7f7CY2aFRWbCLAy1odTex/M= + + + files2 + + Resources/Assets.car + + hash + + Y8vFWeV9aMFK2k/Fmvn1VKDb4G4= + + hash2 + + R6hkb6fWvTpPEJXUWnyv4rhwHuVVIqsihlgRCdNNoz4= + + + Resources/Base.lproj/Main.storyboardc/3Jh-0i-2oC-view-FlG-D0-fB4.nib + + hash + + EN/jmkBY5XqitaaV2kWybEgMtTE= + + hash2 + + 8KgZX7l1DB4wlq8OlL6h9gk2PUditNbKqqR7qnoHCoc= + + + Resources/Base.lproj/Main.storyboardc/8cO-Uq-prt-view-GPE-0I-haQ.nib + + hash + + vZO5vWZuRi0vaSFqKPCW1qksfDE= + + hash2 + + aK2kvZcgmqywotLHVkXGbEh1LkOnXWQEX6RKwgp3f7s= + + + Resources/Base.lproj/Main.storyboardc/Info.plist + + hash + + 71E/nyD1JC6i4rw6+kjjVgE/fZA= + + hash2 + + d1R62G7VThDKTjMMGGoUR6TC9bR0hjwLNqAggKJwsS0= + + + Resources/Base.lproj/Main.storyboardc/MainMenu.nib + + hash + + lC9mNWqzXYAYynusmnCrDuM3hvI= + + hash2 + + ZBTMovff3XB5dFKWqxpFhQsHN7/F4Zfp45tuh4OSDB0= + + + Resources/Base.lproj/Main.storyboardc/NSViewController-3Jh-0i-2oC.nib + + hash + + jBRfznhMbiKUnUxlCD1QLUegGsc= + + hash2 + + niqIc11tpbnFJIeMHBNiCcjwUkpkJvJJoAKTguRNp/s= + + + Resources/Base.lproj/Main.storyboardc/NSWindowController-B8D-0N-5wS.nib + + hash + + S9xl+rRRrH6aWKPTrX11XmKhYtA= + + hash2 + + unrn3sgw+6nM2WDwyTjK8g/wIOAogLhFXRotyPK6xIw= + + + Resources/Base.lproj/Main.storyboardc/NSWindowController-QqD-oc-2tR.nib + + hash + + a5hup3BYBUycbe+iJd/nx+VQ/rA= + + hash2 + + P/jSqX6j8bzFQoaQzsZl49a9zRuMnaO4/Gq+iECoDu4= + + + Resources/Base.lproj/Main.storyboardc/XfG-lQ-9wD-view-m2S-Jp-Qdl.nib + + hash + + 7osH7f7CY2aFRWbCLAy1odTex/M= + + hash2 + + aNkXpHLXtb/zTBJ/LsXFPlcRqVfZh4L5qRk4kUZx2NE= + + + + rules + + ^Resources/ + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^version.plist$ + + + rules2 + + .*\.dSYM($|/) + + weight + 11 + + ^(.*/)?\.DS_Store$ + + omit + + weight + 2000 + + ^(Frameworks|SharedFrameworks|PlugIns|Plug-ins|XPCServices|Helpers|MacOS|Library/(Automator|Spotlight|LoginItems))/ + + nested + + weight + 10 + + ^.* + + ^Info\.plist$ + + omit + + weight + 20 + + ^PkgInfo$ + + omit + + weight + 20 + + ^Resources/ + + weight + 20 + + ^Resources/.*\.lproj/ + + optional + + weight + 1000 + + ^Resources/.*\.lproj/locversion.plist$ + + omit + + weight + 1100 + + ^Resources/Base\.lproj/ + + weight + 1010 + + ^[^/]+$ + + nested + + weight + 10 + + ^embedded\.provisionprofile$ + + weight + 20 + + ^version\.plist$ + + weight + 20 + + + + diff --git a/启动服务.exe b/启动服务.exe index 2c84bd69..95d5d1f7 100644 Binary files a/启动服务.exe and b/启动服务.exe differ diff --git a/常用工具/便捷PS工具.exe b/常用工具/便捷PS工具.exe index d1d1aeab..422d76fa 100644 Binary files a/常用工具/便捷PS工具.exe and b/常用工具/便捷PS工具.exe differ diff --git a/常用素材.zip b/常用素材.zip deleted file mode 100644 index 489ab393..00000000 Binary files a/常用素材.zip and /dev/null differ diff --git a/快捷键说明.txt b/快捷键说明.txt deleted file mode 100644 index 0e0fcf45..00000000 --- a/快捷键说明.txt +++ /dev/null @@ -1,53 +0,0 @@ -快捷键说明: - -=== 全局 === -[↑][↓][←][→] 移动勇士 -[CTRL] 跳过对话 -[Z] 转向 -[X] 打开/关闭怪物手册 -[G] 打开/关闭楼层传送器 -[A] 读取自动存档 -[S] 打开/关闭存档页面 -[D] 打开/关闭读档页面 -[K] 打开/关闭快捷商店选择列表 -[T] 打开/关闭工具栏 -[ESC] 打开/关闭系统菜单 -[E] 显示光标 -[H] 打开帮助页面 -[R] 回放 -[SPACE] 轻按(仅在轻按开关打开时有效) -[1] 快捷使用破墙镐 -[2] 快捷使用炸弹/圣锤(先检测有没有炸弹,没有再检测圣锤) -[3] 快捷使用中心对称飞行器 - -=== 文本显示界面 === -[SPACE]/[ENTER] 继续 - -=== 选项列表 === -[↑][↓] 移动当前选择项 -[ESC] 返回 -[SPACE]/[ENTER] 确认该选项 - -=== 怪物手册页面 === -[↑][↓][←][→] 翻页 -[ESC]/[X] 关闭怪物手册 - -=== 楼传器页面 === -[↑][↓][←][→] 更改楼层 -[SPACE]/[ENTER] 确认传送 -[ESC]/[G] 关闭楼传器 - -=== 道具栏页面 === -[↑][↓][←][→] 更改当前道具 -[SPACE]/[ENTER] 确认使用道具 -[ESC]/[T] 关闭道具栏 - -=== 存读档页面 === -[↑][↓][←][→] 更改当前存读档位置 -[PAGEUP][PAGEDOWN] 存读档翻页 -[SPACE]/[ENTER] 确认存读档 -[ESC]/[S]/[D] 关闭存读档界面 - -=== 正在使用中心对称飞行器时 === -[3]/[SPACE]/[ENTER] 确认飞行 -其他键 取消飞行 diff --git a/更新说明.txt b/更新说明.txt index 30f0a265..df2f23f8 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -1,19 +1,20 @@ HTML5魔塔样板V2.3 -地图编辑器可以右键复制或移动图块 √ -事件:while循环处理 √ -事件:等待用户操作并获得按键或点击信息 √ -地图数据统计 √ -衰弱可以减少攻防的比例 √ -便捷PS工具可以批量导入素材 √ -除Autotile外均可自动注册 √ -支持status:x获得当前坐标 √ -core.debug()改成调试模式,可以Ctrl穿墙 √ -新建地图可以保留楼层属性 √ -地图编辑器可用PageUp和PageDown切换楼层 √ -提供大量素材,可直接取用 √ -重写大部分教程,新增大量拓展描述 √ -大量细节进行优化,所有已知的bug进行了修复 √ +启动服务和便捷PS工具(Mac版) +地图编辑器可以右键复制或移动图块 +事件:while循环处理 +事件:等待用户操作并获得按键或点击信息 +地图数据统计 +衰弱可以减少攻防的比例 +便捷PS工具可以批量导入素材 +除Autotile外均可自动注册 +支持status:x获得当前坐标 +core.debug()改成调试模式,可以Ctrl穿墙 +新建地图可以保留楼层属性 +地图编辑器可用PageUp和PageDown切换楼层 +提供大量素材,可直接取用 +重写大部分教程,新增大量拓展描述 +大量细节进行优化,所有已知的bug进行了修复 ----------------------------------------------------------------------- diff --git a/素材整理下载地址.txt b/素材整理下载地址.txt new file mode 100644 index 00000000..76aa0f1f --- /dev/null +++ b/素材整理下载地址.txt @@ -0,0 +1,16 @@ +将几个RM塔的素材进行归整后,上传到了百度网盘和QQ群文件可供下载使用。 + +包含: + - 地面图(Tilesets) + - 道具和帧动画 + - 行走图(勇士、怪物和NPC等) + - 动画(可被RM动画导出器直接导出) + - 自动元件(Autotiles) + - 音效 +等六个部分 + +百度网盘下载地址: + +https://pan.baidu.com/s/1vXICR79ZoP5LXujhlAjN-A + +也可以在HTML5魔塔交流群539113091的群文件中找“常用素材”下载。