diff --git a/drawMapGUI.html b/drawMapGUI.html index 574817a8..c59246dd 100644 --- a/drawMapGUI.html +++ b/drawMapGUI.html @@ -608,7 +608,7 @@ } filestr+='],\n' } - printf('
'+filestr+'\n

已复制到剪贴板

'+'


'); + printf('
'+filestr+'\n

已复制到剪贴板

'+'


'); poutTmp.select(); document.execCommand("Copy"); } diff --git a/libs/core.js b/libs/core.js index db2560fc..42f79220 100644 --- a/libs/core.js +++ b/libs/core.js @@ -597,7 +597,7 @@ core.prototype.onup = function () { core.canvas.ui.clearRect(0, 0, 416,416); core.canvas.ui.restore(); core.onclick(posx,posy,stepPostfix); - //posx,posy是之前寻路的目标点,stepPostfix是后续的移动 + //posx,posy是寻路的目标点,stepPostfix是后续的移动 } } @@ -626,7 +626,7 @@ core.prototype.getClickLoc = function (x, y) { } core.prototype.onclick = function (x, y, stepPostfix) { - // console.log("Click: (" + x + "," + y + ")"); + console.log("Click: (" + x + "," + y + ")"); // 非游戏屏幕内 if (x<0 || y<0 || x>12 || y>12) return; @@ -735,10 +735,26 @@ core.prototype.onclick = function (x, y, stepPostfix) { } core.prototype.onmousewheel = function (direct) { + // 向下滚动是 -1 ,向上是 1 + // 楼层飞行器 if (core.status.lockControl && core.status.event.id == 'fly') { - if (direct==-1) core.ui.drawFly(core.status.event.data-1); if (direct==1) core.ui.drawFly(core.status.event.data+1); + if (direct==-1) core.ui.drawFly(core.status.event.data-1); + return; + } + + // 怪物手册 + if (core.status.event.id == 'book') { + if (direct==1) core.ui.drawEnemyBook(core.status.event.data - 1); + if (direct==-1) core.ui.drawEnemyBook(core.status.event.data + 1); + return; + } + + // 存读档 + if (core.status.event.id == 'save' || core.status.event.id == 'load') { + if (direct==1) core.ui.drawSLPanel(core.status.event.data - 1); + if (direct==-1) core.ui.drawSLPanel(core.status.event.data + 1); return; } } @@ -1049,86 +1065,29 @@ core.prototype.setHeroMoveInterval = function (direction, x, y, callback) { } core.status.heroMoving = true; var moveStep = 0; + var scan = { + 'up': {'x': 0, 'y': -1}, + 'left': {'x': -1, 'y': 0}, + 'down': {'x': 0, 'y': 1}, + 'right': {'x': 1, 'y': 0} + }; core.interval.heroMoveInterval = window.setInterval(function () { - switch (direction) { - case 'up': - moveStep -= 4; - if (moveStep == -4 || moveStep == -8 || moveStep == -12 || moveStep == -16) { - core.drawHero(direction, x, y, 'leftFoot', 0, moveStep); - } - else if (moveStep == -20 || moveStep == -24 || moveStep == -28 || moveStep == -32) { - core.drawHero(direction, x, y, 'rightFoot', 0, moveStep); - } - if (moveStep == -32) { - core.setHeroLoc('y', '--'); - core.moveOneStep(); - if (core.status.heroStop) { - core.drawHero(direction, x, y - 1, 'stop'); - } - if (core.isset(callback)) { - callback(); - } - } - break; - case 'left': - moveStep -= 4; - if (moveStep == -4 || moveStep == -8 || moveStep == -12 || moveStep == -16) { - core.drawHero(direction, x, y, 'leftFoot', moveStep); - } - else if (moveStep == -20 || moveStep == -24 || moveStep == -28 || moveStep == -32) { - core.drawHero(direction, x, y, 'rightFoot', moveStep); - } - if (moveStep == -32) { - core.setHeroLoc('x', '--'); - core.moveOneStep(); - if (core.status.heroStop) { - core.drawHero(direction, x - 1, y, 'stop'); - } - if (core.isset(callback)) { - callback(); - } - } - break; - case 'down': - moveStep+=4; - if(moveStep == 4 || moveStep == 8 || moveStep == 12 || moveStep == 16) { - core.drawHero(direction, x, y, 'leftFoot', 0, moveStep); - } - else if(moveStep == 20 || moveStep == 24 ||moveStep == 28 || moveStep == 32) { - core.drawHero(direction, x, y, 'rightFoot', 0, moveStep); - } - if (moveStep == 32) { - core.setHeroLoc('y', '++'); - core.moveOneStep(); - if (core.status.heroStop) { - core.drawHero(direction, x, y + 1, 'stop'); - } - if (core.isset(callback)) { - callback(); - } - } - break; - case 'right': - moveStep+=4; - if(moveStep == 4 || moveStep == 8 || moveStep == 12 || moveStep == 16) { - core.drawHero(direction, x, y, 'leftFoot', moveStep); - } - else if(moveStep == 20 || moveStep == 24 ||moveStep == 28 || moveStep == 32) { - core.drawHero(direction, x, y, 'rightFoot', moveStep); - } - if (moveStep == 32) { - core.setHeroLoc('x', '++'); - core.moveOneStep(); - if (core.status.heroStop) { - core.drawHero(direction, x + 1, y, 'stop'); - } - if (core.isset(callback)) { - callback(); - } - } - break; + moveStep++; + if (moveStep<=4) { + core.drawHero(direction, x, y, 'leftFoot', 4*moveStep*scan[direction].x, 4*moveStep*scan[direction].y); } - }, 10); + else if (moveStep<=8) { + core.drawHero(direction, x, y, 'rightFoot', 4*moveStep*scan[direction].x, 4*moveStep*scan[direction].y); + } + if (moveStep==8) { + core.setHeroLoc('x', x+scan[direction].x); + core.setHeroLoc('y', y+scan[direction].y); + core.moveOneStep(); + if (core.status.heroStop) + core.drawHero(direction, core.getHeroLoc('x'), core.getHeroLoc('y'), 'stop'); + if (core.isset(callback)) callback(); + } + }, 12.5); } core.prototype.setHeroMoveTriggerInterval = function () { @@ -1242,6 +1201,66 @@ core.prototype.moveHero = function (direction) { core.status.heroStop = false; } +core.prototype.eventMoveHero = function(steps, time, callback) { + + time = time || 100; + + core.clearMap('ui', 0, 0, 416, 416); + core.setAlpha('ui', 1.0); + + // 要运行的轨迹:将steps展开 + var moveSteps=[]; + steps.forEach(function (e) { + if (typeof e=="string") { + moveSteps.push(e); + } + else { + if (!core.isset(e.value)) { + moveSteps.push(e.direction) + } + else { + for (var i=0;i= core.values.animateSpeed * 2 / animateValue) { + animateCurrent++; + animateTime = 0; + if (animateCurrent>=animateValue) animateCurrent=0; + } + // 已经移动完毕,消失 if (moveSteps.length==0) { if (immediateHide) opacityVal=0; else opacityVal -= 0.06; core.setOpacity('data', opacityVal); core.clearMap('data', nowX, nowY, 32, 32); - core.canvas.data.drawImage(blockImage, 0, blockIcon * 32, 32, 32, nowX, nowY, 32, 32); + core.canvas.data.drawImage(blockImage, animateCurrent * 32, blockIcon * 32, 32, 32, nowX, nowY, 32, 32); if (opacityVal<=0) { clearInterval(animate); core.loadCanvas('data'); @@ -1900,7 +1931,7 @@ core.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) { nowY+=scan[moveSteps[0]].y*2; core.clearMap('data', nowX-32, nowY-32, 96, 96); // 绘制 - core.canvas.data.drawImage(blockImage, 0, blockIcon * 32, 32, 32, nowX, nowY, 32, 32); + core.canvas.data.drawImage(blockImage, animateCurrent * 32, blockIcon * 32, 32, 32, nowX, nowY, 32, 32); if (step==16) { // 该移动完毕,继续 step=0; diff --git a/libs/enemys.js b/libs/enemys.js index f9e0d716..04611d30 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -76,7 +76,7 @@ enemys.prototype.getEnemys = function (enemyId) { } enemys.prototype.hasSpecial = function (special, test) { - return parseInt(special/1000) == test || special % 1000 == test; + return special!=0 && (special%100 == test || this.hasSpecial(parseInt(special/100), test)); } enemys.prototype.getSpecialText = function (enemyId) { diff --git a/libs/events.js b/libs/events.js index b00e6e0e..c90a3cfa 100644 --- a/libs/events.js +++ b/libs/events.js @@ -239,10 +239,19 @@ events.prototype.doAction = function() { else this.doAction(); break; case "move": // 移动事件 + if (core.isset(data.loc)) { + x=data.loc[0]; + y=data.loc[1]; + } core.moveBlock(x,y,data.steps,data.time,data.immediateHide,function() { core.events.doAction(); }) break; + case "moveHero": + core.eventMoveHero(data.steps,data.time,function() { + core.events.doAction(); + }); + break; case "changeFloor": // 楼层转换 var heroLoc = {"x": data.loc[0], "y": data.loc[1]}; if (core.isset(data.direction)) heroLoc.direction=data.direction; diff --git a/libs/floors/sample1.js b/libs/floors/sample1.js index afb288c3..74cfca5f 100644 --- a/libs/floors/sample1.js +++ b/libs/floors/sample1.js @@ -31,7 +31,7 @@ main.floors.sample1 = { "\t[样板提示]本层楼将会对各类事件进行介绍。", "左边是一个仿50层的陷阱做法,上方是商店、快捷商店的使用方法,右上是一个典型的杀怪开门的例子,右下是各类可能的NPC事件。", "本样板目前支持的事件列表大致有:\ntext: 显示一段文字(比如你现在正在看到的)\nshow: 使一个事件有效(可见、可被交互)\nhide: 使一个事件失效(不可见、不可被交互)\ntrigger: 触发另一个地点的事件\nbattle: 强制和某怪物战斗\nopenDoor: 无需钥匙开门(例如机关门、暗墙)\nopenShop: 打开一个全局商店\ndisableShop: 禁用一个全局商店\nchangeFloor: 传送勇士到某层某位置\nchangePos: 传送勇士到当层某位置;转向\nsetFg: 更改画面色调", - "move: 移动事件效果\nplaySound: 播放某个音频\nif: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nwin: 获得胜利(游戏通关)\nlose: 游戏失败\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n更多支持的事件还在编写中,欢迎您宝贵的意见。", + "move: 移动事件效果\nmoveHero: 移动勇士效果\nplaySound: 播放某个音频\nif: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nwin: 获得胜利(游戏通关)\nlose: 游戏失败\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n更多支持的事件还在编写中,欢迎您宝贵的意见。", "有关各事件的样例,可参见本层一些NPC的写法。\n所有事件样例本层都有介绍。\n\n一个自定义事件处理完后,需要调用{\"type\": \"hide\"}该事件才不会再次出现。", {"type": "hide"} ], diff --git a/libs/ui.js b/libs/ui.js index d70c7551..71c7484c 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -425,6 +425,8 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) { core.fillRect('ui', left, top, right, bottom, '#000000'); core.setAlpha('ui', 1); core.strokeRect('ui', left - 1, top - 1, right + 1, bottom + 1, '#FFFFFF', 2); + core.setAlpha('data', 1); + core.setOpacity('data', 1); core.status.boxAnimateObjs = []; core.setBoxAnimate(); diff --git a/main.js b/main.js index 4e7bcec1..2305a77f 100644 --- a/main.js +++ b/main.js @@ -224,6 +224,10 @@ document.ontouchstart = function() { main.dom.data.onmousedown = function (e) { try { e.stopPropagation(); + if(e.button==1){// 把鼠标中键绑定为ESC + core.keyUp(27); + return; + } var loc = main.core.getClickLoc(e.clientX, e.clientY); if (loc == null) return; var x = parseInt(loc.x / loc.size), y = parseInt(loc.y / loc.size); diff --git a/常用工具/便捷PS工具.exe b/常用工具/便捷PS工具.exe new file mode 100644 index 00000000..ffe1447f Binary files /dev/null and b/常用工具/便捷PS工具.exe differ diff --git a/更新内容.txt b/更新内容.txt index 0c504483..204a5f44 100644 --- a/更新内容.txt +++ b/更新内容.txt @@ -1,8 +1,11 @@ +新增:本地服务器 新增:可视化地图编辑工具 +新增:便捷P图工具 √ 新增:支持Autotile √ -新增:怪物支持双属性 √ +新增:怪物支持多属性 √ 新增:单向箭头、感叹号 √ -新增:怪物P图工具 +新增:勇士支持移动;其他事件支持移动 √ 快捷道具使用:1破2炸3飞;读档改为D键 √ 更多的默认素材;无需P图,直接替换即可 √ 破甲、反击、净化等效果放全局变量 √ +细节优化和Bug修复 √