From 7043c950d853d5e383173e93fe3dadb917c06bfc Mon Sep 17 00:00:00 2001 From: oc Date: Sun, 26 Aug 2018 02:28:06 +0800 Subject: [PATCH 01/12] Draw Thumbnail & View maps --- libs/actions.js | 75 ++++++++++++++++++-------- libs/core.js | 10 ++-- libs/maps.js | 14 +++-- libs/ui.js | 138 ++++++++++++++++++++++++++++++++++-------------- libs/utils.js | 2 +- 5 files changed, 164 insertions(+), 75 deletions(-) diff --git a/libs/actions.js b/libs/actions.js index 2ae074d3..1003c29c 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -351,7 +351,7 @@ actions.prototype.keyUp = function(keyCode, fromReplay) { case 33: case 34: // PAGEUP/PAGEDOWN if (core.status.heroStop) { if (core.flags.enableViewMaps) { - core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId)); + core.ui.drawMaps(); } else { core.drawTip("本塔不允许浏览地图!"); @@ -968,23 +968,47 @@ actions.prototype.keyUpFly = function (keycode) { ////// 查看地图界面时的点击操作 ////// actions.prototype.clickViewMaps = function (x,y) { + if (!core.isset(core.status.event.data)) { + core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId)); + return; + } + var now = core.floorIds.indexOf(core.status.floorId); - var nextId = core.status.event.data; - if(y<=4) { - nextId++; - while (nextId=2 && x<=10 && y<=1) { + core.ui.drawMaps(index, cx, cy-1); + return; } - else if (y>=8) { - nextId--; - while (nextId>=0 && nextId!=now && core.floors[core.floorIds[nextId]].cannotViewMap) - nextId--; - if (nextId>=0) - core.ui.drawMaps(nextId); + if (x>=2 && x<=10 && y>=11) { + core.ui.drawMaps(index, cx, cy+1); + return; } - else { + if (x<=1 && y>=2 && y<=10) { + core.ui.drawMaps(index, cx-1, cy); + return; + } + if (x>=11 && y>=2 && y<=10) { + core.ui.drawMaps(index, cx+1, cy); + return; + } + + if(x>=2 && x<=10 && y<=4) { + index++; + while (index=2 && x<=10 && y>=8) { + index--; + while (index>=0 && index!=now && core.floors[core.floorIds[index]].cannotViewMap) + index--; + if (index>=0) + core.ui.drawMaps(index); + } + else if (x>=2 && x<=10 && y>=5 && y<=7) { core.clearMap('data'); core.setOpacity('data', 1); core.ui.closePanel(); @@ -993,17 +1017,23 @@ actions.prototype.clickViewMaps = function (x,y) { ////// 查看地图界面时,按下某个键的操作 ////// actions.prototype.keyDownViewMaps = function (keycode) { - if (keycode==37 || keycode==38 || keycode==33) { - this.clickViewMaps(6,2); - } - else if (keycode==39 || keycode==40 || keycode==34) { - this.clickViewMaps(6,10); - } + if (!core.isset(core.status.event.data)) return; + if (keycode==38||keycode==33) this.clickViewMaps(6, 3); + if (keycode==40||keycode==34) this.clickViewMaps(6, 9); + if (keycode==87) this.clickViewMaps(6,0); + if (keycode==65) this.clickViewMaps(0,6); + if (keycode==83) this.clickViewMaps(6,12); + if (keycode==68) this.clickViewMaps(12,6); return; } ////// 查看地图界面时,放开某个键的操作 ////// actions.prototype.keyUpViewMaps = function (keycode) { + if (!core.isset(core.status.event.data)) { + core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId)); + return; + } + if (keycode==27 || keycode==13 || keycode==32 || keycode==67) { core.clearMap('data'); core.setOpacity('data', 1); @@ -1585,9 +1615,12 @@ actions.prototype.clickSettings = function (x,y) { core.drawTip("本塔不允许浏览地图!"); } else { + /* core.drawText("\t[系统提示]即将进入浏览地图模式。\n\n点击地图上半部分,或按[↑]键可查看前一张地图\n点击地图下半部分,或按[↓]键可查看后一张地图\n点击地图中间,或按[ESC]键可离开浏览地图模式\n此模式下可以打开怪物手册以查看某层楼的怪物属性", function () { core.ui.drawMaps(core.floorIds.indexOf(core.status.floorId)); }) + */ + core.ui.drawMaps(); } break; case 3: diff --git a/libs/core.js b/libs/core.js index 93f24225..bdb734b8 100644 --- a/libs/core.js +++ b/libs/core.js @@ -2,11 +2,6 @@ * 初始化 start */ -// 额外功能 -Number.prototype.clamp = function(min, max) { - return Math.min(Math.max(this, min), max); -}; - function core() { this.material = { 'animates': {}, @@ -81,7 +76,8 @@ function core() { offsetX: 0, // in pixel offsetY: 0, width: 13, // map width and height - height: 13 + height: 13, + tempCanvas: null, // A temp canvas for drawing } this.initStatus = { 'played': false, @@ -275,6 +271,8 @@ core.prototype.init = function (coreData, callback) { core.material.ground = new Image(); core.material.ground.src = "project/images/ground.png"; + core.bigmap.tempCanvas = document.createElement('canvas').getContext('2d'); + core.loader.load(function () { console.log(core.material); // 设置勇士高度 diff --git a/libs/maps.js b/libs/maps.js index f1423463..3368d423 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -354,10 +354,8 @@ maps.prototype.drawMap = function (mapName, callback) { } } images.forEach(function (t) { - var size=416, ratio=1; var dx=parseInt(t[0]), dy=parseInt(t[1]), p=t[2]; if (core.isset(dx) && core.isset(dy) && core.isset(core.material.images.images[p])) { - dx*=32; dy*=32; var image = core.material.images.images[p]; if (!t[3]) { if (/.*\.gif/i.test(p) && main.mode=='play') { @@ -365,23 +363,23 @@ maps.prototype.drawMap = function (mapName, callback) { var gif = new Image(); gif.src = core.material.images.images[p].src; gif.style.position = 'absolute'; - gif.style.left = (dx*core.domStyle.scale)+"px"; - gif.style.top = (dy*core.domStyle.scale)+"px"; + gif.style.left = (32*dx*core.domStyle.scale)+"px"; + gif.style.top = (32*dy*core.domStyle.scale)+"px"; gif.style.width = core.material.images.images[p].width*core.domStyle.scale+"px"; gif.style.height = core.material.images.images[p].height*core.domStyle.scale+"px"; core.dom.gif.appendChild(gif); } else { - core.canvas.bg.drawImage(image, dx * ratio, dy * ratio, Math.min(size - dx * ratio, ratio * image.width), Math.min(size - dy * ratio, ratio * image.height)); + core.canvas.bg.drawImage(image, 32*dx, 32*dy, image.width, image.height); } } else if (t[3]==1) - core.canvas.event2.drawImage(image, dx*ratio, dy*ratio, Math.min(size-dx*ratio, ratio*image.width), Math.min(size-dy*ratio, ratio*image.height)); + core.canvas.event2.drawImage(image, 32*dx, 32*dy, image.width, image.height); else if (t[3]==2) { core.canvas.event2.drawImage(image, 0, 0, image.width, image.height-32, - dx * ratio, dy * ratio, ratio * image.width, ratio * (image.height-32)); + 32*dx, 32*dy, image.width, image.height-32); core.canvas.bg.drawImage(image, 0, image.height-32, image.width, 32, - dx * ratio, (dy + image.height - 32) * ratio, ratio*image.width, 32*ratio); + 32*dx, 32*dy + image.height - 32, image.width, 32); } } }) diff --git a/libs/ui.js b/libs/ui.js index 0a4fd41d..b3fc3c82 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1476,30 +1476,81 @@ ui.prototype.drawFly = function(page) { } ////// 绘制浏览地图界面 ////// -ui.prototype.drawMaps = function (index) { - if (!core.isset(index)) index=core.floorIds.indexOf(core.status.floorId); +ui.prototype.drawMaps = function (index, x, y) { + core.lockControl(); + core.status.event.id = 'viewMaps'; + + if (!core.isset(index)) { + core.status.event.data = null; + core.clearMap('ui'); + core.setAlpha('ui', 1); + + core.clearMap('animate'); + core.setOpacity('animate', 0.4); + core.fillRect('animate', 0, 0, 416, 416, '#000000'); + + core.strokeRect('ui', 66, 2, 284, 60, "#FFD700", 4); + core.strokeRect('ui', 2, 66, 60, 284); + core.strokeRect('ui', 66, 416-62, 284, 60); + core.strokeRect('ui', 416-62, 66, 60, 284); + core.strokeRect('ui', 66, 66, 284, 92); + core.strokeRect('ui', 66, 32*8+2, 284, 92); + core.canvas.ui.textAlign = 'center'; + core.fillText('ui', "上移地图 [W]", 208, 38, '#FFD700', '20px Arial'); + core.fillText('ui', "下移地图 [S]", 208, 390); + + var top = 150; + core.fillText('ui', "左", 32, top); + core.fillText('ui', "移", 32, top+32); + core.fillText('ui', "地", 32, top+32*2); + core.fillText('ui', "图", 32, top+32*3); + core.fillText('ui', "[A]", 32, top+32*4); + core.fillText('ui', "右", 384, top); + core.fillText('ui', "移", 384, top+32); + core.fillText('ui', "地", 384, top+32*2); + core.fillText('ui', "图", 384, top+32*3); + core.fillText('ui', "[D]", 384, top+32*4); + + core.fillText('ui', "前张地图 [▲ / PGUP]", 208, 64+54); + core.fillText('ui', "后张地图 [▼ / PGDN]", 208, 32*8+54); + + core.fillText('ui', "退出 [ESC / ENTER]", 208, 208+8); + core.fillText('ui', "[X] 可查看怪物手册", 285, 208+40, null, '13px Arial'); + return; + } + + core.clearMap('animate'); + core.setOpacity('animate', 1); + + if (core.isset(index.index)) { + x=index.x; + y=index.y; + index=index.index; + } if (index<0) index=0; if (index>=core.floorIds.length) index=core.floorIds.length-1; + var floorId = core.floorIds[index], mw = core.floors[floorId].width||13, mh = core.floors[floorId].height||13; + if (!core.isset(x)) x = parseInt(mw/2); + if (!core.isset(y)) y = parseInt(mh/2); + if (x<6) x=6; + if (x>mw-7) x=mw-7; + if (y<6) y=6; + if (y>mh-7) y=mh-7; - core.lockControl(); - core.status.event.id = 'viewMaps'; - core.status.event.data = index; - - var floorId = core.floorIds[index]; + core.status.event.data = {"index": index, "x": x, "y": y}; clearTimeout(core.interval.tipAnimate); - core.clearMap('ui'); core.setAlpha('ui', 1); - this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 0, 0, 416); + this.drawThumbnail(floorId, 'ui', core.status.maps[floorId].blocks, 0, 0, 416, x, y); core.clearMap('data'); core.setOpacity('data', 0.2); core.canvas.data.textAlign = 'left'; core.setFont('data', '16px Arial'); - var text = core.floors[floorId].title; + var text = core.floors[floorId].title + " ["+(x-6)+","+(y-6)+"]"; var textX = 16, textY = 18, width = textX + core.canvas.data.measureText(text).width + 16, height = 42; core.fillRect('data', 5, 5, width, height, '#000'); core.setOpacity('data', 0.5); @@ -1679,7 +1730,7 @@ ui.prototype.drawSLPanel = function(index) { core.fillText('ui', i==0?"自动存档":name+id, (2*i+1)*u, 35, '#FFFFFF', "bold 17px Verdana"); core.strokeRect('ui', (2*i+1)*u-size/2, 50, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2); if (core.isset(data) && core.isset(data.floorId)) { - this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc, data.hero.flags.heroIcon||"hero.png"); + this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i+1)*u-size/2, 50, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png"); core.fillText('ui', core.formatDate(new Date(data.time)), (2*i+1)*u, 65+size, '#FFFFFF', '10px Verdana'); } else { @@ -1691,7 +1742,7 @@ ui.prototype.drawSLPanel = function(index) { core.fillText('ui', name+id, (2*i-5)*u, 230, '#FFFFFF', "bold 17px Verdana"); core.strokeRect('ui', (2*i-5)*u-size/2, 245, size, size, i==offset?strokeColor:'#FFFFFF', i==offset?6:2); if (core.isset(data) && core.isset(data.floorId)) { - this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc, data.hero.flags.heroIcon||"hero.png"); + this.drawThumbnail(data.floorId, 'ui', core.maps.load(data.maps, data.floorId).blocks, (2*i-5)*u-size/2, 245, size, data.hero.loc.x, data.hero.loc.y, data.hero.loc, data.hero.flags.heroIcon||"hero.png"); core.fillText('ui', core.formatDate(new Date(data.time)), (2*i-5)*u, 260+size, '#FFFFFF', '10px Verdana'); } else { @@ -1709,20 +1760,27 @@ ui.prototype.drawSLPanel = function(index) { } ////// 绘制一个缩略图 ////// -ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, heroLoc, heroIcon) { - core.clearMap(canvas, x, y, size, size); +ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, centerX, centerY, heroLoc, heroIcon) { + + var mw = core.floors[floorId].width || 13; + var mh = core.floors[floorId].height || 13; + // 绘制到tempCanvas上面 + var tempCanvas = core.bigmap.tempCanvas; + var tempWidth = mw*32, tempHeight = mh*32; + tempCanvas.canvas.width = tempWidth; + tempCanvas.canvas.height = tempHeight; + tempCanvas.clearRect(0, 0, tempWidth, tempHeight); + var groundId = core.floors[floorId].defaultGround || "ground"; var blockIcon = core.material.icons.terrains[groundId]; var blockImage = core.material.images.terrains; - var persize = size/13; - var mw = core.floors[floorId].width || 13; - var mh = core.floors[floorId].height || 13; - for (var i=0;i<13;i++) { - for (var j=0;j<13;j++) { - core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + i * persize, y + j * persize, persize, persize); + // background + for (var i=0;i Date: Sun, 26 Aug 2018 18:07:20 +0800 Subject: [PATCH 02/12] Fix centerfly for bigmap --- libs/actions.js | 98 ++++++++++++++++++++++++------------------------ libs/core.js | 1 - libs/events.js | 9 ++++- libs/ui.js | 2 +- project/items.js | 4 +- 5 files changed, 58 insertions(+), 56 deletions(-) diff --git a/libs/actions.js b/libs/actions.js index 1003c29c..5fa63e2b 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -165,34 +165,8 @@ actions.prototype.keyDown = function(keyCode) { case 40: core.moveHero('down'); break; - case 13: case 32: case 67: case 51: // 快捷键3:飞 - // 因为加入了两次的检测机制,从keydown转移到keyup,同时保证位置信息正确,但以下情况会触发作图的bug: - // 在鼠标的路线移动中使用飞,绿块会滞后一格,显示的位置不对,同时也不会倍以下的代码清除 - if (core.status.heroStop && core.hasItem('centerFly')) { - if (core.status.usingCenterFly) { - if (core.canUseItem('centerFly')) { - core.useItem('centerFly'); - core.clearMap('ui', core.getHeroLoc('x')*32,core.getHeroLoc('y')*32,32,32); - } - else { - core.drawTip('当前不能使用中心对称飞行器'); - core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32); - } - core.status.usingCenterFly = false; - } else if (keyCode==51) { - core.status.usingCenterFly = true; - core.setAlpha('ui', 0.5); - core.fillRect('ui',(12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32,core.canUseItem('centerFly')?'#00FF00':'#FF0000'); - core.setAlpha('ui', 1); - core.drawTip("请确认当前中心对称飞行器的位置"); - } - } break; } - if (core.status.usingCenterFly && keyCode!=51) { - core.clearMap('ui', (12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32); - core.status.usingCenterFly= false; - } } ////// 根据放开键的code来执行一系列操作 ////// @@ -283,6 +257,10 @@ actions.prototype.keyUp = function(keyCode, fromReplay) { this.keyUpReplay(keyCode); return; } + if (core.status.event.id=='centerFly') { + this.keyUpCenterFly(keyCode); + return; + } return; } @@ -366,7 +344,7 @@ actions.prototype.keyUp = function(keyCode, fromReplay) { break; case 40: // DOWN break; - case 49: // 快捷键1:破 + case 49: // 快捷键1: 破 if (core.status.heroStop && core.hasItem('pickaxe')) { if (core.canUseItem('pickaxe')) { core.useItem('pickaxe'); @@ -376,7 +354,7 @@ actions.prototype.keyUp = function(keyCode, fromReplay) { } } break; - case 50: // 快捷键2:炸 + case 50: // 快捷键2: 炸 if (core.status.heroStop) { if (core.hasItem('bomb')) { if (core.canUseItem('bomb')) { @@ -397,6 +375,11 @@ actions.prototype.keyUp = function(keyCode, fromReplay) { } } break; + case 51: // 快捷键3: 飞 + if (core.status.heroStop && core.hasItem('centerFly')) { + core.events.useItem('centerFly'); + } + break; } @@ -533,30 +516,18 @@ actions.prototype.onclick = function (x, y, stepPostfix) { // 非游戏屏幕内 if (x<0 || y<0 || x>12 || y>12) return; - // 中心对称飞行器 - if (core.status.usingCenterFly) { - if (x!=12-core.getHeroLoc('x') || y!=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(x+parseInt(core.bigmap.offsetX/32), y+parseInt(core.bigmap.offsetY/32), stepPostfix); return; } + // 中心对称飞行器 + if (core.status.event.id == 'centerFly') { + this.clickCenterFly(x, y); + return; + } + // 怪物手册 if (core.status.event.id == 'book') { this.clickBook(x,y); @@ -705,8 +676,8 @@ actions.prototype.onmousewheel = function (direct) { // 浏览地图 if (core.status.lockControl && core.status.event.id == 'viewMaps') { - if (direct==1) this.clickViewMaps(6,2); - if (direct==-1) this.clickViewMaps(6,10); + if (direct==1) this.clickViewMaps(6,3); + if (direct==-1) this.clickViewMaps(6,9); return; } } @@ -747,6 +718,32 @@ actions.prototype.keyDownCtrl = function () { } } +////// +actions.prototype.clickCenterFly = function(x, y) { + if (x==core.status.event.data.x && y==core.status.event.data.y) { + if (core.canUseItem('centerFly')) { + core.useItem('centerFly'); + } + else { + core.drawTip('当前不能使用中心对称飞行器'); + } + } + core.ui.closePanel(); +} + +actions.prototype.keyUpCenterFly = function (keycode) { + if (keycode==51 || keycode==13 || keycode==32 || keycode==67) { + if (core.canUseItem('centerFly')) { + core.useItem('centerFly'); + } + else { + core.drawTip('当前不能使用中心对称飞行器'); + } + } + core.ui.closePanel(); +} + + ////// 点击确认框时 ////// actions.prototype.clickConfirmBox = function (x,y) { if ((x == 4 || x == 5) && y == 7 && core.isset(core.status.event.data.yes)) @@ -976,12 +973,13 @@ actions.prototype.clickViewMaps = function (x,y) { var now = core.floorIds.indexOf(core.status.floorId); var index = core.status.event.data.index; var cx = core.status.event.data.x, cy = core.status.event.data.y; + var floorId = core.floorIds[index], mw = core.floors[floorId].width||13, mh = core.floors[floorId].height||13; - if (x>=2 && x<=10 && y<=1) { + if (x>=2 && x<=10 && y<=1 && mh>13) { core.ui.drawMaps(index, cx, cy-1); return; } - if (x>=2 && x<=10 && y>=11) { + if (x>=2 && x<=10 && y>=11 && mh>13) { core.ui.drawMaps(index, cx, cy+1); return; } diff --git a/libs/core.js b/libs/core.js index bdb734b8..c18777a7 100644 --- a/libs/core.js +++ b/libs/core.js @@ -151,7 +151,6 @@ function core() { "time": 0, }, 'curtainColor': null, - 'usingCenterFly':false, 'openingDoor': null, 'isSkiing': false, diff --git a/libs/events.js b/libs/events.js index 215a6a51..718f3ec3 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1490,10 +1490,15 @@ events.prototype.useItem = function(itemId) { return; } if (itemId=='centerFly') { - core.status.usingCenterFly= true; + core.lockControl(); + core.status.event.id = 'centerFly'; var fillstyle = 'rgba(255,0,0,0.5)'; if (core.canUseItem('centerFly')) fillstyle = 'rgba(0,255,0,0.5)'; - core.fillRect('ui',(12-core.getHeroLoc('x'))*32,(12-core.getHeroLoc('y'))*32,32,32,fillstyle); + var toX = core.bigmap.width-1 - core.getHeroLoc('x'), toY = core.bigmap.height-1-core.getHeroLoc('y'); + core.ui.drawThumbnail(core.status.floorId, 'ui', core.status.thisMap.blocks, 0, 0, 416, toX, toY, core.status.hero.loc, core.getFlag('heroIcon', "hero.png")); + var offsetX = core.clamp(toX-6, 0, core.bigmap.width-13), offsetY = core.clamp(toY-6, 0, core.bigmap.height-13); + core.fillRect('ui',(toX-offsetX)*32,(toY-offsetY)*32,32,32,fillstyle); + core.status.event.data = {"x": toX, "y": toY, "poxX": toX-offsetX, "posY": toY-offsetY}; core.drawTip("请确认当前中心对称飞行器的位置"); return; } diff --git a/libs/ui.js b/libs/ui.js index b3fc3c82..0bc7eea4 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1843,7 +1843,7 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, cente if (!core.isset(centerX)) centerX=parseInt(mw/2); if (!core.isset(centerY)) centerY=parseInt(mh/2); - var offsetX = core.clamp(centerX-6, 0, mw), offsetY = core.clamp(centerY-6, 0, mh); + var offsetX = core.clamp(centerX-6, 0, mw-13), offsetY = core.clamp(centerY-6, 0, mh-13); // offsetX~offsetX+12; offsetY~offsetY+12 core.canvas[canvas].drawImage(tempCanvas.canvas, offsetX*32, offsetY*32, 416, 416, x, y, size, size); } diff --git a/project/items.js b/project/items.js index b6848936..a0236f61 100644 --- a/project/items.js +++ b/project/items.js @@ -290,7 +290,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "bigKey": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n});", "bomb": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});", "hammer": "core.removeBlockByIds(core.status.floorId, core.status.event.data);\ncore.drawMap(core.status.floorId, function () {\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.events.afterUseBomb();\n});", - "centerFly": "core.clearMap('hero');\ncore.setHeroLoc('x', core.status.event.data.x);\ncore.setHeroLoc('y', core.status.event.data.y);\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');", + "centerFly": "core.clearMap('hero');\ncore.setHeroLoc('x', (core.bigmap.width||13)-1-core.getHeroLoc('x'));\ncore.setHeroLoc('y', (core.bigmap.height||13)-1-core.getHeroLoc('y'));\ncore.drawHero();\ncore.drawTip(core.material.items[itemId].name + '使用成功');", "upFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});", "downFly": "var loc = {'direction': core.status.hero.loc.direction, 'x': core.status.event.data.x, 'y': core.status.event.data.y};\ncore.changeFloor(core.status.event.data.id, null, loc, null, function (){\n core.drawTip(core.material.items[itemId].name + '使用成功');\n core.replay();\n});", "poisonWine": "core.setFlag('poison', false);", @@ -320,7 +320,7 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", "hammer": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", "earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) // 能炸的墙壁\n ids.push(i);\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable", - "centerFly": "var able=false;\nvar toX = 12 - core.getHeroLoc('x'), toY = 12-core.getHeroLoc('y');\nvar block = core.getBlock(toX, toY);\nif (block==null) {\n core.status.event.data = {'x': toX, 'y': toY};\n able = true;\n}\nable", + "centerFly": "var toX = (core.bigmap.width||13)-1-core.getHeroLoc('x'), toY = (core.bigmap.height||13)-1-core.getHeroLoc('y');\ncore.getBlockId(toX, toY) == null", "upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable", "snow": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) \n\t\t&& block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", From cb95ce4f0bd46c2bce0d37a9ccd3a77e237eaac5 Mon Sep 17 00:00:00 2001 From: oc Date: Sun, 26 Aug 2018 23:42:16 +0800 Subject: [PATCH 03/12] Download replay on R --- libs/actions.js | 13 +++++++++++++ libs/ui.js | 2 +- 更新说明.txt | 10 +++++++++- 3 files changed, 23 insertions(+), 2 deletions(-) diff --git a/libs/actions.js b/libs/actions.js index 5fa63e2b..a667031c 100644 --- a/libs/actions.js +++ b/libs/actions.js @@ -2042,6 +2042,19 @@ actions.prototype.clickReplay = function (x, y) { break; } case 2: + 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; + break; + case 3: core.ui.closePanel(); break; } diff --git a/libs/ui.js b/libs/ui.js index 0bc7eea4..958d4c0b 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1178,7 +1178,7 @@ ui.prototype.drawReplay = function () { core.lockControl(); core.status.event.id = 'replay'; this.drawChoices(null, [ - "从头回放录像", "从存档开始回放", "返回游戏" + "从头回放录像", "从存档开始回放", "下载当前录像", "返回游戏" ]); } diff --git a/更新说明.txt b/更新说明.txt index c491796f..5e78abec 100644 --- a/更新说明.txt +++ b/更新说明.txt @@ -1,4 +1,12 @@ -HTML5魔塔样板V2.3.3 +HTML5魔塔样板V2.3.4 + +大地图的支持 +修复超大数值领域导致自动寻路卡死的问题 +部分细节优化 + +----------------------------------------------------------------------- + +HTML5魔塔样板V2.3.3 将怪物特殊属性定义和伤害计算函数移动到脚本编辑中 地图编辑器可以使用矩形方式绘制地图 From adbcd4e383ccbc6944a24e7e45a5824c9620f368 Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 27 Aug 2018 00:00:24 +0800 Subject: [PATCH 04/12] Rewrite Automatic Route using PriorityQueue --- index.html | 1 + libs/control.js | 46 +++++++++++---------------- libs/thirdparty/priority-queue.min.js | 1 + 3 files changed, 20 insertions(+), 28 deletions(-) create mode 100644 libs/thirdparty/priority-queue.min.js diff --git a/index.html b/index.html index b2a606db..52b69439 100644 --- a/index.html +++ b/index.html @@ -121,6 +121,7 @@ + diff --git a/libs/control.js b/libs/control.js index 7501f365..4ac0de4f 100644 --- a/libs/control.js +++ b/libs/control.js @@ -542,9 +542,7 @@ control.prototype.setAutomaticRoute = function (destX, destY, stepPostfix) { ////// 自动寻路算法,找寻最优路径 ////// control.prototype.automaticRoute = function (destX, destY) { - var fw = core.bigmap.width; - var fh = core.bigmap.height; - var total = fw * fh; + var fw = core.bigmap.width, fh = core.bigmap.height; var startX = core.getHeroLoc('x'); var startY = core.getHeroLoc('y'); var scan = { @@ -553,31 +551,26 @@ control.prototype.automaticRoute = function (destX, destY) { 'down': {'x': 0, 'y': 1}, 'right': {'x': 1, 'y': 0} }; - var queue = []; - var nowDeep = 0; - var route = []; - var ans = [] - if (destX == startX && destY == startY) return false; - queue.push(startX + fw * startY); - queue.push(-1); - route[startX + fw * startY] = ''; - while (queue.length != 1) { - var f = queue.shift(); - if (f===-1) {nowDeep+=1;queue.push(-1);continue;} - var deep = parseInt(f/total); - if (deep!==nowDeep) {queue.push(f);continue;} - f=f%total; - var nowX = parseInt(f % fw), nowY = parseInt(f / fw); - var nowIsArrow = false, nowId, nowBlock = core.getBlock(nowX,nowY); + var route = []; + var queue = new PriorityQueue({comparator: function (a,b) { + return a.depth - b.depth; + }}); + var ans = []; + + route[startX + fw * startY] = ''; + queue.queue({depth: 0, x: startX, y: startY}); + while (queue.length!=0) { + var curr = queue.dequeue(); + var deep = curr.depth, nowX = curr.x, nowY = curr.y; + for (var direction in scan) { if (!core.canMoveHero(nowX, nowY, direction)) continue; var nx = nowX + scan[direction].x; var ny = nowY + scan[direction].y; - if (nx<0 || nx>=fw || ny<0 || ny>=fh) continue; var nid = nx + fw * ny; @@ -585,21 +578,19 @@ control.prototype.automaticRoute = function (destX, destY) { if (core.isset(route[nid])) continue; var deepAdd=1; - var nextId, nextBlock = core.getBlock(nx,ny); if (nextBlock!=null){ nextId = nextBlock.block.event.id; // 绕过亮灯(因为只有一次通行机会很宝贵) if(nextId == "light") deepAdd=100; // 绕过路障 - if (nextId.substring(nextId.length-3)=="Net") deepAdd=core.values.lavaDamage; + // if (nextId.substring(nextId.length-3)=="Net") deepAdd=core.values.lavaDamage*10; // 绕过血瓶 - if (!core.flags.potionWhileRouting && nextId.substring(nextId.length-6)=="Potion") deepAdd=20; + if (!core.flags.potionWhileRouting && nextId.substring(nextId.length-6)=="Potion") deepAdd+=20; // 绕过传送点 - if (nextBlock.block.event.trigger == 'changeFloor') deepAdd = 10; + if (nextBlock.block.event.trigger == 'changeFloor') deepAdd+=10; } - if (core.status.checkBlock.damage[nid]>0) - deepAdd = core.status.checkBlock.damage[nid]; + deepAdd+=core.status.checkBlock.damage[nid]*10; if (nx == destX && ny == destY) { route[nid] = direction; @@ -609,11 +600,10 @@ control.prototype.automaticRoute = function (destX, destY) { continue; route[nid] = direction; - queue.push(total*(nowDeep+deepAdd)+nid); + queue.queue({depth: deep+deepAdd, x: nx, y: ny}); } if (core.isset(route[destX + fw * destY])) break; } - if (!core.isset(route[destX + fw * destY])) { return false; } diff --git a/libs/thirdparty/priority-queue.min.js b/libs/thirdparty/priority-queue.min.js new file mode 100644 index 00000000..f161936f --- /dev/null +++ b/libs/thirdparty/priority-queue.min.js @@ -0,0 +1 @@ +!function(t){if("object"==typeof exports&&"undefined"!=typeof module)module.exports=t();else if("function"==typeof define&&define.amd)define([],t);else{var e;e="undefined"!=typeof window?window:"undefined"!=typeof global?global:"undefined"!=typeof self?self:this,e.PriorityQueue=t()}}(function(){return function t(e,i,r){function o(n,s){if(!i[n]){if(!e[n]){var h="function"==typeof require&&require;if(!s&&h)return h(n,!0);if(a)return a(n,!0);var u=new Error("Cannot find module '"+n+"'");throw u.code="MODULE_NOT_FOUND",u}var p=i[n]={exports:{}};e[n][0].call(p.exports,function(t){var i=e[n][1][t];return o(i?i:t)},p,p.exports,t,e,i,r)}return i[n].exports}for(var a="function"==typeof require&&require,n=0;no;)a=o+r>>>1,i(t[a],e)>=0?o=a+1:r=a;return o},e.exports=r=function(){function t(t){var e;this.options=t,this.comparator=this.options.comparator,this.data=(null!=(e=this.options.initialValues)?e.slice(0):void 0)||[],this.data.sort(this.comparator).reverse()}return t.prototype.queue=function(t){var e;e=o(this.data,t,this.comparator),this.data.splice(e,0,t)},t.prototype.dequeue=function(){return this.data.pop()},t.prototype.peek=function(){return this.data[this.data.length-1]},t.prototype.clear=function(){this.data.length=0},t}()},{}],4:[function(t,e,i){var r;e.exports=r=function(){function t(t){var e,i,r,o,a,n,s,h,u;for(this.comparator=(null!=t?t.comparator:void 0)||function(t,e){return t-e},this.pageSize=(null!=t?t.pageSize:void 0)||512,this.length=0,h=0;1<=0?n>r:r>n;i=n>=0?++r:--r)e.push(null);if(this._memory=[],this._mask=this.pageSize-1,t.initialValues)for(s=t.initialValues,o=0,a=s.length;a>o;o++)u=s[o],this.queue(u)}return t.prototype.queue=function(t){this.length+=1,this._write(this.length,t),this._bubbleUp(this.length,t)},t.prototype.dequeue=function(){var t,e;return t=this._read(1),e=this._read(this.length),this.length-=1,this.length>0&&(this._write(1,e),this._bubbleDown(1,e)),t},t.prototype.peek=function(){return this._read(1)},t.prototype.clear=function(){this.length=0,this._memory.length=0},t.prototype._write=function(t,e){var i;for(i=t>>this._shift;i>=this._memory.length;)this._memory.push(this._emptyMemoryPageTemplate.slice(0));return this._memory[i][t&this._mask]=e},t.prototype._read=function(t){return this._memory[t>>this._shift][t&this._mask]},t.prototype._bubbleUp=function(t,e){var i,r,o,a;for(i=this.comparator;t>1&&(r=t&this._mask,t3?o=t&~this._mask|r>>1:2>r?(o=t-this.pageSize>>this._shift,o+=o&~(this._mask>>1),o|=this.pageSize>>1):o=t-2,a=this._read(o),!(i(a,e)<0));)this._write(o,e),this._write(t,a),t=o},t.prototype._bubbleDown=function(t,e){var i,r,o,a,n;for(n=this.comparator;tthis._mask&&!(t&this._mask-1)?i=r=t+2:t&this.pageSize>>1?(i=(t&~this._mask)>>1,i|=t&this._mask>>1,i=i+1<0)for(t=e=1,i=this.data.length;i>=1?i>e:e>i;t=i>=1?++e:--e)this._bubbleUp(t)},t.prototype.queue=function(t){this.data.push(t),this._bubbleUp(this.data.length-1)},t.prototype.dequeue=function(){var t,e;return e=this.data[0],t=this.data.pop(),this.data.length>0&&(this.data[0]=t,this._bubbleDown(0)),e},t.prototype.peek=function(){return this.data[0]},t.prototype.clear=function(){this.length=0,this.data.length=0},t.prototype._bubbleUp=function(t){for(var e,i;t>0&&(e=t-1>>>1,this.comparator(this.data[t],this.data[e])<0);)i=this.data[e],this.data[e]=this.data[t],this.data[t]=i,t=e},t.prototype._bubbleDown=function(t){var e,i,r,o,a;for(e=this.data.length-1;;){if(i=(t<<1)+1,o=i+1,r=t,e>=i&&this.comparator(this.data[i],this.data[r])<0&&(r=i),e>=o&&this.comparator(this.data[o],this.data[r])<0&&(r=o),r===t)break;a=this.data[r],this.data[r]=this.data[t],this.data[t]=a,t=r}},t}()},{}]},{},[1])(1)}); \ No newline at end of file From 635e43d1db5c5ebdac9bd7be7eb1c186d3f8a6b9 Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 27 Aug 2018 00:31:56 +0800 Subject: [PATCH 05/12] Use disable instead of enable --- docs/api.md | 15 ++++++++++---- libs/control.js | 8 ++++---- libs/core.js | 13 ++++++++---- libs/enemys.js | 2 +- libs/events.js | 10 ++++----- libs/maps.js | 53 +++++++++++++++++++++++++++--------------------- libs/ui.js | 4 ++-- project/data.js | 2 +- project/items.js | 14 ++++++------- 9 files changed, 70 insertions(+), 51 deletions(-) diff --git a/docs/api.md b/docs/api.md index 50319569..f28da96b 100644 --- a/docs/api.md +++ b/docs/api.md @@ -184,22 +184,29 @@ core.enemyExists(x, y, id, floorId) x和y为坐标;id为怪物ID,可为null表示任意怪物;floorId为楼层ID,可忽略表示当前楼层。 -core.getBlock(x, y, floorId, needEnable) +core.getBlock(x, y, floorId, showDisable) 获得某个点的当前图块信息。 x和y为坐标;floorId为楼层ID,可忽略或null表示当前楼层。 -needEnable表示该点是否启用时才返回,其值不设置则默认为true。 +showDisable如果为true,则对于禁用的点和事件也会进行返回。 如果该点不存在图块,则返回null。 否则,返回值如下: {"index": xxx, "block": xxx} 其中index为该点在该楼层blocks数组中的索引,block为该图块实际内容。 -core.getBlockId(x, y, floorId, needEnable) +core.getBlockId(x, y, floorId, showDisable) 获得某个点的图块ID。 x和y为坐标;floorId为楼层ID,可忽略或null表示当前楼层。 -needEnable表示是否需要该点处于启用状态才返回,其值不设置则默认为true。 +showDisable如果为true,则对于禁用的点和事件也会进行返回。 如果该点不存在图块,则返回null,否则返回该点的图块ID。 +core.getBlockCls(x, y, floorId, showDisable) +获得某个点的图块cls。 +x和y为坐标;floorId为楼层ID,可忽略或null表示当前楼层。 +showDisable如果为true,则对于禁用的点和事件也会进行返回。 +如果该点不存在图块,则返回null,否则返回该点的图块cls。 + + core.showBlock(x, y, floorId) 将某个点从禁用变成启用状态。 diff --git a/libs/control.js b/libs/control.js index 4ac0de4f..1cc0347e 100644 --- a/libs/control.js +++ b/libs/control.js @@ -1164,14 +1164,14 @@ control.prototype.updateCheckBlock = function() { core.status.checkBlock.map = []; // 记录怪物地图 for (var n=0;n=0 && nx=0 && ny=0 && nx=0 && ny0) @@ -1568,7 +1568,7 @@ control.prototype.updateFg = function () { for (var b = 0; b < mapBlocks.length; b++) { var x = mapBlocks[b].x, y = mapBlocks[b].y; if (core.isset(mapBlocks[b].event) && mapBlocks[b].event.cls.indexOf('enemy')==0 - && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable)) { + && !mapBlocks[b].disable) { // 非系统默认的战斗事件(被覆盖) if (mapBlocks[b].event.trigger != 'battle') { diff --git a/libs/core.js b/libs/core.js index c18777a7..8bca255a 100644 --- a/libs/core.js +++ b/libs/core.js @@ -666,13 +666,18 @@ core.prototype.enemyExists = function (x, y, id,floorId) { } ////// 获得某个点的block ////// -core.prototype.getBlock = function (x, y, floorId, needEnable) { - return core.maps.getBlock(x,y,floorId,needEnable); +core.prototype.getBlock = function (x, y, floorId, showDisable) { + return core.maps.getBlock(x,y,floorId,showDisable); } ////// 获得某个点的blockId ////// -core.prototype.getBlockId = function (x, y, floorId, needEnable) { - return core.maps.getBlockId(x, y, floorId, needEnable); +core.prototype.getBlockId = function (x, y, floorId, showDisable) { + return core.maps.getBlockId(x, y, floorId, showDisable); +} + +////// 获得某个点的blockCls ////// +core.prototype.getBlockCls = function (x, y, floorId, showDisable) { + return core.maps.getBlockCls(x, y, floorId, showDisable); } ////// 显示移动某块的动画,达到{“type”:”move”}的效果 ////// diff --git a/libs/enemys.js b/libs/enemys.js index 058389a4..d7e0d5d0 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -228,7 +228,7 @@ enemys.prototype.getCurrentEnemys = function (floorId) { var used = {}; var mapBlocks = core.status.maps[floorId].blocks; for (var b = 0; b < mapBlocks.length; b++) { - if (core.isset(mapBlocks[b].event) && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable) + if (core.isset(mapBlocks[b].event) && !mapBlocks[b].disable && mapBlocks[b].event.cls.indexOf('enemy')==0) { var enemyId = mapBlocks[b].event.id; if (core.isset(used[enemyId])) continue; diff --git a/libs/events.js b/libs/events.js index 718f3ec3..699c854e 100644 --- a/libs/events.js +++ b/libs/events.js @@ -1026,7 +1026,7 @@ events.prototype.trigger = function (x, y) { var mapBlocks = core.status.thisMap.blocks; var noPass; for (var b = 0; b < mapBlocks.length; b++) { - if (mapBlocks[b].x == x && mapBlocks[b].y == y && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable)) { // 启用事件 + if (mapBlocks[b].x == x && mapBlocks[b].y == y && !mapBlocks[b].disable) { // 启用事件 noPass = mapBlocks[b].event && mapBlocks[b].event.noPass; if (noPass) { core.clearAutomaticRouteNode(x, y); @@ -1102,7 +1102,7 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback else { var blocks = core.status.maps[floorId].blocks; for (var i in blocks) { - if (core.isset(blocks[i].event) && !(core.isset(blocks[i].enable) && !blocks[i].enable) && blocks[i].event.id === stair) { + if (core.isset(blocks[i].event) && !blocks[i].disable && blocks[i].event.id === stair) { heroLoc.x = blocks[i].x; heroLoc.y = blocks[i].y; break; @@ -1179,9 +1179,9 @@ events.prototype.changeFloor = function (floorId, stair, heroLoc, time, callback // 检查重生 if (!core.isset(fromLoad)) { core.status.maps[floorId].blocks.forEach(function(block) { - if (core.isset(block.enable) && !block.enable && core.isset(block.event) && block.event.cls.indexOf('enemy')==0 + if (block.disable && core.isset(block.event) && block.event.cls.indexOf('enemy')==0 && core.enemys.hasSpecial(core.material.enemys[block.event.id].special, 23)) { - block.enable = true; + block.disable = false; } }) } @@ -1617,7 +1617,7 @@ events.prototype.pushBox = function (data) { if (nx<0||nx>=core.bigmap.width||ny<0||ny>=core.bigmap.height) return; - var block = core.getBlock(nx, ny, null, false); + var block = core.getBlock(nx, ny, null, true); if (block!=null && !(core.isset(block.block.event) && block.block.event.id=='flower')) return; diff --git a/libs/maps.js b/libs/maps.js index 3368d423..be066c67 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -43,21 +43,21 @@ maps.prototype.loadFloor = function (floorId, map) { ////// 数字和ID的对应关系 ////// maps.prototype.initBlock = function (x, y, id) { - var enable=null; + var disable=null; id = ""+id; if (id.length>2) { if (id.indexOf(":f")==id.length-2) { id = id.substring(0, id.length - 2); - enable = false; + disable = false; } else if (id.indexOf(":t")==id.length-2) { id = id.substring(0, id.length - 2); - enable = true; + disable = true; } } id=parseInt(id); var tmp = {'x': x, 'y': y, 'id': id}; - if (enable!=null) tmp.enable = enable; + if (disable!=null) tmp.disable = disable; if (id in this.blocksInfo) tmp.event = JSON.parse(JSON.stringify(this.blocksInfo[id])); @@ -113,8 +113,8 @@ maps.prototype.addEvent = function (block, x, y, event) { block.event.noPass = event.noPass; // 覆盖enable - if (!core.isset(block.enable) && core.isset(event.enable)) { - block.enable=event.enable; + if (!core.isset(block.disable) && core.isset(event.enable)) { + block.disable=!event.enable; } // 覆盖trigger if (!core.isset(block.event.trigger)) { @@ -126,7 +126,7 @@ maps.prototype.addEvent = function (block, x, y, event) { } // 覆盖其他属性 for (var key in event) { - if (key!="enable" && key!="trigger" && key!="noPass" && core.isset(event[key])) { + if (key!="disable" && key!="trigger" && key!="noPass" && core.isset(event[key])) { block.event[key]=core.clone(event[key]); } } @@ -171,8 +171,8 @@ maps.prototype.save = function(maps, floorId) { } } thisFloor.blocks.forEach(function (block) { - if (core.isset(block.enable)) { - if (block.enable) blocks[block.y][block.x] = block.id+":t"; + if (core.isset(block.disable)) { + if (!block.disable) blocks[block.y][block.x] = block.id+":t"; else blocks[block.y][block.x] = block.id+":f"; } else blocks[block.y][block.x] = block.id; @@ -218,7 +218,7 @@ maps.prototype.getMapArray = function (blockArray,width,height){ } } blockArray.forEach(function (block) { - if (!(core.isset(block.enable) && !block.enable)) + if (!block.disable) blocks[block.y][block.x] = block.id; }); return blocks; @@ -404,7 +404,7 @@ maps.prototype.drawMap = function (mapName, callback) { for (var b = 0; b < mapBlocks.length; b++) { // 事件启用 var block = mapBlocks[b]; - if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) { + if (core.isset(block.event) && !block.disable) { if (block.event.cls == 'autotile') { core.drawAutotile(core.canvas.event, mapArray, block, 32, 0, 0); } @@ -567,13 +567,12 @@ maps.prototype.enemyExists = function (x, y, id,floorId) { } ////// 获得某个点的block ////// -maps.prototype.getBlock = function (x, y, floorId, needEnable) { +maps.prototype.getBlock = function (x, y, floorId, showDisable) { if (!core.isset(floorId)) floorId=core.status.floorId; - if (!core.isset(needEnable)) needEnable=true; var blocks = core.status.maps[floorId].blocks; for (var n=0;n=core.bigmap.width || y<0 || y>=core.bigmap.height) return; - var originBlock=core.getBlock(x,y,floorId,false); + var originBlock=core.getBlock(x,y,floorId,true); var block = core.maps.initBlock(x,y,number); core.maps.addInfo(block); core.maps.addEvent(block,x,y,core.floors[floorId].events[x+","+y]); diff --git a/libs/ui.js b/libs/ui.js index 958d4c0b..73af00ee 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -1803,7 +1803,7 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, cente var mapArray = core.maps.getMapArray(blocks,mw,mh); for (var b in blocks) { var block = blocks[b]; - if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable)) { + if (core.isset(block.event) && !block.disable) { if (block.event.cls == 'autotile') { core.drawAutotile(tempCanvas, mapArray, block, 32, 0, 0); } @@ -1925,7 +1925,7 @@ ui.prototype.drawStatistics = function () { if (floor.cannotViewMap && floorId!=core.status.floorId) return; blocks.forEach(function (block) { - if (!core.isset(block.event) || (core.isset(block.enable) && !block.enable)) + if (!core.isset(block.event) || block.disable) return; var event = block.event; if (event.cls.indexOf("enemy")==0) { diff --git a/project/data.js b/project/data.js index eba61dc1..82bad9b6 100644 --- a/project/data.js +++ b/project/data.js @@ -2,7 +2,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = { "main" : { "floorIds" : [ - "MT0" + "MT0", "sample0", "sample1", "sample2" ], "images" : [ "bg.jpg" diff --git a/project/items.js b/project/items.js index a0236f61..8b9cbd9f 100644 --- a/project/items.js +++ b/project/items.js @@ -315,16 +315,16 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "canUseItemEffect": { "book": "true", "fly": "core.status.hero.flyRange.indexOf(core.status.floorId)>=0", - "pickaxe": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) \n\t\t&& Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1\n\t\t&& (block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙\n\t{\n\t\t// 四个方向\n\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", - "icePickaxe": "var able=false;\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\tcore.status.event.data = [i];\n\t\table=true;\n\t}\n}\nable", - "bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", - "hammer": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", - "earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) // 能炸的墙壁\n ids.push(i);\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable", + "pickaxe": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable \n\t\t&& Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1\n\t\t&& (block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙\n\t{\n\t\t// 四个方向\n\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", + "icePickaxe": "var able=false;\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\tcore.status.event.data = [i];\n\t\table=true;\n\t}\n}\nable", + "bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", + "hammer": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", + "earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !block.disable && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) // 能炸的墙壁\n ids.push(i);\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable", "centerFly": "var toX = (core.bigmap.width||13)-1-core.getHeroLoc('x'), toY = (core.bigmap.height||13)-1-core.getHeroLoc('y');\ncore.getBlockId(toX, toY) == null", "upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable", - "snow": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) \n\t\t&& block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", - "bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.id == 'yellowDoor') {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable", + "snow": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable \n\t\t&& block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", + "bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !block.disable && block.event.id == 'yellowDoor') {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable", "poisonWine": "core.hasFlag('poison')", "weakWine": "core.hasFlag('weak')", "curseWine": "core.hasFlag('curse')", From d1be1ea49c43e9734c0c8d6f61eb3aa579c3e693 Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 27 Aug 2018 00:38:51 +0800 Subject: [PATCH 06/12] Item effects of bigmap --- project/items.js | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/project/items.js b/project/items.js index 8b9cbd9f..39f7089e 100644 --- a/project/items.js +++ b/project/items.js @@ -315,15 +315,15 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "canUseItemEffect": { "book": "true", "fly": "core.status.hero.flyRange.indexOf(core.status.floorId)>=0", - "pickaxe": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable \n\t\t&& Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1\n\t\t&& (block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙\n\t{\n\t\t// 四个方向\n\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", + "pickaxe": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1\n\t\t&& (block.event.id == 'yellowWall' || block.event.id=='whiteWall' || block.event.id=='blueWall')) // 能破哪些墙\n\t{\n\t\t// 四个方向\n\t\tif (core.flags.pickaxeFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", "icePickaxe": "var able=false;\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.x==core.nextX() && block.y==core.nextY() && block.event.id=='ice') {\n\t\tcore.status.event.data = [i];\n\t\table=true;\n\t}\n}\nable", - "bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", + "bomb": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY()))\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", "hammer": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable && block.event.cls.indexOf('enemy')==0 && \n\t\tMath.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tvar enemy = core.material.enemys[block.event.id];\n\t\tif (core.isset(enemy) && enemy.notBomb) continue;\n\t\tif (block.x==core.nextX() && block.y==core.nextY())\n\t\t\tids.push(i);\n\t\telse\n\t\t\tid2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", "earthquake": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !block.disable && (block.event.id == 'yellowWall' || block.event.id == 'blueWall' || block.event.id == 'whiteWall')) // 能炸的墙壁\n ids.push(i);\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable", "centerFly": "var toX = (core.bigmap.width||13)-1-core.getHeroLoc('x'), toY = (core.bigmap.height||13)-1-core.getHeroLoc('y');\ncore.getBlockId(toX, toY) == null", - "upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tif (core.getBlock(toX, toY, toId)==null) {\n\t\tcore.status.event.data = {'id': toId, 'x': toX, 'y': toY};\n\t\table=true;\n\t}\n}\nable", - "snow": "var able=false;\nvar ids = [], id2s = [];\nfor (var i in core.status.thisMap.blocks) {\n\tvar block = core.status.thisMap.blocks[i];\n\tif (core.isset(block.event) && !block.disable \n\t\t&& block.event.id == 'lava' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) {\n\t\tif (core.flags.snowFourDirections || (block.x == core.nextX() && block.y == core.nextY()))\n\t\t\tids.push(i);\n\t\telse id2s.push(i);\n\t}\n}\nif (ids.length>0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", + "upFly": "var able=false;\nvar floorId = core.status.floorId, index = core.floorIds.indexOf(floorId);\nif (index=0 && toX=0 && toY0) {\n\tvar toId = core.floorIds[index-1], toX = core.getHeroLoc('x'), toY = core.getHeroLoc('y');\n\tvar mw = core.floors[toId].width||13, mh = core.floors[toId].height||13;\n\tif (toX>=0 && toX=0 && toY0) {\n\tcore.status.event.data = ids;\n\table=true;\n}\nelse if (id2s.length==1) {\n\tcore.status.event.data = id2s;\n\table=true;\n}\nable", "bigKey": "var able=false;\nvar ids = [];\nfor (var i in core.status.thisMap.blocks) {\n var block = core.status.thisMap.blocks[i];\n if (core.isset(block.event) && !block.disable && block.event.id == 'yellowDoor') {\n ids.push(i);\n }\n}\nif (ids.length>0) {\n core.status.event.data = ids;\n able=true;\n}\nable", "poisonWine": "core.hasFlag('poison')", "weakWine": "core.hasFlag('weak')", From 08ade77c2296ebbce8319bb7817f4659bef018fa Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 27 Aug 2018 00:51:38 +0800 Subject: [PATCH 07/12] Item effects of bigmap --- project/items.js | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/project/items.js b/project/items.js index 39f7089e..05fc0df0 100644 --- a/project/items.js +++ b/project/items.js @@ -343,6 +343,6 @@ items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "shiled5": "true", "shield5": "true", "lifeWand": "true", - "jumpShoes": "var nx=core.nextX(2),ny=core.nextY(2);nx>=0&&nx<=12&&ny>=0&&ny<=12&&core.getBlock(nx,ny)==null" + "jumpShoes": "var nx=core.nextX(2),ny=core.nextY(2);nx>=0&&nx=0&&ny Date: Mon, 27 Aug 2018 01:01:24 +0800 Subject: [PATCH 08/12] Add arrow keys --- _server/editor.js | 12 ++++++++++++ 1 file changed, 12 insertions(+) diff --git a/_server/editor.js b/_server/editor.js index 08795309..c94747e7 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -591,6 +591,18 @@ editor.prototype.listen = function () { editor.changeFloor(toId); } } + if (e.keyCode==37) { + editor.moveViewport(-1, 0); + } + if (e.keyCode==38) { + editor.moveViewport(0, -1); + } + if (e.keyCode==39) { + editor.moveViewport(1, 0); + } + if (e.keyCode==40) { + editor.moveViewport(0, 1); + } } var dataSelection = document.getElementById('dataSelection'); From fb540a6976c665e2057094494dbe26da663ad722 Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 27 Aug 2018 01:36:00 +0800 Subject: [PATCH 09/12] Create bigmap --- _server/editor.js | 30 ++++++++++++++++++------------ _server/editor_file.js | 16 +++++++++++++--- _server/editor_mode.js | 6 ++++++ editor.html | 6 +++++- 4 files changed, 42 insertions(+), 16 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index c94747e7..0df9b22c 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -511,6 +511,24 @@ editor.prototype.listen = function () { } } + /* + document.getElementById('mid').onkeydown = function (e) { + console.log(e); + if (e.keyCode==37) { + editor.moveViewport(-1, 0); + } + if (e.keyCode==38) { + editor.moveViewport(0, -1); + } + if (e.keyCode==39) { + editor.moveViewport(1, 0); + } + if (e.keyCode==40) { + editor.moveViewport(0, 1); + } + } + */ + document.getElementById('mid').onmousewheel = function (e) { e.preventDefault(); var wheel = function (direct) { @@ -591,18 +609,6 @@ editor.prototype.listen = function () { editor.changeFloor(toId); } } - if (e.keyCode==37) { - editor.moveViewport(-1, 0); - } - if (e.keyCode==38) { - editor.moveViewport(0, -1); - } - if (e.keyCode==39) { - editor.moveViewport(1, 0); - } - if (e.keyCode==40) { - editor.moveViewport(0, 1); - } } var dataSelection = document.getElementById('dataSelection'); diff --git a/_server/editor_file.js b/_server/editor_file.js index 46b2fe6b..4f534d2a 100644 --- a/_server/editor_file.js +++ b/_server/editor_file.js @@ -83,12 +83,21 @@ editor_file = function (editor, callback) { } */ var filename = 'project/floors/' + editor.currentFloorId + '.js'; var datastr = ['main.floors.', editor.currentFloorId, '=\n{']; - if (editor.currentFloorData.map == 'new') + if (editor.currentFloorData.map == 'new') { + /* editor.currentFloorData.map = editor.map.map(function (v) { return v.map(function () { return 0 }) }); + */ + var width = parseInt(document.getElementById('newMapWidth').value); + var height = parseInt(document.getElementById('newMapHeight').value); + var row = []; + for (var i=0;i1000) { + printe("新建地图的宽高都不得小于13,且宽高之积不能超过1000"); + return; + } editor_mode.onmode(''); editor.file.saveNewFile(newFileName.value, function (err) { diff --git a/editor.html b/editor.html index c52708fb..32610082 100644 --- a/editor.html +++ b/editor.html @@ -23,7 +23,11 @@
- + + + + + 保留楼层属性
From 5e5c653b81f2c7637f6c44037822e98ab783ba4e Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 27 Aug 2018 01:39:54 +0800 Subject: [PATCH 10/12] Create bigmap --- editor-mobile.html | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/editor-mobile.html b/editor-mobile.html index e7092229..73bc757a 100644 --- a/editor-mobile.html +++ b/editor-mobile.html @@ -24,9 +24,13 @@
- + + + + + - 保留楼层属性 + 保留属性
From 373e6a281eee70151184230cfe951042f71ffcab Mon Sep 17 00:00:00 2001 From: oc Date: Mon, 27 Aug 2018 01:59:56 +0800 Subject: [PATCH 11/12] Fix mapIntoBlocks bug --- _server/editor.js | 6 +++--- libs/maps.js | 8 ++++---- 2 files changed, 7 insertions(+), 7 deletions(-) diff --git a/_server/editor.js b/_server/editor.js index 0df9b22c..4e5c516d 100644 --- a/_server/editor.js +++ b/_server/editor.js @@ -18,9 +18,9 @@ editor.prototype.init = function (callback) { return editor.ids[[editor.indexs[parseInt(v)][0]]] }) }); - editor.updateMap(); editor.currentFloorId = core.status.floorId; editor.currentFloorData = core.floors[core.status.floorId]; + editor.updateMap(); editor.buildMark(); editor.drawEventBlock(); if (Boolean(callback)) callback(); @@ -229,7 +229,7 @@ editor.prototype.updateMap = function () { return v.map(function (v) { return v.idnum || v || 0 }) - }), {'events': {}, 'changeFloor': {}}); + }), {'events': {}, 'changeFloor': {}}, editor.currentFloorId); core.status.thisMap.blocks = blocks; main.editor.updateMap(); @@ -340,9 +340,9 @@ editor.prototype.changeFloor = function (floorId, callback) { return editor.ids[[editor.indexs[parseInt(v)][0]]] }) }); - editor.updateMap(); editor.currentFloorId = core.status.floorId; editor.currentFloorData = core.floors[core.status.floorId]; + editor.updateMap(); editor_mode.floor(); editor.drawEventBlock(); if (core.isset(callback)) callback(); diff --git a/libs/maps.js b/libs/maps.js index be066c67..82aa04bb 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -16,7 +16,7 @@ maps.prototype.loadFloor = function (floorId, map) { content['title'] = floor.title; content['canFlyTo'] = floor.canFlyTo; if (!core.isset(map)) map=floor.map; - var mapIntoBlocks = function(map,maps,floor){ + var mapIntoBlocks = function(map,maps,floor,floorId){ var blocks = []; var mw = core.floors[floorId].width || 13; var mh = core.floors[floorId].height || 13; @@ -32,12 +32,12 @@ maps.prototype.loadFloor = function (floorId, map) { return blocks; } if (main.mode=='editor'){ - main.editor.mapIntoBlocks = function(map,floor){ - return mapIntoBlocks(map,core.maps,floor); + main.editor.mapIntoBlocks = function(map,floor,floorId){ + return mapIntoBlocks(map,core.maps,floor,floorId); } } // 事件处理 - content['blocks'] = mapIntoBlocks(map,this,floor); + content['blocks'] = mapIntoBlocks(map,this,floor,floorId); return content; } From 4c94243e98a8cf3748a52619e2c057e0ad936eee Mon Sep 17 00:00:00 2001 From: ckcz123 Date: Mon, 27 Aug 2018 13:55:21 +0800 Subject: [PATCH 12/12] Finish Bigmap --- libs/control.js | 11 +- libs/events.js | 23 +- libs/maps.js | 56 ++--- project/data.js | 4 +- project/floors/MT0.js | 79 +++---- project/floors/sample2.js | 458 ++++---------------------------------- 6 files changed, 134 insertions(+), 497 deletions(-) diff --git a/libs/control.js b/libs/control.js index 1cc0347e..4a3f2468 100644 --- a/libs/control.js +++ b/libs/control.js @@ -912,9 +912,14 @@ control.prototype.jumpHero = function (ex, ey, time, callback) { var animate=window.setInterval(function() { if (jump_count>0) { - core.clearMap('hero', drawX(), drawY()-height+32, 32, height); + core.clearMap('hero', drawX()-core.bigmap.offsetX, drawY()-height+32-core.bigmap.offsetY, 32, height); updateJump(); - core.canvas.hero.drawImage(core.material.images.hero, heroIcon[status] * 32, heroIcon.loc * height, 32, height, drawX(), drawY() + 32-height, 32, height); + var nowx = drawX(), nowy = drawY(); + core.bigmap.offsetX = core.clamp(nowx - 32*6, 0, 32*core.bigmap.width-416); + core.bigmap.offsetY = core.clamp(nowy - 32*6, 0, 32*core.bigmap.height-416); + core.control.updateViewport(); + core.canvas.hero.drawImage(core.material.images.hero, heroIcon[status] * 32, heroIcon.loc * height, 32, height, + nowx - core.bigmap.offsetX, nowy + 32-height - core.bigmap.offsetY, 32, height); } else { clearInterval(animate); @@ -1034,7 +1039,7 @@ control.prototype.drawHero = function (direction, x, y, status, offset) { if (core.isset(core.status.hero.followers)) { var index=1; core.status.hero.followers.forEach(function (t) { - core.canvas.hero.clearRect(32*t.x-32, 32*t.y-32, 96, 96); + core.canvas.hero.clearRect(32*t.x-core.bigmap.offsetX-32, 32*t.y-core.bigmap.offsetY-32, 96, 96); if (core.isset(core.material.images.images[t.img])) { drawObjs.push({ "img": core.material.images.images[t.img], diff --git a/libs/events.js b/libs/events.js index 699c854e..7b26bf36 100644 --- a/libs/events.js +++ b/libs/events.js @@ -587,8 +587,12 @@ events.prototype.doAction = function() { break; case "openDoor": // 开一个门,包括暗墙 { + if (core.isset(data.loc)) { + x = core.calValue(data.loc[0]); + y = core.calValue(data.loc[1]); + } var floorId=data.floorId || core.status.floorId; - var block=core.getBlock(core.calValue(data.loc[0]), core.calValue(data.loc[1]), floorId); + var block=core.getBlock(x, y, floorId); if (block!=null) { if (floorId==core.status.floorId) core.openDoor(block.block.event.id, block.block.x, block.block.y, false, function() { @@ -1328,13 +1332,16 @@ events.prototype.vibrate = function(time, callback) { core.status.replay.animate=true; - var setGameCanvasTranslate=function(x,y){ + var addGameCanvasTranslate=function(x,y){ for(var ii=0,canvas;canvas=core.dom.gameCanvas[ii];ii++){ - if(['data','ui'].indexOf(canvas.getAttribute('id'))!==-1)continue; - canvas.style.transform='translate('+x+'px,'+y+'px)'; - canvas.style.webkitTransform='translate('+x+'px,'+y+'px)'; - canvas.style.OTransform='translate('+x+'px,'+y+'px)'; - canvas.style.MozTransform='translate('+x+'px,'+y+'px)'; + var id = canvas.getAttribute('id'); + if (id=='ui' || id=='data') continue; + var offsetX = x, offsetY = y; + if (core.bigmap.canvas.indexOf(id)>=0) { + offsetX-=core.bigmap.offsetX; + offsetY-=core.bigmap.offsetY; + } + core.control.setGameCanvasTranslate(id, offsetX, offsetY); } } @@ -1368,7 +1375,7 @@ events.prototype.vibrate = function(time, callback) { var animate=setInterval(function(){ update(); - setGameCanvasTranslate(shake,0); + addGameCanvasTranslate(shake, 0); if(shake_duration===0) { clearInterval(animate); core.status.replay.animate=false; diff --git a/libs/maps.js b/libs/maps.js index 82aa04bb..d496a9c7 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -464,8 +464,8 @@ maps.prototype.drawAutotile = function(ctx, mapArr, block, size, left, top){ var sx = 16*((index-1)%6), sy = 16*(~~((index-1)/6)); ctx.drawImage(autotileImg, sx, sy, 16, 16, dx, dy, size/2, size/2); } - var getAutotileAroundId = function(currId, x, y){ - if(x<0 || y<0 || x>=core.bigmap.width || y>=core.bigmap.height) return 1; + var getAutotileAroundId = function(currId, x, y) { + if(x<0 || y<0 || x>=mapArr[0].length || y>=mapArr.length) return 1; else return mapArr[y][x]==currId ? 1:0; } var checkAround = function(x, y){ // 得到周围四个32*32块(周围每块都包含当前块的1/4,不清楚的话画下图你就明白)的数组索引 @@ -599,7 +599,7 @@ maps.prototype.getBlockCls = function (x, y, floorId, showDisable) { maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) { time = time || 500; - core.clearMap('animate'); + core.clearMap('route'); var block = core.getBlock(x,y); if (block==null) {// 不存在 @@ -622,8 +622,8 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) { var height = block.event.height || 32; var opacityVal = 1; - core.setOpacity('animate', opacityVal); - core.canvas.animate.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height); + core.setOpacity('route', opacityVal); + core.canvas.route.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height); // 要运行的轨迹:将steps展开 var moveSteps=[]; @@ -668,13 +668,13 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) { if (moveSteps.length==0) { if (keep) opacityVal=0; else opacityVal -= 0.06; - core.setOpacity('animate', opacityVal); - core.clearMap('animate', nowX, nowY-height+32, 32, height); - core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height); + core.setOpacity('route', opacityVal); + core.clearMap('route', nowX, nowY-height+32, 32, height); + core.canvas.route.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height); if (opacityVal<=0) { clearInterval(animate); - core.clearMap('animate'); - core.setOpacity('animate', 1); + core.clearMap('route'); + core.setOpacity('route', 1); // 不消失 if (keep) { core.setBlock(id, nowX/32, nowY/32); @@ -689,9 +689,9 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) { step++; nowX+=scan[moveSteps[0]].x*2; nowY+=scan[moveSteps[0]].y*2; - core.clearMap('animate', nowX-32, nowY-32, 96, 96); + core.clearMap('route', nowX-32, nowY-32, 96, 96); // 绘制 - core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height); + core.canvas.route.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height); if (step==16) { // 该移动完毕,继续 step=0; @@ -704,7 +704,7 @@ maps.prototype.moveBlock = function(x,y,steps,time,keep,callback) { ////// 显示跳跃某块的动画,达到{"type":"jump"}的效果 ////// maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) { time = time || 500; - core.clearMap('animate'); + core.clearMap('route'); var block = core.getBlock(sx,sy); if (block==null) { if (core.isset(callback)) callback(); @@ -725,8 +725,8 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) { var height = block.event.height || 32; var opacityVal = 1; - core.setOpacity('animate', opacityVal); - core.canvas.animate.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height); + core.setOpacity('route', opacityVal); + core.canvas.route.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height); core.playSound('jump.mp3'); @@ -767,20 +767,20 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) { } if (jump_count>0) { - core.clearMap('animate', drawX(), drawY()-height+32, 32, height); + core.clearMap('route', drawX(), drawY()-height+32, 32, height); updateJump(); - core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height); + core.canvas.route.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height); } else { if (keep) opacityVal=0; else opacityVal -= 0.06; - core.setOpacity('animate', opacityVal); - core.clearMap('animate', drawX(), drawY()-height+32, 32, height); - core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height); + core.setOpacity('route', opacityVal); + core.clearMap('route', drawX(), drawY()-height+32, 32, height); + core.canvas.route.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, drawX(), drawY()-height+32, 32, height); if (opacityVal<=0) { clearInterval(animate); - core.clearMap('animate'); - core.setOpacity('animate', 1); + core.clearMap('route'); + core.setOpacity('route', 1); if (keep) { core.setBlock(id, ex, ey); core.showBlock(ex, ey); @@ -797,7 +797,7 @@ maps.prototype.jumpBlock = function(sx,sy,ex,ey,time,keep,callback) { maps.prototype.animateBlock = function (loc,type,time,callback) { if (type!='hide') type='show'; - core.clearMap('animate'); + core.clearMap('route'); if (typeof loc[0] == 'number' && typeof loc[1] == 'number') loc = [loc]; @@ -822,24 +822,24 @@ maps.prototype.animateBlock = function (loc,type,time,callback) { core.status.replay.animate=true; var draw = function () { list.forEach(function (t) { - core.canvas.animate.drawImage(t.blockImage, 0, t.blockIcon*t.height, 32, t.height, t.x*32, t.y*32+32-t.height, 32, t.height); + core.canvas.route.drawImage(t.blockImage, 0, t.blockIcon*t.height, 32, t.height, t.x*32, t.y*32+32-t.height, 32, t.height); }) } var opacityVal = 0; if (type=='hide') opacityVal=1; - core.setOpacity('animate', opacityVal); + core.setOpacity('route', opacityVal); draw(); var animate = window.setInterval(function () { if (type=='show') opacityVal += 0.1; else opacityVal -= 0.1; - core.setOpacity('animate', opacityVal); + core.setOpacity('route', opacityVal); if (opacityVal >=1 || opacityVal<=0) { clearInterval(animate); - core.clearMap('animate'); - core.setOpacity('animate', 1); + core.clearMap('route'); + core.setOpacity('route', 1); core.status.replay.animate=false; if (core.isset(callback)) callback(); } diff --git a/project/data.js b/project/data.js index 82bad9b6..f01f9468 100644 --- a/project/data.js +++ b/project/data.js @@ -2,7 +2,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = { "main" : { "floorIds" : [ - "MT0", "sample0", "sample1", "sample2" + "sample0", "sample1", "sample2", "MT0" ], "images" : [ "bg.jpg" @@ -28,7 +28,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "title": "魔塔样板", "name": "template", "version": "Ver 2.3.3", - "floorId": "MT0", + "floorId": "sample0", "hero": { "name": "阳光", 'lv': 1, diff --git a/project/floors/MT0.js b/project/floors/MT0.js index 020496b8..0b5151b5 100644 --- a/project/floors/MT0.js +++ b/project/floors/MT0.js @@ -1,50 +1,35 @@ main.floors.MT0= { -"floorId": "MT0", -"title": "主塔 0 层", -"name": "0", -"canFlyTo": true, -"canUseQuickShop": true, -"cannotViewMap": false, -"defaultGround": "ground", -"images": [], -"item_ratio": 1, -"map": [ - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], - [ 0, 0, 0, 0, 1, 1, 45, 0, 1, 0,202,202, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0], - [ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], - [ 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0], - [ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0], - [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] -], -"width":26, -"height":26, -"firstArrive": [], -"events": {}, -"changeFloor": {}, -"afterBattle": {}, -"afterGetItem": {}, -"afterOpenDoor": {}, -"cannotMove": {}, -"upFloor": null, + "floorId": "MT0", + "title": "主塔 0 层", + "name": "0", + "canFlyTo": true, + "canUseQuickShop": true, + "cannotViewMap": false, + "defaultGround": "ground", + "images": [], + "item_ratio": 1, + "map": [ + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] + ], + "firstArrive": [], + "events": {}, + "changeFloor": {}, + "afterBattle": {}, + "afterGetItem": {}, + "afterOpenDoor": {}, + "cannotMove": {}, + "upFloor": null, } \ No newline at end of file diff --git a/project/floors/sample2.js b/project/floors/sample2.js index 5db5310c..04dd70aa 100644 --- a/project/floors/sample2.js +++ b/project/floors/sample2.js @@ -1,410 +1,50 @@ -main.floors.sample2 = +main.floors.sample2= { - "floorId": "sample2", // 这里需要改楼层名,请和文件名及下面的floorId保持完全一致 - // 楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 - // 推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等 - // 楼层唯一标识符,需要和名字完全一致 - "title": "主塔 40 层", // 楼层中文名 - "name": "40", // 显示在状态栏中的层数 - "canFlyTo": false, // 该楼能否被楼传器飞到(不能的话在该楼也不允许使用楼传器) - "canUseQuickShop": true, // 该层是否允许使用快捷商店 - "defaultGround": "snowGround", // 默认地面的图块ID(terrains中) - "images": [], // // 该层默认显示的所有图片;详细用法请查看文档“自定义素材”中的说明。 - "color": [255,0,0,0.3], // 该层的默认画面色调。本项可不写(代表无色调),如果写需要是一个RGBA数组。 - "weather": ["rain",10], // 该层的默认天气。本项可忽略表示晴天,如果写则第一项为"rain"或"snow"代表雨雪,第二项为1-10之间的数代表强度。 - "bgm": "bgm.mp3", // 到达该层后默认播放的BGM。本项可忽略。 - "item_ratio": 1, // 该层的宝石/血瓶倍率 - "map": [ // 地图数据,需要是13x13,建议使用地图生成器来生成 - [ 5, 5, 5, 5, 5, 5, 87, 5, 5, 5, 5, 5, 5], - [ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5], - [ 5, 4, 4, 4, 4, 1, 85, 1, 4, 4, 4, 4, 5], - [ 5, 4, 4, 4,247, 1,247, 1,247, 4, 4, 4, 5], - [ 5, 4, 4, 4, 1,247,247,247, 1, 4, 4, 4, 5], - [ 5, 4, 4, 4, 1,247, 30,247, 1, 4, 4, 4, 5], - [ 5, 4, 4, 4,247, 1,124, 1,247, 4, 4, 4, 5], - [ 5, 4, 4, 4, 4, 1,123, 1, 4, 4, 4, 4, 5], - [ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5], - [ 5, 4, 4, 4, 4, 1, 0, 1, 4, 4, 4, 4, 5], - [ 5, 4, 4, 4, 4, 4, 0, 4, 4, 4, 4, 4, 5], - [ 5, 4, 4, 4, 4, 4, 85, 4, 4, 4, 4, 4, 5], - [ 5, 5, 5, 5, 5, 5, 88, 5, 5, 5, 5, 5, 5] - ], - "firstArrive": [ // 第一次到该楼层触发的事件 - "\t[实战!]本楼将尝试复刻《宿命的旋律》40F剧情。" - ], - "events": { // 该楼的所有可能事件列表 - - "6,11": {"enable": false}, // 下楼梯口的机关门,初始处于关闭状态 - "6,10": [ // 进入陷阱后关门 - {"type": "playSound", "name": "door.mp3"}, - {"type": "show", "loc": [6,11]}, // 显示机关门 - {"type": "hide"}, // 隐藏该事件 - {"type": "trigger", "loc": [6,7]}, // 直接引发"6,7"处的事件,即下面的杰克 - // 请再次注意"trigger"会立刻结束当前事件,因此"type":"hide"需要在trigger前调用 - ], - "6,7": [ // 杰克事件 - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]杰克,你究竟是什么人?", - {"type": "playSound", "name": "item.mp3"}, - "\t[杰克,thief]……", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]我们……是朋友对吧?\n是朋友就应该相互信任对吧?", - {"type": "playSound", "name": "item.mp3"}, - "\t[杰克,thief]……事到如今也没有什么好隐瞒的了。", - {"type": "playSound", "name": "item.mp3"}, - "\t[杰克,thief]没错,我就是这一切的背后主谋。", - {"type": "move", "steps": [ // 移动到黑暗大法师的位置;使用move会自动调用hide进行隐藏,无需再手动调用 - {"direction": "up", "value": 3} - ], "time": 1000}, - {"type": "show", "loc": [6,4], "time": 1000}, // 显示黑暗大法师 - {"type": "sleep", "time": 500}, // 等待500毫秒 - // 下面是黑暗大法师的事件 - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]我的真名为——黑暗大法师,第四区域的头目。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]呵呵,不知道为什么,我竟然对事情走到现在这一步毫不感觉意外。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]以杰克的名义利用了你这么久,真是抱歉啊。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]真正的杰克现在在哪里?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]盗贼杰克这个人类从未存在过,他只是我用来接近你的一副皮囊而已。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……这样啊,呵呵。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]为什么你看上去丝毫不生气?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]多亏了鬼帝,我现在的脾气好得连我自己都害怕。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]说起来我还得好好感谢你呢,如果没有杰克……你的帮助,我早就死在第一区域了。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]不论你的目的如何,你的所作所为都是对我有利的。不是吗?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]能够如此淡定的面对背叛,看来跟五年前相比,你确实成长了很多啊。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]五年前?……黑暗大法师,在这之前,我们好像素未谋面吧?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]五年前那场屠城你应该这一生都不会忘记吧。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]很不巧,那场屠城的主谋,也是我。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]这么说,击中我双亲的那道紫色闪电,也就是你释放的吧……", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]你的双亲?这种事情我怎么可能会记得?\n你难道在踩死蚂蚁的时候还会一只只记下他们的样子吗?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]老 子 要 你 的 命", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]你应该对我心怀感激才对,如果不是那时的我看出了你隐藏的稀有勇者体质,你绝对不可能活到今天。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]在暗中动手脚让你通过勇者选拔的人也是我,我一直一直在暗中引导你走到今天这一步。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]是我救赎了一无是处的你。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]为什么只有我一个人活了下来!!!!", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]为什么偏偏是我!!!!", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]我刚才不是说过了吗?因为我看出了你有稀有勇者体质啊。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]你刚刚跟鬼帝交过手,应该已经很清楚这稀有勇者体质意味着什么了吧?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……就因为我有这种体质,就不得不背负如此残酷的宿命吗?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]愚蠢!这意味着只要我对你加以引导跟培养,你就能成为这世间实力最强的存在!", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……所以,你究竟想利用我干什么?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]我利用你干的事情,你不是已经完成了吗?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……你说什么?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]不知不觉间,你已经在我的指引下跟鬼帝正面交手并且杀掉了他啊。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]就连我跟鬼帝的对决……也是被你安排好了的?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]你们两个一个是人类勇者,一个是魔物勇者,迟早会有交手的一天。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]我只不过是操纵了一系列的连锁事件让这一天提早了数十年到来而已。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……你这样做对谁有好处?他可是你们魔物世界的救世主啊。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]一个惧怕征战,爱好和平的懦夫,也配叫救世主?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]获得了力量,却只会被动挨打而不主动向人类世界出击,龟缩在第二区域惶惶度日,他根本就不配拥有稀有勇者体质。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]为了不让这种人霸占着积累多年的庞大灵魂能量无作为,我设计让你杀掉了他。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]你没有辜负我的期待,成功战胜了那个废物,现在你体内累积的灵魂能量……也就是魔力,已经达到了能跟魔王匹敌的地步。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……是吗?现在的我能与魔王匹敌?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]不止如此,你现在的力量之强就算是统治世界也是绰绰有余!", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]怎么样?要不要加入我的麾下,跟随我去征战人类世界?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]能与魔王匹敌的话,也就是说。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]我 现 在 对 付 你 这 种 杂 碎 也 绰 绰 有 余 吧 ?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]……什么?!", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]等一下!别冲动!你先等我把这利害关系理一理——", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]你给老子闭嘴。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]老子什么都不想听。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]老子现在想做的事情只有一件——", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]剁掉你的头,把它放回我双亲的墓前。", - {"type": "update"} // 本事件剧情结束,更新地图显伤 - ], - "6,4": { // 黑暗大法师战斗事件 - "enable": false, // 初始时是禁用状态 - // 打败后将触发afterBattle事件 - }, - "5,4": {"enable":false}, // 大法师的分身们,初始时禁用状态 - "7,4": {"enable":false}, // 大法师的分身们,初始时禁用状态 - "5,5": {"enable":false}, // 大法师的分身们,初始时禁用状态 - "7,5": {"enable":false}, // 大法师的分身们,初始时禁用状态 - "6,3": { // 大法师本尊 - "trigger": "action", // 注意:这里要写 trigger:action ,来覆盖掉系统默认的battle事件。 - "enable":false, - "data": [ - "\t[blackMagician]听不进去人话的蠢货,就要用疼痛来管教!", - {"type": "changePos", "direction": "up"}, - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]出来吧!禁忌——紫电凶杀阵!", - {"type": "show", "loc": [[4,3],[4,6],[8,6],[8,3]], "time": 500}, // 依次显示四个角的法师 - {"type": "sleep", "time": 500}, - "\t[blackMagician]感受绝望吧!冥顽不化的蠢货!", - /* - {"type": "hide", "loc": [4,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示 - {"type": "show", "loc": [4,3], "time": 150}, - {"type": "hide", "loc": [4,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示 - {"type": "show", "loc": [4,6], "time": 150}, - {"type": "hide", "loc": [8,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示 - {"type": "show", "loc": [8,6], "time": 150}, - {"type": "hide", "loc": [8,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示 - {"type": "show", "loc": [8,3], "time": 150}, - */ - {"type": "animate", "name": "yongchang", "loc": [4,3]}, - {"type": "animate", "name": "yongchang", "loc": [4,6]}, - {"type": "animate", "name": "yongchang", "loc": [8,6]}, - {"type": "animate", "name": "yongchang", "loc": [8,3]}, - {"type": "sleep", "time": 200}, - {"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效 - {"type": "animate", "name": "thunder", "loc": "hero"}, - {"type": "sleep", "time": 200}, - "\t[hero]唔……!!(吐血)", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]我的魔力可是充足的很啊!我会一直折磨到你屈服于我为止!", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]人类!好好感受吧!当初你们施加于我的痛苦!如今我要百倍奉还!", - {"type": "show", "loc": [6,6], "time": 1000}, // 显示妖精 - {"type": "sleep", "time": 700}, - {"type": "trigger", "loc": [6,6]} // 立刻触发妖精事件 - ] - }, - "4,3": { // 四个角的大法师, - "trigger": "action", - "displayDamage": false, - "enable":false - }, - "8,3": { // 四个角的大法师, - "trigger": "action", - "displayDamage": false, - "enable":false - }, - "4,6": { // 四个角的大法师, - "trigger": "action", - "displayDamage": false, - "enable":false - }, - "8,6": { // 四个角的大法师, - "trigger": "action", - "displayDamage": false, - "enable":false - }, - - "6,6": { // 妖精 - "enable":false, // 初始时禁用状态 - "data": [ // 妖精事件 - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]…妖精…小姐……是你吗?", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]不要绝望,也不要悲伤。", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]你从来都不是独自一人在前进。", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]咱一直,一直都在注视着你。", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]耍小聪明的你、笨笨的你呆呆的你、胆小的你、勇敢的你帅气的你……全部全部都是你。", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]所以放心吧,无论发生什么,咱都会陪伴在你身边的。", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]因为你要是离开我的话,立刻就会死掉吧?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]…妖精…小姐……其实一直以来,我都非常感激你……", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]笨蛋!都这种时候了就不要作出像是临终遗言的发言了啊!!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]喂!那边穿衣品味差到极点的黑暗大法师,别左顾右盼说的就是你!你应该知道咱的身份吧?\n还不速速退下!", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]可恶…多管闲事的妖精族…明明只要再让他承受一点疼痛来瓦解他的意志力,我的计划就成功了!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]哼哼哼~抱歉哦,这个笨蛋的意志力可不像你想象的那么薄弱哦!", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]不甘心!我不甘心!妖精公主又如何!\n只要是阻挡我的,不管是谁我都要铲除!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]终于露出狐狸尾巴了,其实咱早就看出你有谋反的念头。你的计划就是拉拢这家伙入伙然后推翻魔王对魔塔的统治对吧?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]呵呵呵……那个昏庸的魔王,掌握着那么庞大的魔物军队却只知道固守魔塔,而不主动侵略人类世界扩张领土!", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]我实在是看不过眼,所以我才决定把这个具备稀有勇者体质的家伙培养成新一任魔王!\n来让这个世界的势力重新洗牌!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]你觉得一个满脑子想着回家种田的废柴勇者会成为改变世界的魔王?你晃晃脑袋试试,是不是能听到大海的声音?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]恼人至极的妖精族!呵呵呵……我干脆一不做二不休,连你也一块收拾了吧!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]别小瞧咱!咱好歹也是妖精族里实力数一数二的存在!", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]只会耍嘴皮子的恼人苍蝇!我倒要看看一块焦炭会不会说话!\n——招雷弹!!", - /* - {"type": "hide", "loc": [4,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示 - {"type": "show", "loc": [4,3], "time": 150}, - {"type": "hide", "loc": [4,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示 - {"type": "show", "loc": [4,6], "time": 150}, - {"type": "hide", "loc": [8,6], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示 - {"type": "show", "loc": [8,6], "time": 150}, - {"type": "hide", "loc": [8,3], "time": 150}, // 由于没有动画效果,暂时使用“闪一下”表示 - {"type": "show", "loc": [8,3], "time": 150}, - */ - {"type": "animate", "name": "yongchang", "loc": [4,3]}, - {"type": "animate", "name": "yongchang", "loc": [4,6]}, - {"type": "animate", "name": "yongchang", "loc": [8,6]}, - {"type": "animate", "name": "yongchang", "loc": [8,3]}, - {"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效 - /* - {"type": "hide", "loc": [6,6], "time": 150}, // 妖精也闪一下表示收到了伤害 - {"type": "show", "loc": [6,6], "time": 150}, // 妖精也闪一下表示收到了伤害 - */ - {"type": "animate", "name": "thunder", "loc": [6,6]}, - {"type": "sleep", "time": 500}, // 等待500毫秒 - "\t[小妖精,fairy]切,这点伤痛跟他刚才经历的身心地狱相比根本就不算什么。", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]哼!翅膀都被烧焦了还要嘴硬?你难不成真以为我不会对你动真格?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……你这混蛋!给我离她远点!!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]!…你现在受了很严重的致命伤,乱动什么?\n乖。别怕,这里有咱顶着!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]对了,咱再问你一遍,你是很珍惜自己性命的对吧?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]!…等等…妖精小姐,你不会是……?", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]喂,黑暗大法师,你作为魔塔里最博学多识的蠢货,应该对咱妖精族的特殊能力再清楚不过吧?", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]什么?!难不成你是想!!不可能……\n就为了一个渺小的人类,不可理喻!!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]哼哼哼!你害怕的表情可真美味!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]不过比起这个,咱更期待你吃到“妖精自灭冲击”之后的死状哦!~", - {"type": "playSound", "name": "item.mp3"}, - "\t[blackMagician]不!!不应该是这样的!我完美的计划竟然会被一只小小的妖精破坏!", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]不要!……千万不要!……为了我这种人……唔!", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]笨蛋,动都动不了了就不要强撑着站起来了啊。", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]真是的,都到最后一刻了,你这家伙好歹也让咱省点心吧。", - {"type": "playSound", "name": "item.mp3"}, - "\t[小妖精,fairy]那么,再见了……我的勇者大人。", - {"type": "move", "time": 700, "steps": [ // 向上移动三个,撞上黑暗大大法师;本事件的hide会自动被调用 - {"direction": "up", "value": 3} - ]}, - {"type": "playSound", "name": "attack.mp3"}, // 播放攻击音效 - {"type": "sleep", "time": 200}, - "\t[blackMagician]不可能!!!!!", - {"type": "hide", "loc": [6,3]}, // 法师消失 - {"type": "hide", "loc": [4,3]}, // 四个分身消失 - {"type": "hide", "loc": [4,6]}, - {"type": "hide", "loc": [8,6]}, - {"type": "hide", "loc": [8,3]}, - {"type": "changeFloor", "floorId": "sample2", "loc": [6,6], "direction": "up", "time": 1000}, // 更换勇士地点,合计1秒 - {"type": "show", "loc": [6,5]}, // 显示黄宝石 - {"type": "sleep", "time": 200}, // 等待200毫秒 - {"type": "playSound", "name": "item.mp3"}, - {"type": "sleep", "time": 200}, // 等待200毫秒 - "\t[hero]…妖精…小姐……", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……妖精小姐!", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]是梦吗?……不对,为什么我在流泪?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]这颗漂亮的宝石是……?", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]我全都想起来了……妖精小姐为了我……\n牺牲了自己的性命。", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]在这颗宝石上,我能感受到你的温度……\n熟悉而又令人安心,这就是你最后留给我的东西吗……", - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]好温暖……", - {"type": "setValue", "name": "item:yellowJewel", "value": "1"}, // 获得1个黄宝石 - {"type": "hide", "loc": [6,5]}, // 隐藏黄宝石 - {"type": "playSound", "name": "item.mp3"}, - "\t[hero]……", - {"type": "openDoor", "loc": [6,2]}, // 开门 - {"type": "openDoor", "loc": [6,11]} - ] - }, - "6,5": { // 黄宝石 - "enable": false - } - - }, - "changeFloor": { // 楼层转换事件;该事件不能和上面的events有冲突(同位置点),否则会被覆盖 - "6,0": {"floorId": "sample2", "stair": "upFloor"}, - "6,12": {"floorId": "sample1", "stair": "upFloor"} - }, - "afterBattle": { // 战斗后可能触发的事件列表 - "6,4": [ // 和黑暗大法师战斗结束 - "\t[blackMagician]天真!你以为这样就能战胜我吗?", - {"type": "show", "loc": [7,5], "time": 500}, - {"type": "update"}, // 更新地图显伤 - ], - "7,5": [ // 和分身1的战斗 - "\t[blackMagician]你打败的不过是我众多分身中的其中一个而已。", - {"type": "show", "loc": [5,4], "time": 500}, - {"type": "update"}, // 更新地图显伤 - ], - "5,4": [ // 和分身2的战斗 - "\t[blackMagician]你的身体已经伤痕累累了,可我还留有着九成多的魔力。", - {"type": "show", "loc": [5,5], "time": 500}, - {"type": "update"}, // 更新地图显伤 - ], - "5,5": [ // 和分身3的战斗 - "\t[blackMagician]顽固的家伙!放弃抵抗吧!", - {"type": "show", "loc": [7,4], "time": 500}, - {"type": "update"}, // 更新地图显伤 - ], - "7,4": [ // 和分身4的战斗 - "\t[blackMagician]哈哈哈哈!我的灵魂远比你想象的强大!\n我即是永恒!", - {"type": "show", "loc": [6,3], "time": 500}, - {"type": "trigger", "loc": [6,3]} // 显示大法师本尊 - ], - }, - "afterGetItem": { // 获得道具后可能触发的事件列表 - - }, - "afterOpenDoor": { // 开完门后可能触发的事件列表 - - }, - "cannotMove": { // 每个图块不可通行的方向 - // 可以在这里定义每个点不能前往哪个方向,例如悬崖边不能跳下去 - // "x,y": ["up", "left"], // (x,y)点不能往上和左走 - - }, -} - +"floorId": "sample2", +"title": "样板 2 层", +"name": "2", +"canFlyTo": true, +"canUseQuickShop": true, +"cannotViewMap": false, +"defaultGround": "ground", +"images": [], +"item_ratio": 1, +"map": [ + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 121, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], + [ 0, 0, 0, 0, 1, 1, 45, 0, 1, 0,202,202, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0], + [ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 88, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 122, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0,202, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 1, 0, 0, 0, 0], + [ 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0, 0, 0, 0, 0, 1, 1, 0, 0, 1, 0,202,202, 0], + [ 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 1, 1, 0, 0, 0, 1, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 1, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0,202, 0, 0, 0, 0, 0, 0, 0], + [ 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0] +], +"width":26, +"height":26, +"firstArrive": [], +"events": {"3,2":["123"],"12,12":["234"]}, +"changeFloor": {"6,10": {"floorId": "sample1", "stair": "upFloor"}}, +"afterBattle": {}, +"afterGetItem": {}, +"afterOpenDoor": {}, +"cannotMove": {}, +"upFloor": null, +} \ No newline at end of file