From 1ce3662bec3c84eade46a41a8d2c2fa277a871a6 Mon Sep 17 00:00:00 2001 From: unanmed <1319491857@qq.com> Date: Thu, 29 Dec 2022 23:56:35 +0800 Subject: [PATCH] =?UTF-8?q?=E6=BC=8F=E6=80=AA=E6=A3=80=E6=B5=8B?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- public/project/floors/MT5.js | 2 +- public/project/functions.js | 522 +---------------------------------- public/project/plugins.js | 63 ++++- src/types/plugin.d.ts | 2 +- 4 files changed, 64 insertions(+), 525 deletions(-) diff --git a/public/project/floors/MT5.js b/public/project/floors/MT5.js index f5bcba8..7a37cac 100644 --- a/public/project/floors/MT5.js +++ b/public/project/floors/MT5.js @@ -164,7 +164,7 @@ main.floors.MT5= "这里是漏怪检测,会检测\r[gold]山洞\r[]区域的怪物是否清空", { "type": "function", - "function": "function(){\ncore.checkEnemy([0, \"MT0\", \"MT1\", \"MT2\", \"MT3\", \"MT4\", \"MT5\"]);\n}" + "function": "function(){\nconst enemy = core.getRemainEnemyString(core.floorIds.slice(0, 5));\nif (enemy.length === 0) {\n\tcore.insertAction(['当前无剩余怪物!', { \"type\": \"hide\", \"remove\": true }, ]);\n} else {\n\tcore.insertAction(enemy);\n}\n}" } ] }, diff --git a/public/project/functions.js b/public/project/functions.js index 0f1d997..806091c 100644 --- a/public/project/functions.js +++ b/public/project/functions.js @@ -1408,12 +1408,6 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { loadData: function (data, callback) { // 读档操作;从存储中读取了内容后的行为 - // tower6 - if (core.floors.tower6) { - core.loadLoopMap(data.tower6, 'tower6'); - if (core.status.floorId == 'tower6') - core.extractBlocks('tower6'); - } // 重置游戏和路线 core.resetGame( data.hero, @@ -2279,526 +2273,14 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = { }, drawStatusBar: function () { // 自定义绘制状态栏,需要开启状态栏canvas化 - - // 如果是非状态栏canvas化,直接返回 - if (!core.flags.statusCanvas) return; - var ctx = core.dom.statusCanvasCtx; - // 清空状态栏 - core.clearMap(ctx); - // 如果是隐藏状态栏模式,直接返回 - if (!core.domStyle.showStatusBar) return; - // 作为样板,只绘制楼层、生命、攻击、防御、护盾、金币、钥匙这七个内容 // 需要其他的请自行进行修改;横竖屏都需要进行适配绘制。 // (可以使用Chrome浏览器开控制台来模拟手机上的竖屏模式的显示效果,具体方式自行百度) // 横屏模式下的画布大小是 149*480 // 竖屏模式下的画布大小是 480*(32*rows+9) 其中rows为状态栏行数,即全塔属性中statusCanvasRowsOnMobile值 // 可以使用 core.domStyle.isVertical 来判定当前是否是竖屏模式 - - core.setFillStyle( - ctx, - core.status.globalAttribute.statusBarColor || - core.initStatus.globalAttribute.statusBarColor - ); - // 属性 - var hp = core.getRealStatus('hp'), // 生命 - atk = core.getRealStatus('atk'), // 攻击 - def = core.getRealStatus('def'), // 防御 - inte = core.getRealStatus('mdef'), // 智慧 - recovery = core.getRealStatus('hpmax'), // 恢复 - extraAtk = core.getRealStatus('mana'); // 额外攻击 - // 断灭之刃技能 - if (flags.blade && flags.bladeOn) { - var level = core.getSkillLevel()[2]; - atk *= 1 + 0.1 * level; - def *= 1 - 0.1 * level; - } - // 横竖屏需要分别绘制... - if (!core.domStyle.isVertical) { - // 横屏模式 - // 背景 - ctx.shadowColor = 'rgba(0, 0, 0, 0.4)'; - ctx.shadowOffsetX = 0; - ctx.shadowOffsetY = 0; - ctx.shadowBlur = 7; - core.fillRect(ctx, 0, 0, 149, 480, [30, 30, 30, 0.8]); - core.strokeRect(ctx, 0, 0, 149, 480, [255, 255, 255, 1], 3); - ctx.shadowOffsetX = 3; - ctx.shadowOffsetY = 2; - ctx.shadowBlur = 3; - // 技能名 - core.setTextAlign(ctx, 'right'); - if (flags.blade && flags.bladeOn) - core.fillBoldText( - ctx, - '断灭之刃', - 145, - 47, - '#ffffff', - '#cc3333', - '16px normal' - ); - core.setTextAlign(ctx, 'left'); - // 楼层名+等级名 - core.fillBoldText( - ctx, - (core.status.thisMap || {}).title || '', - 10, - 22, - '#ffffff', - '#000000', - '20px normal' - ); - core.drawLine(ctx, 5, 27, 144, 27, '#ffffff', 2); - core.drawLine(ctx, 85, 49, 144, 49, '#ffffff', 1); - ctx.beginPath(); - ctx.moveTo(55, 27); - ctx.bezierCurveTo(75, 27, 70, 49, 85, 49); - ctx.stroke(); - ctx.beginPath(); - core.fillBoldText( - ctx, - core.getLvName(), - 10, - 47, - '#ffffff', - '#000000', - '20px normal' - ); - // 各个属性 - core.drawImage(ctx, 'hp.png', 5, 55, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(hp), - 42, - 80, - '#ffffff', - '#000000', - '27px normal' - ); - // 生命回复 - core.fillBoldText( - ctx, - '+' + core.formatBigNumber(recovery) + '/t', - 100, - 95, - '#ffffff', - '#00cc00', - '16px normal' - ); - // 治愈之泉 - if (core.hasFlag('spring')) - core.fillBoldText( - ctx, - '剩余' + (50 - core.getFlag('springCount', 0)), - 90, - 60, - '#ffffff', - '#00cc00', - '16px normal' - ); - // 额外攻击 - core.fillBoldText( - ctx, - '+' + core.formatBigNumber(extraAtk), - 100, - 127, - '#ffffff', - '#cc6666', - '16px normal' - ); - // 其他 - core.drawImage(ctx, 'atk.png', 5, 87, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(atk), - 42, - 112, - '#ffffff', - '#000000', - '27px normal' - ); - core.drawImage(ctx, 'def.png', 5, 119, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(def), - 42, - 144, - '#ffffff', - '#000000', - '27px normal' - ); - core.drawImage(ctx, 'IQ.png', 5, 151, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(inte), - 42, - 176, - '#ffffff', - '#000000', - '27px normal' - ); - core.drawImage(ctx, 'money.png', 5, 183, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber( - core.getRealStatusOrDefault(null, 'money') - ), - 42, - 208, - '#ffffff', - '#000000', - '27px normal' - ); - core.drawImage(ctx, 'exp.png', 5, 215, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(core.getNextLvUpNeed() || 0), - 42, - 240, - '#ffffff', - '#000000', - '27px normal' - ); - // 绘制三色钥匙 - core.fillBoldText( - ctx, - core.setTwoDigits(core.itemCount('yellowKey')), - 15, - 270, - '#ffccaa', - '#000000', - 'bold 27px normal' - ); - core.fillBoldText( - ctx, - core.setTwoDigits(core.itemCount('blueKey')), - 55, - 270, - '#aaaadd', - '#000000', - 'bold 27px normal' - ); - core.fillBoldText( - ctx, - core.setTwoDigits(core.itemCount('redKey')), - 95, - 270, - '#ff8888', - '#000000', - 'bold 27px normal' - ); - // 技能树 和 技能查看 - if (core.getFlag('chapter', 0) > 0) { - // core.fillRect(ctx, 20, 320, 109, 30, "#ffffff"); - // core.fillRect(ctx, 20, 280, 109, 30, "#ffffff"); - ctx.shadowOffsetX = 0; - ctx.shadowOffsetY = 0; - ctx.shadowBlur = 5; - core.drawImage(ctx, 'botton.png', 20, 320, 109, 30); - core.drawImage(ctx, 'botton.png', 20, 280, 109, 30); - // core.fillRect(ctx, 21, 321, 107, 28, "#ffffff"); - // core.fillRect(ctx, 21, 281, 107, 28, "#ffffff"); - core.setTextAlign(ctx, 'center'); - ctx.shadowOffsetX = 3; - ctx.shadowOffsetY = 2; - ctx.shadowBlur = 3; - core.fillBoldText( - ctx, - '技能树', - 75, - 340, - '#ffffff', - '#000000', - '20px normal' - ); - core.fillBoldText( - ctx, - '查看技能', - 75, - 300, - '#ffffff', - '#000000', - '20px normal' - ); - core.setTextAlign(ctx, 'left'); - } - } else { - // 竖屏模式 - // css - ctx.shadowColor = 'rgba(0, 0, 0, 0.4)'; - ctx.shadowOffsetX = 0; - ctx.shadowOffsetY = 0; - ctx.shadowBlur = 7; - core.fillRect(ctx, 0, 0, 480, 105, [30, 30, 30, 0.8]); - core.strokeRect(ctx, 0, 0, 480, 105, [255, 255, 255, 1], 3); - ctx.shadowOffsetX = 3; - ctx.shadowOffsetY = 2; - ctx.shadowBlur = 3; - // 各个属性 - core.setTextAlign(ctx, 'left'); - core.drawImage(ctx, 'hp.png', 5, 4, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(hp), - 42, - 29, - '#ffffff', - '#000000', - '27px normal' - ); - // 治愈之泉 - if (core.hasFlag('spring')) - core.fillBoldText( - ctx, - '剩余' + (50 - core.getFlag('springCount', 0)), - 220, - 41, - '#ffffff', - '#00cc00', - '16px normal' - ); - // 生命回复 - core.fillBoldText( - ctx, - '+' + core.formatBigNumber(recovery) + '/t', - 100, - 41, - '#ffffff', - '#00cc00', - '16px normal' - ); - // 额外攻击 - core.fillBoldText( - ctx, - '+' + core.formatBigNumber(extraAtk), - 100, - 76, - '#ffffff', - '#cc6666', - '16px normal' - ); - core.drawImage(ctx, 'atk.png', 5, 36, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(atk), - 42, - 61, - '#ffffff', - '#000000', - '27px normal' - ); - core.drawImage(ctx, 'def.png', 5, 68, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(def), - 42, - 93, - '#ffffff', - '#000000', - '27px normal' - ); - core.drawImage(ctx, 'IQ.png', 145, 4, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(inte), - 182, - 29, - '#ffffff', - '#000000', - '27px normal' - ); - core.drawImage(ctx, 'money.png', 145, 36, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber( - core.getRealStatusOrDefault(null, 'money') - ), - 182, - 61, - '#ffffff', - '#000000', - '27px normal' - ); - core.drawImage(ctx, 'exp.png', 145, 68, 32, 32); - core.fillBoldText( - ctx, - core.formatBigNumber(core.getNextLvUpNeed() || 0), - 182, - 93, - '#ffffff', - '#000000', - '27px normal' - ); - // 楼层名 + 等级名 + 技能名 - core.setTextAlign(ctx, 'right'); - core.fillBoldText( - ctx, - (core.status.thisMap || {}).title || '', - 385, - 52, - '#ffffff', - '#000000', - '20px normal' - ); - core.drawLine(ctx, 282, 57, 390, 57, '#ffffff', 2); - core.drawLine(ctx, 312, 82, 390, 82, '#ffffff', 1); - core.fillBoldText( - ctx, - core.getLvName(), - 385, - 77, - '#ffffff', - '#000000', - '20px normal' - ); - if (flags.blade && flags.bladeOn) - core.fillBoldText( - ctx, - '断灭之刃', - 385, - 97, - '#ffffff', - '#cc3333', - '16px normal' - ); - core.setTextAlign(ctx, 'left'); - - // 技能树 查看技能 - if (core.getFlag('chapter', 0) > 0) { - // core.fillRect(ctx, 400, 10, 30, 85, "#ffffff"); - // core.fillRect(ctx, 440, 10, 30, 85, "#ffffff"); - ctx.shadowOffsetX = 0; - ctx.shadowOffsetY = 0; - ctx.shadowBlur = 5; - core.drawImage( - ctx, - 'botton.png', - 0, - 0, - 190, - 60, - 375, - 40, - 85, - 30, - -Math.PI / 2 - ); - core.drawImage( - ctx, - 'botton.png', - 0, - 0, - 190, - 60, - 415, - 40, - 85, - 30, - -Math.PI / 2 - ); - // core.fillRect(ctx, 401, 11, 28, 83, "#ffffff"); - // core.fillRect(ctx, 441, 11, 28, 83, "#ffffff"); - core.setTextAlign(ctx, 'center'); - ctx.shadowOffsetX = 3; - ctx.shadowOffsetY = 2; - ctx.shadowBlur = 3; - core.setTextAlign(ctx, 'center'); - core.fillBoldText( - ctx, - '技', - 415, - 42, - '#ffffff', - '#000000', - '20px normal' - ); - core.fillBoldText( - ctx, - '能', - 415, - 62, - '#ffffff', - '#000000', - '20px normal' - ); - core.fillBoldText( - ctx, - '树', - 415, - 82, - '#ffffff', - '#000000', - '20px normal' - ); - core.fillBoldText( - ctx, - '查', - 455, - 30, - '#ffffff', - '#000000', - '20px normal' - ); - core.fillBoldText( - ctx, - '看', - 455, - 50, - '#ffffff', - '#000000', - '20px normal' - ); - core.fillBoldText( - ctx, - '技', - 455, - 70, - '#ffffff', - '#000000', - '20px normal' - ); - core.fillBoldText( - ctx, - '能', - 455, - 90, - '#ffffff', - '#000000', - '20px normal' - ); - core.setTextAlign(ctx, 'left'); - } - - // 绘制三色钥匙 - core.fillBoldText( - ctx, - core.setTwoDigits(core.itemCount('yellowKey')), - 282, - 29, - '#FFCCAA', - '#000000', - 'bold 27px normal' - ); - core.fillBoldText( - ctx, - core.setTwoDigits(core.itemCount('blueKey')), - 317, - 29, - '#AAAADD', - '#000000', - 'bold 27px normal' - ); - core.fillBoldText( - ctx, - core.setTwoDigits(core.itemCount('redKey')), - 352, - 29, - '#FF8888', - '#000000', - 'bold 27px normal' - ); - } + // + // 这里不需要写任何东西,状态栏全在vue里面 }, drawStatistics: function () { // 浏览地图时参与的统计项目 diff --git a/public/project/plugins.js b/public/project/plugins.js index 309d1c7..152c950 100644 --- a/public/project/plugins.js +++ b/public/project/plugins.js @@ -1455,7 +1455,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { core.status.maps[floorId].blocks.forEach(function (block) { if ( block.event.cls !== 'items' || - block.event.id === 'superPotion' + block.event.id === 'superPotion' || + block.disable ) return; var x = block.x, @@ -6268,8 +6269,64 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = { remainEnemy: function () { /** * 检查漏怪 - * @param {FloorIds[]} floorIds + * @param {FloorIds[]} floorIds */ - this.checkRemainEnemy = function(floorIds) {} + this.checkRemainEnemy = function (floorIds) { + /** + * @type {Record} + */ + const enemy = {}; + floorIds.forEach(v => { + core.extractBlocks(v); + const blocks = core.status.maps[v].blocks; + blocks.forEach(block => { + if (!block.event.cls.startsWith('enemy')) return; + /** + * @type {EnemyIds} + */ + const id = block.event.id; + enemy[v] ??= []; + const info = enemy[v]; + info.push({ loc: [block.x, block.y], id }); + }); + }); + return enemy; + }; + + /** + * 获取剩余怪物字符串 + * @param {FloorIds[]} floorIds + */ + this.getRemainEnemyString = function (floorIds) { + const enemy = this.checkRemainEnemy(floorIds); + const str = []; + let now = []; + for (const floor in enemy) { + /** + * @type {{loc: LocArr, id: EnemyIds}[]} + */ + const all = enemy[floor]; + /** + * @type {Record} + */ + const remain = {}; + all.forEach(v => { + const id = v.id; + remain[id] ??= 0; + remain[id]++; + }); + const title = core.status.maps[floor].title; + for (const id in remain) { + const name = core.material.enemys[id].name; + now.push(`${title}(${floor}): ${name} * ${remain[id]}`); + if (now.length === 20) { + str.push(now.join('\n')); + now = []; + } + } + } + if (now.length > 0) str.push(now.join('\n')); + return str; + }; } }; diff --git a/src/types/plugin.d.ts b/src/types/plugin.d.ts index c1d012b..c255df3 100644 --- a/src/types/plugin.d.ts +++ b/src/types/plugin.d.ts @@ -45,7 +45,7 @@ interface PluginDeclaration extends PluginUtils, PluginUis, PluginUse { removeAnimate(fn: (time: number) => void); /** - * 检查被标记怪物的状态,是否需要更新 + * 检查被标记怪物的状态 */ checkMarkedEnemy(): void;