diff --git a/EcmaScript.NET.dll b/EcmaScript.NET.dll new file mode 100644 index 00000000..188f4c8d Binary files /dev/null and b/EcmaScript.NET.dll differ diff --git a/JS代码压缩工具.exe b/JS代码压缩工具.exe new file mode 100644 index 00000000..38eaaf25 Binary files /dev/null and b/JS代码压缩工具.exe differ diff --git a/Yahoo.Yui.Compressor.dll b/Yahoo.Yui.Compressor.dll new file mode 100644 index 00000000..a2ff2ae6 Binary files /dev/null and b/Yahoo.Yui.Compressor.dll differ diff --git a/libs/core.min.js b/libs/core.min.js new file mode 100644 index 00000000..74d8fb1b --- /dev/null +++ b/libs/core.min.js @@ -0,0 +1 @@ +function core(){this.dom={};this.statusBar={};this.canvas={};this.images=[];this.sounds={};this.floorIds=[];this.floors={};this.firstData={};this.material={images:{},sounds:{},ground:null,items:{},enemys:{},icons:{},events:{}};this.timeout={getItemTipTimeout:null};this.interval={twoAnimate:null,fourAnimate:null,boxAnimate:null,heroMoveTriggerInterval:null,heroMoveInterval:null,heroAutoMoveScan:null,tipAnimate:null,openDoorAnimate:null};this.musicStatus={isIOS:false,loaded:false,bgmStatus:false,soundStatus:true,playedSound:null,playedBgm:null,};this.position={gameGroup:{},canvas:{},statusBar:{},toolBar:{},items:{},scale:1,screenMode:"bigScreen",};this.initStatus={played:false,hero:{},floorId:null,thisMap:null,maps:null,heroMoving:false,heroStop:true,lockControl:false,autoHeroMove:false,automaticRouting:false,automaticRouted:false,autoStep:0,movedStep:0,destStep:0,automaticRoutingTemp:{destX:0,destY:0,moveStep:[]},autoStepRoutes:[],holdingPath:0,stepPostfix:[],mouseOutCheck:1,moveStepBeforeStop:[],savePage:null,shops:{},event:{id:null,data:null},openingDoor:null,twoAnimateObjs:[],fourAnimateObjs:[],boxAnimateObjs:[],};this.status={};this.flags={}}core.prototype.init=function(c,i,a,f,h,d,e,b){core.dom=c;core.statusBar=i;core.canvas=a;core.images=f;core.sounds=h;core.floorIds=d;core.floors=e;for(var g in b){core[g]=b[g]}core.flags=core.data.flags;core.values=core.clone(core.data.values);core.firstData=core.data.getFirstData();core.initStatus.shops=core.firstData.shops;core.dom.versionLabel.innerHTML=core.firstData.version;core.dom.logoLabel.innerHTML=core.firstData.title;core.material.items=core.items.getItems();core.initStatus.maps=core.maps.initMaps(d);core.material.enemys=core.clone(core.enemys.getEnemys());core.material.icons=core.icons.getIcons();core.material.events=core.events.getEvents();core.musicStatus.soundStatus=core.getLocalStorage("soundStatus",true);var j=navigator.userAgent;if(j.indexOf("iPhone")>-1||j.indexOf("iPad")>-1){console.log("你的设备为iphone,不自动播放音乐!");core.musicStatus.isIOS=true;core.musicStatus.soundStatus=false}core.material.ground=new Image();core.material.ground.src="images/ground.png";core.loader(function(){console.log(core.material);core.showStartAnimate()})};core.prototype.showStartAnimate=function(a){core.dom.startPanel.style.opacity=1;core.dom.startPanel.style.display="block";core.dom.startTop.style.opacity=1;core.dom.startTop.style.display="block";core.dom.startButtonGroup.style.display="none";core.dom.startButtons.style.display="block";core.dom.levelChooseButtons.style.display="none";core.status.played=false;core.clearStatus();core.clearMap("all");var b=1;var c=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(c);core.dom.startTop.style.display="none";core.dom.startButtonGroup.style.display="block";if(core.isset(a)){a()}}core.dom.startTop.style.opacity=b},20)};core.prototype.hideStartAnimate=function(a){var b=1;var c=window.setInterval(function(){b-=0.03;if(b<0){clearInterval(c);core.dom.startPanel.style.display="none";if(core.isset(a)){a()}}core.dom.startPanel.style.opacity=b},20)};core.prototype.setStartProgressVal=function(a){core.dom.startTopProgress.style.width=a+"%"};core.prototype.setStartLoadTipText=function(a){core.dom.startTopLoadTips.innerHTML=a};core.prototype.loader=function(c){var f=0,a=0,b=0;a=core.images.length;for(var e in core.sounds){b+=core.sounds[e].length}for(var d=0;d0){return}core.musicStatus.bgmStatus=1;if(core.musicStatus.soundStatus){core.playBgm("bgm","mp3")}return}var a=b.shift();a.oncanplay=function(){core.loadSoundItem(b)};a.load()};core.prototype.isPlaying=function(){if(core.isset(core.status.played)&&core.status.played){return true}return false};core.prototype.clearStatus=function(){for(var a in core.interval){clearInterval(core.interval[a])}core.status={};core.clearStatusBar();core.resize(main.dom.body.clientWidth,main.dom.body.clientHeight)};core.prototype.resetStatus=function(c,b,a,e){for(var d in core.interval){clearInterval(core.interval[d])}core.status=core.clone(core.initStatus);core.status.played=true;core.status.floorId=a;core.status.maps=core.clone(e);core.material.enemys=core.clone(core.enemys.getEnemys());core.status.hero=core.clone(c);core.status.hard=b;core.status.savePage=core.getLocalStorage("savePage",0);core.resize(main.dom.body.clientWidth,main.dom.body.clientHeight)};core.prototype.startGame=function(b,a){console.log("开始游戏");core.resetStatus(core.firstData.hero,b,core.firstData.floorId,core.initStatus.maps);core.changeFloor(core.status.floorId,null,core.firstData.hero.loc,null,function(){core.setHeroMoveTriggerInterval();if(core.isset(a)){a()}})};core.prototype.restart=function(){core.showStartAnimate()};core.prototype.onkeyDown=function(a){if(!core.isset(core.status.holdingKeys)){core.status.holdingKeys=[]}var c={37:true,38:true,39:true,40:true}[a.keyCode];if(c){for(var b=0;bd){c=b;d=a[b]}}e=[{x:0,y:1},{x:-1,y:0},{x:0,y:-1},{x:1,y:0},false][c];if(e){e.x+=f.x;e.y+=f.y;core.status.stepPostfix.push(e);core.fillPosWithPoint(e)}};core.prototype.onup=function(){core.status.holdingPath=0;if(core.status.stepPostfix.length>0){var g=[];var a={"0":{"1":"down","-1":"up"},"-1":{"0":"left"},"1":{"0":"right"}};for(var b=1;b12||c>12){return}if(!core.status.lockControl){core.setAutomaticRoute(b,c,a);return}if(core.status.event.id=="book"){core.events.clickBook(b,c);return}if(core.status.event.id=="fly"){core.events.clickFly(b,c);return}if(core.status.event.id=="settings"){core.events.clickSettings(b,c);return}if(core.status.event.id=="shop"){core.events.clickShop(b,c);return}if(core.status.event.id=="selectShop"){core.events.clickSelectShop(b,c);return}if(core.status.event.id=="toolbox"){core.events.clickToolbox(b,c);return}if(core.status.event.id=="save"||core.status.event.id=="load"){core.events.clickSL(b,c);return}if(core.status.event.id=="confirmBox"){if((b==4||b==5)&&c==7&&core.isset(core.status.event.data.yes)){core.status.event.data.yes()}if((b==7||b==8)&&c==7&&core.isset(core.status.event.data.no)){core.status.event.data.no()}return}if(core.status.event.id=="about"){if(core.isPlaying()){core.ui.closePanel(false)}else{core.showStartAnimate()}return}if(core.status.event.id=="action"){core.events.clickAction(b,c);return}if(core.status.event.id=="text"){core.drawText();return}if(core.status.event.id=="syncSave"){if(b>=4&&b<=8){if(c==5){core.ui.drawConfirmBox("你确定要将本地存档同步到服务器吗?",function(){core.ui.drawWaiting("正在同步,请稍后...");var e=new FormData();e.append("type","save");e.append("name",core.firstData.name);var h=[];for(var f=1;f<=180;f++){var d=core.getLocalStorage("save"+f,null);if(core.isset(d)){h.push(d)}}var g=JSON.stringify(h);e.append("data",g);var j=new XMLHttpRequest();j.open("POST","../sync.php");j.timeout=1000;j.onload=function(i){if(j.status==200){var k=JSON.parse(j.response);if(k.code<0){core.drawText("出错啦!\n无法同步存档到服务器。")}else{core.drawText("同步成功!\n\n您的存档编号: "+k.code+"\n您的存档密码: "+k.msg+"\n\n请牢记以上两个信息(如截图等),在从服务器\n同步存档时使用。")}}else{core.drawText("出错啦!\n无法同步存档到服务器。")}};j.ontimeout=function(i){console.log(i);core.drawText("出错啦!\n无法同步存档到服务器。")};j.onerror=function(i){console.log(i);core.drawText("出错啦!\n无法同步存档到服务器。")};j.send(e)},function(){core.ui.drawSyncSave()})}if(c==6){core.ui.drawConfirmBox("你确定要从服务器加载存档吗?\n该操作将覆盖所有本地存档且不可逆!",function(){var e=prompt("请输入存档编号:");if(e==null||e==""){core.ui.drawSyncSave();return}var f=prompt("请输入存档密码:");if(f==null||f==""){core.ui.drawSyncSave();return}core.ui.drawWaiting("正在同步,请稍后...");var d=new FormData();d.append("type","load");d.append("name",core.firstData.name);d.append("id",e);d.append("password",f);var g=new XMLHttpRequest();g.open("POST","../sync.php");g.timeout=1000;g.onload=function(j){if(g.status==200){var l=JSON.parse(g.response);switch(l.code){case 0:var h=JSON.parse(l.msg);for(var k=1;k<=180;k++){if(k<=h.length){core.setLocalStorage("save"+k,h[k-1])}else{core.removeLocalStorage("save"+k)}}core.drawText("同步成功!\n你的本地所有存档均已被覆盖。");break;case -1:core.drawText("出错啦!\n存档编号"+e+"不存在!");break;case -2:core.drawText("出错啦!\n存档密码错误!");break;default:core.drawText("出错啦!\n无法从服务器同步存档。");break}}else{core.drawText("出错啦!\n无法从服务器同步存档。")}};g.ontimeout=function(h){console.log(h);core.drawText("出错啦!\n无法从服务器同步存档。")};g.onerror=function(h){console.log(h);core.drawText("出错啦!\n无法从服务器同步存档。")};g.send(d)},function(){core.ui.drawSyncSave()})}}if(b>=5&&b<=7&&c==7){core.ui.drawSettings(false)}}};core.prototype.onmousewheel=function(a){if(core.status.lockControl&&core.status.event.id=="fly"){if(a==-1){core.ui.drawFly(core.status.event.data-1)}if(a==1){core.ui.drawFly(core.status.event.data+1)}return}};core.prototype.clearAutomaticRouteNode=function(a,b){core.canvas.ui.clearRect(a*32+5,b*32+5,27,27)};core.prototype.stopAutomaticRoute=function(){if(!core.status.played){return}core.stopAutoHeroMove();core.status.automaticRouting=false;core.status.automaticRouted=false;core.status.autoStepRoutes=[];core.status.automaticRoutingTemp={destX:0,destY:0,moveStep:[]};if(core.status.moveStepBeforeStop.length==0){core.canvas.ui.clearRect(0,0,416,416)}};core.prototype.continueAutomaticRoute=function(){var a=core.status.moveStepBeforeStop;core.status.moveStepBeforeStop=[];if(a.length===0){return}if(a.length===1&&a[0].step===1){return}core.status.automaticRouting=true;core.setAutoHeroMove(a)};core.prototype.clearContinueAutomaticRoute=function(){core.canvas.ui.clearRect(0,0,416,416);core.status.moveStepBeforeStop=[]};core.prototype.setAutomaticRoute=function(a,b,f){if(!core.status.played||core.status.lockControl){return}else{if(core.status.automaticRouting){core.stopAutomaticRoute();return}}if(a==core.status.hero.loc.x&&b==core.status.hero.loc.y&&f.length==0){core.turnHero();return}var e=0;var g=null;var d;core.status.automaticRoutingTemp={destX:0,destY:0,moveStep:[]};if(!(d=core.automaticRoute(a,b))){if(a==core.status.hero.loc.x&&b==core.status.hero.loc.y){d=[]}else{core.canvas.ui.clearRect(0,0,416,416);return}}d=d.concat(f);core.status.automaticRoutingTemp.destX=a;core.status.automaticRoutingTemp.destY=b;core.canvas.ui.save();core.canvas.ui.clearRect(0,0,416,416);core.canvas.ui.fillStyle="#bfbfbf";core.canvas.ui.strokeStyle="#bfbfbf";core.canvas.ui.lineWidth=8;for(var c=0;c12||q<0||q>12){continue}var l=13*p+q;if(core.isset(s[l])){continue}if(p==e&&q==g){s[l]=i;break}if(core.noPassExists(p,q)){continue}var d=1;var b=core.getBlock(p,q);if(b!=null){var k=b.block.event.id;if(k.substring(k.length-3)=="Net"){d=100}if(!core.flags.potionWhileRouting&&k.substring(k.length-6)=="Potion"){d=20}if(b.block.event.trigger=="checkBlock"){d=200}}s[l]=i;r.push(169*(m+d)+l)}if(core.isset(s[13*e+g])){break}}if(!core.isset(s[13*e+g])){return false}var n=e,o=g;while(n!=u||o!=v){var h=s[13*n+o];a.push({direction:h,x:n,y:o});n-=t[h].x;o-=t[h].y}a.reverse();return a};core.prototype.fillPosWithPoint=function(a){core.fillRect("ui",a.x*32+12,a.y*32+12,8,8,"#bfbfbf")};core.prototype.clearStepPostfix=function(){if(core.status.mouseOutCheck>0){core.status.mouseOutCheck--;window.setTimeout(core.clearStepPostfix,1000);return}core.status.holdingPath=0;if(core.status.stepPostfix.length>0){core.status.stepPostfix=[];core.canvas.ui.clearRect(0,0,416,416);core.canvas.ui.restore()}};core.prototype.stopAutoHeroMove=function(){core.status.autoHeroMove=false;core.status.automaticRouting=false;core.status.automaticRouted=false;core.status.autoStep=0;core.status.destStep=0;core.status.movedStep=0;core.status.autoStepRoutes=[];core.stopHero();clearInterval(core.interval.heroAutoMoveScan)};core.prototype.setAutoHeroMove=function(b,a){if(b.length==0){return}core.status.autoStepRoutes=b;core.status.autoStep=0;clearInterval(core.interval.heroAutoMoveScan);core.interval.heroAutoMoveScan=window.setInterval(function(){if(!core.status.autoHeroMove){if(core.status.autoStep==core.status.autoStepRoutes.length){core.stopAutoHeroMove();return}core.autoHeroMove(core.status.autoStepRoutes[core.status.autoStep].direction,core.status.autoStepRoutes[core.status.autoStep].step);core.status.autoStep++}},80)};core.prototype.autoHeroMove=function(a,b){core.status.autoHeroMove=true;core.status.destStep=b;core.moveHero(a)};core.prototype.setHeroMoveInterval=function(b,d,e,a){if(core.status.heroMoving){return}core.status.heroMoving=true;var c=0;core.interval.heroMoveInterval=window.setInterval(function(){switch(b){case"up":c-=4;if(c==-4||c==-8||c==-12||c==-16){core.drawHero(b,d,e,"leftFoot",0,c)}else{if(c==-20||c==-24||c==-28||c==-32){core.drawHero(b,d,e,"rightFoot",0,c)}}if(c==-32){core.setHeroLoc("y","--");core.moveOneStep();if(core.status.heroStop){core.drawHero(b,d,e-1,"stop")}if(core.isset(a)){a()}}break;case"left":c-=4;if(c==-4||c==-8||c==-12||c==-16){core.drawHero(b,d,e,"leftFoot",c)}else{if(c==-20||c==-24||c==-28||c==-32){core.drawHero(b,d,e,"rightFoot",c)}}if(c==-32){core.setHeroLoc("x","--");core.moveOneStep();if(core.status.heroStop){core.drawHero(b,d-1,e,"stop")}if(core.isset(a)){a()}}break;case"down":c+=4;if(c==4||c==8||c==12||c==16){core.drawHero(b,d,e,"leftFoot",0,c)}else{if(c==20||c==24||c==28||c==32){core.drawHero(b,d,e,"rightFoot",0,c)}}if(c==32){core.setHeroLoc("y","++");core.moveOneStep();if(core.status.heroStop){core.drawHero(b,d,e+1,"stop")}if(core.isset(a)){a()}}break;case"right":c+=4;if(c==4||c==8||c==12||c==16){core.drawHero(b,d,e,"leftFoot",c)}else{if(c==20||c==24||c==28||c==32){core.drawHero(b,d,e,"rightFoot",c)}}if(c==32){core.setHeroLoc("x","++");core.moveOneStep();if(core.status.heroStop){core.drawHero(b,d+1,e,"stop")}if(core.isset(a)){a()}}break}},10)};core.prototype.setHeroMoveTriggerInterval=function(){var a,c,d;var b={up:{x:0,y:-1},left:{x:-1,y:0},down:{x:0,y:1},right:{x:1,y:0}};core.interval.heroMoveTriggerInterval=window.setInterval(function(){if(!core.status.heroStop){a=core.getHeroLoc("direction");c=core.getHeroLoc("x");d=core.getHeroLoc("y");var e;e=core.noPass(c+b[a].x,d+b[a].y);if(e){core.trigger(c+b[a].x,d+b[a].y);core.drawHero(a,c,d,"stop");if(core.status.autoHeroMove){core.status.movedStep++;if(core.status.destStep==core.status.movedStep){core.status.autoHeroMove=false;core.status.destStep=0;core.status.movedStep=0;core.status.moveStepBeforeStop=[];core.stopAutomaticRoute()}}else{core.status.heroStop=true}return}core.setHeroMoveInterval(a,c,d,function(){if(core.status.autoHeroMove){core.status.movedStep++;if(core.status.destStep==core.status.movedStep){core.status.autoHeroMove=false;core.status.destStep=0;core.status.movedStep=0;core.stopHero();core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop")}}else{if(core.status.heroStop){core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop")}}core.trigger(core.getHeroLoc("x"),core.getHeroLoc("y"));clearInterval(core.interval.heroMoveInterval);core.status.heroMoving=false})}},50)};core.prototype.turnHero=function(a){if(core.isset(a)){core.status.hero.loc.direction=a}else{if(core.status.hero.loc.direction=="up"){core.status.hero.loc.direction="right"}else{if(core.status.hero.loc.direction=="right"){core.status.hero.loc.direction="down"}else{if(core.status.hero.loc.direction=="down"){core.status.hero.loc.direction="left"}else{if(core.status.hero.loc.direction=="left"){core.status.hero.loc.direction="up"}}}}}core.drawHero(core.status.hero.loc.direction,core.status.hero.loc.x,core.status.hero.loc.y,"stop",0,0);core.status.automaticRoutingTemp={destX:0,destY:0,moveStep:[]};core.canvas.ui.clearRect(0,0,416,416)};core.prototype.moveHero=function(a){core.setHeroLoc("direction",a);core.status.heroStop=false};core.prototype.moveOneStep=function(){if(core.hasFlag("poison")){core.status.hero.hp-=core.values.poisonDamage;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose("poison");return}core.updateStatusBar()}};core.prototype.waitHeroToStop=function(a){core.stopAutomaticRoute();core.clearContinueAutomaticRoute();if(core.isset(a)){core.lockControl();setTimeout(function(){core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");a()},30)}};core.prototype.stopHero=function(){core.status.heroStop=true};core.prototype.drawHero=function(a,f,g,e,c,d){c=c||0;d=d||0;core.clearAutomaticRouteNode(f,g);var b=core.material.icons.heros[core.status.hero.id][a];f=f*32;g=g*32;core.canvas.hero.clearRect(f-32,g-32,96,96);core.canvas.hero.drawImage(core.material.images.heros,b[e]*32,b.loc*32,32,32,f+c,g+d,32,32)};core.prototype.openDoor=function(d,i,j,f,a){if(!core.terrainExists(i,j,d)){if(core.isset(a)){a()}return}if(core.status.moveStepBeforeStop.length==0){core.status.moveStepBeforeStop=core.status.autoStepRoutes.slice(core.status.autoStep-1,core.status.autoStepRoutes.length);if(core.status.moveStepBeforeStop.length>=1){core.status.moveStepBeforeStop[0].step-=core.status.movedStep}}core.stopHero();core.stopAutomaticRoute();var g=30;if(f){var e=d.replace("Door","Key");if(!core.rmItem(e)){if(e!="specialKey"){core.drawTip("你没有"+core.material.items[e].name)}else{core.drawTip("无法开启此门")}core.clearContinueAutomaticRoute();if(core.isset(a)){a()}return}}core.playSound("door","ogg");var h=0;var c=d;if(!(c.substring(c.length-4)=="Door")){c=c+"Door";g=100}var b=core.material.icons.animates[c];core.interval.openDoorAnimate=window.setInterval(function(){h++;if(h==4){clearInterval(core.interval.openDoorAnimate);core.removeBlock(i,j);core.events.afterOpenDoor(d,i,j,a);return}core.canvas.event.clearRect(32*i,32*j,32,32);core.canvas.event.drawImage(core.material.images.animates,32*h,32*b,32,32,32*i,32*j,32,32)},g)};core.prototype.battle=function(f,h,i,d,a){if(core.status.moveStepBeforeStop.length==0){core.status.moveStepBeforeStop=core.status.autoStepRoutes.slice(core.status.autoStep-1,core.status.autoStepRoutes.length);if(core.status.moveStepBeforeStop.length>=1){core.status.moveStepBeforeStop[0].step-=core.status.movedStep}}core.stopHero();core.stopAutomaticRoute();var b=core.enemys.getDamage(f);if(b>=core.status.hero.hp&&!d){core.drawTip("你打不过此怪物!");core.clearContinueAutomaticRoute();return}core.playSound("attack","ogg");core.status.hero.hp-=b;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose("battle");return}var g=core.material.enemys[f].money;if(core.hasItem("coin")){g*=2}if(core.hasFlag("curse")){g=0}core.status.hero.money+=g;var c=core.material.enemys[f].experience;if(core.hasFlag("curse")){c=0}core.status.hero.experience+=c;core.updateStatusBar();if(core.isset(h)&&core.isset(i)){core.removeBlock(h,i);core.canvas.event.clearRect(32*h,32*i,32,32)}core.updateFg();var e="打败 "+core.material.enemys[f].name+",金币+"+g;if(core.flags.enableExperience){e+=",经验+"+core.material.enemys[f].experience}core.drawTip(e);core.events.afterBattle(f,h,i,a)};core.prototype.changeFloor=function(c,f,d,g,b){g=g||50;core.lockControl();core.stopHero();core.stopAutomaticRoute();core.clearContinueAutomaticRoute();core.dom.floorNameLabel.innerHTML=core.status.maps[c].title;if(core.isset(f)){d=core.status.hero.loc;var a=core.status.maps[c].blocks;for(var e in a){if(core.isset(a[e].event)&&!(core.isset(a[e].enable)&&!a[e].enable)&&a[e].event.id===f){d.x=a[e].x;d.y=a[e].y}}}if(core.status.maps[c].canFlyTo&&core.status.hero.flyRange.indexOf(c)<0){if(core.floorIds.indexOf(c)>core.floorIds.indexOf(core.status.floorId)){core.status.hero.flyRange.push(c)}else{core.status.hero.flyRange.unshift(c)}}window.setTimeout(function(){core.playSound("floor","mp3");core.mapChangeAnimate("show",g/2,function(){core.statusBar.floor.innerHTML=core.status.maps[c].name;core.updateStatusBar();core.drawMap(c,function(){setTimeout(function(){core.mapChangeAnimate("hide",g/4,function(){core.unLockControl();core.events.afterChangeFloor(c);if(core.isset(b)){b()}});if(core.isset(d.direction)){core.setHeroLoc("direction",d.direction)}core.setHeroLoc("x",d.x);core.setHeroLoc("y",d.y);core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");core.updateFg()},15)})})},50)};core.prototype.mapChangeAnimate=function(b,c,a){if(b=="show"){core.show(core.dom.floorMsgGroup,c,function(){a()})}else{core.hide(core.dom.floorMsgGroup,c,function(){a()})}};core.prototype.clearMap=function(c,e,f,d,a){if(c=="all"){for(var b in core.canvas){core.canvas[b].clearRect(0,0,416,416)}}else{core.canvas[c].clearRect(e,f,d,a)}};core.prototype.fillText=function(b,d,e,f,c,a){if(core.isset(c)){core.setFillStyle(b,c)}if(core.isset(a)){core.setFont(b,a)}core.canvas[b].fillText(d,e,f)};core.prototype.fillRect=function(b,e,f,d,a,c){if(core.isset(c)){core.setFillStyle(b,c)}core.canvas[b].fillRect(e,f,d,a)};core.prototype.strokeRect=function(c,f,g,e,a,d,b){if(core.isset(d)){core.setStrokeStyle(c,d)}if(core.isset(b)){core.setLineWidth(c,b)}core.canvas[c].strokeRect(f,g,e,a)};core.prototype.setFont=function(b,a){core.canvas[b].font=a};core.prototype.setLineWidth=function(c,a){if(c=="all"){for(var b in core.canvas){core.canvas[b].lineWidth=a}}core.canvas[c].lineWidth=a};core.prototype.saveCanvas=function(a){core.canvas[a].save()};core.prototype.loadCanvas=function(a){core.canvas[a].restore()};core.prototype.setAlpha=function(c,a){if(c=="all"){for(var b in core.canvas){core.canvas[b].globalAlpha=a}}core.canvas[c].globalAlpha=a};core.prototype.setStrokeStyle=function(b,c){if(b=="all"){for(var a in core.canvas){core.canvas[a].strokeStyle=c}}else{core.canvas[b].strokeStyle=c}};core.prototype.setAlpha=function(c,a){if(c=="all"){for(var b in core.canvas){core.canvas[b].globalAlpha=a}}else{core.canvas[c].globalAlpha=a}};core.prototype.setOpacity=function(b,c){if(b=="all"){for(var a in core.canvas){core.canvas[a].canvas.style.opacity=c}}else{core.canvas[b].canvas.style.opacity=c}};core.prototype.setFillStyle=function(b,c){if(b=="all"){for(var a in core.canvas){core.canvas[a].fillStyle=c}}else{core.canvas[b].fillStyle=c}};core.prototype.drawMap=function(h,e){var g=core.status.maps[h];var f=g.blocks;core.status.floorId=h;core.status.thisMap=g;var c,d;core.clearMap("all");core.rmGlobalAnimate(null,null,true);for(var i=0;i<13;i++){for(var j=0;j<13;j++){c=core.material.icons.terrains.ground;d=core.material.images.terrains;core.canvas.bg.drawImage(d,0,c*32,32,32,i*32,j*32,32,32)}}for(var a=0;a=0){a[d]={x:e,y:f,event:{cls:"terrains",id:"ground",noPass:false,trigger:"checkBlock"}};return}var b=core.floors[c].events[e+","+f];if(!core.isset(b)){b=core.floors[c].changeFloor[e+","+f]}if(!core.isset(b)){a.splice(d,1);return}a[d].enable=false};core.prototype.moveBlock=function(m,n,k,l,d,c){l=l||500;clearInterval(core.interval.tipAnimate);core.saveCanvas("data");core.clearMap("data",0,0,416,416);var b=core.getBlock(m,n,core.status.floorId,false);if(b==null){if(core.isset(c)){c()}return}core.removeBlock(m,n);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);b=b.block;blockIcon=core.material.icons[b.event.cls][b.event.id];blockImage=core.material.images[b.event.cls];var h=1;core.setOpacity("data",h);core.canvas.data.drawImage(blockImage,0,blockIcon*32,32,32,b.x*32,b.y*32,32,32);var e=[];k.forEach(function(o){if(typeof o=="string"){e.push(o)}else{if(!core.isset(o.value)){e.push(o.direction)}else{for(var p=0;p=1||d<=0){clearInterval(a);core.loadCanvas("data");core.clearMap("data",0,0,416,416);core.setOpacity("data",1);if(core.isset(c)){c()}}},e/10)};core.prototype.addBlock=function(c,d,b){b=b||core.status.floorId;var a=core.getBlock(c,d,b,false);if(a==null){return}a=a.block;if(core.isset(a.enable)&&!a.enable){a.enable=true;if(b==core.status.floorId&&core.isset(a.event)){blockIcon=core.material.icons[a.event.cls][a.event.id];blockImage=core.material.images[a.event.cls];core.canvas.event.drawImage(core.material.images[a.event.cls],0,blockIcon*32,32,32,a.x*32,a.y*32,32,32);core.addGlobalAnimate(a.event.animate,a.x*32,a.y*32,blockIcon,blockImage);core.setGlobalAnimate(core.values.animateSpeed)}}};core.prototype.removeBlock=function(d,e,b){b=b||core.status.floorId;var a=core.getBlock(d,e,b,false);if(a==null){return}var c=a.index;if(b==core.status.floorId){core.rmGlobalAnimate(d,e);core.canvas.event.clearRect(d*32,e*32,32,32)}core.removeBlockById(c,b);core.updateFg()};core.prototype.removeBlockByIds=function(a,b){b.sort(function(c,d){return d-c}).forEach(function(c){core.removeBlockById(c,a)})};core.prototype.noPass=function(a,b){return a<0||a>12||b<0||b>12||core.noPassExists(a,b)};core.prototype.trigger=function(g,h){var d=core.status.thisMap.blocks;var e;for(var a=0;a0){var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.drawBoxAnimate(a);core.interval.boxAnimate=setInterval(function(){core.drawBoxAnimate(a)},core.values.animateSpeed)}};core.prototype.drawBoxAnimate=function(c){for(var b=0;b=999999999){d="???"}else{if(d>100000){d=(d/10000).toFixed(1)+"w"}}core.setFillStyle("fg","#000000");core.canvas.fg.fillText(d,32*h+2,32*(i+1)-2);core.canvas.fg.fillText(d,32*h,32*(i+1)-2);core.canvas.fg.fillText(d,32*h+2,32*(i+1));core.canvas.fg.fillText(d,32*h,32*(i+1));core.setFillStyle("fg",c);core.canvas.fg.fillText(d,32*h+1,32*(i+1)-1)}}};core.prototype.itemCount=function(b){if(!core.isset(b)||!core.isset(core.material.items[b])){return 0}var a=core.material.items[b].cls;if(a=="items"){return 0}return core.isset(core.status.hero.items[a][b])?core.status.hero.items[a][b]:0};core.prototype.hasItem=function(a){return core.itemCount(a)>0};core.prototype.setItem=function(b,c){var a=core.material.items[b].cls;if(a=="items"){return}if(!core.isset(core.status.hero.items[a])){core.status.hero.items[a]={}}core.status.hero.items[a][b]=c};core.prototype.rmItem=function(b){if(!core.hasItem(b)){return false}var a=core.material.items[b].cls;core.status.hero.items[a][b]--;core.updateStatusBar();if(a=="tools"&&core.status.hero.items[a][b]==0){delete core.status.hero.items[a][b]}return true};core.prototype.useItem=function(a){core.items.useItem(a);return};core.prototype.canUseItem=function(a){return core.items.canUseItem(a)};core.prototype.addItem=function(c,d){var b=core.material.items[c];var a=b.cls;if(a=="items"){return}if(!core.isset(core.status.hero.items[a])){core.status.hero.items[a]={};core.status.hero.items[a][c]=0}else{if(!core.isset(core.status.hero.items[a][c])){core.status.hero.items[a][c]=0}}core.status.hero.items[a][c]+=d};core.prototype.getItem=function(d,e,f,g,a){core.playSound("item","ogg");var c=core.material.items[d].cls;core.items.getItemEffect(d,e);core.removeBlock(f,g);var h="获得 "+core.material.items[d].name;if(e>1){h+="x"+e}if(c==="items"){h+=core.items.getItemEffectTip(d)}core.drawTip(h,core.material.icons.items[d]);core.canvas.event.clearRect(f*32,g*32,32,32);core.updateStatusBar();var b=core.floors[core.status.floorId].afterGetItem[f+","+g];if(core.isset(b)){core.events.doEvents(b,f,g,a)}else{if(core.isset(a)){a()}}};core.prototype.drawTip=function(e,c){var f,g,h,a,b=false,d=0;clearInterval(core.interval.tipAnimate);core.setFont("data","16px Arial");core.saveCanvas("data");core.setOpacity("data",0);if(!core.isset(c)){f=16;g=18;h=f+core.canvas.data.measureText(e).width+16;a=42}else{f=44;g=18;h=f+core.canvas.data.measureText(e).width+8;a=42}core.interval.tipAnimate=window.setInterval(function(){if(b){d-=0.1}else{d+=0.1}core.setOpacity("data",d);core.clearMap("data",5,5,400,a);core.fillRect("data",5,5,h,a,"#000");if(core.isset(c)){core.canvas.data.drawImage(core.material.images.items,0,c*32,32,32,10,8,32,32)}core.fillText("data",e,f+5,g+15,"#fff");if(d>0.6||d<0){if(b){core.loadCanvas("data");core.clearMap("data",5,5,400,a);core.setOpacity("data",1);clearInterval(core.interval.tipAnimate);return}else{if(!core.timeout.getItemTipTimeout){core.timeout.getItemTipTimeout=window.setTimeout(function(){b=true;core.timeout.getItemTipTimeout=null},750)}d=0.6;core.setOpacity("data",d)}}},30)};core.prototype.drawText=function(b,a){if(core.isset(b)){if(typeof b=="string"){b=[{content:b}]}else{if(b instanceof Object&&core.isset(b.content)){b=[b]}else{if(!(b instanceof Array)){core.drawTip("出错了");console.log(b);return}}}core.status.event={id:"text",data:{list:b,callback:a}};core.lockControl();core.stopAutomaticRoute();setTimeout(function(){core.drawText()},30);return}if(core.status.event.data.list.length==0){var a=core.status.event.data.callback;core.ui.closePanel(false);if(core.isset(a)){a()}return}var c=core.status.event.data.list.shift();if(typeof c=="string"){core.ui.drawTextBox(c)}else{core.ui.drawTextBox(c.content,c.id)}};core.prototype.replaceText=function(a){return a.replace(/\${([^}]+)}/g,function(c,b){return core.calValue(b)})};core.prototype.calValue=function(value){value=value.replace(/status:([\w\d_]+)/g,"core.getStatus('$1')");value=value.replace(/item:([\w\d_]+)/g,"core.itemCount('$1')");value=value.replace(/flag:([\w\d_]+)/g,"core.getFlag('$1', false)");return eval(value)};core.prototype.unshift=function(c,d){if(!(c instanceof Array)||!core.isset(d)){return}if(d instanceof Array){core.clone(d).reverse().forEach(function(a){c.unshift(a)})}else{c.unshift(d)}return c};core.prototype.setLocalStorage=function(b,c){try{localStorage.setItem(core.firstData.name+"_"+b,JSON.stringify(c));return true}catch(a){console.log(a);return false}};core.prototype.getLocalStorage=function(b,a){var c=localStorage.getItem(core.firstData.name+"_"+b);if(core.isset(c)){return JSON.parse(c)}return a};core.prototype.removeLocalStorage=function(a){localStorage.removeItem(core.firstData.name+"_"+a)};core.prototype.clone=function(b){if(!core.isset(b)){return b}if(b instanceof Date){var a=new Date();a.setTime(b.getTime());return a}if(b instanceof Array){var a=[];for(var c in b){a[c]=core.clone(b[c])}return a}if(b instanceof Function){return b}if(b instanceof Object){var a={};for(var c in b){if(b.hasOwnProperty(c)){a[c]=core.clone(b[c])}}return a}return b};core.prototype.formatDate=function(a){if(!core.isset(a)){return""}return a.getFullYear()+"-"+core.setTwoDigits(a.getMonth()+1)+"-"+core.setTwoDigits(a.getDate())+" "+core.setTwoDigits(a.getHours())+":"+core.setTwoDigits(a.getMinutes())+":"+core.setTwoDigits(a.getSeconds())};core.prototype.setTwoDigits=function(a){return parseInt(a)<10?"0"+a:a};core.prototype.lose=function(){core.stopAutomaticRoute();if(!core.status.heroStop){setTimeout(function(){core.lose()},30);return}core.events.lose()};core.prototype.debug=function(){core.setStatus("hp",999999);core.setStatus("atk",10000);core.setStatus("def",10000);core.setStatus("mdef",10000);core.setStatus("money",10000);core.setStatus("experience",10000);core.setItem("yellowKey",50);core.setItem("blueKey",50);core.setItem("redKey",50);core.setItem("book",1);core.setItem("fly",1);for(var a in core.status.maps){if(core.status.maps[a].canFlyTo&&core.status.hero.flyRange.indexOf(a)<0){core.status.hero.flyRange.push(a)}}core.updateStatusBar();core.drawTip("作弊成功")};core.prototype.checkStatus=function(c,d,b,a){if(d&&core.status.event.id==c){core.ui.closePanel(a);return false}if(d&&core.status.lockControl){return false}if(core.isset(b)&&b&&!core.hasItem(c)){core.drawTip("你没有"+core.material.items[c].name);return false}if(!core.status.heroStop){core.drawTip("请先停止勇士行动");return false}core.lockControl();core.status.automaticRoutingTemp={destX:0,destY:0,moveStep:[]};core.status.event.id=c;return true};core.prototype.openBook=function(a){if(!core.checkStatus("book",a,true,true)){return}core.useItem("book")};core.prototype.useFly=function(a){if(!core.checkStatus("fly",a,true)){return}if(core.flags.flyNearStair&&!core.nearStair()){core.drawTip("只有在楼梯边才能使用传送器");core.unLockControl();core.status.event.data=null;core.status.event.id=null;return}if(!core.canUseItem("fly")){core.drawTip("楼层传送器好像失效了");core.unLockControl();core.status.event.data=null;core.status.event.id=null;return}core.useItem("fly");return};core.prototype.openToolbox=function(a){if(!core.checkStatus("toolbox",a)){return}core.ui.drawToolbox()};core.prototype.save=function(a){if(!core.checkStatus("save",a)){return}core.ui.drawSLPanel(core.status.savePage)};core.prototype.load=function(a){if(!core.isPlaying()){core.status.event={id:"load",data:null};core.status.lockControl=true;core.dom.startPanel.style.display="none";var b=core.getLocalStorage("savePage",0);core.ui.drawSLPanel(b);return}if(!core.checkStatus("load",a)){return}core.ui.drawSLPanel(core.status.savePage)};core.prototype.doSL=function(b,c){if(c=="save"){if(core.saveData("save"+b)){core.ui.closePanel();core.drawTip("存档成功!");core.setLocalStorage("savePage",core.status.savePage)}else{core.drawTip("存储空间不足,请覆盖已有的存档或在菜单栏中进行清理")}return}else{if(c=="load"){var a=core.getLocalStorage("save"+b,null);if(!core.isset(a)){core.drawTip("无效的存档");return}if(a.version!=core.firstData.version){core.drawTip("存档版本不匹配");return}core.ui.closePanel();core.loadData(a,function(){core.setLocalStorage("savePage",core.status.savePage);core.drawTip("读档成功")});return}}};core.prototype.saveData=function(b){var a={floorId:core.status.floorId,hero:core.clone(core.status.hero),hard:core.status.hard,maps:core.maps.save(core.status.maps),shops:{},version:core.firstData.version,time:new Date().getTime()};for(var c in core.status.shops){a.shops[c]={times:core.status.shops[c].times||0,visited:core.status.shops[c].visited||false}}core.events.beforeSaveData(a);return core.setLocalStorage(b,a)};core.prototype.loadData=function(b,a){core.resetStatus(b.hero,b.hard,b.floorId,core.maps.load(b.maps));for(var c in core.status.shops){core.status.shops[c].times=b.shops[c].times;core.status.shops[c].visited=b.shops[c].visited}core.events.afterLoadData(b);core.changeFloor(b.floorId,null,b.hero.loc,null,function(){core.setHeroMoveTriggerInterval();if(core.isset(a)){a()}})};core.prototype.setStatus=function(a,b){core.status.hero[a]=b};core.prototype.getStatus=function(a){return core.status.hero[a]};core.prototype.setFlag=function(a,b){if(!core.isset(core.status.hero)){return}core.status.hero.flags[a]=b};core.prototype.getFlag=function(b,a){if(!core.isset(core.status.hero)){return a}var c=core.status.hero.flags[b];if(core.isset(c)){return c}return a};core.prototype.hasFlag=function(a){if(core.getFlag(a)){return true}return false};core.prototype.lockControl=function(){core.status.lockControl=true};core.prototype.unLockControl=function(){core.status.lockControl=false};core.prototype.isset=function(a){if(a==undefined||a==null){return false}return true};core.prototype.playSound=function(a,b){if(!core.musicStatus.soundStatus||!core.musicStatus.loaded){return}if(!core.isset(core.material.sounds[b][a])){return}core.musicStatus.playedSound=core.material.sounds[b][a];core.musicStatus.playedSound.play()};core.prototype.playBgm=function(a,b){if(core.musicStatus.isIOS||!core.musicStatus.loaded){return}if(core.isset(core.musicStatus.playedBgm)){core.musicStatus.playedBgm.pause()}core.musicStatus.playedBgm=core.material.sounds[b][a];if(core.musicStatus.soundStatus){core.musicStatus.playedBgm.play()}};core.prototype.changeSoundStatus=function(){if(core.musicStatus.soundStatus){main.core.disabledSound()}else{main.core.enabledSound()}};core.prototype.enabledSound=function(){core.musicStatus.soundStatus=true;core.playBgm("bgm","mp3");core.setLocalStorage("soundStatus",true)};core.prototype.disabledSound=function(){core.musicStatus.playedBgm.pause();core.musicStatus.soundStatus=false;core.setLocalStorage("soundStatus",false)};core.prototype.show=function(b,e,a){if(!core.isset(e)){b.style.display="block";return}b.style.display="block";b.style.opacity=0;var c=0;var d=window.setInterval(function(){c+=0.03;b.style.opacity=c;if(c>1){clearInterval(d);if(core.isset(a)){a()}}},e)};core.prototype.hide=function(c,e,a){if(!core.isset(e)){c.style.display="none";return}var d=1;var b=window.setInterval(function(){d-=0.03;c.style.opacity=d;if(d<0){c.style.display="none";clearInterval(b);if(core.isset(a)){a()}}},e)};core.prototype.clearStatusBar=function(){var a=["floor","hp","atk","def","mdef","money","experience","yellowKey","blueKey","redKey","poison","weak","curse","hard"];a.forEach(function(b){core.statusBar[b].innerHTML=""});core.statusBar.image.book.style.opacity=0.3;core.statusBar.image.fly.style.opacity=0.3};core.prototype.updateStatusBar=function(){if(core.values.HPMAX>0){core.setStatus("hp",Math.min(core.values.HPMAX,core.getStatus("hp")))}var b=["hp","atk","def","mdef","money","experience"];b.forEach(function(c){core.statusBar[c].innerHTML=core.getStatus(c)});var a=["yellowKey","blueKey","redKey"];a.forEach(function(c){core.statusBar[c].innerHTML=core.setTwoDigits(core.status.hero.items.keys[c])});core.statusBar.poison.innerHTML=core.hasFlag("poison")?"毒":"";core.statusBar.weak.innerHTML=core.hasFlag("weak")?"衰":"";core.statusBar.curse.innerHTML=core.hasFlag("curse")?"咒":"";core.statusBar.hard.innerHTML=core.status.hard;if(core.hasItem("book")){core.statusBar.image.book.style.opacity=1}else{core.statusBar.image.book.style.opacity=0.3}if(core.hasItem("fly")){core.statusBar.image.fly.style.opacity=1}else{core.statusBar.image.fly.style.opacity=0.3}core.updateFg()};core.prototype.resize=function(d,c){var b=416;var k=83;var q=49;var l=132;var a=b+6;var s=d;var i=false;if(d>c&&c<422){i=true;s=c}if(s0){core.drawTip("受到领域伤害"+b+"点")}core.status.hero.hp-=b;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose("zone");return}var e=false;if(d[0]!=null&&d[2]!=null&&d[0].id==d[2].id&&d[0].special==16){e=true}if(d[1]!=null&&d[3]!=null&&d[1].id==d[3].id&&d[1].special==16){e=true}if(e&&core.status.hero.hp>1){core.status.hero.hp=parseInt(core.status.hero.hp/2);core.drawTip("受到夹击,生命变成一半")}core.updateStatusBar()};events.prototype.afterChangeFloor=function(a){if(!core.hasFlag("visited_"+a)){this.doEvents(core.floors[a].firstArrive);core.setFlag("visited_"+a,true)}};events.prototype.doEvents=function(b,c,d,a){core.waitHeroToStop(function(){if(!core.isset(b)){return}if(!(b instanceof Array)){b=[b]}core.lockControl();core.status.event={id:"action",data:{list:core.clone(b),x:c,y:d,callback:a}};core.events.doAction()})};events.prototype.doAction=function(){clearInterval(core.interval.boxAnimate);core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);if(core.status.event.data.list.length==0){if(core.isset(core.status.event.data.callback)){core.status.event.data.callback()}core.ui.closePanel(false);return}var b=core.status.event.data.list.shift();core.status.event.data.current=b;var m=core.status.event.data.x,n=core.status.event.data.y;if(typeof b=="string"){core.status.event.data.type="text";core.ui.drawTextBox(b);return}core.status.event.data.type=b.type;switch(b.type){case"text":core.ui.drawTextBox(b.data);break;case"show":if(core.isset(b.time)&&b.time>0&&(!core.isset(b.floorId)||b.floorId==core.status.floorId)){core.animateBlock(b.loc[0],b.loc[1],"show",b.time,function(){core.addBlock(b.loc[0],b.loc[1],b.floorId);core.events.doAction()})}else{core.addBlock(b.loc[0],b.loc[1],b.floorId);this.doAction()}break;case"hide":var j=m,k=n,i=core.status.floorId;if(core.isset(b.loc)){j=b.loc[0];k=b.loc[1]}if(core.isset(b.floorId)){i=b.floorId}core.removeBlock(j,k,i);if(core.isset(b.time)&&b.time>0&&i==core.status.floorId){core.animateBlock(j,k,"hide",b.time,function(){core.events.doAction()})}else{this.doAction()}break;case"move":core.moveBlock(m,n,b.steps,b.time,b.disappear,function(){core.events.doAction()});break;case"changeFloor":var f={x:b.loc[0],y:b.loc[1]};if(core.isset(b.direction)){f.direction=b.direction}core.changeFloor(b.floorId||core.status.floorId,null,f,b.time,function(){core.lockControl();core.events.doAction()});break;case"changePos":core.clearMap("hero",0,0,416,416);core.setHeroLoc("x",b.loc[0]);core.setHeroLoc("y",b.loc[1]);core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");this.doAction();break;case"openDoor":var d=b.floorId||core.status.floorId;var a=core.getBlock(b.loc[0],b.loc[1],d);if(a!=null){if(d==core.status.floorId){core.openDoor(a.block.event.id,a.block.x,a.block.y,false,function(){core.events.doAction()})}else{core.removeBlock(a.block.x,a.block.y,d);this.doAction()}break}this.doAction();break;case"openShop":core.events.openShop(b.id);break;case"battle":core.battle(b.id,null,null,true,function(){core.events.doAction()});break;case"trigger":var j=b.loc[0],k=b.loc[1];var a=core.getBlock(j,k);if(a!=null){a=a.block;if(core.isset(a.event)&&a.event.trigger=="action"){core.status.event={id:"action",data:{list:core.clone(a.event.data),x:a.x,y:a.y,callback:core.status.event.data.callback}}}}this.doAction();break;case"playSound":var h=b.name.split(".");if(h.length==2){core.playSound(h[0],h[1])}this.doAction();break;case"setValue":try{var l=core.calValue(b.value);if(b.name.indexOf("status:")==0){l=parseInt(l);core.setStatus(b.name.substring(7),l)}if(b.name.indexOf("item:")==0){l=parseInt(l);var g=b.name.substring(5);if(l>core.itemCount(g)){core.getItem(g,l-core.itemCount(g))}else{core.setItem(g,l)}}if(b.name.indexOf("flag:")==0){core.setFlag(b.name.substring(5),l)}}catch(c){console.log(c)}core.updateStatusBar();this.doAction();break;case"if":if(core.calValue(b.condition)){core.events.insertAction(b["true"])}else{core.events.insertAction(b["false"])}this.doAction();break;case"choices":core.ui.drawChoices(b.text,b.choices);break;case"win":core.events.win(b.reason);break;case"lose":core.events.lose(b.reason);break;case"function":if(core.isset(b["function"])){b["function"]()}this.doAction();break;case"update":core.updateStatusBar();this.doAction();break;case"sleep":setTimeout(function(){core.events.doAction()},b.time);break;case"revisit":var a=core.getBlock(m,n);if(a!=null){a=a.block;if(core.isset(a.event)&&a.event.trigger=="action"){core.status.event.data.list=core.clone(a.event.data)}}this.doAction();break;case"exit":core.status.event.data.list=[];core.events.doAction();break;default:core.status.event.data.type="text";core.ui.drawTextBox("\t[警告,]出错啦!\n"+b.type+" 事件不被支持...")}return};events.prototype.insertAction=function(a){core.unshift(core.status.event.data.list,a)};events.prototype.openShop=function(shopId,needVisited){var shop=core.status.shops[shopId];shop.times=shop.times||0;shop.visited=shop.visited||false;if(needVisited&&!shop.visited){if(shop.times==0){core.drawTip("该商店尚未开启")}else{core.drawTip("该商店已失效")}return}shop.visited=true;core.ui.closePanel();core.lockControl();core.status.event={id:"shop",data:{id:shopId,shop:shop}};var content="\t["+shop.name+","+shop.icon+"]";var times=shop.times,need=eval(shop.need);if(need<0){need="若干"}var use=shop.use=="experience"?"经验":"金币";content=content+"勇敢的武士啊,给我"+need+"\n"+use+",你就可以:";var choices=[];for(var i=0;i=0){return"当前不能使用快捷商店。"}return null};events.prototype.useItem=function(a){core.ui.closePanel(false);if(a=="book"){core.openBook(false);return}if(a=="fly"){core.useFly(false);return}if(core.canUseItem(a)){core.useItem(a)}else{core.drawTip("当前无法使用"+core.material.items[a].name)}};events.prototype.afterBattle=function(b,e,f,a){var d=core.material.enemys[b].special;if(d==12&&!core.hasFlag("poison")){core.setFlag("poison",true);core.updateStatusBar()}if(d==13&&!core.hasFlag("weak")){core.setFlag("weak",true);core.status.hero.atk-=core.values.weakValue;core.status.hero.def-=core.values.weakValue;core.updateStatusBar()}if(d==14&&!core.hasFlag("curse")){core.setFlag("curse",true);core.updateStatusBar()}if(core.status.lockControl){if(core.isset(a)){a()}return}var c=core.floors[core.status.floorId].afterBattle[e+","+f];if(core.isset(c)){core.events.doEvents(c,e,f,a)}else{core.continueAutomaticRoute();if(core.isset(a)){a()}}};events.prototype.afterOpenDoor=function(b,d,e,a){if(core.status.lockControl){if(core.isset(a)){a()}return}var c=core.floors[core.status.floorId].afterOpenDoor[d+","+e];if(core.isset(c)){core.events.doEvents(c,d,e,a)}else{core.continueAutomaticRoute();if(core.isset(a)){a()}}};events.prototype.passNet=function(a){if(core.hasItem("shoes")){return}if(a.event.id=="lavaNet"){core.status.hero.hp-=core.values.lavaDamage;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose("lava");return}core.drawTip("经过血网,生命-"+core.values.lavaDamage)}if(a.event.id=="poisonNet"){if(core.hasFlag("poison")){return}core.setFlag("poison",true)}if(a.event.id=="weakNet"){if(core.hasFlag("weak")){return}core.setFlag("weak",true);core.status.hero.atk-=core.values.weakValue;core.status.hero.def-=core.values.weakValue}if(a.event.id=="curseNet"){if(core.hasFlag("curse")){return}core.setFlag("curse",true)}core.updateStatusBar()};events.prototype.beforeSaveData=function(a){};events.prototype.afterLoadData=function(a){};events.prototype.clickAction=function(d,e){if(core.status.event.data.type=="text"){this.doAction();return}if(core.status.event.data.type=="choices"){var b=core.status.event.data.current;var a=b.choices;if(a.length==0){return}if(d>=5&&d<=7){var c=6-parseInt((a.length-1)/2);if(e>=c&&e=10&&a<=12&&b==12){core.ui.closePanel(true)}return};events.prototype.clickFly=function(d,e){if((d==10||d==11)&&e==9){core.ui.drawFly(core.status.event.data-1)}if((d==10||d==11)&&e==5){core.ui.drawFly(core.status.event.data+1)}if(d>=5&&d<=7&&e==12){core.ui.closePanel()}if(d>=0&&d<=9&&e>=3&&e<=11){var b=core.status.hero.flyRange.indexOf(core.status.floorId);var c=core.status.event.data=5&&x<=7){var topIndex=6-parseInt(choices.length/2);if(y>=topIndex&&yeval(use)){core.drawTip("你的"+use_text+"不足");return}eval(use+"-="+need);core.setStatus("money",money);core.setStatus("experience",experience);choice.effect.split(";").forEach(function(t){if(t.indexOf("status:")==0){eval(t.replace("status:","core.status.hero."))}else{if(t.indexOf("item:")==0){eval(t.replace("item:","core.getItem('").replace("+=","', ")+")")}}});core.updateStatusBar();shop.times++;this.openShop(core.status.event.data.id)}else{if(y==topIndex+choices.length){core.status.boxAnimateObjs=[];core.setBoxAnimate();if(core.status.event.data.fromList){core.ui.drawQuickShop()}else{core.ui.closePanel()}}}}};events.prototype.clickSelectShop=function(f,g){if(f>=5&&f<=7){var d=core.status.shops,b=Object.keys(d);var e=6-parseInt((b.length+1)/2);var a=6+parseInt((b.length+1)/2);if(g>=e&&g-e=10&&c<=12&&d==12){core.ui.closePanel(false);return}var b=null;if(d>=4&&d<=7&&c!=12){b=Object.keys(core.status.hero.items.tools).sort()}if(d>=9&&d<=12&&c!=12){b=Object.keys(core.status.hero.items.constants).sort()}if(b==null){return}var a=0;if(d==4||d==5||d==9||d==10){a=parseInt(c/2)}else{a=6+parseInt(c/2)}if(a>=b.length){return}itemId=b[a];if(itemId==core.status.event.data){core.events.useItem(itemId)}else{core.ui.drawToolbox(itemId)}};events.prototype.clickSL=function(b,c){if((b==3||b==4)&&c==12){core.ui.drawSLPanel(core.status.event.data-1)}if((b==8||b==9)&&c==12){core.ui.drawSLPanel(core.status.event.data+1)}if(b>=10&&b<=12&&c==12){core.ui.closePanel(false);if(!core.isPlaying()){core.showStartAnimate()}return}var a=6*core.status.event.data+1;if(c>=1&&c<=4){if(b>=1&&b<=3){core.doSL(a,core.status.event.id)}if(b>=5&&b<=7){core.doSL(a+1,core.status.event.id)}if(b>=9&&b<=11){core.doSL(a+2,core.status.event.id)}}if(c>=7&&c<=10){if(b>=1&&b<=3){core.doSL(a+3,core.status.event.id)}if(b>=5&&b<=7){core.doSL(a+4,core.status.event.id)}if(b>=9&&b<=11){core.doSL(a+5,core.status.event.id)}}};events.prototype.clickSettings=function(a,b){if(a<5||a>7){return}if(b==3){if(core.musicStatus.isIOS){core.drawTip("iOS设备不支持播放音乐");return}core.changeSoundStatus();core.ui.drawSettings(false)}if(b==4){core.ui.drawQuickShop()}if(b==5){core.ui.drawSyncSave()}if(b==6){core.ui.drawConfirmBox("你确定要清空所有本地存档吗?",function(){localStorage.clear();core.drawText("\t[操作成功]你的本地所有存档已被清空。")},function(){core.ui.drawSettings(false)})}if(b==7){core.ui.drawConfirmBox("你确定要重新开始吗?",function(){core.ui.closePanel();core.restart()},function(){core.ui.drawSettings(false)})}if(b==8){core.ui.drawAbout()}if(b==9){core.ui.closePanel()}return}; \ No newline at end of file diff --git a/libs/floors.min.js b/libs/floors.min.js new file mode 100644 index 00000000..9bda996e --- /dev/null +++ b/libs/floors.min.js @@ -0,0 +1 @@ +main.floors.sample0={floorId:"sample0",title:"样板 0 层",name:0,canFlyTo:true,map:[[0,0,220,0,0,6,87,3,65,64,44,43,42],[0,246,0,246,0,6,0,3,58,59,60,61,41],[219,0,0,0,219,6,0,3,57,26,62,63,40],[6,6,125,6,6,6,0,3,53,54,55,56,39],[216,247,256,235,248,6,0,3,49,50,51,52,38],[5,5,125,5,5,5,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],[5,5,125,5,5,5,0,1,21,22,23,24,25],[0,0,0,0,0,0,45,1,1,1,121,1,1],[4,4,126,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],],firstArrive:["\t[样板提示]首次到达某层可以触发 firstArrive 事件,\n该事件可类似于RMXP中的“自动执行脚本”。\n\n本事件支持一切的事件类型,常常用来触发对话,\n例如:","\t[hero]我是谁?\n我从哪来?\n我又要到哪去?","\t[仙子,fairy]你问我...?我也不知道啊...","本层主要对道具、门、怪物等进行介绍,\n有关事件的各种信息在下一层会有更为详细的说明。",],events:{"10,9":["\t[老人,man]这些是本样板支持的所有的道具。\n\n道具分为三类:items, constants, tools。\nitems 为即捡即用类道具,例如宝石、血瓶、\n剑盾等。\nconstants 为永久道具,例如怪物手册、楼层\n传送器、幸运金币等。\ntools 为消耗类道具,例如破墙镐、炸弹、中\n心对称飞行器等。\n\n后两类道具在工具栏中可以看到并使用。","\t[老人,man]有关道具效果,定义在items.js中。\n目前大多数道具已有默认行为,如有自定义\n的需求则需在items.js中修改代码。","\t[老人,man]constants 和 tools 各最多只允许12种,\n多了会导致图标溢出。","\t[老人,man]拾取道具结束后可触发 afterGetItem 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",{type:"hide",time:500}],"10,11":["\t[老人,woman]这些是门,需要对应的钥匙打开。\n机关门必须使用特殊的开法。","\t[老人,woman]开门后可触发 afterOpenDoor 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",{type:"hide",time:500}],"2,10":["\t[老人,womanMagician]这些是路障、楼梯、传送门。","\t[老人,womanMagician]血网的伤害数值、中毒后每步伤害数值、衰弱\n时攻防下降的数值,都在 data.js 内定义。\n\n路障同样会尽量被自动寻路绕过。","\t[老人,womanMagician]楼梯和传送门需要在changeFloor中定义目标\n楼层和位置,可参见样板里已有的的写法。","\t[老人,womanMagician]楼梯和传送门是否可“穿透”,由data.js中的\n全局变量所决定,你也可以单独设置。\n穿透的意思是,自动寻路得到的路径中间经\n过了楼梯,行走时是否触发楼层转换事件。\n例如,下面的“下箭头”就是不能穿透的。",{type:"hide",time:500}],"2,8":["\t[老人,magician]这些都是各种各样的怪物,\n所有怪物的数据都在enemys.js中设置。\n\n每个怪物最多只能有一个特殊属性。","\t[老人,magician]这批怪物分别为:普通、先攻、魔攻、坚固、\n2连击、3连击、4连击、破甲、反击、净化。","\t[老人,magician]打败怪物后可触发 afterBattle 事件。\n\n有关事件的各种信息在下一层会有更为详细的\n说明。",{type:"hide",time:500}],"2,5":["\t[老人,magician]模仿、吸血、中毒、衰弱、诅咒。\n\n请注意吸血怪需要设置value为吸血数值,\n可参见样板中黑暗大法师的写法。",{type:"hide",time:500}],"2,3":["\t[老人,magician]领域、夹击。\n请注意领域怪需要设置value为伤害数值,\n可参见样板中初级巫师的写法。","\t[老人,magician]出于游戏性能的考虑,我们不可能每走一步都\n对领域和夹击进行检查。\n因此我们需要在本楼层的 checkBlock 中指明\n哪些点可能会触发领域和夹击事件,在这些点\n才会对领域和夹击进行检查和处理。\n具体可参见本层 checkBlock 的写法。","\t[老人,magician]夹击和领域同时发生时先计算领域,再夹击。\n自动寻路同样会尽量绕过你设置的这些点。\n\n另:本塔不支持阻击怪。",{type:"hide",time:500}],"12,10":{enable:false,data:["\t[仙子,fairy]只有楼上启用事件后,才能看到我并可以和我\n对话来触发事件。",{type:"hide",time:500}]},},changeFloor:{"6,0":{floorId:"sample1",stair:"downFloor"},"0,11":{floorId:"sample0",loc:[0,12]},"0,12":{floorId:"sample0",stair:"upFloor"},"1,12":{floorId:"sample0",loc:[1,12]},"2,12":{floorId:"sample0",loc:[2,12]},"3,12":{floorId:"sample0",loc:[6,1]},"4,12":{floorId:"sample0",loc:[0,9]},"5,12":{floorId:"sample0",loc:[6,10],portalWithoutTrigger:false},"6,12":{floorId:"sample0",loc:[10,10]},},afterBattle:{"2,6":["\t[ghostSkeleton]不可能,你怎么可能打败我!\n(一个打败怪物触发的事件)"]},afterGetItem:{"11,8":["由于状态栏放不下,绿钥匙和铁门钥匙均视为tools,\n放入工具栏中。\n碰到绿门和铁门仍然会自动使用开门。"],"8,6":["由于吸血和夹击等的存在,血瓶默认自动被绕路。\n你可以修改data.js中的系统Flag来设置这一项。"],"8,7":["如需修改消耗品的效果,请前往 data.js ,找到\n并修改values内对应的具体数值即可。\n\n如果有更高级的需求(如每个区域宝石数值变化)\n,详见doc文档内的做法说明。"],"10,7":["在 data.js 的系统Flag中设置是否启用魔防。\n如果不启用魔防则不会在状态栏显示。"],"9,5":["每层楼的 canFlyTo 决定了该楼层能否被飞到。\n\n不能被飞到的楼层也无法使用楼层传送器。","飞行的楼层顺序由 main.js 中 floorIds 加载顺序\n所决定。\n\n是否必须在楼梯边使用楼传器由 data.js 中的系统\nFlag所决定。"],"10,5":["破墙镐是破面前的墙壁还是四个方向的墙壁,\n由data.js中的系统Flag所决定。"],"8,4":["炸弹可以炸四个方向的怪物。\n如只需要炸前方怪物请使用上面的圣锤。","不能被炸的怪物在enemys中可以定义。\n可参见样板里黑衣魔王的写法。\n\n炸死怪物是否触发事件由 data.js 中的系统Flag\n所决定。"],"10,4":["“上楼”和“下楼”的目标层由 main.js 的 floorIds\n顺序所决定。"],"10,3":["十字架目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。"],"9,2":["该道具默认是大黄门钥匙,如需改为钥匙盒直接\n修改 data.js 中的系统Flag即可。"],"10,2":["屠龙匕首目前未被定义,可能需要自行实现功能。\n有关如何实现一个道具功能参见doc文档。"],},afterOpenDoor:{"11,12":["你开了一个绿门,触发了一个afterOpenDoor事件"]},checkBlock:["1,0","3,0","0,1","2,1","4,1","1,2","3,2"]};main.floors.sample1={floorId:"sample1",title:"样板 1 层",name:1,canFlyTo:true,map:[[7,131,8,2,9,130,10,2,0,0,132,0,0],[0,0,0,0,0,0,0,2,0,0,0,0,0],[2,2,2,2,121,2,2,2,0,0,229,0,0],[43,33,44,1,0,0,0,2,0,0,0,0,0],[21,22,21,1,0,0,0,2,0,0,0,0,0],[1,245,1,1,0,87,0,2,2,2,85,2,2],[0,246,0,1,0,0,0,2,2,221,0,221,2],[246,0,246,1,0,0,0,121,85,0,0,0,2],[1,246,1,1,0,2,2,2,2,2,2,2,2],[0,0,0,0,0,0,0,0,0,0,0,0,0],[1,1,1,1,0,3,0,0,0,0,0,0,0],[1,0,123,1,0,3,124,0,121,0,122,0,126],[1,0,0,1,88,3,86,0,0,0,0,0,0],],firstArrive:[],events:{"4,10":["\t[样板提示]本层楼将会对各类事件进行介绍。","左边是一个仿50层的陷阱做法,上方是商店、快捷\n商店的使用方法,右上是一个典型的杀怪开门的例\n子,右下是各类可能的NPC事件。","本样板目前支持的事件列表大致有:\ntext: 显示一段文字(比如你现在正在看到的)\nshow: 使一个事件有效(可见、可被交互)\nhide: 使一个事件失效(不可见、不可被交互)\ntrigger: 触发另一个地点的事件\nbattle: 强制和某怪物战斗\nopenDoor: 无需钥匙开门(例如机关门、暗墙)\nopenShop: 打开一个全局商店\nchangeFloor: 传送勇士到某层某位置\nchangePos: 传送勇士到当层某位置\nwin: 获得胜利(游戏通关)\nlose: 游戏失败","move: 移动事件效果\nplaySound: 播放某个音频\nif: 条件判断\nchoices: 提供选项\nsetValue: 设置勇士属性、道具,或某个变量/flag\nupdate: 更新状态栏和地图显伤\nsleep: 等待多少毫秒\nexit: 立刻结束当前事件\nrevisit: 立刻结束事件并重新触发\nfunction: 自定义JS脚本\n\n更多支持的事件还在编写中,欢迎您宝贵的意见。",'有关各类事件的样例,可参见本层一些NPC的写法。\n所有事件样例本层都有介绍。\n\n一个自定义事件处理完后,需要调用\n{"type": "hide"}\n该事件才不会再次出现。',{type:"hide"}],"1,5":{enable:false},"1,6":{enable:false},"0,7":{enable:false},"2,7":{enable:false},"1,8":{enable:false},"1,7":[{type:"show",loc:[1,5],time:1500},{type:"sleep",time:500},"\t[redKing]欢迎来到魔塔,你是第一百位挑战者。\n若你能打败我所有的手下,我就与你一对一\n的决斗。\n现在你必须接受我的安排。",{type:"show",loc:[1,6],time:500},{type:"show",loc:[0,7],time:500},{type:"show",loc:[1,8],time:500},{type:"show",loc:[2,7],time:500},"\t[hero]什么?",{type:"playSound",name:"attack.ogg"},{type:"setValue",name:"status:atk",value:"status:atk/10"},{type:"setValue",name:"status:def",value:"status:def/10"},{type:"hide",loc:[1,6]},{type:"hide",loc:[0,7]},{type:"hide",loc:[2,7]},{type:"hide",loc:[1,8]},{type:"hide",loc:[1,5],time:500},{type:"hide"},{type:"changeFloor",floorId:"sample1",loc:[1,11]},{type:"trigger",loc:[2,11]}],"2,11":["\t[杰克,thief]喂!醒醒!快醒醒!","\t[hero]额,我这是在什么地方?","\t[杰克,thief]你被魔王抓了起来扔进了监狱,和我关在了一\n起,但是幸运的是我在昨天刚刚挖好一条越狱\n的暗道!",{type:"openDoor",loc:[3,11]},{type:"sleep",time:300},"\t[杰克,thief]我先走了,祝你好运!",{type:"move",time:750,steps:[{direction:"right",value:2},"down"]},"上面是个move事件,可以对NPC等进行移动。\n详见样板中小偷事件的写法。","\t[hero]怎么跑的这么快..."],"4,2":["\t[老人,man]本塔的商店有两类,全局商店和非全局商店。\n\n所谓非全局商店,就类似于右下角那个卖钥匙\n的老人一样,一定要碰到才能触发事件。\n\n而全局商店,则能在快捷商店中直接使用。","\t[老人,man]要注册一个全局商店,你需要在 data.js 中,\n找到 shops,并在内添加你的商店信息。",'\t[老人,man]商店信息添加后,可以在需要的事件处调用\n{"type": "openShop"}\n来打开你添加的全局商店。',"\t[老人,man]在上面的例子里,左边是一个仿50层的金币\n商店,右边是一个仿24层的经验商店。\n\n商店被访问后即可在快捷商店中进行使用。",{type:"hide",time:500}],"1,0":[{type:"openShop",id:"moneyShop1"}],"5,0":[{type:"openShop",id:"expShop1"}],"7,7":["\t[老人,man]这是一个典型的杀怪开门、强制战斗事件。",{type:"hide"}],"8,7":{enable:false},"9,7":[{type:"show",loc:[8,7]},{type:"hide"}],"10,4":["\t[blackKing]你终于还是来了。","\t[hero]放开我们的公主!","\t[blackKing]如果我不愿意呢?","\t[hero]无需多说,拔剑吧!",{type:"battle",id:"blackKing"},{type:"hide",loc:[10,2]},{type:"openDoor",loc:[8,7]},"\t[blackKing]没想到你已经变得这么强大了... 算你厉害。\n公主就交给你了,请好好对她。",{type:"hide"}],"10,0":["\t[hero]公主,我来救你了~","\t[公主,princess]快救我出去!我受够这里了!","\t[hero]公主别怕,我们走吧~",{type:"win",reason:"救出公主"}],"6,12":{enable:false},"6,11":['\t[仙子,fairy]通过调用 {"type": "show"} 可以使隐藏的\n事件显示出来。\n比如我下面这个机关门。',{type:"show",loc:[6,12]},'\t[仙子,fairy]通过调用 {"type": "openDoor"} 可以无需\n钥匙打开一扇门或暗墙。',{type:"openDoor",loc:[6,12]},"\t[仙子,fairy]同时,也可以对其它层进行操作,比如楼下\n的机关门,现在已经为你打开了。",{type:"openDoor",loc:[11,10],floorId:"sample0"},"\t[仙子,fairy]如果 show 或 hide 指定了 time 参数,则\n以动画效果显示,指定的参数作为消失时间\n(毫秒)来计算。","\t[仙子,fairy]现在到楼下来找我吧~",{type:"show",loc:[12,10],floorId:"sample0"},{type:"hide",time:500}],"8,11":[{type:"setValue",name:"flag:man_times",value:"flag:man_times+1"},"\t[老人,man]在文字中使用${' ${ '}和 } 可以计算并显示一个\n表达式的结果。\n","\t[老人,man]例如:\n你的当前攻击力是${status:atk},防御力是${status:def}。\n攻防和的十倍是${10*(status:atk+status:def)},攻防之积是${status:atk*status:def}。\n你有${item:yellowKey}把黄钥匙,${item:blueKey}把蓝钥匙,${item:redKey}把红钥匙。\n你有${item:pickaxe}个破,${item:bomb}个炸,${item:centerFly}个飞。\n这是你第${flag:man_times}次和我对话。",'\t[老人,man]同时,你也可以通过\n{"type": "setValue"}\n来设置一个勇士的属性、道具,或某个Flag。',"\t[老人,man]例如:\n现在我将让你的攻防提升50%,再将攻防和\n的十倍加到生命值上。",{type:"setValue",name:"status:atk",value:"status:atk*1.5"},{type:"setValue",name:"status:def",value:"status:def*1.5"},{type:"setValue",name:"status:hp",value:"status:hp+10*(status:atk+status:def)"},"\t[老人,man]再送你500金币,1000经验,1破2炸3飞!",{type:"setValue",name:"status:money",value:"status:money+500"},{type:"setValue",name:"status:experience",value:"status:experience+1000"},{type:"setValue",name:"item:pickaxe",value:"item:pickaxe+1"},{type:"setValue",name:"item:bomb",value:"item:bomb+2"},{type:"setValue",name:"item:centerFly",value:"item:centerFly+3"},"\t[老人,man]status:xxx 代表勇士的某个属性。\n其中xxx可取hp, atk, def, mdef, money,\nexperience这几项。\n\nitem:xxx 代表勇士的某个道具的个数。\nxxx为道具ID,具体可参见items.js中的定义。\n\nflag:xxx 代表某个自定义Flag或变量。\nxxx为Flag/变量名,可以自行定义,由字母、\n数字和下划线组成。\n未定义过而直接取用的Flag默认值为false。","\t[老人,man]你现在可以重新和我进行对话,进一步看到\n属性值的改变。"],"10,11":[{type:"if",condition:"flag:woman_times==0","true":["\t[老人,woman]这是个很复杂的例子,它将教会你如何使用\nif 语句进行条件判断,以及 choices 提供\n选项来供用户进行选择。","\t[老人,woman]第一次访问我将显示这段文字;从第二次开始\n将会向你出售钥匙。\n钥匙价格将随着访问次数递增。\n当合计出售了七把钥匙后,将送你一把大黄门\n钥匙,并消失不再出现。","\t[老人,woman]这部分的逻辑比较长,请细心看样板的写法,\n是很容易看懂并理解的。"],"false":[{type:"if",condition:"flag:woman_times==8","true":["\t[老人,woman]你购买的钥匙已经够多了,再继续卖给你的话\n我会有危险的。","\t[老人,woman]看在你贡献给我这么多钱的份上,送你一把大\n黄门钥匙吧,希望你能好好用它。",{type:"setValue",name:"item:bigKey",value:"item:bigKey+1"},"\t[老人,woman]我先走了,拜拜~",{type:"hide",time:500},{type:"exit"}],"false":[{type:"choices",text:"\t[老人,woman]少年,你需要钥匙吗?\n我这里有大把的!",choices:[{text:"黄钥匙(${9+flag:woman_times}金币)",action:[{type:"if",condition:"status:money>=9+flag:woman_times","true":[{type:"setValue",name:"status:money",value:"status:money-(9+flag:woman_times)"},{type:"setValue",name:"item:yellowKey",value:"item:yellowKey+1"},],"false":["\t[老人,woman]你的金钱不足!",{type:"revisit"}]}]},{text:"蓝钥匙(${18+2*flag:woman_times}金币)",action:[{type:"if",condition:"status:money>=18+2*flag:woman_times","true":[{type:"setValue",name:"status:money",value:"status:money-(18+2*flag:woman_times)"},{type:"setValue",name:"item:blueKey",value:"item:blueKey+1"},],"false":["\t[老人,woman]你的金钱不足!",{type:"revisit"}]}]},{text:"红钥匙(${36+4*flag:woman_times}金币)",action:[{type:"if",condition:"status:money>=36+4*flag:woman_times","true":[{type:"setValue",name:"status:money",value:"status:money-(36+4*flag:woman_times)"},{type:"setValue",name:"item:redKey",value:"item:redKey+1"},],"false":["\t[老人,woman]你的金钱不足!",{type:"revisit"}]}]},{text:"离开",action:[{type:"exit"}]}]}]}]},{type:"setValue",name:"flag:woman_times",value:"flag:woman_times+1"},{type:"revisit"}],"12,11":['\t[老人,womanMagician]使用 {"type":"function"} 可以写自定义的\nJS脚本。\n本塔支持的所有主要API会在doc文档内给出。',"\t[老人,womanMagician]例如这个例子:即将弹出一个输入窗口,然后\n会将你的输入结果直接加到你的攻击力上。",{type:"function","function":function(){var a=prompt("请输入你要加攻击力的数值:");if(a!=null){a=parseInt(a);if(a>0){core.setStatus("atk",core.getStatus("atk")+a);core.drawTip("操作成功,攻击+"+a);core.events.insertAction([{type:"update"},"操作成功,攻击+"+a])}}}},"\t[老人,womanMagician]具体可参见样板中本事件的写法。"]},changeFloor:{"4,12":{floorId:"sample0",loc:[6,0]},"5,5":{floorId:"sample2",stair:"downFloor"}},afterBattle:{"9,6":[{type:"setValue",name:"flag:door",value:"flag:door+1"},{type:"if",condition:"flag:door==2","true":[{type:"openDoor",loc:[10,5]}],"false":[]},],"11,6":[{type:"setValue",name:"flag:door",value:"flag:door+1"},{type:"if",condition:"flag:door==2","true":[{type:"openDoor",loc:[10,5]}],"false":[]},],},afterGetItem:{},afterOpenDoor:{},checkBlock:[]};main.floors.sample2={floorId:"sample2",title:"主塔 40 层",name:40,canFlyTo:false,map:[[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剧情。","由于暂不支持一些动画效果,例如雷电、振动、天\n气渲染等等,因此做出来的效果远远比不上原版。\n\n不过作为抛砖引玉,还是可以展示一下H5的能力。\n(开音效食用更加)"],events:{"6,11":{enable:false},"6,10":[{type:"playSound",name:"door.ogg"},{type:"show",loc:[6,11]},{type:"hide"},{type:"trigger",loc:[6,7]},],"6,7":[{type:"playSound",name:"item.ogg"},"\t[hero]杰克,你究竟是什么人?",{type:"playSound",name:"item.ogg"},"\t[杰克,thief]……",{type:"playSound",name:"item.ogg"},"\t[hero]我们……是朋友对吧?\n是朋友就应该相互信任对吧?",{type:"playSound",name:"item.ogg"},"\t[杰克,thief]……事到如今也没有什么好隐瞒的了。",{type:"playSound",name:"item.ogg"},"\t[杰克,thief]没错,我就是这一切的背后主谋。",{type:"move",steps:[{direction:"up",value:3}],time:1000},{type:"show",loc:[6,4],time:1000},{type:"sleep",time:500},{type:"playSound",name:"item.ogg"},"\t[blackMagician]我的真名为——黑暗大法师,第四区域的头目。",{type:"playSound",name:"item.ogg"},"\t[hero]呵呵,不知道为什么,我竟然对事情走到\n现在这一步毫不感觉意外。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]以杰克的名义利用了你这么久,真是抱歉啊。",{type:"playSound",name:"item.ogg"},"\t[hero]真正的杰克现在在哪里?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]盗贼杰克这个人类从未存在过,他只是我用来\n接近你的一副皮囊而已。",{type:"playSound",name:"item.ogg"},"\t[hero]……这样啊,呵呵。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]为什么你看上去丝毫不生气?",{type:"playSound",name:"item.ogg"},"\t[hero]多亏了鬼帝,我现在的脾气好得连我自己\n都害怕。",{type:"playSound",name:"item.ogg"},"\t[hero]说起来我还得好好感谢你呢,如果没有杰\n克……你的帮助,我早就死在第一区域了。",{type:"playSound",name:"item.ogg"},"\t[hero]不论你的目的如何,你的所作所为都是对\n我有利的。不是吗?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]能够如此淡定的面对背叛,看来跟五年前相比,\n你确实成长了很多啊。",{type:"playSound",name:"item.ogg"},"\t[hero]五年前?……黑暗大法师,在这之前,我们\n好像素未谋面吧?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]五年前那场屠城你应该这一生都不会忘记吧。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]很不巧,那场屠城的主谋,也是我。",{type:"playSound",name:"item.ogg"},"\t[hero]……",{type:"playSound",name:"item.ogg"},"\t[hero]这么说,击中我双亲的那道紫色闪电,也\n就是你释放的吧……",{type:"playSound",name:"item.ogg"},"\t[blackMagician]你的双亲?这种事情我怎么可能会记得?\n你难道在踩死蚂蚁的时候还会一只只记下\n他们的样子吗?",{type:"playSound",name:"item.ogg"},"\t[hero]老 子 要 你 的 命",{type:"playSound",name:"item.ogg"},"\t[blackMagician]你应该对我心怀感激才对,如果不是那时的\n我看出了你隐藏的稀有勇者体质,你绝对不\n可能活到今天。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]在暗中动手脚让你通过勇者选拔的人也是我,\n我一直一直在暗中引导你走到今天这一步。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]是我救赎了一无是处的你。",{type:"playSound",name:"item.ogg"},"\t[hero]为什么只有我一个人活了下来!!!!",{type:"playSound",name:"item.ogg"},"\t[hero]为什么偏偏是我!!!!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]我刚才不是说过了吗?因为我看出了你有\n稀有勇者体质啊。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]你刚刚跟鬼帝交过手,应该已经很清楚这\n稀有勇者体质意味着什么了吧?",{type:"playSound",name:"item.ogg"},"\t[hero]……就因为我有这种体质,就不得不背负如此\n残酷的宿命吗?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]愚蠢!这意味着只要我对你加以引导跟培养,\n你就能成为这世间实力最强的存在!",{type:"playSound",name:"item.ogg"},"\t[hero]……所以,你究竟想利用我干什么?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]我利用你干的事情,你不是已经完成了吗?",{type:"playSound",name:"item.ogg"},"\t[hero]……你说什么?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]不知不觉间,你已经在我的指引下跟鬼帝\n正面交手并且杀掉了他啊。",{type:"playSound",name:"item.ogg"},"\t[hero]就连我跟鬼帝的对决……也是被你安排好了的?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]你们两个一个是人类勇者,一个是魔物勇者,\n迟早会有交手的一天。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]我只不过是操纵了一系列的连锁事件让这一天\n提早了数十年到来而已。",{type:"playSound",name:"item.ogg"},"\t[hero]……你这样做对谁有好处?他可是你们魔物\n世界的救世主啊。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]一个惧怕征战,爱好和平的懦夫,也配叫\n救世主?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]获得了力量,却只会被动挨打而不主动向\n人类世界出击,龟缩在第二区域惶惶度日,\n他根本就不配拥有稀有勇者体质。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]为了不让这种人霸占着积累多年的庞大灵魂\n能量无作为,我设计让你杀掉了他。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]你没有辜负我的期待,成功战胜了那个废物,\n现在你体内累积的灵魂能量……也就是魔力,\n已经达到了能跟魔王匹敌的地步。",{type:"playSound",name:"item.ogg"},"\t[hero]……是吗?现在的我能与魔王匹敌?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]不止如此,你现在的力量之强就算是统治\n世界也是绰绰有余!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]怎么样?要不要加入我的麾下,跟随我去\n征战人类世界?",{type:"playSound",name:"item.ogg"},"\t[hero]能与魔王匹敌的话,也就是说。",{type:"playSound",name:"item.ogg"},"\t[hero]我 现 在 对 付 你 这 种 杂 碎 也 绰 绰 有 余\n吧 ?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]……什么?!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]等一下!别冲动!你先等我把这利害关系\n理一理——",{type:"playSound",name:"item.ogg"},"\t[hero]你给老子闭嘴。",{type:"playSound",name:"item.ogg"},"\t[hero]老子什么都不想听。",{type:"playSound",name:"item.ogg"},"\t[hero]老子现在想做的事情只有一件——",{type:"playSound",name:"item.ogg"},"\t[hero]剁掉你的头,把它放回我双亲的墓前。",{type:"update"}],"6,4":{enable:false,},"5,4":{enable:false},"7,4":{enable:false},"5,5":{enable:false},"7,5":{enable:false},"6,3":{trigger:"action",enable:false,data:["\t[blackMagician]听不进去人话的蠢货,就要用疼痛来管教!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]出来吧!禁忌——紫电凶杀阵!",{type:"show",loc:[4,3],time:500},{type:"show",loc:[4,6],time:500},{type:"show",loc:[8,6],time:500},{type:"show",loc:[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:"sleep",time:200},{type:"playSound",name:"attack.ogg"},{type:"sleep",time:200},"\t[hero]唔……!!(吐血)",{type:"playSound",name:"item.ogg"},"\t[blackMagician]我的魔力可是充足的很啊!我会一直折磨\n到你屈服于我为止!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]人类!好好感受吧!当初你们施加于我的\n痛苦!如今我要百倍奉还!",{type:"show",loc:[6,6],time:1000},{type:"sleep",time:700},{type:"trigger",loc:[6,6]}]},"4,3":{trigger:"action",enable:false},"8,3":{trigger:"action",enable:false},"4,6":{trigger:"action",enable:false},"8,6":{trigger:"action",enable:false},"6,6":{enable:false,data:[{type:"playSound",name:"item.ogg"},"\t[hero]…妖精…小姐……是你吗?",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]不要绝望,也不要悲伤。",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]你从来都不是独自一人在前进。",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]咱一直,一直都在注视着你。",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]耍小聪明的你、笨笨的你呆呆的你、胆小的\n你、勇敢的你帅气的你……全部全部都是你。",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]所以放心吧,无论发生什么,咱都会陪伴\n在你身边的。",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]因为你要是离开我的话,立刻就会死掉吧?",{type:"playSound",name:"item.ogg"},"\t[hero]…妖精…小姐……其实一直以来,我都非常\n感激你……",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]笨蛋!都这种时候了就不要作出像是临终\n遗言的发言了啊!!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]喂!那边穿衣品味差到极点的黑暗大法师,\n别左顾右盼说的就是你!你应该知道咱的\n身份吧?\n还不速速退下!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]可恶…多管闲事的妖精族…明明只要再让他\n承受一点疼痛来瓦解他的意志力,我的计\n划就成功了!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]哼哼哼~抱歉哦,这个笨蛋的意志力可不像\n你想象的那么薄弱哦!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]不甘心!我不甘心!妖精公主又如何!\n只要是阻挡我的,不管是谁我都要铲除!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]终于露出狐狸尾巴了,其实咱早就看出你有\n谋反的念头。你的计划就是拉拢这家伙入\n伙然后推翻魔王对魔塔的统治对吧?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]呵呵呵……那个昏庸的魔王,掌握着那么庞大\n的魔物军队却只知道固守魔塔,而不主动侵略\n人类世界扩张领土!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]我实在是看不过眼,所以我才决定把这个具\n备稀有勇者体质的家伙培养成新一任魔王!\n来让这个世界的势力重新洗牌!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]你觉得一个满脑子想着回家种田的废柴勇者\n会成为改变世界的魔王?你晃晃脑袋试试,\n是不是能听到大海的声音?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]恼人至极的妖精族!呵呵呵……我干脆一不做\n二不休,连你也一块收拾了吧!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]别小瞧咱!咱好歹也是妖精族里实力数一\n数二的存在!",{type:"playSound",name:"item.ogg"},"\t[blackMagician]只会耍嘴皮子的恼人苍蝇!我倒要看看一块\n焦炭会不会说话!\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:"playSound",name:"attack.ogg"},{type:"hide",loc:[6,6],time:150},{type:"show",loc:[6,6],time:150},{type:"sleep",time:500},"\t[小妖精,fairy]切,这点伤痛跟他刚才经历的身心地狱相比\n根本就不算什么。",{type:"playSound",name:"item.ogg"},"\t[blackMagician]哼!翅膀都被烧焦了还要嘴硬?你难不成\n真以为我不会对你动真格?",{type:"playSound",name:"item.ogg"},"\t[hero]……你这混蛋!给我离她远点!!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]!…你现在受了很严重的致命伤,乱动什么?\n乖。别怕,这里有咱顶着!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]对了,咱再问你一遍,你是很珍惜自己性命\n的对吧?",{type:"playSound",name:"item.ogg"},"\t[hero]!…等等…妖精小姐,你不会是……?",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]喂,黑暗大法师,你作为魔塔里最博学多识\n的蠢货,应该对咱妖精族的特殊能力再清楚\n不过吧?",{type:"playSound",name:"item.ogg"},"\t[blackMagician]什么?!难不成你是想!!不可能……\n就为了一个渺小的人类,不可理喻!!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]哼哼哼!你害怕的表情可真美味!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]不过比起这个,咱更期待你吃到“妖精自灭\n冲击”之后的死状哦!~",{type:"playSound",name:"item.ogg"},"\t[blackMagician]不!!不应该是这样的!我完美的计划竟然\n会被一只小小的妖精破坏!",{type:"playSound",name:"item.ogg"},"\t[hero]不要!……千万不要!……为了我这种人……唔!",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]笨蛋,动都动不了了就不要强撑着站起来\n了啊。",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]真是的,都到最后一刻了,你这家伙好歹\n也让咱省点心吧。",{type:"playSound",name:"item.ogg"},"\t[小妖精,fairy]那么,再见了……我的勇者大人。",{type:"move",time:700,steps:[{direction:"up",value:3}]},{type:"playSound",name:"attack.ogg"},{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:100},{type:"show",loc:[6,5]},{type:"sleep",time:200},{type:"playSound",name:"item.ogg"},{type:"sleep",time:200},"\t[hero]…妖精…小姐……",{type:"playSound",name:"item.ogg"},"\t[hero]……妖精小姐!",{type:"playSound",name:"item.ogg"},"\t[hero]是梦吗?……不对,为什么我在流泪?",{type:"playSound",name:"item.ogg"},"\t[hero]这颗漂亮的宝石是……?",{type:"playSound",name:"item.ogg"},"\t[hero]我全都想起来了……妖精小姐为了我……\n牺牲了自己的性命。",{type:"playSound",name:"item.ogg"},"\t[hero]在这颗宝石上,我能感受到你的温度……\n熟悉而又令人安心,这就是你最后留给我\n的东西吗……",{type:"playSound",name:"item.ogg"},"\t[hero]好温暖……",{type:"setValue",name:"item:yellowJewel",value:"1"},{type:"hide",loc:[6,5]},{type:"playSound",name:"item.ogg"},"\t[hero]……",{type:"openDoor",loc:[6,2]},{type:"openDoor",loc:[6,11]}]},"6,5":{enable:false}},changeFloor:{"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":["\t[blackMagician]你打败的不过是我众多分身中的其中一个\n而已。",{type:"show",loc:[5,4],time:500},{type:"update"},],"5,4":["\t[blackMagician]你的身体已经伤痕累累了,可我还留有着\n九成多的魔力。",{type:"show",loc:[5,5],time:500},{type:"update"},],"5,5":["\t[blackMagician]顽固的家伙!放弃抵抗吧!",{type:"show",loc:[7,4],time:500},{type:"update"},],"7,4":["\t[blackMagician]哈哈哈哈!我的灵魂远比你想象的强大!\n我即是永恒!",{type:"show",loc:[6,3],time:500},{type:"trigger",loc:[6,3]}],},afterGetItem:{},afterOpenDoor:{},checkBlock:[]}; \ No newline at end of file diff --git a/libs/floors/sample2.js b/libs/floors/sample2.js index af05b0d5..26cd84e0 100644 --- a/libs/floors/sample2.js +++ b/libs/floors/sample2.js @@ -322,7 +322,6 @@ main.floors.sample2 = { }, "6,5": { // 黄宝石 "enable": false - // 获得后将触发afterGetItem事件 } }, diff --git a/libs/icons.min.js b/libs/icons.min.js new file mode 100644 index 00000000..71a6fc3b --- /dev/null +++ b/libs/icons.min.js @@ -0,0 +1 @@ +function icons(){}icons.prototype.init=function(){this.icons={heros:{hero1:{down:{loc:0,stop:0,leftFoot:1,rightFoot:2},left:{loc:1,stop:0,leftFoot:1,rightFoot:2},right:{loc:2,stop:0,leftFoot:1,rightFoot:2},up:{loc:3,stop:0,leftFoot:1,rightFoot:2}}},terrains:{ground:0,yellowWall:1,whiteWall:2,blueWall:3,star:4,lava:5,ice:6,downFloor:7,upFloor:8,yellowDoor:9,blueDoor:10,redDoor:11,greenDoor:12,specialDoor:13,steelDoor:14,"blueShop-left":15,"blueShop-right":16,"pinkShop-left":17,"pinkShop-right":18},animates:{star:0,lava:1,water:2,yellowDoor:3,blueDoor:4,redDoor:5,greenDoor:6,specialDoor:7,blueWallDoor:8,yellowWallDoor:9,whiteWallDoor:10,steelDoor:11,lavaDoor:12,grayLavaDoor:13,starDoor:14,mockBlueWallDoor:15,mockYellowWallDoor:16,mockWhiteWallDoor:17,iceYellowWallDoor:18,starPortal:19,exclamation:20,portal:21,"switch":22,lavaNet:23,poisonNet:24,weakNet:25,curseNet:26,downPortal:27,leftPortal:28,rightPortal:29,upPortal:30},npcs:{man:0,woman:1,thief:2,fairy:3,magician:4,womanMagician:5,oldMan:6,child:7,wood:8,pinkShop:9,blueShop:10,princess:11},enemys:{greenSlime:0,redSlime:1,blackSlime:2,slimelord:3,bat:4,bigBat:5,redBat:6,vampire:7,skeleton:8,skeletonSoilder:9,skeletonCaptain:10,ghostSkeleton:11,zombie:12,zombieKnight:13,rock:14,slimeMan:15,bluePriest:16,redPriest:17,brownWizard:18,redWizard:19,yellowGuard:20,blueGuard:21,redGuard:22,swordsman:23,soldier:24,yellowKnight:25,redKnight:26,darkKnight:27,blackKing:28,yellowKing:29,greenKing:30,blueKnight:31,goldSlime:32,poisonSkeleton:33,poisonBat:34,steelRock:35,skeletonPriest:36,skeletonKing:37,skeletonWizard:38,redSkeletonCaption:39,badHero:40,demon:41,demonPriest:42,goldHornSlime:43,redKing:44,whiteKing:45,blackMagician:46,silverSlime:47,swordEmperor:48,whiteHornSlime:49,badPrincess:50,badFairy:51,grayPriest:52,redSwordsman:53,whiteGhost:54,poisonZombie:55,magicDragon:56,octopus:57,fairy:58,greenKnight:59,},items:{yellowKey:0,blueKey:1,redKey:2,greenKey:3,steelKey:4,bigKey:6,redJewel:16,blueJewel:17,greenJewel:18,yellowJewel:19,redPotion:20,bluePotion:21,greenPotion:22,yellowPotion:23,sword1:50,sword2:51,sword3:52,sword4:53,sword5:54,shield1:55,shield2:56,shield3:57,shield4:58,shield5:59,book:9,fly:12,pickaxe:45,icePickaxe:44,bomb:43,centerFly:13,upFly:15,downFly:14,coin:11,snow:41,cross:40,superPotion:29,earthquake:8,poisonWine:24,weakWine:25,curseWine:27,superWine:28,knife:42,moneyPocket:46,shoes:47,hammer:48}}};icons.prototype.getIcons=function(a){if(a==undefined){return this.icons}return this.icons[a]};main.instance.icons=new icons(); \ No newline at end of file diff --git a/libs/items.min.js b/libs/items.min.js new file mode 100644 index 00000000..d55b3e21 --- /dev/null +++ b/libs/items.min.js @@ -0,0 +1 @@ +function items(){}items.prototype.init=function(){this.items={yellowKey:{cls:"keys",name:"黄钥匙"},blueKey:{cls:"keys",name:"蓝钥匙"},redKey:{cls:"keys",name:"红钥匙"},redJewel:{cls:"items",name:"红宝石"},blueJewel:{cls:"items",name:"蓝宝石"},greenJewel:{cls:"items",name:"绿宝石"},yellowJewel:{cls:"items",name:"黄宝石"},redPotion:{cls:"items",name:"红血瓶"},bluePotion:{cls:"items",name:"蓝血瓶"},yellowPotion:{cls:"items",name:"黄血瓶"},greenPotion:{cls:"items",name:"绿血瓶"},sword1:{cls:"items",name:"铁剑"},sword2:{cls:"items",name:"银剑"},sword3:{cls:"items",name:"骑士剑"},sword4:{cls:"items",name:"圣剑"},sword5:{cls:"items",name:"神圣剑"},shield1:{cls:"items",name:"铁盾"},shield2:{cls:"items",name:"银盾"},shield3:{cls:"items",name:"骑士盾"},shield4:{cls:"items",name:"圣盾"},shield5:{cls:"items",name:"神圣盾"},superPotion:{cls:"items",name:"圣水"},moneyPocket:{cls:"items",name:"金钱袋"},book:{cls:"constants",name:"怪物手册",text:"可以查看当前楼层各怪物属性"},fly:{cls:"constants",name:"楼层传送器",text:"可以自由往来去过的楼层"},coin:{cls:"constants",name:"幸运金币",text:"持有时打败怪物可得双倍金币"},snow:{cls:"constants",name:"冰冻徽章",text:"可以将四周的熔岩变成平地"},cross:{cls:"constants",name:"十字架",text:"该道具尚未被定义"},knife:{cls:"constants",name:"屠龙匕首",text:"该道具尚未被定义"},shoes:{cls:"constants",name:"绿鞋",text:"持有时无视负面地形"},bigKey:{cls:"tools",name:"大黄门钥匙",text:"可以开启当前层所有黄门"},greenKey:{cls:"tools",name:"绿钥匙",text:"可以打开一扇绿门"},steelKey:{cls:"tools",name:"铁门钥匙",text:"可以打开一扇铁门"},pickaxe:{cls:"tools",name:"破墙镐",text:"可以破坏勇士面前的墙"},icePickaxe:{cls:"tools",name:"破冰镐",text:"可以破坏勇士面前的一堵冰墙"},bomb:{cls:"tools",name:"炸弹",text:"可以炸掉勇士四周的怪物"},centerFly:{cls:"tools",name:"中心对称飞行器",text:"可以飞向当前楼层中心对称的位置"},upFly:{cls:"tools",name:"上楼器",text:"可以飞往楼上的相同位置"},downFly:{cls:"tools",name:"下楼器",text:"可以飞往楼下的相同位置"},earthquake:{cls:"tools",name:"地震卷轴",text:"可以破坏当前层的所有墙"},poisonWine:{cls:"tools",name:"解毒药水",text:"可以解除中毒状态"},weakWine:{cls:"tools",name:"解衰药水",text:"可以解除衰弱状态"},curseWine:{cls:"tools",name:"解咒药水",text:"可以解除诅咒状态"},superWine:{cls:"tools",name:"万能药水",text:"可以解除所有不良状态"},hammer:{cls:"tools",name:"圣锤",text:"可以炸掉勇士面前的怪物"}}};items.prototype.getItems=function(){if(core.flags.bigKeyIsBox){this.items.bigKey={cls:"items",name:"钥匙盒"}}if(core.flags.pickaxeFourDirections){this.items.pickaxe.text="可以破坏勇士四周的墙"}return this.items};main.instance.items=new items();items.prototype.getItemEffect=function(b,c){var a=core.material.items[b].cls;if(a==="items"){if(b==="redJewel"){core.status.hero.atk+=core.values.redJewel}if(b==="blueJewel"){core.status.hero.def+=core.values.blueJewel}if(b==="greenJewel"){core.status.hero.mdef+=core.values.greenJewel}if(b=="yellowJewel"){core.status.hero.hp+=1000;core.status.hero.atk+=6;core.status.hero.def+=6;core.status.hero.mdef+=10}if(b==="redPotion"){core.status.hero.hp+=core.values.redPotion}if(b==="bluePotion"){core.status.hero.hp+=core.values.bluePotion}if(b==="yellowPotion"){core.status.hero.hp+=core.values.yellowPotion}if(b==="greenPotion"){core.status.hero.hp+=core.values.greenPotion}if(b==="sword1"){core.status.hero.atk+=core.values.sword1}if(b==="sword2"){core.status.hero.atk+=core.values.sword2}if(b=="sword3"){core.status.hero.atk+=core.values.sword3}if(b=="sword4"){core.status.hero.atk+=core.values.sword4}if(b==="sword5"){core.status.hero.atk+=core.values.sword5}if(b==="shield1"){core.status.hero.def+=core.values.shield1}if(b==="shield2"){core.status.hero.def+=core.values.shield2}if(b==="shield3"){core.status.hero.def+=core.values.shield3}if(b==="shield4"){core.status.hero.def+=core.values.shield4}if(b==="shield5"){core.status.hero.def+=core.values.shield5}if(b==="bigKey"){core.status.hero.items.keys.yellowKey++;core.status.hero.items.keys.blueKey++;core.status.hero.items.keys.redKey++}if(b=="superPotion"){core.status.hero.hp*=2}if(b=="moneyPocket"){core.status.hero.money+=core.values.moneyPocket}}else{core.addItem(b,c)}};items.prototype.getItemEffectTip=function(a){if(a==="redJewel"){return",攻击+"+core.values.redJewel}if(a==="blueJewel"){return",防御+"+core.values.blueJewel}if(a==="greenJewel"){return",魔防+"+core.values.greenJewel}if(a=="yellowJewel"){return",全属性提升"}if(a==="redPotion"){return",生命+"+core.values.redPotion}if(a==="bluePotion"){return",生命+"+core.values.bluePotion}if(a==="yellowPotion"){return",生命+"+core.values.yellowPotion}if(a==="greenPotion"){return",生命+"+core.values.greenPotion}if(a==="sword1"){return",攻击+"+core.values.sword1}if(a==="sword2"){return",攻击+"+core.values.sword2}if(a==="sword3"){return",攻击+"+core.values.sword3}if(a==="sword4"){return",攻击+"+core.values.sword4}if(a==="sword5"){return",攻击+"+core.values.sword5}if(a==="shield1"){return",防御+"+core.values.shield1}if(a==="shield2"){return",防御+"+core.values.shield2}if(a==="shield3"){return",防御+"+core.values.shield3}if(a==="shield4"){return",防御+"+core.values.shield4}if(a==="shield5"){return",防御+"+core.values.shield5}if(a==="bigKey"){return",全钥匙+1"}if(a==="superPotion"){return",生命值翻倍"}if(a=="moneyPocket"){return",金币+"+core.values.moneyPocket}return""};items.prototype.useItem=function(b){if(!this.canUseItem(b)){return}var a=core.material.items[b].cls;if(b=="book"){core.ui.drawEnemyBook(1)}if(b=="fly"){core.ui.drawFly(core.status.hero.flyRange.indexOf(core.status.floorId))}if(b=="earthquake"||b=="bomb"||b=="pickaxe"||b=="icePickaxe"||b=="snow"||b=="hammer"||b=="bigKey"){core.removeBlockByIds(core.status.floorId,core.status.event.data);core.drawMap(core.status.floorId,function(){core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");core.updateFg();core.drawTip(core.material.items[b].name+"使用成功");if(b=="bomb"&&core.flags.bombTrigger){core.events.afterBattle()}else{if(b=="hammer"&&core.flags.bombTrigger){core.events.afterBattle(core.status.event.data[0])}}})}if(b=="centerFly"){core.clearMap("hero",0,0,416,416);core.setHeroLoc("x",core.status.event.data.x);core.setHeroLoc("y",core.status.event.data.y);core.drawHero(core.getHeroLoc("direction"),core.getHeroLoc("x"),core.getHeroLoc("y"),"stop");core.drawTip(core.material.items[b].name+"使用成功")}if(b=="upFly"||b=="downFly"){core.changeFloor(core.status.event.data.id,null,{direction:core.status.hero.loc.direction,x:core.status.event.data.x,y:core.status.event.data.y},null,function(){core.drawTip(core.material.items[b].name+"使用成功")})}if(b=="poisonWine"){core.setFlag("poison",false)}if(b=="weakWine"){core.setFlag("weak",false);core.status.hero.atk+=core.values.weakValue;core.status.hero.def+=core.values.weakValue}if(b=="curseWine"){core.setFlag("curse",false)}if(b=="superWine"){core.setFlag("poison",false);core.setFlag("weak",false);core.status.hero.atk+=core.values.weakValue;core.status.hero.def+=core.values.weakValue;core.setFlag("curse",false)}core.updateStatusBar();if(a=="tools"){core.status.hero.items[a][b]--}if(core.status.hero.items[a][b]==0){delete core.status.hero.items[a][b]}};items.prototype.canUseItem=function(h){if(!core.hasItem(h)){return false}var g=core.material.items[h].cls;if(h=="book"){return true}if(h=="fly"){return core.status.hero.flyRange.indexOf(core.status.floorId)>=0}if(h=="pickaxe"){var e=[];for(var d in core.status.thisMap.blocks){var a=core.status.thisMap.blocks[d];if(core.isset(a.event)&&!(core.isset(a.enable)&&!a.enable)&&(a.event.id=="yellowWall"||a.event.id=="whiteWall"||a.event.id=="blueWall")){if(core.flags.pickaxeFourDirections){if(Math.abs(a.x-core.status.hero.loc.x)+Math.abs(a.y-core.status.hero.loc.y)<=1){e.push(d)}}else{if(a.x==core.nextX()&&a.y==core.nextY()){e.push(d)}}}}if(e.length>0){core.status.event.data=e;return true}return false}if(h=="icePickaxe"){for(var d in core.status.thisMap.blocks){var a=core.status.thisMap.blocks[d];if(core.isset(a.event)&&!(core.isset(a.enable)&&!a.enable)&&a.x==core.nextX()&&a.y==core.nextY()&&a.event.id=="ice"){core.status.event.data=[d];return true}}return false}if(h=="bomb"){var e=[];for(var d in core.status.thisMap.blocks){var a=core.status.thisMap.blocks[d];if(core.isset(a.event)&&!(core.isset(a.enable)&&!a.enable)&&a.event.cls=="enemys"&&Math.abs(a.x-core.status.hero.loc.x)+Math.abs(a.y-core.status.hero.loc.y)<=1){var b=core.material.enemys[a.event.id];if(core.isset(b.bomb)&&!b.bomb){continue}e.push(d)}}if(e.length>0){core.status.event.data=e;return true}return false}if(h=="hammer"){for(var d in core.status.thisMap.blocks){var a=core.status.thisMap.blocks[d];if(core.isset(a.event)&&!(core.isset(a.enable)&&!a.enable)&&a.event.cls=="enemys"&&a.x==core.nextX()&&a.y==core.nextY()){var b=core.material.enemys[a.event.id];if(core.isset(b.bomb)&&!b.bomb){continue}core.status.event.data=[d];return true}}return false}if(h=="earthquake"){var e=[];for(var d in core.status.thisMap.blocks){var a=core.status.thisMap.blocks[d];if(core.isset(a.event)&&!(core.isset(a.enable)&&!a.enable)&&(a.event.id=="yellowWall"||a.event.id=="blueWall"||a.event.id=="whiteWall")){e.push(d)}}if(e.length>0){core.status.event.data=e;return true}return false}if(h=="centerFly"){var k=12-core.getHeroLoc("x"),l=12-core.getHeroLoc("y");var a=core.getBlock(k,l);if(a==null){core.status.event.data={x:k,y:l};return true}return false}if(h=="upFly"){var c=core.status.floorId;var f=core.floorIds.indexOf(c);if(f==core.floorIds.length-1){return false}var j=core.floorIds[f+1];var k=core.getHeroLoc("x"),l=core.getHeroLoc("y");var a=core.getBlock(k,l,j);if(a==null){core.status.event.data={id:j,x:k,y:l};return true}return false}if(h=="downFly"){var c=core.status.floorId;var f=core.floorIds.indexOf(c);if(f==0){return false}var j=core.floorIds[f-1];var k=core.getHeroLoc("x"),l=core.getHeroLoc("y");var a=core.getBlock(k,l,j);if(a==null){core.status.event.data={id:j,x:k,y:l};return true}return false}if(h=="snow"){var e=[];for(var d in core.status.thisMap.blocks){var a=core.status.thisMap.blocks[d];if(core.isset(a.event)&&!(core.isset(a.enable)&&!a.enable)&&a.event.id=="lava"&&Math.abs(a.x-core.status.hero.loc.x)+Math.abs(a.y-core.status.hero.loc.y)<=1){e.push(d)}}if(e.length>0){core.status.event.data=e;return true}return false}if(h=="bigKey"){var e=[];for(var d in core.status.thisMap.blocks){var a=core.status.thisMap.blocks[d];if(core.isset(a.event)&&!(core.isset(a.enable)&&!a.enable)&&a.event.id=="yellowDoor"){e.push(d)}}if(e.length>0){core.status.event.data=e;return true}return false}if(h=="poisonWine"){return core.hasFlag("poison")}if(h=="weakWine"){return core.hasFlag("weak")}if(h=="curseWine"){return core.hasFlag("curse")}if(h=="superWine"){return core.hasFlag("poison")||core.hasFlag("weak")||core.hasFlag("curse")}return false}; \ No newline at end of file diff --git a/libs/maps.min.js b/libs/maps.min.js new file mode 100644 index 00000000..d2a83f88 --- /dev/null +++ b/libs/maps.min.js @@ -0,0 +1 @@ +function maps(){}maps.prototype.init=function(){};maps.prototype.loadFloor=function(e,h){var d=core.floors[e];var c={};c.floorId=d.floorId;c.name=d.name;c.title=d.title;c.canFlyTo=d.canFlyTo;if(!core.isset(h)){h=d.map}var b=[];for(var f=0;f<13;f++){for(var g=0;g<13;g++){var a=this.getBlock(g,f,h[f][g]);if(a.event!=undefined){if(a.event.cls=="enemys"&&a.event.trigger==undefined){a.event.trigger="battle"}if(a.event.cls=="items"&&a.event.trigger==undefined){a.event.trigger="getItem"}if(a.event.noPass==undefined){if(a.event.cls=="enemys"||a.event.cls=="terrains"||a.event.cls=="npcs"){a.event.noPass=true}}if(a.event.animate==undefined){if(a.event.cls=="enemys"||a.event.cls=="npcs"){a.event.animate=2}if(a.event.cls=="animates"){a.event.animate=4}}}this.addEvent(a,g,f,d.events[g+","+f]);this.addChangeFloor(a,g,f,d.changeFloor[g+","+f]);if(d.checkBlock.indexOf(g+","+f)>=0){this.addEvent(a,g,f,{trigger:"checkBlock"})}if(core.isset(a.event)){b.push(a)}}}c.blocks=b;return c};maps.prototype.getBlock=function(d,e,b){var a=null;b=""+b;if(b.length>2){if(b.indexOf(":f")==b.length-2){b=b.substring(0,b.length-2);a=false}else{if(b.indexOf(":t")==b.length-2){b=b.substring(0,b.length-2);a=true}}}b=parseInt(b);var c={x:d,y:e,id:b};if(a!=null){c.enable=a}if(b==1){c.event={cls:"terrains",id:"yellowWall"}}if(b==2){c.event={cls:"terrains",id:"whiteWall"}}if(b==3){c.event={cls:"terrains",id:"blueWall"}}if(b==4){c.event={cls:"animates",id:"star",noPass:true}}if(b==5){c.event={cls:"animates",id:"lava",noPass:true}}if(b==6){c.event={cls:"terrains",id:"ice"}}if(b==7){c.event={cls:"terrains",id:"blueShop-left"}}if(b==8){c.event={cls:"terrains",id:"blueShop-right"}}if(b==9){c.event={cls:"terrains",id:"pinkShop-left"}}if(b==10){c.event={cls:"terrains",id:"pinkShop-right"}}if(b==11){c.event={cls:"animates",id:"lavaNet",noPass:false,trigger:"passNet"}}if(b==12){c.event={cls:"animates",id:"poisonNet",noPass:false,trigger:"passNet"}}if(b==13){c.event={cls:"animates",id:"weakNet",noPass:false,trigger:"passNet"}}if(b==14){c.event={cls:"animates",id:"curseNet",noPass:false,trigger:"passNet"}}if(b==21){c.event={cls:"items",id:"yellowKey"}}if(b==22){c.event={cls:"items",id:"blueKey"}}if(b==23){c.event={cls:"items",id:"redKey"}}if(b==24){c.event={cls:"items",id:"greenKey"}}if(b==25){c.event={cls:"items",id:"steelKey"}}if(b==26){c.event={cls:"items",id:"bigKey"}}if(b==27){c.event={cls:"items",id:"redJewel"}}if(b==28){c.event={cls:"items",id:"blueJewel"}}if(b==29){c.event={cls:"items",id:"greenJewel"}}if(b==30){c.event={cls:"items",id:"yellowJewel"}}if(b==31){c.event={cls:"items",id:"redPotion"}}if(b==32){c.event={cls:"items",id:"bluePotion"}}if(b==33){c.event={cls:"items",id:"greenPotion"}}if(b==34){c.event={cls:"items",id:"yellowPotion"}}if(b==35){c.event={cls:"items",id:"sword1"}}if(b==36){c.event={cls:"items",id:"shield1"}}if(b==37){c.event={cls:"items",id:"sword2"}}if(b==38){c.event={cls:"items",id:"shield2"}}if(b==39){c.event={cls:"items",id:"sword3"}}if(b==40){c.event={cls:"items",id:"shield3"}}if(b==41){c.event={cls:"items",id:"sword4"}}if(b==42){c.event={cls:"items",id:"shield4"}}if(b==43){c.event={cls:"items",id:"sword5"}}if(b==44){c.event={cls:"items",id:"shield5"}}if(b==45){c.event={cls:"items",id:"book"}}if(b==46){c.event={cls:"items",id:"fly"}}if(b==47){c.event={cls:"items",id:"pickaxe"}}if(b==48){c.event={cls:"items",id:"icePickaxe"}}if(b==49){c.event={cls:"items",id:"bomb"}}if(b==50){c.event={cls:"items",id:"centerFly"}}if(b==51){c.event={cls:"items",id:"upFly"}}if(b==52){c.event={cls:"items",id:"downFly"}}if(b==53){c.event={cls:"items",id:"coin"}}if(b==54){c.event={cls:"items",id:"snow"}}if(b==55){c.event={cls:"items",id:"cross"}}if(b==56){c.event={cls:"items",id:"superPotion"}}if(b==57){c.event={cls:"items",id:"earthquake"}}if(b==58){c.event={cls:"items",id:"poisonWine"}}if(b==59){c.event={cls:"items",id:"weakWine"}}if(b==60){c.event={cls:"items",id:"curseWine"}}if(b==61){c.event={cls:"items",id:"superWine"}}if(b==62){c.event={cls:"items",id:"knife"}}if(b==63){c.event={cls:"items",id:"moneyPocket"}}if(b==64){c.event={cls:"items",id:"shoes"}}if(b==65){c.event={cls:"items",id:"hammer"}}if(b==81){c.event={cls:"terrains",id:"yellowDoor",trigger:"openDoor"}}if(b==82){c.event={cls:"terrains",id:"blueDoor",trigger:"openDoor"}}if(b==83){c.event={cls:"terrains",id:"redDoor",trigger:"openDoor"}}if(b==84){c.event={cls:"terrains",id:"greenDoor",trigger:"openDoor"}}if(b==85){c.event={cls:"terrains",id:"specialDoor",trigger:"openDoor"}}if(b==86){c.event={cls:"terrains",id:"steelDoor",trigger:"openDoor"}}if(b==87){c.event={cls:"terrains",id:"upFloor",noPass:false}}if(b==88){c.event={cls:"terrains",id:"downFloor",noPass:false}}if(b==89){c.event={cls:"animates",id:"portal",noPass:false}}if(b==90){c.event={cls:"animates",id:"starPortal",noPass:false}}if(b==91){c.event={cls:"animates",id:"upPortal",noPass:false}}if(b==92){c.event={cls:"animates",id:"leftPortal",noPass:false}}if(b==93){c.event={cls:"animates",id:"downPortal",noPass:false}}if(b==94){c.event={cls:"animates",id:"rightPortal",noPass:false}}if(b==121){c.event={cls:"npcs",id:"man"}}if(b==122){c.event={cls:"npcs",id:"woman"}}if(b==123){c.event={cls:"npcs",id:"thief"}}if(b==124){c.event={cls:"npcs",id:"fairy"}}if(b==125){c.event={cls:"npcs",id:"magician"}}if(b==126){c.event={cls:"npcs",id:"womanMagician"}}if(b==127){c.event={cls:"npcs",id:"oldMan"}}if(b==128){c.event={cls:"npcs",id:"child"}}if(b==129){c.event={cls:"npcs",id:"wood"}}if(b==130){c.event={cls:"npcs",id:"pinkShop"}}if(b==131){c.event={cls:"npcs",id:"blueShop"}}if(b==132){c.event={cls:"npcs",id:"princess"}}if(b==201){c.event={cls:"enemys",id:"greenSlime"}}if(b==202){c.event={cls:"enemys",id:"redSlime"}}if(b==203){c.event={cls:"enemys",id:"blackSlime"}}if(b==204){c.event={cls:"enemys",id:"slimelord"}}if(b==205){c.event={cls:"enemys",id:"bat"}}if(b==206){c.event={cls:"enemys",id:"bigBat"}}if(b==207){c.event={cls:"enemys",id:"redBat"}}if(b==208){c.event={cls:"enemys",id:"vampire"}}if(b==209){c.event={cls:"enemys",id:"skeleton"}}if(b==210){c.event={cls:"enemys",id:"skeletonSoilder"}}if(b==211){c.event={cls:"enemys",id:"skeletonCaptain"}}if(b==212){c.event={cls:"enemys",id:"ghostSkeleton"}}if(b==213){c.event={cls:"enemys",id:"zombie"}}if(b==214){c.event={cls:"enemys",id:"zombieKnight"}}if(b==215){c.event={cls:"enemys",id:"rock"}}if(b==216){c.event={cls:"enemys",id:"slimeMan"}}if(b==217){c.event={cls:"enemys",id:"bluePriest"}}if(b==218){c.event={cls:"enemys",id:"redPriest"}}if(b==219){c.event={cls:"enemys",id:"brownWizard"}}if(b==220){c.event={cls:"enemys",id:"redWizard"}}if(b==221){c.event={cls:"enemys",id:"yellowGuard"}}if(b==222){c.event={cls:"enemys",id:"blueGuard"}}if(b==223){c.event={cls:"enemys",id:"redGuard"}}if(b==224){c.event={cls:"enemys",id:"swordsman"}}if(b==225){c.event={cls:"enemys",id:"soldier"}}if(b==226){c.event={cls:"enemys",id:"yellowKnight"}}if(b==227){c.event={cls:"enemys",id:"redKnight"}}if(b==228){c.event={cls:"enemys",id:"darkKnight"}}if(b==229){c.event={cls:"enemys",id:"blackKing"}}if(b==230){c.event={cls:"enemys",id:"yellowKing"}}if(b==231){c.event={cls:"enemys",id:"greenKing"}}if(b==232){c.event={cls:"enemys",id:"blueKnight"}}if(b==233){c.event={cls:"enemys",id:"goldSlime"}}if(b==234){c.event={cls:"enemys",id:"poisonSkeleton"}}if(b==235){c.event={cls:"enemys",id:"poisonBat"}}if(b==236){c.event={cls:"enemys",id:"steelRock"}}if(b==237){c.event={cls:"enemys",id:"skeletonPriest"}}if(b==238){c.event={cls:"enemys",id:"skeletonKing"}}if(b==239){c.event={cls:"enemys",id:"skeletonWizard"}}if(b==240){c.event={cls:"enemys",id:"redSkeletonCaption"}}if(b==241){c.event={cls:"enemys",id:"badHero"}}if(b==242){c.event={cls:"enemys",id:"demon"}}if(b==243){c.event={cls:"enemys",id:"demonPriest"}}if(b==244){c.event={cls:"enemys",id:"goldHornSlime"}}if(b==245){c.event={cls:"enemys",id:"redKing"}}if(b==246){c.event={cls:"enemys",id:"whiteKing"}}if(b==247){c.event={cls:"enemys",id:"blackMagician"}}if(b==248){c.event={cls:"enemys",id:"silverSlime"}}if(b==249){c.event={cls:"enemys",id:"swordEmperor"}}if(b==250){c.event={cls:"enemys",id:"whiteHornSlime"}}if(b==251){c.event={cls:"enemys",id:"badPrincess"}}if(b==252){c.event={cls:"enemys",id:"badFairy"}}if(b==253){c.event={cls:"enemys",id:"grayPriest"}}if(b==254){c.event={cls:"enemys",id:"redSwordsman"}}if(b==255){c.event={cls:"enemys",id:"whiteGhost"}}if(b==256){c.event={cls:"enemys",id:"poisonZombie"}}if(b==257){c.event={cls:"enemys",id:"magicDragon"}}if(b==258){c.event={cls:"enemys",id:"octopus"}}if(b==259){c.event={cls:"enemys",id:"fairy"}}if(b==260){c.event={cls:"enemys",id:"greenKnight"}}return c};maps.prototype.addEvent=function(a,d,e,b){if(!core.isset(b)){return}if(!core.isset(a.event)){a.event={cls:"terrains",id:"ground",noPass:false}}if(typeof b=="string"){b={data:[b]}}else{if(b instanceof Array){b={data:b}}}if(!core.isset(b.data)){b.data=[]}if(!core.isset(a.enable)&&core.isset(b.enable)){a.enable=b.enable}if(!core.isset(a.event.trigger)){if(core.isset(b.trigger)){a.event.trigger=b.trigger}else{a.event.trigger="action"}}else{if(core.isset(b.trigger)&&b.trigger!="checkBlock"){a.event.trigger=b.trigger}}for(var c in b){if(c!="enable"&&c!="trigger"){a.event[c]=core.clone(b[c])}}};maps.prototype.addChangeFloor=function(a,c,d,b){if(!core.isset(b)){return}this.addEvent(a,c,d,{trigger:"changeFloor",data:b})};maps.prototype.initMaps=function(b){var d={};for(var c=0;c=0){var t=c.substring(2,o);c=c.substring(o+1);var s=t.split(",");if(s.length==1){m=s[0];if(m!="hero"){var g=core.material.enemys[m];if(core.isset(g)){q=core.material.enemys[m].name;n=core.material.images.enemys;l=core.material.icons.enemys[m]}else{q=m;m="npc";n=null;l=null}}}else{m="npc";q=s[0];n=core.material.images.npcs;l=core.material.icons.npcs[s[1]]}}}c=core.replaceText(c);var a=core.canvas.ui.createPattern(core.material.ground,"repeat");var f=c.split("\n");core.clearMap("ui",0,0,416,416);var h=416-10-Math.min(416-24*(f.length+1)-65,250);var p=10,u=(416-h)/2,r=416-2*p,b=h;core.setAlpha("ui",0.85);core.fillRect("ui",p,u,r,b,"#000000");core.setAlpha("ui",1);core.strokeRect("ui",p-1,u-1,r+1,b+1,"#FFFFFF",2);core.status.boxAnimateObjs=[];core.setBoxAnimate();core.canvas.ui.textAlign="left";var d=p+25,e=u+35;if(core.isset(m)){e=u+57;if(m=="hero"||core.isset(l)){core.strokeRect("ui",p+15-1,u+40-1,34,34,"#FFD700",2);d=p+63}if(m=="hero"){core.fillText("ui",core.status.hero.name,d,u+30,"#FFD700","bold 22px Verdana");core.clearMap("ui",p+15,u+40,32,32);core.fillRect("ui",p+15,u+40,32,32,a);var j=core.material.icons.heros[core.status.hero.id]["down"];core.canvas.ui.drawImage(core.material.images.heros,j.stop*32,j.loc*32,32,32,p+15,u+40,32,32)}else{core.fillText("ui",q,d,u+30,"#FFD700","bold 22px Verdana");if(core.isset(l)){core.status.boxAnimateObjs=[];core.status.boxAnimateObjs.push({bgx:p+15,bgy:u+40,bgsize:32,image:n,x:p+15,y:u+40,icon:l});core.setBoxAnimate()}}}for(var k=0;k",270,u+h-13,"#CCCCCC","13px Verdana")};ui.prototype.drawChoices=function(f,e){var a=core.canvas.ui.createPattern(core.material.ground,"repeat");core.clearMap("ui",0,0,416,416);core.setAlpha("ui",1);core.setFillStyle("ui",a);var t=e.length;var s=85,z=416-2*s;var l=32*(t+2),b=208+l/2;if(t%2==0){b+=16}var d=b-l+56;var p=null,u=null,q=null,o=null;if(core.isset(f)){if(f.indexOf("\t[")==0){var r=f.indexOf("]");if(r>=0){var w=f.substring(2,r);f=f.substring(r+1);var v=w.split(",");if(v.length==1){p=v[0];if(p!="hero"){var k=core.material.enemys[p];if(core.isset(k)){u=core.material.enemys[p].name;q=core.material.images.enemys;o=core.material.icons.enemys[p]}else{u=p;p="npc";q=null;o=null}}}else{p="npc";u=v[0];q=core.material.images.npcs;o=core.material.icons.npcs[v[1]]}}}f=core.replaceText(f);var c=0;if(u!=null){c+=25}c+=f.split("\n").length*20;l+=c}var y=b-l;core.fillRect("ui",s,y,z,l,a);core.strokeRect("ui",s-1,y-1,z+1,l+1,"#FFFFFF",2);if(core.isset(f)){var g=s+15,h=y+35;if(core.isset(p)){core.canvas.ui.textAlign="center";h=y+55;var x=s+z/2;if(p=="hero"||core.isset(o)){core.strokeRect("ui",s+15-1,y+30-1,34,34,"#DDDDDD",2);g=s+60;x+=22}if(p=="hero"){core.fillText("ui",core.status.hero.name,x,y+27,"#FFD700","bold 19px Verdana");core.clearMap("ui",s+15,y+30,32,32);core.fillRect("ui",s+15,y+30,32,32,a);var m=core.material.icons.heros[core.status.hero.id]["down"];core.canvas.ui.drawImage(core.material.images.heros,m.stop*32,m.loc*32,32,32,s+15,y+30,32,32)}else{core.fillText("ui",u,x,y+27,"#FFD700","bold 19px Verdana");if(core.isset(o)){core.status.boxAnimateObjs=[];core.status.boxAnimateObjs.push({bgx:s+15,bgy:y+30,bgsize:32,image:q,x:s+15,y:y+30,icon:o});core.setBoxAnimate()}}}core.canvas.ui.textAlign="left";var j=f.split("\n");for(var n=0;n1){core.fillText("ui","上一页",208-80,403)}if(bn){k=n}core.status.event.data=k;var m=(k-1)*l,e=Math.min(k*l,g.length);g=g.slice(m,e);core.status.boxAnimateObjs=[];for(var h=0;h=core.status.hero.hp){b="#FF0000"}if(c==0){b="#00FF00"}if(c>=999999999){c="无法战斗"}var j=core.canvas.ui.measureText(c).width;core.fillText("ui",c,d,62*h+50,b,"bold 13px Verdana");core.canvas.ui.textAlign="left";if(f.special!=""){core.setFont("data","bold 12px Verdana");var j=core.canvas.data.measureText(f.special).width;core.setAlpha("data","0.4");core.fillRect("data",64-4-j,62*h+46,j+4,17,"#000000");core.setAlpha("data","1");core.fillText("data",f.special,64-2-j,62*h+59,"#FF6A6A","bold 12px Verdana")}core.fillText("ui","临界",165,62*h+68,"#DDDDDD","13px Verdana");core.fillText("ui",f.critical,195,62*h+68,"#DDDDDD","bold 13px Verdana");core.fillText("ui","减伤",255,62*h+68,"#DDDDDD","13px Verdana");core.fillText("ui",f.criticalDamage,285,62*h+68,"#DDDDDD","bold 13px Verdana");core.fillText("ui","1防",335,62*h+68,"#DDDDDD","13px Verdana");core.fillText("ui",f.defDamage,365,62*h+68,"#DDDDDD","bold 13px Verdana")}core.setBoxAnimate();this.drawPagination(k,n)};ui.prototype.drawFly=function(b){if(b<0){b=0}if(b>=core.status.hero.flyRange.length){b=core.status.hero.flyRange.length-1}core.status.event.data=b;var a=core.status.hero.flyRange[b];var c=core.status.maps[a].title;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.canvas.ui.textAlign="center";core.fillText("ui","楼层跳跃",208,60,"#FFFFFF","bold 28px Verdana");core.fillText("ui","返回游戏",208,403,"#FFFFFF","bold 15px Verdana");core.fillText("ui",c,356,247,"#FFFFFF","bold 19px Verdana");if(b0){core.fillText("ui","▼",356,247+64,"#FFFFFF","17px Verdana")}core.strokeRect("ui",20,100,273,273,"#FFFFFF",2);this.drawThumbnail("ui",core.status.maps[a].blocks,20,100,273)};ui.prototype.drawToolbox=function(g){if(!core.hasItem(g)){g=null}core.status.event.data=g;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.setFillStyle("ui","#DDDDDD");core.setStrokeStyle("ui","#DDDDDD");core.canvas.ui.lineWidth=2;core.canvas.ui.strokeWidth=2;core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,130);core.canvas.ui.lineTo(416,130);core.canvas.ui.stroke();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,129);core.canvas.ui.lineTo(0,105);core.canvas.ui.lineTo(72,105);core.canvas.ui.lineTo(102,129);core.canvas.ui.fill();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,290);core.canvas.ui.lineTo(416,290);core.canvas.ui.stroke();core.canvas.ui.beginPath();core.canvas.ui.moveTo(0,289);core.canvas.ui.lineTo(0,265);core.canvas.ui.lineTo(72,265);core.canvas.ui.lineTo(102,289);core.canvas.ui.fill();core.canvas.ui.textAlign="left";core.fillText("ui","消耗道具",5,124,"#333333","bold 16px Verdana");core.fillText("ui","永久道具",5,284);if(core.isset(g)){var f=core.material.items[g];core.fillText("ui",f.name,10,32,"#FFD700","bold 20px Verdana");core.fillText("ui",f.text,10,62,"#FFFFFF","17px Verdana");core.fillText("ui","<继续点击该道具即可进行使用>",10,89,"#CCCCCC","14px Verdana")}core.canvas.ui.textAlign="right";var e=core.material.images.items;var j=Object.keys(core.status.hero.items.tools).sort();for(var c=0;c=30){e=29}core.status.event.data=e;core.status.savePage=e;core.clearMap("ui",0,0,416,416);core.setAlpha("ui",0.85);core.fillRect("ui",0,0,416,416,"#000000");core.setAlpha("ui",1);core.canvas.ui.textAlign="center";var g=416/6,f=117;var d=core.status.event.id=="save"?"存档":"读档";for(var b=0;b<6;b++){var c=6*e+b+1;var a=core.getLocalStorage("save"+c,null);if(b<3){core.fillText("ui",d+c,(2*b+1)*g,35,"#FFFFFF","bold 17px Verdana");core.strokeRect("ui",(2*b+1)*g-f/2,50,f,f,"#FFFFFF",2);if(core.isset(a)&&core.isset(a.floorId)){this.drawThumbnail("ui",core.maps.load(a.maps,a.floorId).blocks,(2*b+1)*g-f/2,50,f,a.hero.loc,a.hero.id);core.fillText("ui",core.formatDate(new Date(a.time)),(2*b+1)*g,65+f,"#FFFFFF","10px Verdana")}else{core.fillRect("ui",(2*b+1)*g-f/2,50,f,f,"#333333",2);core.fillText("ui","空",(2*b+1)*g,117,"#FFFFFF","bold 30px Verdana")}}else{core.fillText("ui",d+c,(2*b-5)*g,230,"#FFFFFF","bold 17px Verdana");core.strokeRect("ui",(2*b-5)*g-f/2,245,f,f,"#FFFFFF",2);if(core.isset(a)&&core.isset(a.floorId)){this.drawThumbnail("ui",core.maps.load(a.maps,a.floorId).blocks,(2*b-5)*g-f/2,245,f,a.hero.loc,a.hero.id);core.fillText("ui",core.formatDate(new Date(a.time)),(2*b-5)*g,260+f,"#FFFFFF","10px Verdana")}else{core.fillRect("ui",(2*b-5)*g-f/2,245,f,f,"#333333",2);core.fillText("ui","空",(2*b-5)*g,245+70,"#FFFFFF","bold 30px Verdana")}}}this.drawPagination(e+1,30)};ui.prototype.drawThumbnail=function(g,f,r,s,q,l,k){core.clearMap(g,r,s,q,q);var p=q/13;for(var m=0;m<13;m++){for(var o=0;o<13;o++){var d=core.material.icons.terrains.ground;var e=core.material.images.terrains;core.canvas[g].drawImage(e,0,d*32,32,32,r+m*p,s+o*p,p,p)}}for(var a in f){var c=f[a];if(core.isset(c.event)&&!(core.isset(c.enable)&&!c.enable)){var m=c.x,o=c.y;var d=core.material.icons[c.event.cls][c.event.id];var e=core.material.images[c.event.cls];core.canvas[g].drawImage(e,0,d*32,32,32,r+m*p,s+o*p,p,p)}}if(core.isset(l)){var n=core.isset(k)?k:core.status.hero.id;var h=core.material.icons.heros[n][l.direction];core.canvas[g].drawImage(core.material.images.heros,h.stop*32,h.loc*32,32,32,r+p*l.x,s+p*l.y,p,p)}};ui.prototype.drawAbout=function(){if(!core.isPlaying()){core.status.event={id:null,data:null};core.dom.startPanel.style.display="none"}core.lockControl();core.status.event.id="about";core.clearMap("ui",0,0,416,416);var b=48,f=36,d=416-2*b,a=416-2*f;core.setAlpha("ui",0.85);core.fillRect("ui",b,f,d,a,"#000000");core.setAlpha("ui",1);core.strokeRect("ui",b-1,f-1,d+1,a+1,"#FFFFFF",2);var e=b+24;core.canvas.ui.textAlign="left";core.fillText("ui","异空间",e,f+35,"#FFD700","bold 22px Verdana");core.fillText("ui","HTML5复刻版",e+75,f+37,"#DDDDDD","bold 15px Verdana");core.fillText("ui","作者: 艾之葵",e,f+80,"#FFFFFF","bold 17px Verdana");core.fillText("ui","原作: ss433_2",e,f+112,"#FFFFFF","bold 17px Verdana");core.fillText("ui","制作工具: WebStorm",e,f+144,"#FFFFFF","bold 17px Verdana");core.fillText("ui","测试平台: Chrome/微信/iOS",e,f+176,"#FFFFFF","bold 17px Verdana");core.fillText("ui","特别鸣谢: ss433_2",e,f+208);var c=core.canvas.ui.measureText("特别鸣谢: ").width;core.fillText("ui","iEcho",e+c,f+240);core.fillText("ui","打Dota的喵",e+c,f+272);core.fillText("ui","HTML5魔塔交流群:539113091",e,f+304)}; \ No newline at end of file diff --git a/main.js b/main.js index a027bd5a..6c83715f 100644 --- a/main.js +++ b/main.js @@ -75,8 +75,11 @@ function main() { 'curse': document.getElementById('curse'), 'hard': document.getElementById("hard") } - this.useCompress = false; // 是否使用压缩文件;发布前推荐使用“JS压缩工具”将所有js文件进行压缩,它会将此项改成true。 - // 只有useCompress是false时才会读取floors目录下的文件。如果要进行剧本的修改请务必将其改成false + this.useCompress = false; // 是否使用压缩文件 + // 当你即将发布你的塔时,请使用“JS代码压缩工具”将所有js代码进行压缩,然后将这里的useCompress改为true。 + // 请注意,只有useCompress是false时才会读取floors目录下的文件,为true时会直接读取libs目录下的floors.min.js文件。 + // 如果要进行剧本的修改请务必将其改成false。 + this.floorIds = [ // 在这里按顺序放所有的楼层;其顺序直接影响到楼层传送器的顺序和上楼器/下楼器的顺序 "sample0", "sample1", "sample2" ] @@ -125,23 +128,35 @@ main.prototype.loaderJs = function (callback) { } main.prototype.loaderFloors = function (callback) { + // 加载js main.setMainTipsText('正在加载楼层文件...') - for (var i = 0; i < main.floorIds.length; i++) { - main.loadFloor(main.floorIds[i], function (modName) { - main.setMainTipsText("楼层 " + modName + '.js 加载完毕'); - if (Object.keys(main.floors).length === main.floorIds.length) { - main.dom.mainTips.style.display = 'none'; - callback(); - } - }); + if (this.useCompress) { // 读取压缩文件 + var script = document.createElement('script'); + script.src = 'libs/floors.min.js?' + this.version; + main.dom.body.appendChild(script); + script.onload = function () { + main.dom.mainTips.style.display = 'none'; + callback(); + } + } + else { + for (var i = 0; i < main.floorIds.length; i++) { + main.loadFloor(main.floorIds[i], function (modName) { + main.setMainTipsText("楼层 " + modName + '.js 加载完毕'); + if (Object.keys(main.floors).length === main.floorIds.length) { + main.dom.mainTips.style.display = 'none'; + callback(); + } + }); + } } } main.prototype.loadMod = function (modName, callback) { var script = document.createElement('script'); var name = modName; - script.src = 'libs/' + modName + '.js?' + this.version; + script.src = 'libs/' + modName + (this.useCompress?".min":"") + '.js?' + this.version; main.dom.body.appendChild(script); script.onload = function () { main[name] = main.instance[name];