diff --git a/index.html b/index.html index 20a62a7d..e04a22e4 100644 --- a/index.html +++ b/index.html @@ -106,8 +106,9 @@
- + + diff --git a/libs/control.js b/libs/control.js index 5df50f52..314b6af9 100644 --- a/libs/control.js +++ b/libs/control.js @@ -54,8 +54,7 @@ control.prototype.setRequestAnimationFrame = function () { var draw = function(timestamp) { - core.animateFrame.twoTime = core.animateFrame.twoTime||timestamp; - core.animateFrame.fourTime = core.animateFrame.fourTime||timestamp; + core.animateFrame.globalTime = core.animateFrame.globalTime||timestamp; core.animateFrame.boxTime = core.animateFrame.boxTime||timestamp; core.animateFrame.moveTime = core.animateFrame.moveTime||timestamp; core.animateFrame.weather.time = core.animateFrame.weather.time||timestamp; @@ -63,29 +62,16 @@ control.prototype.setRequestAnimationFrame = function () { // Global Animate if (core.animateFrame.globalAnimate && core.isPlaying()) { - if (timestamp-core.animateFrame.twoTime>core.animateFrame.speed && core.isset(core.status.twoAnimateObjs)) { + if (timestamp-core.animateFrame.globalTime>core.animateFrame.speed && core.isset(core.status.globalAnimateObjs)) { - for (var a = 0; a < core.status.twoAnimateObjs.length; a++) { - var obj = core.status.twoAnimateObjs[a]; - obj.status = (obj.status+1)%2; - core.canvas.event.clearRect(obj.x, obj.y, 32, 32); - core.canvas.event.drawImage(obj.image, obj.status * 32, obj.loc * 32, 32, 32, obj.x, obj.y, 32, 32); + for (var a = 0; a < core.status.globalAnimateObjs.length; a++) { + var obj = core.status.globalAnimateObjs[a]; + obj.status = (obj.status+1)%(obj.event.animate||1); + core.drawBlock(obj, obj.status); } - core.animateFrame.twoTime = timestamp; + core.animateFrame.globalTime = timestamp; } - - if (timestamp-core.animateFrame.fourTime>core.animateFrame.speed/2 && core.isset(core.status.fourAnimateObjs)) { - for (var a = 0; a < core.status.fourAnimateObjs.length; a++) { - var obj=core.status.fourAnimateObjs[a]; - obj.status = (obj.status+1)%4; - core.canvas.event.clearRect(obj.x, obj.y, 32, 32); - core.canvas.event.drawImage(obj.image, obj.status * 32, obj.loc * 32, 32, 32, obj.x, obj.y, 32, 32); - } - // fourtime = timestamp % fourDelta; - core.animateFrame.fourTime = timestamp; - } - } // Box @@ -882,7 +868,7 @@ control.prototype.updateCheckBlock = function() { core.status.checkBlock.map = []; // 记录怪物地图 for (var n=0;n= core.values.animateSpeed * 2 / animateValue) { + if (animateTime >= core.values.animateSpeed) { animateCurrent++; animateTime = 0; - if (animateCurrent>=animateValue) animateCurrent=0; } snipes.forEach(function (snipe) { var x=snipe.x, y=snipe.y, direction = snipe.direction; - var nowX=32*x+scan[direction].x*2*step, nowY=32*y+scan[direction].y*2*step; + var dx = scan[direction].x*2*step, dy = scan[direction].y*2*step; + var nowX = 32*x+dx, nowY = 32*y+dy; // 清空上一次 - core.clearMap('event', nowX-2*scan[direction].x, nowY-2*scan[direction].y, 32, 32); core.clearMap('fg', nowX-2*scan[direction].x, nowY-2*scan[direction].y, 32, 32); + core.canvas.event.clearRect(nowX-2*scan[direction].x, nowY-2*scan[direction].y, 32, 32); + core.canvas.event2.clearRect(nowX-2*scan[direction].x, nowY-2*scan[direction].y-32, 32, 32) - core.canvas.event.drawImage(snipe.blockImage, animateCurrent*32, snipe.blockIcon*32, 32, 32, nowX, nowY, 32, 32); + core.drawBlock(snipe.block, animateCurrent, dx, dy); if (core.hasItem('book')) { // drawFG @@ -1256,7 +1247,7 @@ control.prototype.updateFg = function () { core.canvas.fg.textAlign = 'left'; 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 == 'enemys' + if (core.isset(mapBlocks[b].event) && mapBlocks[b].event.cls.indexOf('enemy')==0 && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable)) { // 非系统默认的战斗事件(被覆盖) diff --git a/libs/core.js b/libs/core.js index fc595cc4..e9ad0fe6 100644 --- a/libs/core.js +++ b/libs/core.js @@ -29,8 +29,7 @@ function core() { this.animateFrame = { 'background': null, 'globalAnimate': false, - 'twoTime': null, - 'fourTime': null, + 'globalTime': null, 'boxTime': null, 'moveTime': null, 'speed': null, @@ -141,8 +140,7 @@ function core() { 'openingDoor': null, // 动画 - 'twoAnimateObjs': [], - 'fourAnimateObjs': [], + 'globalAnimateObjs': [], 'boxAnimateObjs': [], }; this.status = {}; @@ -608,6 +606,10 @@ core.prototype.setFillStyle = function (map, style) { core.ui.setFillStyle(map, style); } +core.prototype.drawBlock = function (block, animate, dx, dy) { + core.maps.drawBlock(block, animate, dx, dy); +} + ////// 绘制某张地图 ////// core.prototype.drawMap = function (mapName, callback) { core.maps.drawMap(mapName, callback); @@ -689,8 +691,8 @@ core.prototype.removeBlockByIds = function (floorId, ids) { } ////// 添加一个全局动画 ////// -core.prototype.addGlobalAnimate = function (animateMore, x, y, loc, image) { - core.maps.addGlobalAnimate(animateMore, x, y, loc, image); +core.prototype.addGlobalAnimate = function (block) { + core.maps.addGlobalAnimate(block); } ////// 删除一个或所有全局动画 ////// diff --git a/libs/enemys.js b/libs/enemys.js index 7f6156ed..d6bc65b0 100644 --- a/libs/enemys.js +++ b/libs/enemys.js @@ -246,7 +246,8 @@ 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) && mapBlocks[b].event.cls == 'enemys') { + if (core.isset(mapBlocks[b].event) && !(core.isset(mapBlocks[b].enable) && !mapBlocks[b].enable) + && mapBlocks[b].event.cls.indexOf('enemy')==0) { var monsterId = mapBlocks[b].event.id; if (core.isset(used[monsterId])) continue; diff --git a/libs/events.js b/libs/events.js index 58dae299..53340072 100644 --- a/libs/events.js +++ b/libs/events.js @@ -883,7 +883,7 @@ 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=='enemys' + if (core.isset(block.enable) && !block.enable && core.isset(block.event) && block.event.cls.indexOf('enemy')==0 && core.enemys.hasSpecial(core.material.enemys[block.event.id].special, 23)) { block.enable = true; } @@ -1098,10 +1098,7 @@ events.prototype.changeLight = function(x, y) { // 改变为dark block.id = 166; block.event = {'cls': 'terrains', 'id': 'darkLight', 'noPass': true}; - // 更新地图 - core.canvas.event.clearRect(x * 32, y * 32, 32, 32); - var blockIcon = core.material.icons[block.event.cls][block.event.id]; - core.canvas.event.drawImage(core.material.images[block.event.cls], 0, blockIcon * 32, 32, 32, block.x * 32, block.y * 32, 32, 32); + core.drawBlock(block); this.afterChangeLight(x,y); } @@ -1151,18 +1148,14 @@ events.prototype.pushBox = function (data) { if (block!=null && !(core.isset(block.block.event) && block.block.event.id=='flower')) return; - var blockIcon; if (block==null) { core.status.thisMap.blocks.push(core.maps.initBlock(nx, ny, 169)); - blockIcon=core.material.icons.terrains.box; } else { block.block.id=170; block.block.event=core.maps.initBlock(null,null,170).event; - blockIcon=core.material.icons.terrains.boxed; } - core.canvas.event.clearRect(nx * 32, ny * 32, 32, 32); - core.canvas.event.drawImage(core.material.images.terrains, 0, blockIcon * 32, 32, 32, nx * 32, ny * 32, 32, 32); + core.drawBlock(block.block); if (data.event.id=='box') { core.removeBlock(data.x, data.y); @@ -1170,8 +1163,7 @@ events.prototype.pushBox = function (data) { else { data.id=168; data.event=core.maps.initBlock(null,null,168).event; - core.canvas.event.clearRect(data.x * 32, data.y * 32, 32, 32); - core.canvas.event.drawImage(core.material.images.terrains, 0, core.material.icons.terrains.flower * 32, 32, 32, data.x * 32, data.y * 32, 32, 32); + core.drawBlock(data); } core.updateStatusBar(); diff --git a/libs/items.js b/libs/items.js index cc16999a..8616d607 100644 --- a/libs/items.js +++ b/libs/items.js @@ -200,7 +200,7 @@ items.prototype.canUseItem = function (itemId) { var ids = []; for (var i in core.status.thisMap.blocks) { var block = core.status.thisMap.blocks[i]; - if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls == 'enemys' && Math.abs(block.x-core.status.hero.loc.x)+Math.abs(block.y-core.status.hero.loc.y)<=1) { + if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && 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) { var enemy = core.material.enemys[block.event.id]; if (core.isset(enemy.bomb) && !enemy.bomb) continue; if (core.flags.bombFourDirections || (block.x==core.nextX() && block.y==core.nextY())) @@ -217,7 +217,7 @@ items.prototype.canUseItem = function (itemId) { // 圣锤 for (var i in core.status.thisMap.blocks) { var block = core.status.thisMap.blocks[i]; - if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls == 'enemys' && block.x==core.nextX() && block.y==core.nextY()) { + if (core.isset(block.event) && !(core.isset(block.enable) && !block.enable) && block.event.cls.indexOf('enemy')==0 && block.x==core.nextX() && block.y==core.nextY()) { var enemy = core.material.enemys[block.event.id]; if (core.isset(enemy.bomb) && !enemy.bomb) continue; core.status.event.data = [i]; diff --git a/libs/maps.js b/libs/maps.js index 5ae7fc93..879d9027 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -65,14 +65,14 @@ maps.prototype.initBlock = function (x, y, id) { ////// 添加一些信息到block上 ////// maps.prototype.addInfo = function (block) { if (core.isset(block.event)) { - if (block.event.cls == 'enemys' && block.event.trigger==undefined) { + if (block.event.cls.indexOf("enemy")==0 && block.event.trigger==undefined) { block.event.trigger = 'battle'; } if (block.event.cls == 'items' && block.event.trigger==undefined) { block.event.trigger = 'getItem'; } if (block.event.noPass == undefined) { - if (block.event.cls=='enemys' || block.event.cls=='terrains' || block.event.cls=='npcs') { + if (block.event.cls.indexOf("enemy")==0 || block.event.cls.indexOf("npc")==0 || block.event.cls=='terrains') { block.event.noPass = true; } } @@ -80,10 +80,13 @@ maps.prototype.addInfo = function (block) { if (block.event.cls=='enemys' || block.event.cls=='npcs') { block.event.animate = 2; } - if (block.event.cls == 'animates') { + if (block.event.cls == 'animates' || block.event.cls == 'enemy48' || block.event.cls == 'npc48') { block.event.animate = 4; } } + block.event.height = 32; + if (block.event.cls == 'enemy48' || block.event.cls == 'npc48') + block.event.height = 48; } } @@ -283,6 +286,19 @@ maps.prototype.canMoveDirectly = function (destX,destY) { return false; } +maps.prototype.drawBlock = function (block, animate, dx, dy) { + var cls = block.event.cls, height = block.event.height || 32; + var blockIcon = core.material.icons[cls][block.event.id]; + var blockImage = core.material.images[cls]; + animate=(animate||0)%(block.event.animate||1); + dx = dx || 0; + dy = dy || 0; + core.canvas.event.clearRect(block.x * 32 + dx, block.y * 32 + dy, 32, 32); + core.canvas.event2.clearRect(block.x * 32 + dx, block.y * 32 - 32 + dy, 32, 32) + core.canvas.event.drawImage(blockImage, animate * 32, blockIcon * height + height-32, 32, 32, block.x * 32 + dx, block.y * 32 + dy, 32, 32); + core.canvas.event2.drawImage(blockImage, animate * 32, blockIcon * height, 32, height-32, block.x * 32 + dx, block.y*32 + 32 - height + dy, 32, height-32); +} + ////// 绘制某张地图 ////// maps.prototype.drawMap = function (mapName, callback) { core.clearMap('all'); @@ -348,10 +364,8 @@ maps.prototype.drawMap = function (mapName, callback) { } else { if (block.event.id!='none') { - blockIcon = core.material.icons[block.event.cls][block.event.id]; - blockImage = core.material.images[block.event.cls]; - core.canvas.event.drawImage(core.material.images[block.event.cls], 0, blockIcon * 32, 32, 32, block.x * 32, block.y * 32, 32, 32); - core.addGlobalAnimate(block.event.animate, block.x * 32, block.y * 32, blockIcon, blockImage); + core.drawBlock(block); + core.addGlobalAnimate(block); } } } @@ -471,7 +485,7 @@ maps.prototype.noPass = function (x, y) { maps.prototype.npcExists = function (x, y, floorId) { var block = this.getBlock(x,y,floorId); if (block==null) return false; - return block.block.event.cls == 'npcs'; + return block.block.event.cls.indexOf('npc')==0; } ////// 某个点是否存在(指定的)地形 ////// @@ -498,7 +512,7 @@ maps.prototype.nearStair = function() { maps.prototype.enemyExists = function (x, y, id,floorId) { var block = this.getBlock(x,y,floorId); if (block==null) return false; - return block.block.event.cls=='enemys' && (core.isset(id)?block.block.event.id==id:true); + return block.block.event.cls.indexOf('enemy')==0 && (core.isset(id)?block.block.event.id==id:true); } ////// 获得某个点的block ////// @@ -537,10 +551,11 @@ maps.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) { block=block.block; var blockIcon = core.material.icons[block.event.cls][block.event.id]; var blockImage = core.material.images[block.event.cls]; + var height = block.event.height || 32; var opacityVal = 1; core.setOpacity('animate', opacityVal); - core.canvas.animate.drawImage(blockImage, 0, blockIcon * 32, 32, 32, block.x * 32, block.y * 32, 32, 32); + core.canvas.animate.drawImage(blockImage, 0, blockIcon * height, 32, height, block.x * 32, block.y * 32 +32 - height, 32, height); // 要运行的轨迹:将steps展开 var moveSteps=[]; @@ -575,7 +590,7 @@ maps.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) { var animate=window.setInterval(function() { animateTime += time / 16 / core.status.replay.speed; - if (animateTime >= core.values.animateSpeed * 2 / animateValue) { + if (animateTime >= core.values.animateSpeed) { animateCurrent++; animateTime = 0; if (animateCurrent>=animateValue) animateCurrent=0; @@ -586,8 +601,8 @@ maps.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) { if (immediateHide) opacityVal=0; else opacityVal -= 0.06; core.setOpacity('animate', opacityVal); - core.clearMap('animate', nowX, nowY, 32, 32); - core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * 32, 32, 32, nowX, nowY, 32, 32); + 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); if (opacityVal<=0) { clearInterval(animate); core.clearMap('animate', 0, 0, 416, 416); @@ -603,7 +618,7 @@ maps.prototype.moveBlock = function(x,y,steps,time,immediateHide,callback) { nowY+=scan[moveSteps[0]].y*2; core.clearMap('animate', nowX-32, nowY-32, 96, 96); // 绘制 - core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * 32, 32, 32, nowX, nowY, 32, 32); + core.canvas.animate.drawImage(blockImage, animateCurrent * 32, blockIcon * height, 32, height, nowX, nowY-height+32, 32, height); if (step==16) { // 该移动完毕,继续 step=0; @@ -628,7 +643,7 @@ maps.prototype.animateBlock = function (loc,type,time,callback) { if (block==null) return; block=block.block; list.push({ - 'x': t[0], 'y': t[1], + 'x': t[0], 'y': t[1], 'height': block.event.height||32, 'blockIcon': core.material.icons[block.event.cls][block.event.id], 'blockImage': core.material.images[block.event.cls] }) @@ -642,7 +657,7 @@ 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 * 32, 32, 32, t.x * 32, t.y * 32, 32, 32); + 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); }) } @@ -680,11 +695,8 @@ maps.prototype.showBlock = function(x, y, floodId) { block.enable = true; // 在本层,添加动画 if (floodId == core.status.floorId && core.isset(block.event)) { - blockIcon = core.material.icons[block.event.cls][block.event.id]; - blockImage = core.material.images[block.event.cls]; - core.canvas.event.drawImage(core.material.images[block.event.cls], 0, blockIcon * 32, 32, 32, block.x * 32, block.y * 32, 32, 32); - core.addGlobalAnimate(block.event.animate, block.x * 32, block.y * 32, blockIcon, blockImage); - // core.setGlobalAnimate(core.values.animateSpeed); + core.drawBlock(block); + core.addGlobalAnimate(block); core.syncGlobalAnimate(); } core.updateStatusBar(); @@ -704,6 +716,7 @@ maps.prototype.removeBlock = function (x, y, floorId) { if (floorId==core.status.floorId) { core.removeGlobalAnimate(x, y); core.canvas.event.clearRect(x * 32, y * 32, 32, 32); + core.canvas.event2.clearRect(x * 32, y * 32 - 32, 32, 32); } // 删除Index @@ -724,7 +737,7 @@ maps.prototype.removeBlockById = function (index, floorId) { // 检查是否存在重生 var isReborn = false; - if (core.isset(block.event) && block.event.cls=='enemys' + if (core.isset(block.event) && block.event.cls.indexOf('enemy')==0 && core.enemys.hasSpecial(core.material.enemys[block.event.id].special, 23)) isReborn = true; @@ -744,46 +757,29 @@ maps.prototype.removeBlockByIds = function (floorId, ids) { } ////// 添加一个全局动画 ////// -maps.prototype.addGlobalAnimate = function (animateMore, x, y, loc, image) { +maps.prototype.addGlobalAnimate = function (b) { if (main.mode=='editor' && main.editor.disableGlobalAnimate) return; - if (animateMore == 2) { - core.status.twoAnimateObjs.push({ - 'x': x, - 'y': y, - 'status': 0, - 'loc': loc, - 'image': image - }); - } - else if (animateMore == 4) { - core.status.fourAnimateObjs.push({ - 'x': x, - 'y': y, - 'status': 0, - 'loc': loc, - 'image': image - }); - } + if (!core.isset(b.event) || !core.isset(b.event.animate) || b.event.animate==1) return; + + var block = core.clone(b); + block.status = 0; + + core.status.globalAnimateObjs.push(block); + } ////// 删除一个或所有全局动画 ////// maps.prototype.removeGlobalAnimate = function (x, y, all) { - if (all == true) { - core.status.twoAnimateObjs = []; - core.status.fourAnimateObjs = []; - } - if (main.mode=='editor' && main.editor.disableGlobalAnimate) return; - for (var t = 0; t < core.status.twoAnimateObjs.length; t++) { - if (core.status.twoAnimateObjs[t].x == x * 32 && core.status.twoAnimateObjs[t].y == y * 32) { - core.status.twoAnimateObjs.splice(t, 1); - return; - } + if (all) { + core.status.globalAnimateObjs = []; + return; } - for (var f = 0; f < core.status.fourAnimateObjs.length; f++) { - if (core.status.fourAnimateObjs[f].x == x * 32 && core.status.fourAnimateObjs[f].y == y * 32) { - core.status.fourAnimateObjs.splice(f, 1); + + for (var t = 0; t < core.status.globalAnimateObjs.length; t++) { + if (core.status.globalAnimateObjs[t].x == x && core.status.globalAnimateObjs[t].y == y) { + core.status.globalAnimateObjs.splice(t, 1); return; } } @@ -799,10 +795,7 @@ maps.prototype.setGlobalAnimate = function (speed) { ////// 同步所有的全局动画效果 ////// maps.prototype.syncGlobalAnimate = function () { - core.status.twoAnimateObjs.forEach(function (t) { - t.status=0; - }) - core.status.fourAnimateObjs.forEach(function (t) { + core.status.globalAnimateObjs.forEach(function (t) { t.status=0; }) } @@ -811,11 +804,11 @@ maps.prototype.syncGlobalAnimate = function () { maps.prototype.drawBoxAnimate = function () { for (var a = 0; a < core.status.boxAnimateObjs.length; a++) { var obj = core.status.boxAnimateObjs[a]; - obj.status = ((obj.status||0)+1)%2; - core.clearMap('ui', obj.bgx, obj.bgy, obj.bgsize, obj.bgsize); - core.fillRect('ui', obj.bgx, obj.bgy, obj.bgsize, obj.bgsize, core.animateFrame.background); - core.canvas.ui.drawImage(obj.image, obj.status * 32, obj.icon * 32, - 32, 32, obj.x, obj.y, 32, 32); + obj.status = ((obj.status||0)+1)%obj.animate; + core.clearMap('ui', obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight); + core.fillRect('ui', obj.bgx, obj.bgy, obj.bgWidth, obj.bgHeight, core.animateFrame.background); + core.canvas.ui.drawImage(obj.image, obj.status * 32, obj.pos, + 32, obj.height, obj.x, obj.y, 32, obj.height); } } diff --git a/libs/ui.js b/libs/ui.js index 3eb517d1..cceb37be 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -266,7 +266,7 @@ ui.prototype.drawTextBox = function(content) { clearInterval(core.status.event.interval); // 获得name, image, icon - var id=null, name=null, image=null, icon=null; + var id=null, name=null, image=null, icon=null, iconHeight=32, animate=null; if (content.indexOf("\t[")==0 || content.indexOf("\\t[")==0) { var index = content.indexOf("]"); if (index>=0) { @@ -279,11 +279,21 @@ ui.prototype.drawTextBox = function(content) { id=ss[0]; // monster if (id!='hero') { - var enemys = core.material.enemys[id]; - if (core.isset(enemys)) { + if (core.isset(core.material.enemys[id])) { name = core.material.enemys[id].name; - image = core.material.images.enemys; - icon = core.material.icons.enemys[id]; + + if (core.isset(core.material.icons.enemy48[id])) { + image = core.material.images.enemy48; + icon = core.material.icons.enemy48[id]; + iconHeight = 48; + animate=4; + } + else { + image = core.material.images.enemys; + icon = core.material.icons.enemys[id]; + iconHeight = 32; + animate=2; + } } else { name=id; @@ -296,8 +306,18 @@ ui.prototype.drawTextBox = function(content) { else { id='npc'; name=ss[0]; - image=core.material.images.npcs; - icon=core.material.icons.npcs[ss[1]]; + if (core.isset(core.material.icons.npc48[ss[1]])) { + image = core.material.images.npc48; + icon = core.material.icons.npc48[ss[1]]; + iconHeight = 48; + animate=4; + } + else { + image = core.material.images.npcs; + icon = core.material.icons.npcs[ss[1]]; + iconHeight = 32; + animate=2; + } } } } @@ -306,7 +326,7 @@ ui.prototype.drawTextBox = function(content) { var textAttribute = core.status.textAttribute || core.initStatus.textAttribute; - var position = textAttribute.position, px=null, py=null, ydelta=0; + var position = textAttribute.position, px=null, py=null, ydelta=iconHeight-32; if (content.indexOf("\b[")==0 || content.indexOf("\\b[")==0) { var index = content.indexOf("]"); if (index>=0) { @@ -355,7 +375,7 @@ ui.prototype.drawTextBox = function(content) { if (textAttribute.bold) font = "bold "+font; var contents = core.splitLines("ui", content, validWidth, font); - var height = 20 + 21*(contents.length+1) + (id=='hero'?core.material.icons.hero.height-10:core.isset(name)?32-10:0); + var height = 20 + 21*(contents.length+1) + (id=='hero'?core.material.icons.hero.height-10:core.isset(name)?iconHeight-10:0); var xoffset = 6, yoffset = 22; @@ -447,12 +467,16 @@ ui.prototype.drawTextBox = function(content) { else { core.fillText('ui', name, content_left, top + 30, null, 'bold 22px Verdana'); if (core.isset(icon)) { - core.strokeRect('ui', left + 15 - 1, top + 40 - 1, 34, 34, null, 2); + + core.strokeRect('ui', left + 15 - 1, top + 40 - 1, 34, iconHeight + 2, null, 2); core.status.boxAnimateObjs = []; core.status.boxAnimateObjs.push({ - 'bgx': left + 15, 'bgy': top + 40, 'bgsize': 32, - 'image': image, 'x': left + 15, 'y': top + 40, 'icon': icon + 'bgx': left + 15, 'bgy': top + 40, 'bgWidth': 32, 'bgHeight': iconHeight, + 'x': left+15, 'y': top+40, 'height': iconHeight, 'animate': animate, + 'image': image, + 'pos': icon*iconHeight }); + core.drawBoxAnimate(); } } @@ -510,7 +534,7 @@ ui.prototype.drawChoices = function(content, choices) { if (length%2==0) bottom+=16; var choice_top = bottom-height+56; - var id=null, name=null, image=null, icon=null; + var id=null, name=null, image=null, icon=null, iconHeight=32, animate=null; var contents = null; var content_left = left + 15; @@ -528,11 +552,21 @@ ui.prototype.drawChoices = function(content, choices) { id=ss[0]; // monster if (id!='hero') { - var enemys = core.material.enemys[id]; - if (core.isset(enemys)) { + if (core.isset(core.material.enemys[id])) { name = core.material.enemys[id].name; - image = core.material.images.enemys; - icon = core.material.icons.enemys[id]; + + if (core.isset(core.material.icons.enemy48[id])) { + image = core.material.images.enemy48; + icon = core.material.icons.enemy48[id]; + iconHeight = 48; + animate=4; + } + else { + image = core.material.images.enemys; + icon = core.material.icons.enemys[id]; + iconHeight = 32; + animate=2; + } } else { name=id; @@ -545,8 +579,18 @@ ui.prototype.drawChoices = function(content, choices) { else { id='npc'; name=ss[0]; - image=core.material.images.npcs; - icon=core.material.icons.npcs[ss[1]]; + if (core.isset(core.material.icons.npc48[ss[1]])) { + image = core.material.images.npc48; + icon = core.material.icons.npc48[ss[1]]; + iconHeight = 48; + animate=4; + } + else { + image = core.material.images.npcs; + icon = core.material.icons.npcs[ss[1]]; + iconHeight = 32; + animate=2; + } } } } @@ -595,11 +639,13 @@ ui.prototype.drawChoices = function(content, choices) { else { core.fillText('ui', name, title_offset, top + 27, '#FFD700', 'bold 19px Verdana'); if (core.isset(icon)) { - core.strokeRect('ui', left + 15 - 1, top + 30 - 1, 34, 34, '#DDDDDD', 2); + core.strokeRect('ui', left + 15 - 1, top + 30 - 1, 34, iconHeight + 2, '#DDDDDD', 2); core.status.boxAnimateObjs = []; core.status.boxAnimateObjs.push({ - 'bgx': left + 15, 'bgy': top + 30, 'bgsize': 32, - 'image': image, 'x': left + 15, 'y': top + 30, 'icon': icon + 'bgx': left + 15, 'bgy': top + 30, 'bgWidth': 32, 'bgHeight': iconHeight, + 'x': left+15, 'y': top+30, 'height': iconHeight, 'animate': animate, + 'image': image, + 'pos': icon*iconHeight }); core.drawBoxAnimate(); } @@ -809,19 +855,28 @@ ui.prototype.drawBattleAnimate = function(monsterId, callback) { var margin = 35; var boxWidth = 40; + var monsterHeight = 32, animate=2; + + var image = core.material.images.enemys, icon = core.material.icons.enemys; + if (core.isset(core.material.icons.enemy48[monsterId])) { + image = core.material.images.enemy48; + icon = core.material.icons.enemy48; + monsterHeight = 48; + animate=4; + } // 方块 var heroHeight = core.material.icons.hero.height; core.strokeRect('ui', left + margin - 1, top + margin - 1, boxWidth+2, heroHeight+boxWidth-32+2, '#FFD700', 2); - core.strokeRect('ui', left + right - margin - boxWidth - 1 , top+margin-1, boxWidth+2, boxWidth+2); + core.strokeRect('ui', left + right - margin - boxWidth - 1 , top+margin-1, boxWidth+2, monsterHeight+boxWidth-32+2); // 名称 core.canvas.ui.textAlign='center'; core.fillText('ui', core.status.hero.name, left+margin+boxWidth/2, top+margin+heroHeight+40, '#FFD700', 'bold 22px Verdana'); - core.fillText('ui', "怪物", left+right-margin-boxWidth/2, top+margin+32+40); + core.fillText('ui', "怪物", left+right-margin-boxWidth/2, top+margin+monsterHeight+40); for (var i=0, j=0; i0) @@ -1166,11 +1221,18 @@ ui.prototype.drawBook = function (index) { var enemy = enemys[i]; core.strokeRect('ui', 22, 62 * i + 22, 42, 42, '#DDDDDD', 2); + var cls = 'enemys'; + if (core.isset(core.material.icons.enemy48[enemy.id])) + cls = 'enemy48'; + var height = cls=='enemy48'?48:32; + var animate = cls=='enemy48'?4:2; + // 怪物 core.status.boxAnimateObjs.push({ - 'bgx': 22, 'bgy': 62 * i + 22, 'bgsize': 42, - 'image': core.material.images.enemys, - 'x': 27, 'y': 62 * i + 27, 'icon': core.material.icons.enemys[enemy.id] + 'bgx': 22, 'bgy': 62 * i + 22, 'bgWidth': 42, 'bgHeight': 42, + 'x': 27, 'y': 62 * i + 27, 'height': 32, 'animate': animate, + 'image': core.material.images[cls], + 'pos': core.material.icons[cls][enemy.id] * height }); // 数据 @@ -1558,12 +1620,6 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, heroL if (core.isset(core.floors[floorId].png)) { var png = core.floors[floorId].png; - /* - if (core.isset(core.material.images.pngs[png])) { - core.canvas.ui.drawImage(core.material.images.pngs[png], x, y, size, size); - } - */ - var ratio = size/416; if (typeof png == 'string') { @@ -1596,7 +1652,8 @@ ui.prototype.drawThumbnail = function(floorId, canvas, blocks, x, y, size, heroL if (block.event.id!='none') { var blockIcon = core.material.icons[block.event.cls][block.event.id]; var blockImage = core.material.images[block.event.cls]; - core.canvas[canvas].drawImage(blockImage, 0, blockIcon * 32, 32, 32, x + block.x * persize, y + block.y * persize, persize, persize); + var height = block.event.height || 32; + core.canvas[canvas].drawImage(blockImage, 0, blockIcon * height, 32, height, x + block.x * persize, y + block.y * persize + (persize-persize*height/32), persize, persize * height/32); } } } diff --git a/main.js b/main.js index 292a2e74..2631395d 100644 --- a/main.js +++ b/main.js @@ -59,7 +59,7 @@ function main() { "data","enemys","icons","maps","items","functions" ]; this.images = [ - 'animates', 'enemys', 'hero', 'items', 'npcs', 'terrains' + 'animates', 'enemys', 'hero', 'items', 'npcs', 'terrains', 'enemy48', 'npc48' ]; this.statusBar = { diff --git a/project/comment.js b/project/comment.js index 9c0a6b06..e1869a3c 100644 --- a/project/comment.js +++ b/project/comment.js @@ -30,7 +30,7 @@ comment_c456ea59_6018_45ef_8bcc_211a24c627dc = 'defValue':'退化时勇士下降的防御力点数\n$range(thiseval==~~thiseval||thiseval==null)$end', 'damage':'战前扣血的点数\n$range(thiseval==~~thiseval||thiseval==null)$end' }, - "enemys_template" : {'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'special': 0}, + "enemys_template" : {'name': '新敌人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, "floors" : { 'floor' : { "floorId": "文件名和floorId需要保持完全一致 \n楼层唯一标识符仅能由字母、数字、下划线组成,且不能由数字开头 \n推荐用法:第20层就用MT20,第38层就用MT38,地下6层就用MT_6(用下划线代替负号),隐藏3层用MT3h(h表示隐藏),等等 \n楼层唯一标识符,需要和名字完全一致 \n这里不能更改floorId,请通过另存为来实现\n$range(false)$end", diff --git a/project/data.js b/project/data.js index bcfd57e2..b1402f32 100644 --- a/project/data.js +++ b/project/data.js @@ -131,7 +131,7 @@ data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = 'counterAttack': 0.1, 'purify': 3, 'hatred': 2, - 'animateSpeed': 500, + 'animateSpeed': 300, }, "flags" : { diff --git a/project/enemys.js b/project/enemys.js index 1ee04c40..8be699d0 100644 --- a/project/enemys.js +++ b/project/enemys.js @@ -1,63 +1,67 @@ enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = { - 'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'point': 0, 'special': [1,5,7,8]}, - 'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'point': 0, 'special': [1,9]}, - 'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'point': 0, 'special': 1}, - 'bigBat': {'name': '大蝙蝠', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'redBat': {'name': '红蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 5, 'experience': 0, 'point': 0, 'special': 4}, - 'vampire': {'name': '冥灵魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'skeleton': {'name': '骷髅人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'skeletonSoilder': {'name': '骷髅士兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'skeletonCaptain': {'name': '骷髅队长', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'ghostSkeleton': {'name': '冥队长', 'hp': 100, 'atk': 120, 'def': 0, 'money': 8, 'experience': 0, 'point': 0, 'special': 7}, - 'zombie': {'name': '兽人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'zombieKnight': {'name': '兽人武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'rock': {'name': '石头人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 4, 'experience': 0, 'point': 0, 'special': 3}, - 'slimeMan': {'name': '影子战士', 'hp': 100, 'atk': 0, 'def': 0, 'money': 11, 'experience': 0, 'point': 0, 'special': [10,21], 'atkValue': 2, 'defValue': 3}, // 退化怪可以在后面写atkValue和defValue表示退化的数值 - 'bluePriest': {'name': '初级法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 3, 'experience': 0, 'point': 1, 'special': 2}, - 'redPriest': {'name': '高级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'brownWizard': {'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'point': 0, 'special': 15, 'value': 100, 'range': 2}, // 领域怪需要加value表示领域伤害的数值;range可选,代表领域伤害的范围;不加默认为1 - 'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 1200, 'def': 0, 'money': 160, 'experience': 0, 'point': 0, 'special': 15, 'value': 200, 'zoneSquare': true}, // zoneSquare可选,代表是否九宫格伤害,true为是九宫格伤害,false或不设置为十字伤害 - 'yellowGuard': {'name': '初级卫兵', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'point': 0, 'special': 0}, - 'blueGuard': {'name': '中级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'redGuard': {'name': '高级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'swordsman': {'name': '双手剑士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 6, 'experience': 0, 'point': 0, 'special': [5,23]}, - 'soldier': {'name': '冥战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'yellowKnight': {'name': '金骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'redKnight': {'name': '红骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'darkKnight': {'name': '黑骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'blackKing': {'name': '黑衣魔王', 'hp': 1000, 'atk': 500, 'def': 0, 'money': 1000, 'experience': 1000, 'point': 0, 'special': 0, 'bomb': false}, // 加入 'bomb': false 代表该怪物不可被炸弹或圣锤炸掉 - 'yellowKing': {'name': '黄衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'greenKing': {'name': '青衣武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'blueKnight': {'name': '蓝骑士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 9, 'experience': 0, 'point': 0, 'special': 8}, - 'goldSlime': {'name': '黄头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'poisonSkeleton': {'name': '紫骷髅', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'poisonBat': {'name': '紫蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 14, 'experience': 0, 'point': 0, 'special': 13}, - 'steelRock': {'name': '铁面人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'skeletonPriest': {'name': '骷髅法师', 'hp': 100, 'atk': 100, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 18, 'value': 20}, - 'skeletonKing': {'name': '骷髅王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'skeletonWizard': {'name': '骷髅巫师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'redSkeletonCaption': {'name': '骷髅武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'badHero': {'name': '迷失勇者', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'demon': {'name': '魔神武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'point': 0, 'special': 16}, - 'blackMagician': {'name': '黑暗大法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'point': 0, 'special': 11, 'value': 1/3, 'add': true, 'bomb': false}, // 吸血怪需要在后面添加value代表吸血比例;添加add: true可以将吸血的伤害加到自身 - 'silverSlime': {'name': '银头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 15, 'experience': 0, 'point': 0, 'special': 14}, - 'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'whiteHornSlime': {'name': '尖角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'point': 0, 'special': 6, 'n': 8}, // 多连击需要在后面指定n代表是几连击 - 'whiteGhost': {'name': '水银战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'poisonZombie': {'name': '绿兽人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 13, 'experience': 0, 'point': 0, 'special': 12}, - 'magicDragon': {'name': '魔龙', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'octopus': {'name': '血影', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'darkFairy': {'name': '仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, - 'greenKnight': {'name': '强盾骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'greenSlime': {'name': '绿头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 1, 'experience': 1, 'point': 0, 'special': [1,5,7,8]}, + 'redSlime': {'name': '红头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'blackSlime': {'name': '青头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'slimelord': {'name': '怪王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'point': 0, 'special': [1,9]}, + 'bat': {'name': '小蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 2, 'experience': 0, 'point': 0, 'special': 1}, + 'bigBat': {'name': '大蝙蝠', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'redBat': {'name': '红蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 5, 'experience': 0, 'point': 0, 'special': 4}, + 'vampire': {'name': '冥灵魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'skeleton': {'name': '骷髅人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'skeletonSoilder': {'name': '骷髅士兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'skeletonCaptain': {'name': '骷髅队长', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'ghostSkeleton': {'name': '冥队长', 'hp': 100, 'atk': 120, 'def': 0, 'money': 8, 'experience': 0, 'point': 0, 'special': 7}, + 'zombie': {'name': '兽人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'zombieKnight': {'name': '兽人武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'rock': {'name': '石头人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 4, 'experience': 0, 'point': 0, 'special': 3}, + 'slimeMan': {'name': '影子战士', 'hp': 100, 'atk': 0, 'def': 0, 'money': 11, 'experience': 0, 'point': 0, 'special': [10,21], 'atkValue': 2, 'defValue': 3}, // 退化怪可以在后面写atkValue和defValue表示退化的数值 + 'bluePriest': {'name': '初级法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 3, 'experience': 0, 'point': 1, 'special': 2}, + 'redPriest': {'name': '高级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'brownWizard': {'name': '初级巫师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 16, 'experience': 0, 'point': 0, 'special': 15, 'value': 100, 'range': 2}, // 领域怪需要加value表示领域伤害的数值;range可选,代表领域伤害的范围;不加默认为1 + 'redWizard': {'name': '高级巫师', 'hp': 1000, 'atk': 1200, 'def': 0, 'money': 160, 'experience': 0, 'point': 0, 'special': 15, 'value': 200, 'zoneSquare': true}, // zoneSquare可选,代表是否九宫格伤害,true为是九宫格伤害,false或不设置为十字伤害 + 'yellowGuard': {'name': '初级卫兵', 'hp': 100, 'atk': 120, 'def': 0, 'money': 10, 'experience': 0, 'point': 0, 'special': 0}, + 'blueGuard': {'name': '中级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'redGuard': {'name': '高级卫兵', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'swordsman': {'name': '双手剑士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 6, 'experience': 0, 'point': 0, 'special': [5,23]}, + 'soldier': {'name': '冥战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'yellowKnight': {'name': '金骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'redKnight': {'name': '红骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'darkKnight': {'name': '黑骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'blackKing': {'name': '黑衣魔王', 'hp': 1000, 'atk': 500, 'def': 0, 'money': 1000, 'experience': 1000, 'point': 0, 'special': 0, 'bomb': false}, // 加入 'bomb': false 代表该怪物不可被炸弹或圣锤炸掉 + 'yellowKing': {'name': '黄衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'greenKing': {'name': '青衣武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'blueKnight': {'name': '蓝骑士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 9, 'experience': 0, 'point': 0, 'special': 8}, + 'goldSlime': {'name': '黄头怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'poisonSkeleton': {'name': '紫骷髅', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'poisonBat': {'name': '紫蝙蝠', 'hp': 100, 'atk': 120, 'def': 0, 'money': 14, 'experience': 0, 'point': 0, 'special': 13}, + 'steelRock': {'name': '铁面人', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'skeletonPriest': {'name': '骷髅法师', 'hp': 100, 'atk': 100, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 18, 'value': 20}, + 'skeletonKing': {'name': '骷髅王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'skeletonWizard': {'name': '骷髅巫师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'redSkeletonCaption': {'name': '骷髅武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'badHero': {'name': '迷失勇者', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'demon': {'name': '魔神武士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'demonPriest': {'name': '魔神法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'goldHornSlime': {'name': '金角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'redKing': {'name': '红衣魔王', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'whiteKing': {'name': '白衣武士', 'hp': 100, 'atk': 120, 'def': 0, 'money': 17, 'experience': 0, 'point': 0, 'special': 16}, + 'blackMagician': {'name': '黑暗大法师', 'hp': 100, 'atk': 120, 'def': 0, 'money': 12, 'experience': 0, 'point': 0, 'special': 11, 'value': 1/3, 'add': true, 'bomb': false}, // 吸血怪需要在后面添加value代表吸血比例;添加add: true可以将吸血的伤害加到自身 + 'silverSlime': {'name': '银头怪', 'hp': 100, 'atk': 120, 'def': 0, 'money': 15, 'experience': 0, 'point': 0, 'special': 14}, + 'swordEmperor': {'name': '剑圣', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'whiteHornSlime': {'name': '尖角怪', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'badPrincess': {'name': '痛苦魔女', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'badFairy': {'name': '黑暗仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'grayPriest': {'name': '中级法师', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'redSwordsman': {'name': '剑王', 'hp': 100, 'atk': 120, 'def': 0, 'money': 7, 'experience': 0, 'point': 0, 'special': 6, 'n': 8}, // 多连击需要在后面指定n代表是几连击 + 'whiteGhost': {'name': '水银战士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'poisonZombie': {'name': '绿兽人', 'hp': 100, 'atk': 120, 'def': 0, 'money': 13, 'experience': 0, 'point': 0, 'special': 12}, + 'magicDragon': {'name': '魔龙', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'octopus': {'name': '血影', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'darkFairy': {'name': '仙子', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'greenKnight': {'name': '强盾骑士', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'angel': {'name': '天使', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'elemental': {'name': '元素生物', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 0}, + 'steelGuard': {'name': '铁守卫', 'hp': 0, 'atk': 0, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': 18, 'value': 20}, + 'evilBat': {'name': '邪恶蝙蝠', 'hp': 1000, 'atk': 1, 'def': 0, 'money': 0, 'experience': 0, 'point': 0, 'special': [2,3]}, } \ No newline at end of file diff --git a/project/floors/sample0.js b/project/floors/sample0.js index e78b84ac..22feae9b 100644 --- a/project/floors/sample0.js +++ b/project/floors/sample0.js @@ -19,13 +19,13 @@ main.floors.sample0 = [0, 246, 0, 246, 0, 20, 0, 3, 58, 59, 60, 61, 41], [219, 0, 0, 0, 219, 20, 0, 3, 57, 26, 62, 63, 40], [20, 20, 125, 20, 20, 20, 0, 3, 53, 54, 55, 56, 39], - [216, 247, 256, 235, 248, 6, 0, 3, 49, 50, 51, 52, 38], + [216, 247, 263, 235, 248, 6, 0, 3, 49, 50, 51, 52, 38], [6, 6, 125, 6, 6, 6, 0, 1, 45, 46, 47, 48, 37], - [224, 254, 212, 232, 204, 5, 0, 1, 31, 32, 34, 33, 36], - [201, 205, 217, 215, 207, 5, 0, 1, 27, 28, 29, 30, 35], + [224, 254, 212, 262, 204, 5, 0, 1, 31, 32, 34, 33, 36], + [201, 261, 217, 215, 207, 5, 263, 1, 27, 28, 29, 30, 35], [5, 5, 125, 5, 5, 5, 0, 1, 21, 22, 23, 24, 25], [0, 0, 237, 0, 0, 0, 45, 1, 1, 1, 121, 1, 1], - [4, 4, 126, 4, 4, 4, 0, 0, 0, 0, 0, 85, 124], + [4, 4, 133, 4, 4, 4, 0, 0, 0, 0, 0, 85, 124], [87, 11, 12, 13, 14, 4, 4, 2, 2, 2, 122, 2, 2], [88, 89, 90, 91, 92, 93, 94, 2, 81, 82, 83, 84, 86], ], @@ -49,9 +49,9 @@ main.floors.sample0 = {"type": "hide", "time": 500} ], "2,10": [ // 守着楼梯、传送门、路障的老人 - "\t[老人,womanMagician]这些是路障、楼梯、传送门。", - "\t[老人,womanMagician]血网的伤害数值、中毒后每步伤害数值、衰弱时攻防下降的数值,都在 data.js 内定义。\n\n路障同样会尽量被自动寻路绕过。", - "\t[老人,womanMagician]楼梯和传送门需要在changeFloor中定义目标楼层和位置,可参见样板里已有的的写法。", + "\t[少女,npc0]这些是路障、楼梯、传送门。", + "\t[少女,npc0]血网的伤害数值、中毒后每步伤害数值、衰弱时攻防下降的数值,都在 data.js 内定义。\n\n路障同样会尽量被自动寻路绕过。", + "\t[少女,npc0]楼梯和传送门需要在changeFloor中定义目标楼层和位置,可参见样板里已有的的写法。", {"type": "hide", "time": 500} ], "2,8": [ // 守着第一批怪物的老人 diff --git a/project/icons.js b/project/icons.js index fbd4a186..21c181d2 100644 --- a/project/icons.js +++ b/project/icons.js @@ -101,6 +101,13 @@ icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = 'blueShop': 10, 'princess': 11 }, + 'npc48': { + 'npc0': 0, + 'npc1': 1, + 'npc2': 2, + 'npc3': 3, + 'npc4': 4, + }, 'enemys': { 'greenSlime': 0, 'redSlime': 1, @@ -163,6 +170,12 @@ icons_4665ee12_3a1f_44a4_bea3_0fccba634dc1 = 'darkFairy': 58, 'greenKnight': 59, }, + 'enemy48': { + 'angel': 0, + 'elemental': 1, + 'steelGuard': 2, + 'evilBat': 3, + }, 'items': { 'yellowKey': 0, 'blueKey': 1, diff --git a/project/images/animates.png b/project/images/animates.png index c1c1cb1a..29707cdb 100644 Binary files a/project/images/animates.png and b/project/images/animates.png differ diff --git a/project/images/enemy48.png b/project/images/enemy48.png new file mode 100644 index 00000000..a7f7d0cd Binary files /dev/null and b/project/images/enemy48.png differ diff --git a/project/images/npc48.png b/project/images/npc48.png new file mode 100644 index 00000000..43c3a376 Binary files /dev/null and b/project/images/npc48.png differ diff --git a/project/maps.js b/project/maps.js index a265e88c..027b4302 100644 --- a/project/maps.js +++ b/project/maps.js @@ -112,6 +112,12 @@ maps_90f36752_8815_4be8_b32b_d7fad1d0542e = '130':{'cls': 'npcs', 'id': 'pinkShop'}, '131':{'cls': 'npcs', 'id': 'blueShop'}, '132':{'cls': 'npcs', 'id': 'princess'}, + '133':{'cls': 'npc48', 'id': 'npc0'}, + '134':{'cls': 'npc48', 'id': 'npc1'}, + '135':{'cls': 'npc48', 'id': 'npc2'}, + '136':{'cls': 'npc48', 'id': 'npc3'}, + '137':{'cls': 'npc48', 'id': 'npc4'}, + ////////////////////////// 其他部分 ////////////////////////// @@ -192,6 +198,10 @@ maps_90f36752_8815_4be8_b32b_d7fad1d0542e = '259':{'cls': 'enemys', 'id': 'darkFairy'}, '260':{'cls': 'enemys', 'id': 'greenKnight'}, + '261':{'cls': 'enemy48', 'id': 'angel'}, + '262':{'cls': 'enemy48', 'id': 'elemental'}, + '263':{'cls': 'enemy48', 'id': 'steelGuard'}, + '264':{'cls': 'enemy48', 'id': 'evilBat'}, + ////////////////////////// 待定... ////////////////////////// - // 目前ID暂时不要超过400 } \ No newline at end of file diff --git a/styles.css b/styles.css index 0c8a944f..913d64e0 100644 --- a/styles.css +++ b/styles.css @@ -32,7 +32,7 @@ left: 0; background-color: #fff; overflow: hidden; - z-index: 11; + z-index: 12; } #startTop { @@ -142,7 +142,7 @@ display: none; color: #fff; background-color: #000; - z-index: 10; + z-index: 11; } #logoLabel { @@ -234,7 +234,7 @@ span#poison, span#weak, span#curse { } #curtain { - z-index: 7; + z-index: 8; position: absolute; opacity: 0; background: #000000; @@ -248,28 +248,32 @@ span#poison, span#weak, span#curse { z-index: 2; } -#fg { +#hero { z-index: 3; } -#hero { +#event2 { z-index: 4; } -#animate { +#fg { z-index: 5; } -#weather { +#animate { z-index: 6; } +#weather { + z-index: 7; +} + #ui { - z-index: 8; + z-index: 9; } #data { - z-index: 9; + z-index: 10; } .clearfix:before,