From d0a6f4076fd4c76daba91cd8beca8cb7dc942e27 Mon Sep 17 00:00:00 2001 From: unanmed <90094606+unanmed@users.noreply.github.com> Date: Tue, 25 Apr 2023 12:52:34 +0000 Subject: [PATCH] =?UTF-8?q?Deploying=20to=20gh-pages=20from=20=20@=20bd4a7?= =?UTF-8?q?f946a90c592f0907b662851cc26cd0366b5=20=F0=9F=9A=80?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- libs/core.js | 25 ++++++++++++++++++++-- libs/events.js | 10 ++++++--- libs/maps.js | 4 ++-- libs/ui.js | 49 +++++++++++++------------------------------ main.js | 2 +- project/functions.js | 22 ++++++++++++++++--- project/plugin.m.js | 1 - project/plugin.min.js | 1 + 8 files changed, 67 insertions(+), 47 deletions(-) delete mode 100644 project/plugin.m.js create mode 100644 project/plugin.min.js diff --git a/libs/core.js b/libs/core.js index fc50764..4ea0919 100644 --- a/libs/core.js +++ b/libs/core.js @@ -310,17 +310,38 @@ core.prototype.init = async function (coreData, callback) { }); }; +core.prototype.initSync = function (coreData, callback) { + this._forwardFuncs(); + for (var key in coreData) core[key] = coreData[key]; + this._init_flags(); + this._init_platform(); + this._init_others(); + this._loadPluginSync(); + + core.loader._load(function () { + core.extensions._load(function () { + core._afterLoadResources(callback); + }); + }); +}; + +core.prototype._loadPluginSync = function () { + core.plugin = {}; + if (main.useCompress) main.loadMod('project', 'plugin', () => 0); + else main.loadMod('project', 'plugin.min', () => 0); +}; + core.prototype._loadPlugin = async function () { const mainData = data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main; core.plugin = {}; // 加载插件 - if (!main.replayChecking && main.mode === 'play') { + if (main.mode === 'play') { main.forward(); core.resetSettings(); core.plugin.showMarkedEnemy.value = true; } if (main.pluginUseCompress) { - await main.loadScript(`project/plugin.m.js?v=${main.version}`); + await main.loadScript(`project/plugin.min.js?v=${main.version}`); } else { await main.loadScript( `project/plugin/index.js?v=${main.version}`, diff --git a/libs/events.js b/libs/events.js index a89c15c..c2ad12e 100644 --- a/libs/events.js +++ b/libs/events.js @@ -25,8 +25,10 @@ events.prototype.resetGame = function (hero, hard, floorId, maps, values) { events.prototype.startGame = function (hard, seed, route, callback) { hard = hard || ''; core.dom.gameGroup.style.display = 'block'; - core.plugin.startOpened.value = false; - core.plugin.loaded.value = false; + if (!main.replayChecking) { + core.plugin.startOpened.value = false; + core.plugin.loaded.value = false; + } if (main.mode != 'play') return; core.plugin.skillTree.resetSkillLevel(); @@ -73,7 +75,9 @@ events.prototype._startGame_start = function (hard, seed, route, callback) { core.events._startGame_afterStart(callback); }); - if (route != null) core.startReplay(route); + if (route != null) { + core.startReplay(route); + } }; events.prototype._startGame_setHard = function () { diff --git a/libs/maps.js b/libs/maps.js index 139c689..e313d5c 100644 --- a/libs/maps.js +++ b/libs/maps.js @@ -3202,7 +3202,7 @@ maps.prototype.removeBlock = function (x, y, floorId) { const block = blocks[i]; this.removeBlockByIndex(i, floorId); this._removeBlockFromMap(floorId, block); - core.updateShadow(true); + if (!main.replayChecking) core.updateShadow(true); return true; } return false; @@ -3365,7 +3365,7 @@ maps.prototype.setBlock = function (number, x, y, floorId, noredraw) { } } } - core.updateShadow(true); + if (!main.replayChecking) core.updateShadow(true); }; maps.prototype.animateSetBlock = function ( diff --git a/libs/ui.js b/libs/ui.js index 054682d..064fce6 100644 --- a/libs/ui.js +++ b/libs/ui.js @@ -942,40 +942,19 @@ ui.prototype.clearUI = function () { ////// 左上角绘制一段提示 ////// ui.prototype.drawTip = function (text, id, frame) { - text = core.replaceText(text) || ''; - var realText = this._getRealContent(text); - var one = { - text: text, - textX: 21, - width: 26 + core.calWidth('data', realText, '16px Arial'), - opacity: 0.1, - stage: 1, - frame: frame || 0, - time: 0 - }; - if (id != null) { - var info = core.getBlockInfo(id); - if (info == null || !info.image || info.bigImage) { - // 检查状态栏图标 - if (core.statusBar.icons[id] instanceof Image) { - info = { - image: core.statusBar.icons[id], - posX: 0, - posY: 0, - height: 32 - }; - } else info = null; - } - if (info != null) { - one.image = info.image; - one.posX = info.posX; - one.posY = info.posY; - one.height = info.height; - one.textX += 24; - one.width += 24; - } - } - core.animateFrame.tip = one; + let t = + text + + ' [' + + core.status.hero.loc.x + + ',' + + core.status.hero.loc.y + + ',' + + core.status.floorId + + '] '; + if (core.status.floorId === 'tower6') + t += core.searchBlockWithFilter(v => v.event.cls === 'enemys').length; + + console.log(t); }; ui.prototype._drawTip_drawOne = function (tip) { @@ -4229,5 +4208,5 @@ ui.prototype.deleteAllCanvas = function () { this.deleteCanvas(function () { return true; }); - if (main.mode === 'play' && !core.isReplaying()) core.initShadowCanvas(); + if (main.mode === 'play' && !main.replayChecking) core.initShadowCanvas(); }; diff --git a/main.js b/main.js index 428cf40..44ed1a4 100644 --- a/main.js +++ b/main.js @@ -217,4 +217,4 @@ function main() { this.__VERSION__ = '2.10.0'; this.__VERSION_CODE__ = 510; } -function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}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(_e){throw _e},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(_e2){didErr=true;err=_e2},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}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=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}main.prototype.loadScript=function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(src,module){var script;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:script=document.createElement("script");script.src=src;if(module)script.type="module";document.body.appendChild(script);return _context.abrupt("return",new Promise(function(res,rej){script.addEventListener("load",res);script.addEventListener("error",rej)}));case 5:case"end":return _context.stop();}},_callee)}));return function(_x,_x2){return _ref.apply(this,arguments)}}();main.prototype.init=function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(mode,callback){var a,b,i,mainData,_iterator,_step,name,coreData,auto;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:_context3.prev=0;a={};b={};new Proxy(a,b);new Promise(function(res){return res()});eval("`${123}`");_context3.next=13;break;case 8:_context3.prev=8;_context3.t0=_context3["catch"](0);alert("\u6D4F\u89C8\u5668\u7248\u672C\u8FC7\u4F4E\uFF0C\u65E0\u6CD5\u6E38\u73A9\u672C\u5854\uFF01");alert("\u5EFA\u8BAE\u4F7F\u7528Edge\u6D4F\u89C8\u5668\u6216Chrome\u6D4F\u89C8\u5668\u6E38\u73A9\uFF01");return _context3.abrupt("return");case 13:for(i=0;iwindow.innerHeight*0.95){core.control.setDisplayScale(-1);if(!core.isPlaying()&&core.flags.enableHDCanvas){core.domStyle.ratio=Math.max(window.devicePixelRatio||1,core.domStyle.scale);core.resize()}}})}catch(_unused2){}}case 68:case"end":return _context3.stop();}},_callee3,null,[[0,8],[33,44,47,50]])}));return function(_x3,_x4){return _ref2.apply(this,arguments)}}();main.prototype.setMainTipsText=function(text){main.dom.mainTips.innerHTML=text};main.prototype.createOnChoiceAnimation=function(){var borderColor=main.dom.startButtonGroup.style.caretColor||"rgb(255, 215, 0)";var rgb=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+\s*)?\)$/.exec(borderColor);if(rgb!=null){var value=rgb[1]+", "+rgb[2]+", "+rgb[3];var style=document.createElement("style");style.type="text/css";var keyFrames="onChoice { "+"0% { border-color: rgba("+value+", 0.9); } "+"50% { border-color: rgba("+value+", 0.3); } "+"100% { border-color: rgba("+value+", 0.9); } "+"}";style.innerHTML="@-webkit-keyframes "+keyFrames+" @keyframes "+keyFrames;document.body.appendChild(style)}};main.prototype.importFonts=function(fonts){if(!(fonts instanceof Array)||fonts.length==0)return;var style=document.createElement("style");style.type="text/css";var html="";fonts.forEach(function(font){html+="@font-face { font-family: \""+font+"\"; src: url(\"project/fonts/"+font+".ttf\") format(\"truetype\"); }"});style.innerHTML=html;document.body.appendChild(style)};main.prototype.listen=function(){window.onresize=function(){try{core.resize()}catch(ee){console.error(ee)}};main.dom.body.onkeydown=function(e){if(main.editorOpened)return;try{if(e.keyCode===27)e.preventDefault();if(main.dom.inputDiv.style.display=="block")return;if(core&&(core.isPlaying()||core.status.lockControl))core.onkeyDown(e)}catch(ee){console.error(ee)}};main.dom.body.onkeyup=function(e){if(main.editorOpened)return;try{if(main.dom.startPanel.style.display=="block"&&(main.dom.startButtons.style.display=="block"||main.dom.levelChooseButtons.style.display=="block")){if(e.keyCode==38||e.keyCode==33)main.selectButton((main.selectedButton||0)-1);else if(e.keyCode==40||e.keyCode==34)main.selectButton((main.selectedButton||0)+1);else if(e.keyCode==67||e.keyCode==13||e.keyCode==32)main.selectButton(main.selectedButton);else if(e.keyCode==27&&main.dom.levelChooseButtons.style.display=="block"){core.showStartAnimate(true);e.preventDefault()}e.stopPropagation();return}if(main.dom.inputDiv.style.display=="block"){if(e.keyCode==13){setTimeout(function(){main.dom.inputYes.click()},50)}else if(e.keyCode==27){setTimeout(function(){main.dom.inputNo.click()},50)}return}if(core&&core.isPlaying&&core.status&&(core.isPlaying()||core.status.lockControl))core.onkeyUp(e)}catch(ee){console.error(ee)}};main.dom.body.onselectstart=function(){return false};main.dom.data.onmousedown=function(e){try{e.stopPropagation();var loc=core.actions._getClickLoc(e.clientX,e.clientY);if(loc==null)return;core.ondown(loc)}catch(ee){console.error(ee)}};main.dom.data.onmousemove=function(e){try{var loc=core.actions._getClickLoc(e.clientX,e.clientY);if(loc==null)return;core.onmove(loc)}catch(ee){console.error(ee)}};main.dom.data.onmouseup=function(e){try{var loc=core.actions._getClickLoc(e.clientX,e.clientY);if(loc==null)return;core.onup(loc)}catch(ee){console.error(ee)}};main.dom.data.onmousewheel=function(e){try{if(e.wheelDelta)core.onmousewheel(Math.sign(e.wheelDelta));else if(e.detail)core.onmousewheel(Math.sign(e.detail))}catch(ee){console.error(ee)}};main.dom.data.ontouchstart=function(e){try{e.preventDefault();var loc=core.actions._getClickLoc(e.targetTouches[0].clientX,e.targetTouches[0].clientY);if(loc==null)return;main.lastTouchLoc=loc;core.ondown(loc)}catch(ee){console.error(ee)}};main.dom.data.ontouchmove=function(e){try{e.preventDefault();var loc=core.actions._getClickLoc(e.targetTouches[0].clientX,e.targetTouches[0].clientY);if(loc==null)return;main.lastTouchLoc=loc;core.onmove(loc)}catch(ee){console.error(ee)}};main.dom.data.ontouchend=function(e){try{e.preventDefault();if(main.lastTouchLoc==null)return;var loc=main.lastTouchLoc;delete main.lastTouchLoc;core.onup(loc)}catch(e){console.error(e)}};main.statusBar.image.book.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.triggerReplay();return}if(core.isPlaying())core.openBook(true)};main.statusBar.image.fly.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.stopReplay();return}if(core.isPlaying()){if(!core.flags.equipboxButton){core.useFly(true)}else{core.openEquipbox(true)}}};main.statusBar.image.toolbox.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.rewindReplay();return}if(core.isPlaying()){core.openToolbox(core.status.event.id!="equipbox")}};main.statusBar.image.toolbox.ondblclick=function(e){e.stopPropagation();if(core.isReplaying()){return}if(core.isPlaying())core.openEquipbox(true)};main.statusBar.image.keyboard.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.control._replay_book();return}if(core.isPlaying())core.openKeyBoard(true)};main.statusBar.image.shop.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.control._replay_viewMap();return}if(core.isPlaying())core.openQuickShop(true)};main.statusBar.image.money.onclick=function(e){e.stopPropagation();if(core.isPlaying())core.openQuickShop(true)};main.statusBar.image.floor.onclick=function(e){e.stopPropagation();if(core&&core.isPlaying()&&!core.isMoving()&&!core.status.lockControl){core.ui._drawViewMaps()}};main.statusBar.image.save.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.speedDownReplay();return}if(core.isPlaying())core.save(true)};main.statusBar.image.load.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.speedUpReplay();return}if(core.isPlaying())core.load(true)};main.statusBar.image.settings.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.control._replay_SL();return}if(core.isPlaying())core.openSettings(true)};main.dom.hard.onclick=function(){core.control.setToolbarButton(!core.domStyle.toolbarBtn)};main.statusBar.image.btn1.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:49,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn2.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:50,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn3.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:51,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn4.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:52,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn5.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:53,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn6.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:54,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn7.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:55,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn8.onclick=function(e){e.stopPropagation();if(core.getLocalStorage("altKey")){core.removeLocalStorage("altKey");core.drawTip("Alt\u6A21\u5F0F\u5DF2\u5173\u95ED\u3002");main.statusBar.image.btn8.style.filter=""}else{core.setLocalStorage("altKey",true);core.drawTip("Alt\u6A21\u5F0F\u5DF2\u5F00\u542F\uFF1B\u6B64\u6A21\u5F0F\u4E0B1~7\u6309\u94AE\u89C6\u4E3AAlt+1~7\u3002");main.statusBar.image.btn8.style.filter="sepia(1) contrast(1.5)"}};window.onblur=function(){if(core&&core.control){try{core.control.checkAutosave()}catch(e){}}};main.dom.inputYes.onclick=function(){main.dom.inputDiv.style.display="none";var func=core.platform.successCallback;core.platform.successCallback=core.platform.errorCallback=null;if(func)func(main.dom.inputBox.value)};main.dom.inputNo.onclick=function(){main.dom.inputDiv.style.display="none";var func=core.platform.errorCallback;core.platform.successCallback=core.platform.errorCallback=null;if(func)func(null)}};var main=new main; \ No newline at end of file +function _typeof(obj){"@babel/helpers - typeof";return _typeof="function"==typeof Symbol&&"symbol"==typeof Symbol.iterator?function(obj){return typeof obj}:function(obj){return obj&&"function"==typeof Symbol&&obj.constructor===Symbol&&obj!==Symbol.prototype?"symbol":typeof obj},_typeof(obj)}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(_e){throw _e},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(_e2){didErr=true;err=_e2},f:function f(){try{if(!normalCompletion&&it["return"]!=null)it["return"]()}finally{if(didErr)throw err}}}}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=0;--i){var entry=this.tryEntries[i],record=entry.completion;if("root"===entry.tryLoc)return handle("end");if(entry.tryLoc<=this.prev){var hasCatch=hasOwn.call(entry,"catchLoc"),hasFinally=hasOwn.call(entry,"finallyLoc");if(hasCatch&&hasFinally){if(this.prev=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc<=this.prev&&hasOwn.call(entry,"finallyLoc")&&this.prev=0;--i){var entry=this.tryEntries[i];if(entry.finallyLoc===finallyLoc)return this.complete(entry.completion,entry.afterLoc),resetTryEntry(entry),ContinueSentinel}},"catch":function _catch(tryLoc){for(var i=this.tryEntries.length-1;i>=0;--i){var entry=this.tryEntries[i];if(entry.tryLoc===tryLoc){var record=entry.completion;if("throw"===record.type){var thrown=record.arg;resetTryEntry(entry)}return thrown}}throw new Error("illegal catch attempt")},delegateYield:function delegateYield(iterable,resultName,nextLoc){return this.delegate={iterator:values(iterable),resultName:resultName,nextLoc:nextLoc},"next"===this.method&&(this.arg=undefined),ContinueSentinel}},exports}function asyncGeneratorStep(gen,resolve,reject,_next,_throw,key,arg){try{var info=gen[key](arg);var value=info.value}catch(error){reject(error);return}if(info.done){resolve(value)}else{Promise.resolve(value).then(_next,_throw)}}function _asyncToGenerator(fn){return function(){var self=this,args=arguments;return new Promise(function(resolve,reject){var gen=fn.apply(self,args);function _next(value){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"next",value)}function _throw(err){asyncGeneratorStep(gen,resolve,reject,_next,_throw,"throw",err)}_next(undefined)})}}main.prototype.loadScript=function(src,module){var script=document.createElement("script");script.src=src;if(module)script.type="module";document.body.appendChild(script);return new Promise(function(res,rej){script.addEventListener("load",res);script.addEventListener("error",rej)})};main.prototype.init=function(){var _ref=_asyncToGenerator(_regeneratorRuntime().mark(function _callee(mode,callback){var a,b;return _regeneratorRuntime().wrap(function _callee$(_context){while(1)switch(_context.prev=_context.next){case 0:_context.prev=0;a={};b={};new Proxy(a,b);new Promise(function(res){return res()});eval("`${123}`");_context.next=13;break;case 8:_context.prev=8;_context.t0=_context["catch"](0);alert("\u6D4F\u89C8\u5668\u7248\u672C\u8FC7\u4F4E\uFF0C\u65E0\u6CD5\u6E38\u73A9\u672C\u5854\uFF01");alert("\u5EFA\u8BAE\u4F7F\u7528Edge\u6D4F\u89C8\u5668\u6216Chrome\u6D4F\u89C8\u5668\u6E38\u73A9\uFF01");return _context.abrupt("return");case 13:if(main.replayChecking){main.loadSync(mode,callback)}else{main.loadAsync(mode,callback)}case 14:case"end":return _context.stop();}},_callee,null,[[0,8]])}));return function(_x,_x2){return _ref.apply(this,arguments)}}();main.prototype.loadSync=function(mode,callback){main.mode=mode;if(main.useCompress){main.loadMod("project","project",function(){return 0})}else{main.pureData.forEach(function(v){main.loadMod("project",v,function(){return 0})})}var mainData=data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d.main;Object.assign(main,mainData);if(main.useCompress){main.loadMod("libs","libs",function(){return 0})}else{main.loadList.forEach(function(v){main.loadMod("libs",v,function(){return 0})})}var _iterator=_createForOfIteratorHelper(main.loadList),_step;try{for(_iterator.s();!(_step=_iterator.n()).done;){var name=_step.value;if(name==="core")continue;core[name]=new window[name]}}catch(err){_iterator.e(err)}finally{_iterator.f()}main.loadFloors(function(){return 0});var coreData={};["dom","statusBar","canvas","images","tilesets","materials","animates","bgms","sounds","floorIds","floors","floorPartitions"].forEach(function(t){coreData[t]=main[t]});core.initSync(coreData,callback);core.resize();main.core=core;core.completeAchievement=function(){return 0}};main.prototype.loadAsync=function(){var _ref2=_asyncToGenerator(_regeneratorRuntime().mark(function _callee3(mode,callback){var i,mainData,_iterator2,_step2,name,coreData,auto;return _regeneratorRuntime().wrap(function _callee3$(_context3){while(1)switch(_context3.prev=_context3.next){case 0:for(i=0;iwindow.innerHeight*0.95){core.control.setDisplayScale(-1);if(!core.isPlaying()&&core.flags.enableHDCanvas){core.domStyle.ratio=Math.max(window.devicePixelRatio||1,core.domStyle.scale);core.resize()}}})}catch(_unused2){}}case 55:case"end":return _context3.stop();}},_callee3,null,[[20,31,34,37]])}));return function(_x3,_x4){return _ref2.apply(this,arguments)}}();main.prototype.setMainTipsText=function(text){main.dom.mainTips.innerHTML=text};main.prototype.createOnChoiceAnimation=function(){var borderColor=main.dom.startButtonGroup.style.caretColor||"rgb(255, 215, 0)";var rgb=/^rgba?\(\s*(\d+)\s*,\s*(\d+)\s*,\s*(\d+)\s*(,\s*\d+\s*)?\)$/.exec(borderColor);if(rgb!=null){var value=rgb[1]+", "+rgb[2]+", "+rgb[3];var style=document.createElement("style");style.type="text/css";var keyFrames="onChoice { "+"0% { border-color: rgba("+value+", 0.9); } "+"50% { border-color: rgba("+value+", 0.3); } "+"100% { border-color: rgba("+value+", 0.9); } "+"}";style.innerHTML="@-webkit-keyframes "+keyFrames+" @keyframes "+keyFrames;document.body.appendChild(style)}};main.prototype.importFonts=function(fonts){if(!(fonts instanceof Array)||fonts.length==0)return;var style=document.createElement("style");style.type="text/css";var html="";fonts.forEach(function(font){html+="@font-face { font-family: \""+font+"\"; src: url(\"project/fonts/"+font+".ttf\") format(\"truetype\"); }"});style.innerHTML=html;document.body.appendChild(style)};main.prototype.listen=function(){window.onresize=function(){try{core.resize()}catch(ee){console.error(ee)}};main.dom.body.onkeydown=function(e){if(main.editorOpened)return;try{if(e.keyCode===27)e.preventDefault();if(main.dom.inputDiv.style.display=="block")return;if(core&&(core.isPlaying()||core.status.lockControl))core.onkeyDown(e)}catch(ee){console.error(ee)}};main.dom.body.onkeyup=function(e){if(main.editorOpened)return;try{if(main.dom.startPanel.style.display=="block"&&(main.dom.startButtons.style.display=="block"||main.dom.levelChooseButtons.style.display=="block")){if(e.keyCode==38||e.keyCode==33)main.selectButton((main.selectedButton||0)-1);else if(e.keyCode==40||e.keyCode==34)main.selectButton((main.selectedButton||0)+1);else if(e.keyCode==67||e.keyCode==13||e.keyCode==32)main.selectButton(main.selectedButton);else if(e.keyCode==27&&main.dom.levelChooseButtons.style.display=="block"){core.showStartAnimate(true);e.preventDefault()}e.stopPropagation();return}if(main.dom.inputDiv.style.display=="block"){if(e.keyCode==13){setTimeout(function(){main.dom.inputYes.click()},50)}else if(e.keyCode==27){setTimeout(function(){main.dom.inputNo.click()},50)}return}if(core&&core.isPlaying&&core.status&&(core.isPlaying()||core.status.lockControl))core.onkeyUp(e)}catch(ee){console.error(ee)}};main.dom.body.onselectstart=function(){return false};main.dom.data.onmousedown=function(e){try{e.stopPropagation();var loc=core.actions._getClickLoc(e.clientX,e.clientY);if(loc==null)return;core.ondown(loc)}catch(ee){console.error(ee)}};main.dom.data.onmousemove=function(e){try{var loc=core.actions._getClickLoc(e.clientX,e.clientY);if(loc==null)return;core.onmove(loc)}catch(ee){console.error(ee)}};main.dom.data.onmouseup=function(e){try{var loc=core.actions._getClickLoc(e.clientX,e.clientY);if(loc==null)return;core.onup(loc)}catch(ee){console.error(ee)}};main.dom.data.onmousewheel=function(e){try{if(e.wheelDelta)core.onmousewheel(Math.sign(e.wheelDelta));else if(e.detail)core.onmousewheel(Math.sign(e.detail))}catch(ee){console.error(ee)}};main.dom.data.ontouchstart=function(e){try{e.preventDefault();var loc=core.actions._getClickLoc(e.targetTouches[0].clientX,e.targetTouches[0].clientY);if(loc==null)return;main.lastTouchLoc=loc;core.ondown(loc)}catch(ee){console.error(ee)}};main.dom.data.ontouchmove=function(e){try{e.preventDefault();var loc=core.actions._getClickLoc(e.targetTouches[0].clientX,e.targetTouches[0].clientY);if(loc==null)return;main.lastTouchLoc=loc;core.onmove(loc)}catch(ee){console.error(ee)}};main.dom.data.ontouchend=function(e){try{e.preventDefault();if(main.lastTouchLoc==null)return;var loc=main.lastTouchLoc;delete main.lastTouchLoc;core.onup(loc)}catch(e){console.error(e)}};main.statusBar.image.book.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.triggerReplay();return}if(core.isPlaying())core.openBook(true)};main.statusBar.image.fly.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.stopReplay();return}if(core.isPlaying()){if(!core.flags.equipboxButton){core.useFly(true)}else{core.openEquipbox(true)}}};main.statusBar.image.toolbox.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.rewindReplay();return}if(core.isPlaying()){core.openToolbox(core.status.event.id!="equipbox")}};main.statusBar.image.toolbox.ondblclick=function(e){e.stopPropagation();if(core.isReplaying()){return}if(core.isPlaying())core.openEquipbox(true)};main.statusBar.image.keyboard.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.control._replay_book();return}if(core.isPlaying())core.openKeyBoard(true)};main.statusBar.image.shop.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.control._replay_viewMap();return}if(core.isPlaying())core.openQuickShop(true)};main.statusBar.image.money.onclick=function(e){e.stopPropagation();if(core.isPlaying())core.openQuickShop(true)};main.statusBar.image.floor.onclick=function(e){e.stopPropagation();if(core&&core.isPlaying()&&!core.isMoving()&&!core.status.lockControl){core.ui._drawViewMaps()}};main.statusBar.image.save.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.speedDownReplay();return}if(core.isPlaying())core.save(true)};main.statusBar.image.load.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.speedUpReplay();return}if(core.isPlaying())core.load(true)};main.statusBar.image.settings.onclick=function(e){e.stopPropagation();if(core.isReplaying()){core.control._replay_SL();return}if(core.isPlaying())core.openSettings(true)};main.dom.hard.onclick=function(){core.control.setToolbarButton(!core.domStyle.toolbarBtn)};main.statusBar.image.btn1.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:49,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn2.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:50,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn3.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:51,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn4.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:52,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn5.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:53,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn6.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:54,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn7.onclick=function(e){e.stopPropagation();core.onkeyUp({keyCode:55,altKey:core.getLocalStorage("altKey")})};main.statusBar.image.btn8.onclick=function(e){e.stopPropagation();if(core.getLocalStorage("altKey")){core.removeLocalStorage("altKey");core.drawTip("Alt\u6A21\u5F0F\u5DF2\u5173\u95ED\u3002");main.statusBar.image.btn8.style.filter=""}else{core.setLocalStorage("altKey",true);core.drawTip("Alt\u6A21\u5F0F\u5DF2\u5F00\u542F\uFF1B\u6B64\u6A21\u5F0F\u4E0B1~7\u6309\u94AE\u89C6\u4E3AAlt+1~7\u3002");main.statusBar.image.btn8.style.filter="sepia(1) contrast(1.5)"}};window.onblur=function(){if(core&&core.control){try{core.control.checkAutosave()}catch(e){}}};main.dom.inputYes.onclick=function(){main.dom.inputDiv.style.display="none";var func=core.platform.successCallback;core.platform.successCallback=core.platform.errorCallback=null;if(func)func(main.dom.inputBox.value)};main.dom.inputNo.onclick=function(){main.dom.inputDiv.style.display="none";var func=core.platform.errorCallback;core.platform.successCallback=core.platform.errorCallback=null;if(func)func(null)}};var main=new main; \ No newline at end of file diff --git a/project/functions.js b/project/functions.js index d1f99bf..1b65915 100644 --- a/project/functions.js +++ b/project/functions.js @@ -13,6 +13,16 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { core.status = core.clone(core.initStatus, function (name) { return name != 'hero' && name != 'maps'; }); + const bgmaps = {}; + const handler = { + set(target, p, v) { + if (core.status.floorId === 'tower6') console.trace(); + + target[p] = v; + return true; + } + }; + core.status.bgmaps = new Proxy(bgmaps, handler); core.control._bindRoutePush(); core.status.played = true; // 初始化人物,图标,统计信息 @@ -52,6 +62,10 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { if (main.mode === 'play' && !main.replayChecking) { core.splitArea(); core.resetFlagSettings(); + } else { + flags.autoSkill ??= true; + flags.itemDetail ??= true; + flags.autoLocate ??= true; } }, win: function (reason, norank, noexit) { @@ -141,7 +155,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { // ---------- 重绘新地图;这一步将会设置core.status.floorId ---------- // core.drawMap(floorId); - core.updateShadow(); + if (!main.replayChecking) core.updateShadow(); // 切换楼层BGM if (core.status.maps[floorId].bgm) { @@ -200,7 +214,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { core.visitFloor(floorId); } } - if (!flags.debug) core.checkVisitedFloor(); + if (!flags.debug && !main.replayChecking) core.checkVisitedFloor(); }, flyTo: function (toId, callback) { // 楼层传送器的使用,从当前楼层飞往toId @@ -1119,7 +1133,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { return; } - const [x, y] = flags.mouseLoc; + const [x, y] = flags.mouseLoc ?? []; const mx = Math.round(x + core.bigmap.offsetX / 32); const my = Math.round(y + core.bigmap.offsetY / 32); @@ -1408,6 +1422,8 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { // 更新全地图显伤 core.updateDamage(); + if (main.replayChecking) return; + // 已学习的技能 if ( core.plugin.skillTree.getSkillLevel(11) > 0 && diff --git a/project/plugin.m.js b/project/plugin.m.js deleted file mode 100644 index 9d2d97b..0000000 --- a/project/plugin.m.js +++ /dev/null @@ -1 +0,0 @@ -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);icore.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(xcore.bigmap.posX+core._PX_+core.bigmap.extend||ycore.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":xty?"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;iitem.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.status.route.push(name);core.replay();return true});core.registerReplayAction("closeShop",function(name){if(name!=="closeShop")return false;if(!shopOpened)return false;shopOpened=false;openedShopId="";core.status.route.push(name);core.replay();return true});core.plugin.replay={ready:ready,readyClip:readyClip,clip:clip};(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;icore._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=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;y0){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:["\u4E3B\u52A8\u6280\u80FD\uFF0C\u5FEB\u6377\u952E1\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:["\u7B2C\u4E00\u7AE0\u7EC8\u6781\u6280\u80FD\uFF0C\u6218\u6597\u65F6\u667A\u6167\u4F1A\u5145\u5F53\u7B49\u91CF\u62A4\u76FE\uFF0C","\u5230\u8FBE\u7B2C\u4E8C\u7AE0\u540E\u6548\u679C\u53D8\u4E3A1/10"],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:["\u4E3B\u52A8\u6280\u80FD\uFF0C\u5FEB\u6377\u952E3\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:["\u5F53\u524D\u7248\u672C\u6B64\u6280\u80FD\u65E0\u6548\uFF01","\u4E3B\u52A8\u6280\u80FD\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:["\u7B2C\u4E8C\u7AE0\u7EC8\u6781\u6280\u80FD\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 resetSkillLevel(){levels=[]}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,resetSkillLevel:resetSkillLevel};var skillTree=Object.freeze({__proto__:null,canUpgrade:canUpgrade,getSkillConsume:getSkillConsume,getSkillFromIndex:getSkillFromIndex,getSkillLevel:getSkillLevel,loadSkillTree:loadSkillTree,openTree:openTree,resetSkillLevel:resetSkillLevel,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);core.insertAction([{type:"sleep",time:1000,noSkip:true}]);setTimeout(bossCore,1000)}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;clip("choices:0");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=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=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;i0){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(x1x*32+12&&x2>x*32+12||y1y*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};var towerBoss=Object.freeze({__proto__:null});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}({}); \ No newline at end of file diff --git a/project/plugin.min.js b/project/plugin.min.js new file mode 100644 index 0000000..5f6b763 --- /dev/null +++ b/project/plugin.min.js @@ -0,0 +1 @@ +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);icore.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(xcore.bigmap.posX+core._PX_+core.bigmap.extend||ycore.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":xty?"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;iitem.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.addItem(id,type==="buy"?num:-num);core.status.route.push(name);core.replay();return true});core.registerReplayAction("closeShop",function(name){if(name!=="closeShop")return false;if(!shopOpened)return false;shopOpened=false;openedShopId="";core.status.route.push(name);core.replay();return true});core.plugin.replay={ready:ready,readyClip:readyClip,clip:clip};(function(){if(main.replayChecking)return core.plugin.gameUi={openItemShop:function openItemShop(){return 0},showChapter:function showChapter(){return 0},openSkill:function openSkill(){return 0}};function openItemShop(itemShopId){if(!core.isReplaying()){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;icore._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};core.has=has;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=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;y0){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:["\u4E3B\u52A8\u6280\u80FD\uFF0C\u5FEB\u6377\u952E1\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:["\u7B2C\u4E00\u7AE0\u7EC8\u6781\u6280\u80FD\uFF0C\u6218\u6597\u65F6\u667A\u6167\u4F1A\u5145\u5F53\u7B49\u91CF\u62A4\u76FE\uFF0C","\u5230\u8FBE\u7B2C\u4E8C\u7AE0\u540E\u6548\u679C\u53D8\u4E3A1/10"],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:["\u4E3B\u52A8\u6280\u80FD\uFF0C\u5FEB\u6377\u952E3\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:["\u5F53\u524D\u7248\u672C\u6B64\u6280\u80FD\u65E0\u6548\uFF01","\u4E3B\u52A8\u6280\u80FD\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:["\u7B2C\u4E8C\u7AE0\u7EC8\u6781\u6280\u80FD\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 resetSkillLevel(){levels=[]}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,resetSkillLevel:resetSkillLevel};var skillTree=Object.freeze({__proto__:null,canUpgrade:canUpgrade,getSkillConsume:getSkillConsume,getSkillFromIndex:getSkillFromIndex,getSkillLevel:getSkillLevel,loadSkillTree:loadSkillTree,openTree:openTree,resetSkillLevel:resetSkillLevel,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);core.insertAction([{type:"sleep",time:1000,noSkip:true}]);setTimeout(bossCore,1000)}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;clip("choices:0");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=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=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;i0){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(x1x*32+12&&x2>x*32+12||y1y*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};var towerBoss=Object.freeze({__proto__:null});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}({}); \ No newline at end of file