mirror of
https://github.com/unanmed/HumanBreak.git
synced 2025-04-19 17:16:08 +08:00
1 line
73 KiB
JavaScript
1 line
73 KiB
JavaScript
function _toConsumableArray(arr){return _arrayWithoutHoles(arr)||_iterableToArray(arr)||_unsupportedIterableToArray(arr)||_nonIterableSpread()}function _nonIterableSpread(){throw new TypeError("Invalid attempt to spread non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _iterableToArray(iter){if(typeof Symbol!=="undefined"&&iter[Symbol.iterator]!=null||iter["@@iterator"]!=null)return Array.from(iter)}function _arrayWithoutHoles(arr){if(Array.isArray(arr))return _arrayLikeToArray(arr)}function _createForOfIteratorHelper(o,allowArrayLike){var it=typeof Symbol!=="undefined"&&o[Symbol.iterator]||o["@@iterator"];if(!it){if(Array.isArray(o)||(it=_unsupportedIterableToArray(o))||allowArrayLike&&o&&typeof o.length==="number"){if(it)o=it;var i=0;var F=function F(){};return{s:F,n:function n(){if(i>=o.length)return{done:true};return{done:false,value:o[i++]}},e:function e(_e2){throw _e2},f:F}}throw new TypeError("Invalid attempt to iterate non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}var normalCompletion=true,didErr=false,err;return{s:function s(){it=it.call(o)},n:function n(){var step=it.next();normalCompletion=step.done;return step},e:function e(_e3){didErr=true;err=_e3},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}function _slicedToArray(arr,i){return _arrayWithHoles(arr)||_iterableToArrayLimit(arr,i)||_unsupportedIterableToArray(arr,i)||_nonIterableRest()}function _nonIterableRest(){throw new TypeError("Invalid attempt to destructure non-iterable instance.\nIn order to be iterable, non-array objects must have a [Symbol.iterator]() method.")}function _unsupportedIterableToArray(o,minLen){if(!o)return;if(typeof o==="string")return _arrayLikeToArray(o,minLen);var n=Object.prototype.toString.call(o).slice(8,-1);if(n==="Object"&&o.constructor)n=o.constructor.name;if(n==="Map"||n==="Set")return Array.from(o);if(n==="Arguments"||/^(?:Ui|I)nt(?:8|16|32)(?:Clamped)?Array$/.test(n))return _arrayLikeToArray(o,minLen)}function _arrayLikeToArray(arr,len){if(len==null||len>arr.length)len=arr.length;for(var i=0,arr2=new Array(len);i<len;i++)arr2[i]=arr[i];return arr2}function _iterableToArrayLimit(arr,i){var _i=null==arr?null:"undefined"!=typeof Symbol&&arr[Symbol.iterator]||arr["@@iterator"];if(null!=_i){var _s,_e,_x,_r,_arr=[],_n=!0,_d=!1;try{if(_x=(_i=_i.call(arr)).next,0===i){if(Object(_i)!==_i)return;_n=!1}else for(;!(_n=(_s=_x.call(_i)).done)&&(_arr.push(_s.value),_arr.length!==i);_n=!0);}catch(err){_d=!0,_e=err}finally{try{if(!_n&&null!=_i["return"]&&(_r=_i["return"](),Object(_r)!==_r))return}finally{if(_d)throw _e}}return _arr}}function _arrayWithHoles(arr){if(Array.isArray(arr))return arr}var CorePlugin=function(exports){"use strict";function createCanvas(name,zIndex){if(!name)return;var canvas=document.createElement("canvas");canvas.id=name;canvas.className="gameCanvas";if(main.mode!="editor")canvas.style.zIndex=zIndex||0;document.getElementById("gameDraw").appendChild(canvas);var ctx=canvas.getContext("2d");core.canvas[name]=ctx;return canvas}var bg2Canvas=createCanvas("bg2",20);var fg2Canvas=createCanvas("fg2",63);core.bigmap.canvas=["bg2","fg2","bg","event","event2","fg","damage"];core.initStatus.bg2maps={};core.initStatus.fg2maps={};if(main.mode=="editor"){document.getElementById("mapEdit").insertBefore(bg2Canvas,document.getElementById("event"));document.getElementById("mapEdit").insertBefore(fg2Canvas,document.getElementById("ebm"));var num=4;editor.dom.bg2c=core.canvas.bg2.canvas;editor.dom.bg2Ctx=core.canvas.bg2;editor.dom.fg2c=core.canvas.fg2.canvas;editor.dom.fg2Ctx=core.canvas.fg2;editor.dom.maps.push("bg2map","fg2map");editor.dom.canvas.push("bg2","fg2");var createCanvasBtn=function createCanvasBtn(name){var input=document.createElement("input");var id="layerMod"+num++;var value=name+"map";input.type="radio";input.name="layerMod";input.id=id;input.value=value;editor.dom[id]=input;input.onchange=function(){editor.uifunctions.setLayerMod(value)};return input};var createCanvasBtn_mobile=function createCanvasBtn_mobile(name){var input=document.createElement("option");var id="layerMod"+num++;var value=name+"map";input.name="layerMod";input.value=value;editor.dom[id]=input;return input};if(!editor.isMobile){var input=createCanvasBtn("bg2");var input2=createCanvasBtn("fg2");var child=document.getElementById("layerMod"),parent=child.parentNode;parent.insertBefore(input,child);var txt=document.createTextNode("\u80CC2");parent.insertBefore(txt,child);parent.appendChild(input2);var txt2=document.createTextNode("\u524D2");parent.appendChild(txt2)}else{var input=createCanvasBtn_mobile("bg2");var input2=createCanvasBtn_mobile("fg2");input.innerText="\u80CC\u666F2";input2.innerText="\u524D\u666F2";var parent=document.getElementById("layerMod");parent.insertBefore(input,parent.children[1]);parent.appendChild(input2)}}core.maps._loadFloor_doNotCopy=function(){return["firstArrive","eachArrive","blocks","parallelDo","map","bgmap","fgmap","bg2map","fg2map","events","changeFloor","afterBattle","afterGetItem","afterOpenDoor","cannotMove"]};core.maps._drawBg_draw=function(floorId,toDrawCtx,cacheCtx,config){config.ctx=cacheCtx;core.maps._drawBg_drawBackground(floorId,config);core.maps._drawFloorImages(floorId,config.ctx,"bg",null,null,config.onMap);core.maps._drawBgFgMap(floorId,"bg",config);if(config.onMap){core.drawImage(toDrawCtx,cacheCtx.canvas,core.bigmap.v2?-32:0,core.bigmap.v2?-32:0);core.clearMap("bg2");core.clearMap(cacheCtx)}core.maps._drawBgFgMap(floorId,"bg2",config);if(config.onMap)core.drawImage("bg2",cacheCtx.canvas,core.bigmap.v2?-32:0,core.bigmap.v2?-32:0);config.ctx=toDrawCtx};core.maps._drawFg_draw=function(floorId,toDrawCtx,cacheCtx,config){config.ctx=cacheCtx;core.maps._drawFloorImages(floorId,config.ctx,"fg",null,null,config.onMap);core.maps._drawBgFgMap(floorId,"fg",config);if(config.onMap){core.drawImage(toDrawCtx,cacheCtx.canvas,core.bigmap.v2?-32:0,core.bigmap.v2?-32:0);core.clearMap("fg2");core.clearMap(cacheCtx)}core.maps._drawBgFgMap(floorId,"fg2",config);if(config.onMap)core.drawImage("fg2",cacheCtx.canvas,core.bigmap.v2?-32:0,core.bigmap.v2?-32:0);config.ctx=toDrawCtx};core.maps._generateMovableArray_arrays=function(floorId){return{bgArray:this.getBgMapArray(floorId),fgArray:this.getFgMapArray(floorId),eventArray:this.getMapArray(floorId),bg2Array:this._getBgFgMapArray("bg2",floorId),fg2Array:this._getBgFgMapArray("fg2",floorId)}};["up","down","left","right"].forEach(function(one){core.material.icons.hero[one].midFoot=2});var heroMoving=function heroMoving(timestamp){if(core.status.heroMoving<=0)return;if(timestamp-core.animateFrame.moveTime>core.values.moveSpeed){core.animateFrame.leftLeg++;core.animateFrame.moveTime=timestamp}core.drawHero(["stop","leftFoot","midFoot","rightFoot"][core.animateFrame.leftLeg%4],4*core.status.heroMoving)};core.registerAnimationFrame("heroMoving",true,heroMoving);core.events._eventMoveHero_moving=function(step,moveSteps){var curr=moveSteps[0];var direction=curr[0],x=core.getHeroLoc("x"),y=core.getHeroLoc("y");var o=direction=="backward"?-1:1;if(direction=="forward"||direction=="backward")direction=core.getHeroLoc("direction");var faceDirection=direction;if(direction=="leftup"||direction=="leftdown")faceDirection="left";if(direction=="rightup"||direction=="rightdown")faceDirection="right";core.setHeroLoc("direction",direction);if(curr[1]<=0){core.setHeroLoc("direction",faceDirection);moveSteps.shift();return true}if(step<=4)core.drawHero("stop",4*o*step);else if(step<=8)core.drawHero("leftFoot",4*o*step);else if(step<=12)core.drawHero("midFoot",4*o*(step-8));else if(step<=16)core.drawHero("rightFoot",4*o*(step-8));if(step==8||step==16){core.setHeroLoc("x",x+o*core.utils.scan2[direction].x,true);core.setHeroLoc("y",y+o*core.utils.scan2[direction].y,true);core.updateFollowers();curr[1]--;if(curr[1]<=0)moveSteps.shift();core.setHeroLoc("direction",faceDirection);return step==16}return false};core.control.updateDamage=function(floorId,ctx){floorId=floorId||core.status.floorId;if(!floorId||core.status.gameOver||main.mode!="play")return;var onMap=ctx==null;if(!core.hasItem("book"))return;core.status.damage.posX=core.bigmap.posX;core.status.damage.posY=core.bigmap.posY;if(!onMap){var width=core.floors[floorId].width,height=core.floors[floorId].height;if(width*height>core.bigmap.threshold)return}this._updateDamage_damage(floorId,onMap);this._updateDamage_extraDamage(floorId,onMap);getItemDetail(floorId,onMap);this.drawDamage(ctx)};function getItemDetail(floorId,onMap){var _floorId;if(!core.getFlag("itemDetail"))return;(_floorId=floorId)!==null&&_floorId!==void 0?_floorId:floorId=core.status.thisMap.floorId;var diff={};var before=core.status.hero;var hero=core.clone(core.status.hero);var handler={set:function set(target,key,v){diff[key]=v-(target[key]||0);if(!diff[key])diff[key]=void 0;return true}};core.status.hero=new Proxy(hero,handler);core.status.maps[floorId].blocks.forEach(function(block){if(block.event.cls!=="items"||block.disable)return;var x=block.x,y=block.y;if(onMap&&core.bigmap.v2){if(x<core.bigmap.posX-core.bigmap.extend||x>core.bigmap.posX+core._PX_+core.bigmap.extend||y<core.bigmap.posY-core.bigmap.extend||y>core.bigmap.posY+core._PY_+core.bigmap.extend){return}}diff={};var id=block.event.id;var item=core.material.items[id];if(item.cls==="equips"){var _item$equip$value,_item$equip$percentag;var _diff=core.clone((_item$equip$value=item.equip.value)!==null&&_item$equip$value!==void 0?_item$equip$value:{});var per=(_item$equip$percentag=item.equip.percentage)!==null&&_item$equip$percentag!==void 0?_item$equip$percentag:{};for(var name in per){_diff[name+"per"]=per[name].toString()+"%"}drawItemDetail(_diff,x,y);return}core.setFlag("__statistics__",true);try{eval(item.itemEffect)}catch(error){}drawItemDetail(diff,x,y)});core.status.hero=before;window.hero=before;window.flags=before.flags}function drawItemDetail(diff,x,y){var px=32*x+2,py=32*y+31;var content="";var i=0;for(var name in diff){if(!diff[name])continue;var color="#fff";if(typeof diff[name]==="number")content=core.formatBigNumber(diff[name],true);else content=diff[name];switch(name){case"atk":case"atkper":color="#FF7A7A";break;case"def":case"defper":color="#00E6F1";break;case"mdef":case"mdefper":color="#6EFF83";break;case"hp":color="#A4FF00";break;case"hpmax":case"hpmaxper":color="#F9FF00";break;case"mana":color="#c66";break;}core.status.damage.data.push({text:content,px:px,py:py-10*i,color:color});i++}}control.prototype.checkBlock=function(forceMockery){var x=core.getHeroLoc("x"),y=core.getHeroLoc("y"),loc=x+","+y;var damage=core.status.checkBlock.damage[loc];if(damage){if(!main.replayChecking)core.addPop((x-core.bigmap.offsetX/32)*32+12,(y-core.bigmap.offsetY/32)*32+20,-damage.toString());core.status.hero.hp-=damage;var text=Object.keys(core.status.checkBlock.type[loc]||{}).join("\uFF0C")||"\u4F24\u5BB3";core.drawTip("\u53D7\u5230"+text+damage+"\u70B9");core.drawHeroAnimate("zone");this._checkBlock_disableQuickShop();core.status.hero.statistics.extraDamage+=damage;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose();return}else{core.updateStatusBar()}}this._checkBlock_repulse(core.status.checkBlock.repulse[loc]);checkMockery(loc,forceMockery)};control.prototype.moveHero=function(direction,callback){if(core.status.heroMoving!=0)return;if(core.isset(direction))core.setHeroLoc("direction",direction);var nx=core.nextX();var ny=core.nextY();if(core.status.checkBlock.mockery["".concat(nx,",").concat(ny)]){core.autosave()}if(callback)return this.moveAction(callback);this._moveHero_moving()};function checkMockery(loc,force){if(core.status.lockControl&&!force)return;var mockery=core.status.checkBlock.mockery[loc];if(mockery){mockery.sort(function(a,b){return a[0]===b[0]?a[1]-b[1]:a[0]-b[0]});var action=[];var _mockery$=_slicedToArray(mockery[0],2),tx=_mockery$[0],ty=_mockery$[1];var _core$status$hero$loc=core.status.hero.loc,x=_core$status$hero$loc.x,y=_core$status$hero$loc.y;var dir=x>tx?"left":x<tx?"right":y>ty?"up":"down";var _core$utils$scan$dir=core.utils.scan[dir],dx=_core$utils$scan$dir.x,dy=_core$utils$scan$dir.y;action.push({type:"changePos",direction:dir});var blocks=core.getMapBlocksObj();while(1){x+=dx;y+=dy;var block=blocks["".concat(x,",").concat(y)];if(block){block.event.cls==="";if(["animates","autotile","tileset","npcs","npc48","terrains"].includes(block.event.cls)){action.push({type:"hide",loc:[[x,y]],remove:true,time:0},{type:"function","function":"function() { core.removeGlobalAnimate(".concat(x,", ").concat(y,") }")},{type:"animate",name:"hand",loc:[x,y],async:true})}if(block.event.cls.startsWith("enemy")){action.push({type:"moveAction"})}}action.push({type:"moveAction"});if(x===tx&&y===ty)break}action.push({type:"function","function":"function() { core.checkBlock(true); }"});action.push({type:"stopAsync"});core.insertAction(action)}}var values={1:["crit"],6:["n"],7:["hungry"],8:["together"],10:["courage"],11:["charge"]};var cannotStudy=[9,12,14,15,24];function canStudySkill(number){var _core$status$hero,_core$status$hero$spe;var s=(_core$status$hero$spe=(_core$status$hero=core.status.hero).special)!==null&&_core$status$hero$spe!==void 0?_core$status$hero$spe:_core$status$hero.special={num:[],last:[]};if(core.plugin.skillTree.getSkillLevel(11)===0)return false;if(s.num.length>=1)return false;if(s.num.includes(number))return false;if(cannotStudy.includes(number))return false;return true}function studySkill(enemy,number){var _core$status$hero2,_core$status$hero2$sp,_values$number;(_core$status$hero2$sp=(_core$status$hero2=core.status.hero).special)!==null&&_core$status$hero2$sp!==void 0?_core$status$hero2$sp:_core$status$hero2.special={num:[],last:[]};var s=core.status.hero.special;var specials=core.getSpecials();var special=specials[number-1][1];if(special instanceof Function)special=special(enemy);if(!canStudySkill(number)){if(!main.replayChecking){core.tip("error","\u65E0\u6CD5\u5B66\u4E60".concat(special))}return}s.num.push(number);s.last.push(core.plugin.skillTree.getSkillLevel(11)*3+2);var value=(_values$number=values[number])!==null&&_values$number!==void 0?_values$number:[];var _iterator=_createForOfIteratorHelper(value),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var key=_step.value;s[key]=enemy[key]}}catch(err){_iterator.e(err)}finally{_iterator.f()}}function forgetStudiedSkill(num,i){var _values$number2;var s=core.status.hero.special;var index=i!==void 0&&i!==null?i:s.num.indexOf(num);if(index===-1)return;s.num.splice(index,1);s.last.splice(index,1);var value=(_values$number2=values[number])!==null&&_values$number2!==void 0?_values$number2:[];var _iterator2=_createForOfIteratorHelper(value),_step2;try{for(_iterator2.s();!(_step2=_iterator2.n()).done;){var key=_step2.value;delete s[key]}}catch(err){_iterator2.e(err)}finally{_iterator2.f()}}function declineStudiedSkill(){var _core$status$hero3,_core$status$hero3$sp;var s=(_core$status$hero3$sp=(_core$status$hero3=core.status.hero).special)!==null&&_core$status$hero3$sp!==void 0?_core$status$hero3$sp:_core$status$hero3.special={num:[],last:[]};s.last=s.last.map(function(v){return v-1})}function checkStudiedSkill(){var s=core.status.hero.special;for(var i=0;i<s.last.length;i++){if(s.last[i]<=0){this.forgetStudiedSkill(void 0,i);i--}}}core.plugin.study={canStudySkill:canStudySkill,studySkill:studySkill,forgetStudiedSkill:forgetStudiedSkill,declineStudiedSkill:declineStudiedSkill,checkStudiedSkill:checkStudiedSkill};var study=Object.freeze({__proto__:null,canStudySkill:canStudySkill,checkStudiedSkill:checkStudiedSkill,declineStudiedSkill:declineStudiedSkill,forgetStudiedSkill:forgetStudiedSkill,studySkill:studySkill});var replayableSettings=["autoSkill"];core.registerReplayAction("settings",function(name){if(!name.startsWith("set:"))return false;var _name$split=name.split(":"),_name$split2=_slicedToArray(_name$split,3),setting=_name$split2[1],value=_name$split2[2];var v=eval(value);if(typeof v!=="boolean")return false;if(!replayableSettings.includes(setting))return false;flags[setting]=v;core.replay();return true});core.registerReplayAction("upgradeSkill",function(name){if(!name.startsWith("skill:"))return false;var skill=parseInt(name.slice(6));core.plugin.skillTree.upgradeSkill(skill);core.replay();return true});core.registerReplayAction("study",function(name){if(!name.startsWith("study:"))return false;var _name$slice$split$map=name.slice(6).split(",").map(function(v){return parseInt(v)}),_name$slice$split$map2=_slicedToArray(_name$slice$split$map,3),num=_name$slice$split$map2[0],x=_name$slice$split$map2[1],y=_name$slice$split$map2[2];if(!canStudySkill(num))return false;var id=core.getBlockId(x,y);var enemy=core.getEnemyInfo(id,void 0,x,y);if(!enemy.special.includes(num))return false;studySkill(enemy,num);core.replay();return true});var shopOpened=false;var openedShopId="";core.registerReplayAction("openShop",function(name){if(!name.startsWith("openShop:"))return false;openedShopId=name.slice(9);shopOpened=true;core.replay();return true});core.registerReplayAction("buy",function(name){var _flags,_flags$itemShop,_flags$itemShop2,_openedShopId,_flags$itemShop2$_ope,_flags$itemShop$opene,_flags$itemShop$opene2;if(!name.startsWith("buy:")&&!name.startsWith("sell:"))return false;if(!shopOpened)return false;if(!openedShopId)return false;var _name$split$map=name.split(":").map(function(v){return /^\d+$/.test(v)?parseInt(v):v}),_name$split$map2=_slicedToArray(_name$split$map,3),type=_name$split$map2[0],id=_name$split$map2[1],num=_name$split$map2[2];var shop=core.status.shops[id];var item=shop.choices.find(function(v){return v.id===id});if(!item)return false;(_flags$itemShop=(_flags=flags).itemShop)!==null&&_flags$itemShop!==void 0?_flags$itemShop:_flags.itemShop={};(_flags$itemShop2$_ope=(_flags$itemShop2=flags.itemShop)[_openedShopId=openedShopId])!==null&&_flags$itemShop2$_ope!==void 0?_flags$itemShop2$_ope:_flags$itemShop2[_openedShopId]={};(_flags$itemShop$opene2=(_flags$itemShop$opene=flags.itemShop[openedShopId])[id])!==null&&_flags$itemShop$opene2!==void 0?_flags$itemShop$opene2:_flags$itemShop$opene[id]=0;if(num>item.number-flags.itemShop[openedShopId][id]){return false}var cost=0;if(type==="buy"){cost=item.money*num}else{cost=-item.sell*num}if(cost>core.status.hero.money)return false;core.status.hero.money-=cost;flags.itemShop[openedShopId][id]+=type==="buy"?num:-num;core.replay();return true});core.registerReplayAction("closeShop",function(name){if(name!=="closeShop")return false;if(!shopOpened)return false;shopOpened=false;openedShopId="";core.replay();return true});(function(){if(main.replayChecking)return core.plugin.gameUi={};function openItemShop(itemShopId){if(!main.replayChecking){core.plugin.openedShopId=itemShopId;core.plugin.shopOpened.value=true}}function updateVueStatusBar(){if(main.replayChecking)return;core.plugin.statusBarStatus.value=!core.plugin.statusBarStatus.value;core.checkMarkedEnemy()}ui.prototype.drawBook=function(){if(!core.isReplaying())return core.plugin.bookOpened.value=true};ui.prototype._drawToolbox=function(){if(!core.isReplaying())return core.plugin.toolOpened.value=true};ui.prototype._drawEquipbox=function(){if(!core.isReplaying())return core.plugin.equipOpened.value=true};ui.prototype.drawFly=function(){if(!core.isReplaying())return core.plugin.flyOpened.value=true};control.prototype.updateStatusBar_update=function(){core.control.updateNextFrame=false;if(!core.isPlaying()||core.hasFlag("__statistics__"))return;core.control.controldata.updateStatusBar();if(!core.control.noAutoEvents)core.checkAutoEvents();core.control._updateStatusBar_setToolboxIcon();core.clearRouteFolding();core.control.noAutoEvents=true;updateVueStatusBar()};control.prototype.showStatusBar=function(){if(main.mode=="editor")return;core.removeFlag("hideStatusBar");core.plugin.showStatusBar.value=true;core.dom.tools.hard.style.display="block";core.dom.toolBar.style.display="block"};control.prototype.hideStatusBar=function(showToolbox){if(main.mode=="editor")return;if(!core.domStyle.showStatusBar)this.showStatusBar();if(core.isReplaying())showToolbox=true;core.plugin.showStatusBar.value=false;var toolItems=core.dom.tools;core.setFlag("hideStatusBar",true);core.setFlag("showToolbox",showToolbox||null);if(!core.domStyle.isVertical&&!core.flags.extendToolbar||!showToolbox){for(var i=0;i<toolItems.length;++i)toolItems[i].style.display="none"}if(!core.domStyle.isVertical&&!core.flags.extendToolbar){core.dom.toolBar.style.display="none"}};function showChapter(chapter){if(core.isReplaying())return;core.plugin.chapterContent.value=chapter;core.plugin.chapterShowed.value=true}function openSkill(){if(core.isReplaying())return;core.plugin.skillOpened.value=true}core.plugin.gameUi={openItemShop:openItemShop,openSkill:openSkill,showChapter:showChapter}})();function drawHalo(ctx,onMap){if(main.replayChecking)return;if(!core.getLocalStorage("showHalo",true))return;var halo=core.status.checkBlock.halo;ctx.save();for(var _i2=0,_Object$entries=Object.entries(halo);_i2<_Object$entries.length;_i2++){var _Object$entries$_i=_slicedToArray(_Object$entries[_i2],2),loc=_Object$entries$_i[0],range=_Object$entries$_i[1];var _loc$split$map=loc.split(",").map(function(v){return parseInt(v)}),_loc$split$map2=_slicedToArray(_loc$split$map,2),x=_loc$split$map2[0],y=_loc$split$map2[1];var _iterator3=_createForOfIteratorHelper(range),_step3;try{for(_iterator3.s();!(_step3=_iterator3.n()).done;){var r=_step3.value;var _r$split=r.split(":"),_r$split2=_slicedToArray(_r$split,4),type=_r$split2[0],value=_r$split2[1],color=_r$split2[2],border=_r$split2[3];if(type==="square"){var n=parseInt(value);var _r2=Math.floor(n/2);var left=x-_r2,right=x+_r2,top=y-_r2,bottom=y+_r2;if(onMap&&core.bigmap.v2){left-=core.bigmap.posX;top-=core.bigmap.posY;right-=core.bigmap.posX;bottom-=core.bigmap.posY;if(right<-1||left>core._PX_/32+1||top<-1||bottom>core._PY_/32+1){continue}}ctx.fillStyle=color;ctx.strokeStyle=border!==null&&border!==void 0?border:color;ctx.lineWidth=1;ctx.globalAlpha=0.1;ctx.fillRect(left*32,top*32,n*32,n*32);ctx.globalAlpha=0.6;ctx.strokeRect(left*32,top*32,n*32,n*32)}}}catch(err){_iterator3.e(err)}finally{_iterator3.f()}}ctx.restore()}core.plugin.halo={drawHalo:drawHalo};var halo=Object.freeze({__proto__:null,drawHalo:drawHalo});function getHeroStatusOn(name,x,y,floorId){return getHeroStatusOf(core.status.hero,name,x,y,floorId)}function getHeroStatusOf(status,name,x,y,floorId){return getRealStatus(status,name,x,y,floorId)}function getRealStatus(status,name,x,y,floorId){var _status$name,_x2,_y,_floorId2;if(name instanceof Array){return Object.fromEntries(name.map(function(v){return[v,v!=="all"&&getRealStatus(status,v,x,y,floorId)]}))}if(name==="all"){return Object.fromEntries(Object.keys(core.status.hero).map(function(v){return[v,v!=="all"&&getRealStatus(status,v,x,y,floorId)]}))}var s=(_status$name=status===null||status===void 0?void 0:status[name])!==null&&_status$name!==void 0?_status$name:core.status.hero[name];if(s===null||s===void 0){throw new ReferenceError("Wrong hero status property name is delivered: ".concat(name))}(_x2=x)!==null&&_x2!==void 0?_x2:x=core.status.hero.loc.x;(_y=y)!==null&&_y!==void 0?_y:y=core.status.hero.loc.y;(_floorId2=floorId)!==null&&_floorId2!==void 0?_floorId2:floorId=core.status.floorId;if(name==="atk"||name==="def"){var _window$flags,_window$flags2;s+=(_window$flags=(_window$flags2=window.flags)===null||_window$flags2===void 0?void 0:_window$flags2["night_".concat(floorId)])!==null&&_window$flags!==void 0?_window$flags:0}if(flags.bladeOn&&flags.blade){var level=core.plugin.skillTree.getSkillLevel(2);if(name==="atk"){s*=1+0.1*level}if(name==="def"){s*=1-0.1*level}}if(flags.shield&&flags.shieldOn){var _level=core.plugin.skillTree.getSkillLevel(10);if(name==="atk"){s*=1-0.1*_level}if(name==="def"){s*=1+0.1*_level}}if(typeof s==="number")s*=core.getBuff(name);if(typeof s==="number")s=Math.floor(s);return s}core.plugin.hero={getHeroStatusOf:getHeroStatusOf,getHeroStatusOn:getHeroStatusOn};var hero=Object.freeze({__proto__:null,getHeroStatusOf:getHeroStatusOf,getHeroStatusOn:getHeroStatusOn});function slide(arr,delta){if(delta===0)return arr;delta%=arr.length;if(delta>0){arr.unshift.apply(arr,_toConsumableArray(arr.splice(arr.length-delta,delta)));return arr}if(delta<0){arr.push.apply(arr,_toConsumableArray(arr.splice(0,-delta)));return arr}}function backDir(dir){return{up:"down",down:"up",left:"right",right:"left"}[dir]}function has(v){return v!==null&&v!==void 0}function maxGameScale(){var n=arguments.length>0&&arguments[0]!==undefined?arguments[0]:0;var index=core.domStyle.availableScale.indexOf(core.domStyle.scale);core.control.setDisplayScale(core.domStyle.availableScale.length-1-index-n);if(!core.isPlaying()&&core.flags.enableHDCanvas){core.domStyle.ratio=Math.max(window.devicePixelRatio||1,core.domStyle.scale);core.resize()}}core.plugin.utils={slide:slide,backDir:backDir,has:has,maxGameScale:maxGameScale};var utils=Object.freeze({__proto__:null,backDir:backDir,has:has,maxGameScale:maxGameScale,slide:slide});var list=["tower6"];function setLoopMap(offset,floorId){var floor=core.status.maps[floorId];if(offset<9){moveMap(floor.width-17,floorId)}if(offset>floor.width-9){moveMap(17-floor.width,floorId)}}function autoSetLoopMap(floorId){setLoopMap(core.status.hero.loc.x,floorId)}function checkLoopMap(){if(isLoopMap(core.status.floorId)){autoSetLoopMap(core.status.floorId)}}function moveMap(delta,floorId){core.extractBlocks(floorId);var floor=core.status.maps[floorId];core.setHeroLoc("x",core.status.hero.loc.x+delta);flags["loop_".concat(floorId)]+=delta;flags["loop_".concat(floorId)]%=floor.width;var origin=floor.blocks.slice();for(var i=0;i<origin.length;i++){core.removeBlockByIndex(0,floorId);core.removeGlobalAnimate(origin[i].x,origin[i].y)}origin.forEach(function(v){var to=v.x+delta;if(to>=floor.width)to-=floor.width;if(to<0)to+=floor.width;core.setBlock(v.id,to,v.y,floorId,true);core.setMapBlockDisabled(floorId,to,v.y,false)});core.drawMap();core.drawHero()}function isLoopMap(floorId){return list.includes(floorId)}events.prototype._sys_changeFloor=function(data,callback){data=data.event.data;var heroLoc={};if(isLoopMap(data.floorId)){var _flags2,_ref,_flags2$_ref;var floor=core.status.maps[data.floorId];(_flags2$_ref=(_flags2=flags)[_ref="loop_".concat(data.floorId)])!==null&&_flags2$_ref!==void 0?_flags2$_ref:_flags2[_ref]=0;var tx=data.loc[0]+flags["loop_".concat(data.floorId)];tx%=floor.width;if(tx<0)tx+=floor.width;heroLoc={x:tx,y:data.loc[1]}}else if(data.loc)heroLoc={x:data.loc[0],y:data.loc[1]};if(data.direction)heroLoc.direction=data.direction;if(core.status.event.id!="action")core.status.event.id=null;core.changeFloor(data.floorId,data.stair,heroLoc,data.time,function(){core.replay();if(callback)callback()})};events.prototype.trigger=function(x,y,callback){var _executeCallback=function _executeCallback(){if(callback){setTimeout(callback,1)}return};if(core.status.gameOver)return _executeCallback();if(core.status.event.id=="action"){core.insertAction({type:"function","function":"function () { core.events._trigger_inAction("+x+","+y+"); }",async:true},null,null,null,true);return _executeCallback()}if(core.status.event.id)return _executeCallback();var block=core.getBlock(x,y);var id=core.status.floorId;var loop=isLoopMap(id);if(loop&&flags["loop_".concat(id)]!==0){if(block&&block.event.trigger==="changeFloor"){delete block.event.trigger;core.maps._addInfo(block)}else{var floor=core.status.maps[id];var tx=x-flags["loop_".concat(id)];tx%=floor.width;if(tx<0)tx+=floor.width;var c=core.floors[id].changeFloor["".concat(tx,",").concat(y)];if(c){var b={event:{},x:tx,y:y};b.event.data=c;b.event.trigger="changeFloor";block=b}}}if(block==null)return _executeCallback();if(block.event.script){core.clearRouteFolding();try{eval(block.event.script)}catch(ee){console.error(ee)}}if(block.event.event){core.clearRouteFolding();core.insertAction(block.event.event,block.x,block.y);return _executeCallback()}if(block.event.trigger&&block.event.trigger!="null"){var noPass=block.event.noPass,trigger=block.event.trigger;if(noPass)core.clearAutomaticRouteNode(x,y);if(trigger=="changeFloor"&&!noPass&&this._trigger_ignoreChangeFloor(block)&&!loop)return _executeCallback();core.status.automaticRoute.moveDirectly=false;this.doSystemEvent(trigger,block)}return _executeCallback()};maps.prototype._getBgFgMapArray=function(name,floorId,noCache){floorId=floorId||core.status.floorId;if(!floorId)return[];var width=core.floors[floorId].width;var height=core.floors[floorId].height;if(!noCache&&core.status[name+"maps"][floorId])return core.status[name+"maps"][floorId];var arr=main.mode=="editor"&&!(window.editor&&editor.uievent&&editor.uievent.isOpen)?core.cloneArray(editor[name+"map"]):null;if(arr==null)arr=core.cloneArray(core.floors[floorId][name+"map"]||[]);if(isLoopMap(floorId)&&window.flags){var _flags3,_ref2,_flags3$_ref;(_flags3$_ref=(_flags3=flags)[_ref2="loop_".concat(floorId)])!==null&&_flags3$_ref!==void 0?_flags3$_ref:_flags3[_ref2]=0;arr.forEach(function(v){slide(v,flags["loop_".concat(floorId)]%width)})}for(var y=0;y<height;++y){if(arr[y]==null)arr[y]=Array(width).fill(0)}(core.getFlag("__"+name+"v__",{})[floorId]||[]).forEach(function(one){arr[one[1]][one[0]]=one[2]||0});(core.getFlag("__"+name+"d__",{})[floorId]||[]).forEach(function(one){arr[one[1]][one[0]]=0});if(main.mode=="editor"){for(var x=0;x<width;x++){for(var y=0;y<height;y++){arr[y][x]=arr[y][x].idnum||arr[y][x]||0}}}if(core.status[name+"maps"])core.status[name+"maps"][floorId]=arr;return arr};core.plugin.loopMap={checkLoopMap:checkLoopMap};var loopMap=Object.freeze({__proto__:null,checkLoopMap:checkLoopMap});function checkRemainEnemy(floorIds){var enemy={};floorIds.forEach(function(v){core.extractBlocks(v);var blocks=core.status.maps[v].blocks;blocks.forEach(function(block){var _enemy$v;if(!block.event.cls.startsWith("enemy")||block.disable)return;var id=block.event.id;(_enemy$v=enemy[v])!==null&&_enemy$v!==void 0?_enemy$v:enemy[v]=[];var info=enemy[v];info.push({loc:[block.x,block.y],id:id})})});return enemy}function getRemainEnemyString(floorIds){var enemy=checkRemainEnemy(floorIds);var str=[];var now=[];var _loop=function _loop(){var all=enemy[floor];var remain={};all.forEach(function(v){var _remain$id;var id=v.id;(_remain$id=remain[id])!==null&&_remain$id!==void 0?_remain$id:remain[id]=0;remain[id]++});var title=core.status.maps[floor].title;for(var id in remain){var name=core.material.enemys[id].name;now.push("".concat(title,"(").concat(floor,"): ").concat(name," * ").concat(remain[id]));if(now.length===10){str.push(now.join("\n"));now=[]}}};for(var floor in enemy){_loop()}if(now.length>0){str.push(now.join("\n"));str[0]="\u5F53\u524D\u5269\u4F59\u602A\u7269\uFF1A\n".concat(str[0])}return str}core.plugin.remainEnemy={checkRemainEnemy:checkRemainEnemy,getRemainEnemyString:getRemainEnemyString};var remainEnemy=Object.freeze({__proto__:null,checkRemainEnemy:checkRemainEnemy,getRemainEnemyString:getRemainEnemyString});function removeMaps(fromId,toId,force){var _flags4,_flags4$__forceDelete;toId=toId||fromId;var fromIndex=core.floorIds.indexOf(fromId),toIndex=core.floorIds.indexOf(toId);if(toIndex<0)toIndex=core.floorIds.length-1;flags.__visited__=flags.__visited__||{};flags.__removed__=flags.__removed__||[];flags.__disabled__=flags.__disabled__||{};flags.__leaveLoc__=flags.__leaveLoc__||{};(_flags4$__forceDelete=(_flags4=flags).__forceDelete__)!==null&&_flags4$__forceDelete!==void 0?_flags4$__forceDelete:_flags4.__forceDelete__={};var deleted=false;for(var i=fromIndex;i<=toIndex;++i){var floorId=core.floorIds[i];if(core.status.maps[floorId].deleted)continue;delete flags.__visited__[floorId];flags.__removed__.push(floorId);delete flags.__disabled__[floorId];delete flags.__leaveLoc__[floorId];(core.status.autoEvents||[]).forEach(function(event){if(event.floorId==floorId&&event.currentFloor){core.autoEventExecuting(event.symbol,false);core.autoEventExecuted(event.symbol,false)}});core.status.maps[floorId].deleted=true;core.status.maps[floorId].canFlyTo=false;core.status.maps[floorId].canFlyFrom=false;core.status.maps[floorId].cannotViewMap=true;if(force){core.status.maps[floorId].forceDelete=true;flags.__forceDelete__[floorId]=true}deleteFlags(floorId);deleted=true}if(deleted&&!main.replayChecking){core.splitArea()}}function deleteFlags(floorId){delete flags["jump_".concat(floorId)];delete flags["inte_".concat(floorId)];delete flags["loop_".concat(floorId)];delete flags["melt_".concat(floorId)];delete flags["night_".concat(floorId)]}function resumeMaps(fromId,toId){toId=toId||fromId;var fromIndex=core.floorIds.indexOf(fromId),toIndex=core.floorIds.indexOf(toId);if(toIndex<0)toIndex=core.floorIds.length-1;flags.__removed__=flags.__removed__||[];for(var i=fromIndex;i<=toIndex;++i){var floorId=core.floorIds[i];if(!core.status.maps[floorId].deleted)continue;if(core.status.maps[floorId].forceDelete||flags.__forceDelete__[floorId])continue;flags.__removed__=flags.__removed__.filter(function(f){return f!=floorId});core.status.maps[floorId]=core.loadFloor(floorId)}}var inAnyPartition=function inAnyPartition(floorId){var inPartition=false;(core.floorPartitions||[]).forEach(function(floor){var fromIndex=core.floorIds.indexOf(floor[0]);var toIndex=core.floorIds.indexOf(floor[1]);var index=core.floorIds.indexOf(floorId);if(fromIndex<0||index<0)return;if(toIndex<0)toIndex=core.floorIds.length-1;if(index>=fromIndex&&index<=toIndex)inPartition=true});return inPartition};function autoRemoveMaps(floorId){if(main.mode!="play"||!inAnyPartition(floorId))return;(core.floorPartitions||[]).forEach(function(floor){var fromIndex=core.floorIds.indexOf(floor[0]);var toIndex=core.floorIds.indexOf(floor[1]);var index=core.floorIds.indexOf(floorId);if(fromIndex<0||index<0)return;if(toIndex<0)toIndex=core.floorIds.length-1;if(index>=fromIndex&&index<=toIndex){core.plugin.removeMap.resumeMaps(core.floorIds[fromIndex],core.floorIds[toIndex])}else{removeMaps(core.floorIds[fromIndex],core.floorIds[toIndex])}})}core.plugin.removeMap={removeMaps:removeMaps,deleteFlags:deleteFlags,resumeMaps:resumeMaps,autoRemoveMaps:autoRemoveMaps};var removeMap=Object.freeze({__proto__:null,autoRemoveMaps:autoRemoveMaps,deleteFlags:deleteFlags,removeMaps:removeMaps,resumeMaps:resumeMaps});var openItemShop=core.plugin.gameUi.openItemShop;function openShop(shopId,noRoute){var shop=core.status.shops[shopId];if(!this.canOpenShop(shopId)){core.drawTip("\u8BE5\u5546\u5E97\u5C1A\u672A\u5F00\u542F");return false}if(shop.item){if(openItemShop)openItemShop(shopId);return}return true}function isShopVisited(id){var _flags5,_flags5$__shops__;(_flags5$__shops__=(_flags5=flags).__shops__)!==null&&_flags5$__shops__!==void 0?_flags5$__shops__:_flags5.__shops__={};var shops=core.getFlag("__shops__");if(!shops[id])shops[id]={};return shops[id].visited}function listShopIds(){return Object.keys(core.status.shops).filter(function(id){return core.plugin.shop.isShopVisited(id)||!core.status.shops[id].mustEnable})}function canOpenShop(id){if(this.isShopVisited(id))return true;var shop=core.status.shops[id];if(shop.item||shop.commonEvent||shop.mustEnable)return false;return true}function setShopVisited(id,visited){if(!core.hasFlag("__shops__"))core.setFlag("__shops__",{});var shops=core.getFlag("__shops__");if(!shops[id])shops[id]={};if(visited)shops[id].visited=true;else delete shops[id].visited}function canUseQuickShop(){if(core.status.thisMap.canUseQuickShop===false)return"\u5F53\u524D\u697C\u5C42\u4E0D\u80FD\u4F7F\u7528\u5FEB\u6377\u5546\u5E97\u3002";return null}core.plugin.shop={openShop:openShop,isShopVisited:isShopVisited,listShopIds:listShopIds,canOpenShop:canOpenShop,setShopVisited:setShopVisited,canUseQuickShop:canUseQuickShop};var shop=Object.freeze({__proto__:null,canOpenShop:canOpenShop,canUseQuickShop:canUseQuickShop,isShopVisited:isShopVisited,listShopIds:listShopIds,openShop:openShop,setShopVisited:setShopVisited});var ignoreInJump={event:["X20007","X20001","X20006","X20014","X20010","X20007"],bg:["X20037","X20038","X20039","X20045","X20047","X20053","X20054","X20055","X20067","X20068","X20075","X20076"]};var jumpIgnoreFloor=["MT31","snowTown","MT36","MT37","MT38","MT39","MT40","MT42","MT43","MT44","MT45","MT46","MT47"];function jumpSkill(){if(core.status.floorId.startsWith("tower"))return core.drawTip("\u5F53\u65E0\u6CD5\u4F7F\u7528\u8BE5\u6280\u80FD");if(jumpIgnoreFloor.includes(core.status.floorId)||flags.onChase){return core.drawTip("\u5F53\u524D\u697C\u5C42\u65E0\u6CD5\u4F7F\u7528\u8BE5\u6280\u80FD")}if(!flags.skill2)return;if(!flags["jump_"+core.status.floorId])flags["jump_"+core.status.floorId]=0;if(core.status.floorId=="MT14"){var _loc=core.status.hero.loc;if(_loc.x===77&&_loc.y===5){flags.MT14Jump=true}if(flags.jump_MT14===2&&!flags.MT14Jump){return core.drawTip("\u8BE5\u5730\u56FE\u8FD8\u6709\u4E00\u4E2A\u5FC5\u8DF3\u7684\u5730\u65B9\uFF0C\u4F60\u8FD8\u6CA1\u6709\u8DF3")}}if(flags["jump_"+core.status.floorId]>=3)return core.drawTip("\u5F53\u524D\u5730\u56FE\u4F7F\u7528\u6B21\u6570\u5DF2\u7528\u5B8C");var direction=core.status.hero.loc.direction;var loc=core.status.hero.loc;var checkLoc={};switch(direction){case"up":checkLoc.x=loc.x;checkLoc.y=loc.y-1;break;case"right":checkLoc.x=loc.x+1;checkLoc.y=loc.y;break;case"down":checkLoc.x=loc.x;checkLoc.y=loc.y+1;break;case"left":checkLoc.x=loc.x-1;checkLoc.y=loc.y;break;}var cls=core.getBlockCls(checkLoc.x,checkLoc.y);var noPass=core.noPass(checkLoc.x,checkLoc.y);var id=core.getBlockId(checkLoc.x,checkLoc.y)||"";var bgId=core.getBlockByNumber(core.getBgNumber(checkLoc.x,checkLoc.y)).event.id||"";if(!noPass||cls=="items"||id.startsWith("X")&&!ignoreInJump.event.includes(id)||bgId.startsWith("X")&&!ignoreInJump.bg.includes(bgId))return core.drawTip("\u5F53\u524D\u65E0\u6CD5\u4F7F\u7528\u6280\u80FD");if(noPass&&!(cls=="enemys"||cls=="enemy48")){var toLoc=checkNoPass(direction,checkLoc.x,checkLoc.y,true);if(!toLoc)return;core.autosave();if(flags.chapter<=1)core.status.hero.hp-=200*flags.hard;core.updateStatusBar();flags["jump_"+core.status.floorId]++;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose("\u4F60\u8DF3\u6B7B\u4E86")}core.playSound("015-Jump01.ogg");core.insertAction([{type:"jumpHero",loc:[toLoc.x,toLoc.y],time:500}])}if(cls=="enemys"||cls=="enemy48"){var firstNoPass=checkNoPass(direction,checkLoc.x,checkLoc.y,false);if(!firstNoPass)return;core.autosave();if(flags.chapter<=1)core.status.hero.hp-=200*flags.hard;core.updateStatusBar();flags["jump_"+core.status.floorId]++;if(core.status.hero.hp<=0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose("\u4F60\u8DF3\u6B7B\u4E86")}core.playSound("015-Jump01.ogg");core.insertAction([{type:"jump",from:[checkLoc.x,checkLoc.y],to:[firstNoPass.x,firstNoPass.y],time:500,keep:true}])}function checkNoPass(direction,x,y,startNo){if(!startNo)startNo=false;switch(direction){case"up":y--;break;case"right":x++;break;case"down":y++;break;case"left":x--;break;}if(x>core.status.thisMap.width-1||y>core.status.thisMap.height-1||x<0||y<0)return core.drawTip("\u5F53\u524D\u65E0\u6CD5\u4F7F\u7528\u6280\u80FD");var id=core.getBlockId(x,y)||"";if(core.getBgNumber(x,y))var bgId=core.getBlockByNumber(core.getBgNumber(x,y)).event.id||"";else var bgId="";if(core.noPass(x,y)||core.getBlockCls(x,y)=="items"||id.startsWith("X")&&!ignoreInJump.event.includes(id)||bgId.startsWith("X")&&!ignoreInJump.bg.includes(bgId)||core.getBlockCls(x,y)=="animates")return checkNoPass(direction,x,y,true);if(!startNo)return checkNoPass(direction,x,y,false);return{x:x,y:y}}}core.plugin.skillEffects={jumpSkill:jumpSkill,jumpIgnoreFloor:jumpIgnoreFloor};var skills$1=Object.freeze({__proto__:null,jumpIgnoreFloor:jumpIgnoreFloor,jumpSkill:jumpSkill});var levels=[];var skills={chapter1:[{index:0,title:"\u529B\u91CF",desc:["\u529B\u91CF\u5C31\u662F\u6839\u672C\uFF01\u53EF\u4EE5\u901A\u8FC7\u667A\u6167\u589E\u52A0\u529B\u91CF\uFF0C\u6BCF\u7EA7\u589E\u52A02\u70B9\u653B\u51FB\u3002"],consume:"10 * level + 10",front:[],loc:[1,2],max:10,effect:["\u653B\u51FB + ${level * 2}"]},{index:1,title:"\u81F4\u547D\u4E00\u51FB",desc:["\u7206\u53D1\u51FA\u5168\u90E8\u529B\u91CF\u653B\u51FB\u654C\u4EBA\uFF0C\u6BCF\u7EA7\u589E\u52A05\u70B9\u989D\u5916\u653B\u51FB\u3002"],consume:"30 * level + 30",front:[[0,5]],loc:[2,1],max:10,effect:["\u989D\u5916\u653B\u51FB + ${level * 5}"]},{index:2,title:"\u65AD\u706D\u4E4B\u5203",desc:["<span style=\"color: gold\">\u4E3B\u52A8\u6280\u80FD\uFF0C\u5FEB\u6377\u952E1</span>\uFF0C","\u5F00\u542F\u540E\u4F1A\u5728\u6218\u6597\u65F6\u4F1A\u989D\u5916\u589E\u52A0\u4E00\u5B9A\u91CF\u7684\u653B\u51FB\uFF0C\u4F46\u540C\u65F6\u51CF\u5C11\u4E00\u5B9A\u91CF\u7684\u9632\u5FA1\u3002"],consume:"200 * level + 400",front:[[1,5]],loc:[4,1],max:5,effect:["\u589E\u52A0${level * 10}%\u653B\u51FB\uFF0C\u51CF\u5C11${level * 10}%\u9632\u5FA1"]},{index:3,title:"\u575A\u97E7",desc:["\u7531\u667A\u6167\u8F6C\u5316\u51FA\u575A\u97E7\uFF01\u6BCF\u7EA7\u589E\u52A02\u70B9\u9632\u5FA1"],consume:"10 * level + 10",front:[],loc:[1,4],max:10,effect:["\u9632\u5FA1 + ${level * 2}"]},{index:4,title:"\u56DE\u6625",desc:["\u8BA9\u667A\u6167\u5316\u4E3A\u6CBB\u6108\u4E4B\u6CC9\u6C34\uFF01\u6BCF\u7EA7\u589E\u52A01\u70B9\u751F\u547D\u56DE\u590D"],consume:"20 * level + 20",front:[[3,5]],loc:[2,5],max:25,effect:["\u751F\u547D\u56DE\u590D + ${level}"]},{index:5,title:"\u6CBB\u6108\u4E4B\u6CC9",desc:["\u8BA9\u751F\u547D\u53D8\u5F97\u66F4\u591A\u4E00\u4E9B\u5427\uFF01\u6BCF\u540350\u74F6\u8840\u74F6\u5C31\u589E\u52A0\u5F53\u524D\u751F\u547D\u56DE\u590D10%\u7684\u751F\u547D\u56DE\u590D"],consume:"1500",front:[[4,25]],loc:[4,5],max:1,effect:["50\u74F6\u884010%\u751F\u547D\u56DE\u590D"]},{index:6,title:"\u575A\u56FA\u4E4B\u76FE",desc:["\u8BA9\u62A4\u7532\u66F4\u52A0\u575A\u786C\u4E00\u4E9B\u5427\uFF01\u6BCF\u7EA7\u589E\u52A010\u70B9\u9632\u5FA1"],consume:"50 + level * 50",front:[[3,5]],loc:[2,3],max:10,effect:["\u9632\u5FA1 + ${level * 10}"]},{index:7,title:"\u65E0\u4E0A\u4E4B\u76FE",desc:["<span style=\"color: #dd4\">\u7B2C\u4E00\u7AE0\u7EC8\u6781\u6280\u80FD</span>\uFF0C\u6218\u6597\u65F6\u667A\u6167\u4F1A\u5145\u5F53\u7B49\u91CF\u62A4\u76FE\uFF0C","\u5230\u8FBE\u7B2C\u4E8C\u7AE0\u540E<span style=\"color: gold\">\u6548\u679C\u53D8\u4E3A1/10</span>"],consume:"2500",front:[[6,10],[5,1],[2,2]],loc:[5,3],max:1,effect:["\u6218\u6597\u65F6\u667A\u6167\u4F1A\u5145\u5F53\u62A4\u76FE"]}],chapter2:[{index:8,title:"\u950B\u5229",desc:["\u8BA9\u5251\u53D8\u5F97\u66F4\u52A0\u950B\u5229\uFF01\u6BCF\u7EA7\u4F7F\u653B\u51FB\u589E\u52A01%\uFF08buff\u5F0F\u589E\u52A0\uFF09"],consume:"level > 5 ? 50 * level ** 2 : 250 * level + 250",front:[],loc:[1,2],max:15,effect:["\u653B\u51FB\u589E\u52A0${level}%"]},{index:9,title:"\u575A\u786C",desc:["\u8BA9\u76FE\u724C\u53D8\u5F97\u66F4\u52A0\u575A\u56FA\uFF01\u6BCF\u7EA7\u4F7F\u9632\u5FA1\u589E\u52A01%\uFF08buff\u5F0F\u589E\u52A0\uFF09"],consume:"level > 5 ? 50 * level ** 2 : 250 * level + 250",front:[],loc:[1,4],max:15,effect:["\u9632\u5FA1\u589E\u52A0${level}%"]},{index:10,title:"\u94F8\u5251\u4E3A\u76FE",desc:["<span style=\"color: gold\">\u4E3B\u52A8\u6280\u80FD\uFF0C\u5FEB\u6377\u952E3</span>\uFF0C","\u51CF\u5C11\u4E00\u5B9A\u7684\u653B\u51FB\uFF0C\u589E\u52A0\u4E00\u5B9A\u7684\u9632\u5FA1"],consume:"1000 * level ** 2 + 1000",front:[[9,5]],loc:[2,5],max:5,effect:["\u589E\u52A0${level * 10}%\u7684\u9632\u5FA1\uFF0C\u51CF\u5C11${level * 10}%\u7684\u653B\u51FB"]},{index:11,title:"\u5B66\u4E60",desc:["<span style=\"color: lightcoral\">\u5F53\u524D\u7248\u672C\u6B64\u6280\u80FD\u65E0\u6548\uFF01</span>","<span style=\"color: gold\">\u4E3B\u52A8\u6280\u80FD</span>\uFF0C\u53EF\u4EE5\u6D88\u8017500\u667A\u6167\u5B66\u4E60\u4E00\u4E2A\u602A\u7269\u7684\u6280\u80FD\uFF0C","\u6301\u7EED5\u573A\u6218\u6597\uFF0C\u6BCF\u5B66\u4E60\u4E00\u6B21\u6D88\u8017\u7684\u667A\u6167\u70B9\u589E\u52A0250\uFF0C\u6BCF\u6B21\u5347\u7EA7\u4F7F\u6301\u7EED\u7684\u6218\u6597\u6B21\u6570\u589E\u52A03\u6B21\u3002\u66F4\u591A\u4FE1\u606F\u53EF\u5728\u5B66\u4E60\u540E\u5728\u767E\u79D1\u5168\u4E66\u67E5\u770B\u3002"],consume:"2500 * 2 ** level + 5000",front:[[8,10],[12,5]],loc:[4,1],max:6,effect:["\u5B66\u4E60\u602A\u7269\u6280\u80FD\uFF0C\u6301\u7EED${level * 3 + 2}\u573A\u6218\u6597"]},{index:12,title:"\u806A\u6167",desc:["\u4F7F\u4E3B\u89D2\u53D8\u5F97\u66F4\u52A0\u806A\u660E\uFF0C\u6BCF\u7EA7\u4F7F\u7EFF\u5B9D\u77F3\u589E\u52A0\u7684\u667A\u6167\u70B9\u4E0A\u53475%"],consume:"level > 5 ? 100 * level ** 2 : 250 * level + 1250",front:[[8,10],[9,10]],loc:[3,3],max:20,effect:["\u589E\u52A0${level * 5}%\u7EFF\u5B9D\u77F3\u6548\u679C"]},{index:13,title:"\u6CBB\u6108",desc:["\u4F7F\u4E3B\u89D2\u80FD\u591F\u66F4\u597D\u5730\u56DE\u590D\u751F\u547D\uFF0C\u6BCF\u7EA7\u4F7F\u8840\u74F6\u7684\u52A0\u8840\u91CF\u589E\u52A02%"],consume:"level > 5 ? 100 * level ** 2 : 250 * level + 1250",front:[[10,3]],loc:[4,5],max:20,effect:["\u589E\u52A0${level * 2}%\u7684\u8840\u74F6\u56DE\u8840\u91CF"]},{index:14,title:"\u80DC\u5229\u4E4B\u53F7",desc:["<span style=\"color: #dd4\">\u7B2C\u4E8C\u7AE0\u7EC8\u6781\u6280\u80FD</span>\uFF0C","\u6BCF\u6253\u4E00\u4E2A\u602A\u7269\uFF0C\u52C7\u58EB\u5728\u672C\u697C\u5C42\u5BF9\u602A\u7269\u9020\u6210\u7684\u4F24\u5BB3\u4FBF\u589E\u52A01%"],consume:"15000",front:[[13,10],[12,10],[11,3]],loc:[5,3],max:1,effect:["\u6BCF\u6253\u4E00\u4E2A\u602A\uFF0C\u52C7\u58EB\u9020\u6210\u7684\u4F24\u5BB3\u589E\u52A01%"]}]};core.plugin.skills=skills;function getSkillFromIndex(index){for(var _i3=0,_Object$entries2=Object.entries(skills);_i3<_Object$entries2.length;_i3++){var _Object$entries2$_i=_slicedToArray(_Object$entries2[_i3],2),skill=_Object$entries2$_i[1];var s=skill.find(function(v){return v.index===index});if(s)return s}}function getSkillLevel(skill){var _levels,_levels$skill;return(_levels$skill=(_levels=levels)[skill])!==null&&_levels$skill!==void 0?_levels$skill:_levels[skill]=0}function getSkillConsume(skill){return eval(getSkillFromIndex(skill).consume.replace(/level(:\d+)?/g,function(str,$1){if($1)return"core.plugin.skillTree.getSkillLevel(".concat($1,")");else return"core.plugin.skillTree.getSkillLevel(".concat(skill,")")}))}function openTree(){if(main.replayChecking)return;core.plugin.skillTreeOpened.value=true}function canUpgrade(skill){var consume=core.plugin.skillTree.getSkillConsume(skill);if(consume>core.status.hero.mdef)return false;var level=core.plugin.skillTree.getSkillLevel(skill);var s=getSkillFromIndex(skill);if(level===s.max)return false;var front=s.front;var _iterator4=_createForOfIteratorHelper(front),_step4;try{for(_iterator4.s();!(_step4=_iterator4.n()).done;){var _step4$value=_slicedToArray(_step4.value,2),_skill=_step4$value[0],_level2=_step4$value[1];if(core.plugin.skillTree.getSkillLevel(_skill)<_level2)return false}}catch(err){_iterator4.e(err)}finally{_iterator4.f()}return true}function upgradeSkill(skill){if(!canUpgrade(skill))return false;switch(skill){case 0:core.status.hero.atk+=2;break;case 1:core.status.hero.mana+=5;break;case 2:core.setFlag("bladeOn",true);break;case 3:core.status.hero.def+=2;break;case 4:core.status.hero.hpmax+=1;break;case 5:core.setFlag("spring",true);break;case 6:core.status.hero.def+=10;break;case 7:core.setFlag("superSheild",true);break;case 8:core.addBuff("atk",0.01);break;case 9:core.addBuff("def",0.01);break;case 10:core.setFlag("shieldOn",true);break;case 11:core.setItem("I565",1);break;}var consume=getSkillConsume(skill);core.status.hero.mdef-=consume;levels[skill]++;core.updateStatusBar();return true}function saveSkillTree(){return levels.slice()}function loadSkillTree(data){levels=data!==null&&data!==void 0?data:[]}core.plugin.skillTree={getSkillConsume:getSkillConsume,getSkillFromIndex:getSkillFromIndex,getSkillLevel:getSkillLevel,saveSkillTree:saveSkillTree,loadSkillTree:loadSkillTree,upgradeSkill:upgradeSkill,openTree:openTree};var skillTree=Object.freeze({__proto__:null,canUpgrade:canUpgrade,getSkillConsume:getSkillConsume,getSkillFromIndex:getSkillFromIndex,getSkillLevel:getSkillLevel,loadSkillTree:loadSkillTree,openTree:openTree,saveSkillTree:saveSkillTree,upgradeSkill:upgradeSkill});var stage=1,hp=10000,seconds=0,boomLocs=[],heroHp;function initTowerBoss(){stage=1;hp=10000;seconds=0;heroHp=core.status.hero.hp;dynamicChangeHp(0,10000,10000);autoFixRouteBoss(true);core.insertAction([{type:"sleep",time:1000,noSkip:true}]);setTimeout(bossCore,1000)}function autoFixRouteBoss(isStart){var route=core.status.route;if(isStart){flags.startFix=route.length-1;return}route.splice(flags.startFix);route.push("choices:0");delete flags.startFix}function healthBar(now,total){var nowLength=now/total*476;var color=[255*2-now/total*2*255,now/total*2*255,0,1];if(!core.dymCanvas.healthBar)core.createCanvas("healthBar",0,0,480,16,140);else core.clearMap("healthBar");core.fillRect("healthBar",0,0,480,16,"#bbbbbb");var style=document.getElementById("healthBar").getContext("2d");style.shadowColor="rgba(0, 0, 0, 0.8)";style.shadowBlur=5;style.shadowOffsetX=10;style.shadowOffsetY=5;style.filter="blur(1px)";core.fillRect("healthBar",2,2,nowLength,12,color);style.shadowColor="rgba(0, 0, 0, 0.5)";style.shadowOffsetX=0;style.shadowOffsetY=0;core.strokeRect("healthBar",1,1,478,14,"#ffffff",2);style.shadowColor="rgba(0, 0, 0, 1)";style.shadowBlur=3;style.shadowOffsetX=2;style.shadowOffsetY=1;style.filter="none";core.fillText("healthBar",now+"/"+total,5,13.5,"#ffffff","16px normal")}function dynamicChangeHp(from,to,total){var frame=0,speed=(to-from)/50,now=from;var interval=window.setInterval(function(){frame++;if(frame==50){clearInterval(interval);healthBar(to,total)}now+=speed;healthBar(now,total)},20)}function skipWord(words,x,y,time){x=x||0;y=y||16;time=time||3000;if(!core.dymCanvas.words)core.createCanvas("words",x,y,480,24,135);else core.clearMap("words");if(flags.wordsTimeOut)clearTimeout(flags.wordsTimeOut);dynamicCurtain(y,y+24,time/3);var style=document.getElementById("words").getContext("2d");style.shadowColor="rgba(0, 0, 0, 1)";style.shadowBlur=3;style.shadowOffsetX=2;style.shadowOffsetY=1;skip1(0);function skip1(now){if(parseInt(now)>=words.length){flags.wordsTimeOut=setTimeout(function(){core.deleteCanvas("words");core.deleteCanvas("wordsBg")},time);return}var frame=0,blur=2,nx=4+now*24;var skip2=window.setInterval(function(){blur-=0.4;frame++;core.clearMap("words",nx,0,24,24);style.filter="blur("+blur+"px)";core.fillText("words",words[now],nx,20,"#ffffff","22px normal");if(frame==5){clearInterval(skip2);skip1(now+1)}},20)}}function dynamicCurtain(from,to,time,width){width=width||480;if(!core.dymCanvas.wordsBg)core.createCanvas("wordsBg",0,from,width,24,130);else core.clearMap("wordsBg");time/=1000;var ny=from,frame=0,a=2*(to-from)/Math.pow(time*50,2),speed=a*time*50;var style=document.getElementById("wordsBg").getContext("2d");style.shadowColor="rgba(0, 0, 0, 0.8)";var wordsInterval=window.setInterval(function(){frame++;speed-=a;ny+=speed;core.clearMap("wordsBg");style.shadowBlur=8;style.shadowOffsetY=2;core.fillRect("wordsBg",0,0,width,ny-from,[180,180,180,0.7]);style.shadowBlur=3;style.shadowOffsetY=0;core.strokeRect("wordsBg",1,1,width-2,ny-from-2,[255,255,255,0.7],2);if(frame>=time*50){clearInterval(wordsInterval);core.clearMap("wordsBg");style.shadowBlur=8;style.shadowOffsetY=2;core.fillRect("wordsBg",0,0,width,to-from,[180,180,180,0.7]);style.shadowBlur=3;style.shadowOffsetY=0;core.strokeRect("wordsBg",1,1,width-2,ny-from-2,[255,255,255,0.7],2)}},20)}function attackBoss(){if(flags.canAttack)return;if(Math.random()<0.8)return;if(hp>3500){var nx=Math.floor(Math.random()*13+1),ny=Math.floor(Math.random()*13+1)}else if(hp>2000){var nx=Math.floor(Math.random()*11+2),ny=Math.floor(Math.random()*11+2)}else if(hp>1000){var nx=Math.floor(Math.random()*9+3),ny=Math.floor(Math.random()*9+3)}else{var nx=Math.floor(Math.random()*7+4),ny=Math.floor(Math.random()*7+4)}flags.canAttack=true;if(!core.dymCanvas.attackBoss)core.createCanvas("attackBoss",0,0,480,480,35);else core.clearMap("attackBoss");var style=document.getElementById("attackBoss").getContext("2d");var frame1=0,blur=3,scale=2,speed=0.04,a=0.0008;var atkAnimate=window.setInterval(function(){core.clearMap("attackBoss");frame1++;speed-=a;scale-=speed;blur-=0.06;style.filter="blur("+blur+"px)";core.strokeCircle("attackBoss",nx*32+16,ny*32+16,16*scale,[255,150,150,0.7],4);core.fillCircle("attackBoss",nx*32+16,ny*32+16,3*scale,[255,150,150,0.7]);if(frame1==50){clearInterval(atkAnimate);core.clearMap("attactkBoss");style.filter="none";core.strokeCircle("attackBoss",nx*32+16,ny*32+16,16,[255,150,150,0.7],4);core.fillCircle("attackBoss",nx*32+16,ny*32+16,3,[255,150,150,0.7])}},20);var frame2=0;var atkBoss=window.setInterval(function(){frame2++;var x=core.status.hero.loc.x,y=core.status.hero.loc.y;if(frame2>100){setTimeout(function(){delete flags.canAttack},4000);clearInterval(atkBoss);core.deleteCanvas("attackBoss");return}if(nx==x&&ny==y){setTimeout(function(){delete flags.canAttack},4000);dynamicChangeHp(hp,hp-500,10000);hp-=500;clearInterval(atkBoss);core.deleteCanvas("attackBoss");if(hp>3500)core.drawAnimate("hand",7,1);else if(hp>2000)core.drawAnimate("hand",7,2);else if(hp>1000)core.drawAnimate("hand",7,3);else core.drawAnimate("hand",7,4);return}},20)}function bossCore(){var interval=window.setInterval(function(){if(stage==1){if(seconds==8)skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u679C\u7136\uFF0C\u4F60\u548C\u522B\u4EBA\u4E0D\u4E00\u6837\u3002");if(seconds==12)skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u4F60\u77E5\u9053\u53BB\u8EB2\u907F\u90A3\u4E9B\u653B\u51FB\u3002");if(seconds==16)skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u4E4B\u524D\u7684\u90A3\u4E9B\u4EBA\u603B\u4F1A\u4E00\u5934\u649E\u4E0A\u6211\u7684\u653B\u51FB\uFF0C\u60B2\u5267\u6536\u573A\u3002");if(seconds==20)skipWord("\u63D0\u793A\uFF1A\u8E29\u5728\u7EA2\u5708\u4E0A\u53EF\u4EE5\u5BF9\u667A\u6167\u4E4B\u795E\u9020\u6210\u4F24\u5BB3");if(seconds>10)attackBoss();if(seconds%10==0)intelligentArrow();if(seconds%7==0&&seconds!=0)intelligentDoor();if(seconds>20&&seconds%13==0)icyMomentem()}if(stage==1&&hp<=7000){stage++;seconds=0;skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u4E0D\u9519\u5C0F\u4F19\u5B50");core.pauseBgm()}if(stage==2){if(seconds==4)skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u4F60\u7684\u786E\u62E5\u6709\u667A\u6167\u3002");if(seconds==8)skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u6216\u8BB8\u4F60\u5C31\u662F\u90A3\u4E2A\u672A\u6765\u7684\u6551\u661F\u3002");if(seconds==12)skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u4E0D\u8FC7\uFF0C\u8FD9\u573A\u6218\u6597\u624D\u521A\u521A\u5F00\u59CB");if(seconds==25)skipWord("\u63D0\u793A\uFF1A\u65B9\u5F62\u533A\u57DF\u5747\u4E3A\u5371\u9669\u533A\u57DF");if(seconds==15)setTimeout(function(){core.playSound("thunder.mp3")},500);if(seconds==16)startStage2();if(seconds>20)attackBoss();if(seconds%4==0&&seconds>20)randomThunder();if(seconds>30&&seconds%12==0)ballThunder()}if(hp<=3500&&stage==2){stage++;seconds=0;skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u4E0D\u5F97\u4E0D\u8BF4\u5C0F\u4F19\u5B50");core.pauseBgm()}if(stage>=3){if(seconds==4)skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u62E5\u6709\u667A\u6167\u5C31\u662F\u4E0D\u4E00\u6837\u3002");if(seconds==8)skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u4E0D\u8FC7\uFF0C\u4F60\u8FD8\u5F97\u518D\u8FC7\u6211\u4E00\u5173\uFF01");if(seconds==12)startStage3();if(seconds==15){flags.booming=true;randomBoom()}if(seconds>20)attackBoss();if(seconds>20&&seconds%10==0)chainThunder();if(hp==2000&&stage==3){stage++;flags.booming=false;skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u8FD8\u6CA1\u6709\u7ED3\u675F\uFF01");startStage4();setTimeout(function(){flags.booming=true;randomBoom()},5000)}if(hp==1000&&stage==4){stage++;flags.booming=false;skipWord("\u667A\u6167\u4E4B\u795E\uFF1A\u8FD8\u6CA1\u6709\u7ED3\u675F\uFF01\uFF01\uFF01\uFF01\uFF01\uFF01");startStage5();setTimeout(function(){flags.booming=true;randomBoom()},5000)}}if(hp==0){clearInterval(interval);clearInterval(flags.boom);core.status.hero.hp=heroHp;core.plugin.towerBoss.autoFixRouteBoss(false);delete flags.__bgm__;core.pauseBgm();core.insertAction(["\t[\u667A\u6167\u4E4B\u795E,E557]\b[down,7,4]\u770B\u6765\u4F60\u771F\u7684\u4F1A\u6210\u4E3A\u90A3\u4E2A\u62EF\u6551\u672A\u6765\u7684\u4EBA\u3002","\t[\u667A\u6167\u4E4B\u795E,E557]\b[down,7,4]\u8BB0\u4F4F\uFF0C\u62E5\u6709\u667A\u6167\u4FBF\u53EF\u4EE5\u638C\u63A7\u4E07\u7269\u3002","\t[\u4F4E\u7EA7\u667A\u4EBA]\b[up,hero]\u667A\u6167\uFF1F\u667A\u6167\u5230\u5E95\u662F\u4EC0\u4E48\uFF1F","\t[\u667A\u6167\u4E4B\u795E,E557]\b[down,7,4]\u6700\u7EC8\uFF0C\u4F60\u4F1A\u77E5\u9053\u7B54\u6848\u7684\u3002","\t[\u667A\u6167\u4E4B\u795E,E557]\b[down,7,4]\u7EE7\u7EED\u5411\u4E1C\u524D\u8FDB\u5427\uFF0C\u90A3\u91CC\u80FD\u627E\u5230\u4F60\u60F3\u8981\u7684\u7B54\u6848\u3002",{type:"openDoor",loc:[13,6],floorId:"MT19"},"\t[\u667A\u6167\u4E4B\u795E,E557]\b[down,7,4]\u6211\u8FD9\u5C31\u628A\u4F60\u9001\u51FA\u53BB",{type:"setValue",name:"flag:boss1",value:"true"},{type:"changeFloor",floorId:"MT20",loc:[7,9]},{type:"forbidSave"},{type:"showStatusBar"},{type:"function","function":"() => {\ncore.deleteAllCanvas();\n}"}])}seconds++},1000)}function intelligentArrow(fromSelf){var loc=Math.floor(Math.random()*13+1);var direction=Math.random()>0.5?"horizon":"vertical";if(!fromSelf){var times=Math.ceil(Math.random()*8)+4;var nowTime=1;var times1=window.setInterval(function(){intelligentArrow(true);nowTime++;if(nowTime>=times){clearInterval(times1)}},200)}if(core.dymCanvas["inteArrow"+loc+direction])return intelligentArrow(true);if(!core.dymCanvas.danger1)core.createCanvas("danger1",0,0,480,480,35);if(direction=="horizon"){for(var nx=1;nx<14;nx++){core.fillRect("danger1",nx*32+2,loc*32+2,28,28,[255,0,0,0.6])}}else{for(var ny=1;ny<14;ny++){core.fillRect("danger1",loc*32+2,ny*32+2,28,28,[255,0,0,0.6])}}if(!core.dymCanvas["inteArrow"+loc+direction])core.createCanvas("inteArrow"+loc+direction,0,0,544,544,65);core.clearMap("inteArrow"+loc+direction);if(direction=="horizon")core.drawImage("inteArrow"+loc+direction,"arrow.png",448,loc*32,102,32);else core.drawImage("inteArrow"+loc+direction,"arrow.png",0,0,259,75,loc*32-32,480,102,32,Math.PI/2);setTimeout(function(){core.playSound("arrow.mp3");core.deleteCanvas("danger1");var nloc=0,speed=0;var damaged={};var skill1=window.setInterval(function(){speed-=1;nloc+=speed;if(direction=="horizon")core.relocateCanvas("inteArrow"+loc+direction,nloc,0);else core.relocateCanvas("inteArrow"+loc+direction,0,nloc);if(nloc<-480){core.deleteCanvas("inteArrow"+loc+direction);clearInterval(skill1)}if(!damaged[loc+direction]){var x=core.status.hero.loc.x,y=core.status.hero.loc.y;if(direction=="horizon"){if(y==loc&&Math.floor((480+nloc)/32)==x){damaged[loc+direction]=true;core.drawHeroAnimate("hand");core.status.hero.hp-=1000;core.addPop(x*32+16,y*32+16,-1000);core.updateStatusBar();if(core.status.hero.hp<0){clearInterval(skill1);core.status.hero.hp=0;core.updateStatusBar();core.events.lose();return}}}else{if(x==loc&&Math.floor((480+nloc)/32)==y){damaged[loc+direction]=true;core.drawHeroAnimate("hand");core.status.hero.hp-=1000;core.addPop(x*32+16,y*32+16,-1000);core.updateStatusBar();if(core.status.hero.hp<0){clearInterval(skill1);core.status.hero.hp=0;core.updateStatusBar();core.events.lose();return}}}}},20)},3000)}function intelligentDoor(){if(Math.random()<0.5)return;var toX=Math.floor(Math.random()*13)+1,toY=Math.floor(Math.random()*13)+1;core.drawHeroAnimate("magicAtk");if(!core.dymCanvas["door"+toX+"_"+toY])core.createCanvas("door"+toX+"_"+toY,0,0,480,480,35);else core.clearMap("door"+toX+"_"+toY);var style=document.getElementById("door"+toX+"_"+toY).getContext("2d");var frame=0,width=0,a=0.0128,speed=0.64;var skill2=window.setInterval(function(){frame++;if(frame<40)return;if(frame==100){clearInterval(skill2);core.insertAction([{type:"changePos",loc:[toX,toY]}]);setTimeout(function(){core.deleteCanvas("door"+toX+"_"+toY)},2000);return}width+=speed*2;speed-=a;core.clearMap("door"+toX+"_"+toY);style.shadowColor="rgba(255, 255, 255, 1)";style.shadowBlur=7;style.filter="blur(5px)";core.fillRect("door"+toX+"_"+toY,toX*32,toY*32-24,width,48,[255,255,255,0.7]);style.shadowColor="rgba(0, 0, 0, 0.5)";style.filter="blur(3px)";core.strokeRect("door"+toX+"_"+toY,toX*32,toY*32-24,width,48,[255,255,255,0.7],3)},20)}function icyMomentem(){if(flags.haveIce)return;if(Math.random()<0.5)return;var times=Math.floor(Math.random()*100);var locs=[],now=0;flags.haveIce=true;if(!core.dymCanvas.icyMomentem)core.createCanvas("icyMomentem",0,0,480,480,35);else core.clearMap("icyMomentem");var skill3=window.setInterval(function(){var nx=Math.floor(Math.random()*13)+1,ny=Math.floor(Math.random()*13)+1;if(!locs.includes([nx,ny])){locs.push([nx,ny]);core.fillRect("icyMomentem",locs[now][0]*32+2,locs[now][1]*32+2,28,28,[150,150,255,0.6])}if(now==times){clearInterval(skill3);skill3Effect()}now++},20);function skill3Effect(){var index=0;var effect=window.setInterval(function(){var x=core.status.hero.loc.x,y=core.status.hero.loc.y;core.clearMap("icyMomentem",locs[index][0]*32,locs[index][1]*32,32,32);core.setBgFgBlock("bg",167,locs[index][0],locs[index][1]);core.drawAnimate("ice",locs[index][0],locs[index][1]);if(x==locs[index][0]&&y==locs[index][1]){core.drawHeroAnimate("hand");core.status.hero.hp-=5000;core.addPop(x*32+16,y*32+16,-5000);core.updateStatusBar();if(core.status.hero.hp<0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose();clearInterval(effect);return}}if(index>=locs.length-1){clearInterval(effect);setTimeout(function(){deleteIce(locs)},5000)}index++},50)}function deleteIce(locs){var index=0;var deleteIce=window.setInterval(function(){core.setBgFgBlock("bg",0,locs[index][0],locs[index][1]);index++;if(index>=locs.length){clearInterval(deleteIce);core.deleteCanvas("icyMomentem");setTimeout(function(){delete flags.haveIce},5000)}},50)}}function startStage2(){core.createCanvas("flash",0,0,480,480,160);var alpha=0;var frame=0;var start1=window.setInterval(function(){core.clearMap("flash");frame++;if(frame<=8)alpha+=0.125;else alpha-=0.01;core.fillRect("flash",0,0,480,480,[255,255,255,alpha]);if(alpha==0){clearInterval(start1);core.deleteCanvas("flash")}if(frame==8){changeWeather()}});function changeWeather(){core.setWeather();core.setWeather("rain",10);core.setWeather("fog",8);core.setCurtain([0,0,0,0.3]);core.playBgm("towerBoss2.mp3")}}function randomThunder(){var x=Math.floor(Math.random()*13)+1,y=Math.floor(Math.random()*13)+1,power=Math.ceil(Math.random()*6);if(!core.dymCanvas.thunderDanger)core.createCanvas("thunderDanger",0,0,480,480,35);else core.clearMap("thunderDanger");for(var nx=x-1;nx<=x+1;nx++){for(var ny=y-1;ny<=y+1;ny++){core.fillRect("thunderDanger",nx*32+2,ny*32+2,28,28,[255,255,255,0.6])}}core.deleteCanvas("flash");setTimeout(function(){core.playSound("thunder.mp3")},500);setTimeout(function(){core.deleteCanvas("thunderDanger");drawThunder(x,y,power)},1000)}function drawThunder(x,y,power){var route=getThunderRoute(x*32+16,y*32+16,power);if(!core.dymCanvas.thunder)core.createCanvas("thunder",0,0,480,480,65);else core.clearMap("thunder");var style=core.dymCanvas.thunder;style.shadowColor="rgba(220, 220, 255, 1)";style.shadowBlur=power;style.filter="blur(2.5px)";for(var num in route){for(var i=0;i<route[num].length-1;i++){var now=route[num][i],next=route[num][i+1];core.drawLine("thunder",now[0],now[1],next[0],next[1],"#ffffff",2.5)}}getThunderRoute(x,y,power);var frame1=0,alpha=0.5;if(!core.dymCanvas.flash)core.createCanvas("flash",0,0,480,480,160);else core.clearMap("flash");var thunderFlash=window.setInterval(function(){alpha-=0.05;frame1++;core.clearMap("flash");core.fillRect("flash",0,0,480,480,[255,255,255,alpha]);if(frame1>=10){clearInterval(thunderFlash);core.deleteCanvas("flash");setTimeout(function(){core.deleteCanvas("thunder")},700)}},20)}function getThunderRoute(x,y,power){var route=[];for(var num=0;num<power;num++){var nx=x,ny=y;route[num]=[];for(var i=0;ny>=0;i++){if(i>0){nx+=Math.random()*30-15;ny-=Math.random()*80+30}else{nx+=Math.random()*16-8;ny+=Math.random()*16-8}route[num].push([nx,ny])}}return route}function ballThunder(){var times=Math.ceil(Math.random()*12)+6;var now=0,locs=[];var ballThunder=window.setInterval(function(){if(!core.dymCanvas["ballThunder"+now])core.createCanvas("ballThunder"+now,0,0,480,480,35);else core.clearMap("ballThunder"+now);var nx=Math.floor(Math.random()*13)+1,ny=Math.floor(Math.random()*13)+1;if(!locs.includes([nx,ny])){locs.push([nx,ny]);for(var mx=1;mx<14;mx++){core.fillRect("ballThunder"+now,mx*32+2,ny*32+2,28,28,[190,190,255,0.6])}for(var my=1;my<14;my++){core.fillRect("ballThunder"+now,nx*32+2,my*32+2,28,28,[190,190,255,0.6])}}now++;if(now>=times){clearInterval(ballThunder);setTimeout(function(){thunderAnimate(locs)},1000)}},200);function thunderAnimate(locs){var frame=0;if(!core.dymCanvas.ballAnimate)core.createCanvas("ballAnimate",0,0,480,480,65);else core.clearMap("ballAnimate");var style=core.dymCanvas.ballAnimate;style.shadowColor="rgba(255, 255, 255, 1)";var damaged=[];var animate=window.setInterval(function(){core.clearMap("ballAnimate");for(var i=0;i<locs.length;i++){style.shadowBlur=16*Math.random();if(frame-10*i>0){var now=frame-10*i;if(now==1)core.playSound("electron.mp3");var nx=locs[i][0]*32+16,ny=locs[i][1]*32+16;if(now<=2){core.fillCircle("ballAnimate",nx,ny,16+3*now,[255,255,255,0.9])}else{core.fillCircle("ballAnimate",nx,ny-4*now,7+2*Math.random(),[255,255,255,0.7]);core.fillCircle("ballAnimate",nx,ny+4*now,7+2*Math.random(),[255,255,255,0.7]);core.fillCircle("ballAnimate",nx-4*now,ny,7+2*Math.random(),[255,255,255,0.7]);core.fillCircle("ballAnimate",nx+4*now,ny,7+2*Math.random(),[255,255,255,0.7])}core.clearMap("ballThunder"+i,nx-16,ny-16-4*now,32,32);core.clearMap("ballThunder"+i,nx-16,ny-16+4*now,32,32);core.clearMap("ballThunder"+i,nx-16-4*now,ny-16,32,32);core.clearMap("ballThunder"+i,nx-16+4*now,ny-16,32,32);if(!damaged[i]){var x=core.status.hero.loc.x,y=core.status.hero.loc.y;if((Math.floor((nx-16-4*now)/32)==x||Math.floor((nx-16+4*now)/32)==x)&&locs[i][1]==y||(Math.floor((ny-16-4*now)/32)==y||Math.floor((ny-16+4*now)/32)==y)&&locs[i][0]==x){damaged[i]=true;core.status.hero.hp-=3000;core.addPop(x*32+16,y*32+16,-3000);core.updateStatusBar();core.playSound("electron.mp3");if(core.status.hero.hp<0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose();clearInterval(animate);return}}}if(i==locs.length-1&&now>120){clearInterval(animate)}}}frame++},20)}}function startStage3(){core.createCanvas("flash",0,0,480,480,160);var alpha=0;var frame=0;var start1=window.setInterval(function(){core.clearMap("flash");frame++;if(frame<=8)alpha+=0.125;else alpha-=0.01;core.fillRect("flash",0,0,480,480,[255,255,255,alpha]);if(alpha==0){clearInterval(start1);core.deleteCanvas("flash")}if(frame==8){core.playSound("thunder.mp3");changeTerra();core.insertAction([{type:"changePos",loc:[7,7]}])}});function changeTerra(){for(var nx=0;nx<15;nx++){for(var ny=0;ny<15;ny++){if(nx==0||nx==14||ny==0||ny==14){core.removeBlock(nx,ny)}if((nx==1||nx==13||ny==1||ny==13)&&nx!=0&&nx!=14&&ny!=0&&ny!=14){core.setBlock(527,nx,ny)}}}core.createCanvas("tower7",0,0,480,480,15);core.drawImage("tower7","tower7.jpeg",360,0,32,480,0,0,32,480);core.drawImage("tower7","tower7.jpeg",840,0,32,480,448,0,32,480);core.drawImage("tower7","tower7.jpeg",392,0,416,32,32,0,416,32);core.drawImage("tower7","tower7.jpeg",392,448,416,32,32,448,416,32);core.setBlock("E557",7,2);core.playBgm("towerBoss3.mp3")}}function startStage4(){core.createCanvas("flash",0,0,480,480,160);var alpha=0;var frame=0;var start1=window.setInterval(function(){core.clearMap("flash");frame++;if(frame<=8)alpha+=0.125;else alpha-=0.01;core.fillRect("flash",0,0,480,480,[255,255,255,alpha]);if(alpha==0){clearInterval(start1);core.deleteCanvas("flash")}if(frame==8){core.playSound("thunder.mp3");changeTerra();core.insertAction([{type:"changePos",loc:[7,7]}])}});function changeTerra(){for(var nx=1;nx<14;nx++){for(var ny=1;ny<14;ny++){if(nx==1||nx==13||ny==1||ny==13){core.removeBlock(nx,ny)}if((nx==2||nx==12||ny==2||ny==12)&&nx!=1&&nx!=13&&ny!=1&&ny!=13){core.setBlock(527,nx,ny)}}}core.createCanvas("tower7",0,0,480,480,15);core.drawImage("tower7","tower7.jpeg",360,0,64,480,0,0,64,480);core.drawImage("tower7","tower7.jpeg",776,0,64,480,416,0,64,480);core.drawImage("tower7","tower7.jpeg",424,0,352,64,64,0,352,64);core.drawImage("tower7","tower7.jpeg",424,416,352,64,64,416,352,64);core.setBlock("E557",7,3)}}function startStage5(){core.createCanvas("flash",0,0,480,480,160);var alpha=0;var frame=0;var start1=window.setInterval(function(){core.clearMap("flash");frame++;if(frame<=8)alpha+=0.125;else alpha-=0.01;core.fillRect("flash",0,0,480,480,[255,255,255,alpha]);if(alpha==0){clearInterval(start1);core.deleteCanvas("flash")}if(frame==8){core.playSound("thunder.mp3");changeTerra();core.insertAction([{type:"changePos",loc:[7,7]}])}});function changeTerra(){for(var nx=2;nx<13;nx++){for(var ny=2;ny<13;ny++){if(nx==2||nx==12||ny==2||ny==12){core.removeBlock(nx,ny)}if((nx==3||nx==11||ny==3||ny==11)&&nx!=2&&nx!=12&&ny!=2&&ny!=12){core.setBlock(527,nx,ny)}}}core.createCanvas("tower7",0,0,480,480,15);core.drawImage("tower7","tower7.jpeg",360,0,96,480,0,0,96,480);core.drawImage("tower7","tower7.jpeg",744,0,96,480,384,0,96,480);core.drawImage("tower7","tower7.jpeg",456,0,288,96,96,0,288,96);core.drawImage("tower7","tower7.jpeg",456,384,288,96,96,384,288,96);core.setBlock("E557",7,4)}}function chainThunder(){var times=Math.ceil(Math.random()*6)+3;if(!core.dymCanvas.chainDanger)core.createCanvas("chainDanger",0,0,480,480,35);else core.clearMap("chainDanger");var locs=[],now=0;var chain=window.setInterval(function(){if(hp>2000){var nx=Math.floor(Math.random()*11)+2,ny=Math.floor(Math.random()*11)+2}else if(hp>1000){var nx=Math.floor(Math.random()*9)+3,ny=Math.floor(Math.random()*9)+3}else{var nx=Math.floor(Math.random()*7)+4,ny=Math.floor(Math.random()*7)+4}if(!locs.includes([nx,ny])){locs.push([nx,ny])}else return;if(now>0){core.drawLine("chainDanger",locs[now-1][0]*32+16,locs[now-1][1]*32+16,nx*32+16,ny*32+16,[220,100,255,0.6],3)}if(now>=times){clearInterval(chain);setTimeout(function(){getChainRoute(locs);core.deleteCanvas("chainDanger")},1000)}now++},100)}function chainAnimate(route){if(!route)return chainThunder();if(!core.dymCanvas.chain)core.createCanvas("chain",0,0,480,480,65);else core.clearMap("chain");var style=core.dymCanvas.chain;style.shadowBlur=3;style.shadowColor="rgba(255, 255, 255, 1)";style.filter="blur(2px)";var frame=0,now=0;var animate=window.setInterval(function(){if(now>=route.length-1){clearInterval(animate);setTimeout(function(){core.deleteCanvas("chain")},1000);return}frame++;if(frame%2!=0)return;core.drawLine("chain",route[now][0],route[now][1],route[now+1][0],route[now+1][1],"#ffffff",3);if(now==0){core.fillCircle("chain",route[0][0],route[0][1],7,"#ffffff")}if((route[now+1][0]-16)%32==0&&(route[now+1][1]-16)%32==0){core.fillCircle("chain",route[now+1][0],route[now+1][1],7,"#ffffff")}lineDamage(route[now][0],route[now][1],route[now+1][0],route[now+1][1],4000);now++},20)}function getChainRoute(locs){var now=0,routes=[];var route=window.setInterval(function(){var nx=locs[now][0]*32+16,ny=locs[now][1]*32+16;var tx=locs[now+1][0]*32+16,ty=locs[now+1][1]*32+16;var dx=tx-nx,dy=ty-ny;var angle=Math.atan(dy/dx);if(dy<0&&dx<0)angle+=Math.PI;if(dx<0&&dy>0)angle+=Math.PI;var times=0;while(true){times++;nx+=Math.random()*50*Math.cos(angle);ny+=Math.random()*50*Math.sin(angle);routes.push([nx,ny]);if(Math.sqrt(Math.pow(ny-ty,2)+Math.pow(nx-tx,2))<=100){routes.push([tx,ty]);break}if(times>=20){clearInterval(route);routes=null;return}}now++;if(now>=locs.length-1){clearInterval(route);chainAnimate(routes)}},2)}function randomBoom(){if(!flags.booming){clearInterval(flags.boom);return}var boomTime;var range;if(hp>2000){boomTime=500;range=11}else if(hp>1000){boomTime=400;range=9}else{boomTime=300;range=7}flags.boom=window.setInterval(function(){var nx=Math.floor(Math.random()*range)+(15-range)/2,ny=Math.floor(Math.random()*range)+(15-range)/2;boomLocs.push([nx,ny,0]);if(!flags.booming)clearInterval(flags.boom)},boomTime);boomingAnimate()}function boomingAnimate(){if(!core.dymCanvas.boom)core.createCanvas("boom",0,0,480,480,65);else core.clearMap("boom");var boomAnimate=window.setInterval(function(){if(boomLocs.length==0)return;if(!flags.booming&&boomLocs.length==0){clearInterval(boomAnimate);return}core.clearMap("boom");boomLocs.forEach(function(loc,index){loc[2]++;var x=loc[0]*32+16,y=loc[1]*32+16;if(loc[2]>=20){var alpha=1,radius=12}else{var radius=0.12*Math.pow(20-loc[2],2)+12,alpha=Math.max(1,2-loc[2]*0.1)}var angle=loc[2]*Math.PI/50;core.fillCircle("boom",x,y,3,[255,50,50,alpha]);core.strokeCircle("boom",x,y,radius,[255,50,50,alpha],2);core.drawLine("boom",x+radius*Math.cos(angle),y+radius*Math.sin(angle),x+(radius+15)*Math.cos(angle),y+(radius+15)*Math.sin(angle),[255,50,50,alpha],1);angle+=Math.PI;core.drawLine("boom",x+radius*Math.cos(angle),y+radius*Math.sin(angle),x+(radius+15)*Math.cos(angle),y+(radius+15)*Math.sin(angle),[255,50,50,alpha],1);if(loc[2]>70){var h=y-(20*(85-loc[2])+2.8*Math.pow(85-loc[2],2));core.drawImage("boom","boom.png",x-18,h-80,36,80)}if(loc[2]==85){core.drawAnimate("explosion1",(x-16)/32,(y-16)/32);boomLocs.splice(index,1);if(boomLocs.length==0)core.deleteCanvas("boom");var hx=core.status.hero.loc.x,hy=core.status.hero.loc.y;if(loc[0]==hx&&loc[1]==hy){core.status.hero.hp-=3000;core.addPop(x*32+16,y*32+16,-3000);core.updateStatusBar();if(core.status.hero.hp<0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose();clearInterval(boomAnimate);flags.booming=false;return}}}})},20)}function lineDamage(x1,y1,x2,y2,damage){var x=core.status.hero.loc.x,y=core.status.hero.loc.y;if(x1<x*32-12&&x2<x*32-12||x1>x*32+12&&x2>x*32+12||y1<y*32-16&&y2<y*32-16||y1>y*32+16&&y2>y*32+16)return;for(var time=1;time<=2;time++){if(time==1){var loc1=[x*32-12,y*32+16],loc2=[x*32+12,y*32-16];var n1=(y2-y1)/(x2-x1)*(loc1[0]-x1)+y1-loc1[1],n2=(y2-y1)/(x2-x1)*(loc2[0]-x1)+y1-loc2[1];if(n1*n2<=0){core.status.hero.hp-=damage;core.addPop(x*32+16,y*32+16,-damage);core.updateStatusBar();core.playSound("electron.mp3");if(core.status.hero.hp<0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose();return}return}}else{var loc1=[x*32-12,y*32-16],loc2=[x*32+12,y*32+16];var n1=(y2-y1)/(x2-x1)*(loc1[0]-x1)+y1-loc1[1],n2=(y2-y1)/(x2-x1)*(loc2[0]-x1)+y1-loc2[1];if(n1*n2<=0){core.status.hero.hp-=damage;core.addPop(x*32+16,y*32+16,-damage);core.updateStatusBar();core.playSound("electron.mp3");if(core.status.hero.hp<0){core.status.hero.hp=0;core.updateStatusBar();core.events.lose();return}return}}}}core.plugin.towerBoss={initTowerBoss:initTowerBoss,autoFixRouteBoss:autoFixRouteBoss};var towerBoss=Object.freeze({__proto__:null,autoFixRouteBoss:autoFixRouteBoss});exports.halo=halo;exports.hero=hero;exports.loopMap=loopMap;exports.remainEnemy=remainEnemy;exports.removeMap=removeMap;exports.shop=shop;exports.skill=skills$1;exports.skillTree=skillTree;exports.study=study;exports.towerBoss=towerBoss;exports.utils=utils;return exports}({}); |