diff --git a/project/plugins.js b/project/plugins.js index 8687259..b93a7b2 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -2726,7 +2726,8 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = main.dom.boss4.style.width = obj.totalWidth + 3 + "px"; main.dom.boss4.style.height = obj.totalHeight + 3 + "px"; - + main.dom.boss5.style.width = obj.totalWidth + 3 + "px"; + main.dom.boss5.style.height = obj.totalHeight + 3 + "px"; main.dom.boss.style.width = obj.totalWidth + 3 + "px"; main.dom.boss.style.height = obj.totalHeight + 3 + "px"; @@ -16466,6 +16467,17 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = boss4.style.transform = "translate(-50%,-50%)"; const ctx4 = boss4.getContext("2d"); main.dom.boss4 = boss4; + const boss5 = document.createElement("canvas"); //boss战画布设置 + boss5.style.position = "absolute"; + boss5.style.zIndex = 304; + boss5.style.display = "none"; + boss5.id = "boss5"; + main.dom.gameGroup.insertAdjacentElement("afterend", boss5); + boss5.style.top = "50%"; + boss5.style.left = "50%"; + boss5.style.transform = "translate(-50%,-50%)"; + const ctx5 = boss5.getContext("2d"); + main.dom.boss5 = boss5; boss.onclick = function (e) { try { e.preventDefault(); @@ -16474,35 +16486,25 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const top = core.dom.gameGroup.offsetTop; const px = Math.floor((e.clientX - left) / core.domStyle.scale), py = Math.floor((e.clientY - top) / core.domStyle.scale); - click(px * 3, py * 3); + if (core.domStyle.isVertical) { + core.ui.boss.click(1248 - py * 3, px * 3) + } else { + core.ui.boss.click(px * 3, py * 3); + } + } catch (ee) { main.log(ee); } }; - function click(px, py) { - //点击效果 - const makeBox = ([x, y], [w, h]) => { - return [ - [x, y], - [x + w, y + h], - ]; - }; - const inRect = ([x, y], [ - [sx, sy], - [dx, dy] - ]) => { - return sx <= x && x <= dx && sy <= y && y <= dy; - }; - const pos = [px, py]; - } + class Boss { constructor() { //绘制需要的变量 - this.bg = ""; + this.bg = "bg_3512.webp"; this.heroImage = "tati_310101.webp" this.hero = { hp: 1000, atk: 100, def: 100, spell: 100, speed: 10, mdef: 10 } - this.boss = { name: "菲奥奈", id: "feiaonai", image: "tati_050143.webp", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 } + this.boss = { name: "菲奥奈", id: "angel", image: "tati_050143.webp", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 } this.enemy = [ { name: "小蝙蝠", id: "bat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }, { name: "红蝙蝠", id: "redBat", hp: 1000, atk: 100, def: 100, speed: 10, mdef: 10 }, @@ -16524,20 +16526,144 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = [] ] } - + click(px, py) { + //点击效果 + const makeBox = ([x, y], [w, h]) => { + return [ + [x, y], + [x + w, y + h], + ]; + }; + const inRect = ([x, y], [ + [sx, sy], + [dx, dy] + ]) => { + return sx <= x && x <= dx && sy <= y && y <= dy; + }; + const pos = [px, py]; + } async bossStart() { core.lockControl() await this.blackBg() this.moveboss() await this.movehero() await this.moveStatus() - + this.drawenemy() } async bossEnd() { await this.close() + core.unlockControl() } + drawenemy() { + let block, + time = 0, + farme = 0; + boss5.style.display = 'block' + core.registerAnimationFrame('enemyanimate', true, (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + farme += 1 + let animate = Math.floor(farme / 30), + posx = 700, + posy = 350; + core.clearMap(ctx5) + if (core.domStyle.isVertical) { + ctx5.canvas.width = 1248; + ctx5.canvas.height = 2028; + ctx5.save(); //保存设置 + ctx5.translate(1248, 0); //重新定位右上角为基准 + ctx5.rotate(Math.PI / 2); //旋转90度 + } else { + ctx5.canvas.width = 2028; + ctx5.canvas.height = 1248; + } + let enemy = false + this.enemy.forEach(v => { if (v.hp > 0) enemy = true }) + if (enemy) { + + core.drawWindowSkin("winskin.webp", ctx5, 650, 250, 400, 660, null, null, null, 3) + if (this.selection === "boss") core.strokeRect(ctx5, 800, 600, 100, 150, "yellow", 6) + const bossBlock = core.getBlockInfo(this.boss.id) + core.drawImage( + ctx5, + bossBlock.image, + 32 * (animate % 4), + bossBlock.posY * 48, + 32, + 48, + 800, + 600, + 96, + 144 + ); + core.drawImage( + ctx5, + "hero.webp", + 32 * (animate % 4), + 144, + 32, + 48, + 800, + 750, + 96, + 144 + ); + for (let i = 0; i < this.enemy.length; i++) { + if (this.enemy[i].id) { + block = core.getBlockInfo(this.enemy[i].id) + } else { + posx += 100 + if (i === 2) { + posx = 600 + posy += 150 + } + continue + } + + if (block.cls === "enemys") { + core.drawImage( + ctx5, + block.image, + 32 * (animate % 2), + block.posY * 32, + 32, + 32, + posx, + posy, + 96, + 96 + ); + if (this.selection == i) core.strokeRect(ctx5, posx, posy, 100, 100, "yellow", 6) + } else { + core.drawImage( + ctx5, + block.image, + 32 * (animate % 4), + block.posY * 48, + 32, + 48, + posx, + posy, + 96, + 144 + ); + if (this.selection == i) core.strokeRect(ctx5, posx, posy, 100, 150, "yellow", 6) + } + + posx += 100 + if (i === 2) { + posx = 700 + posy += 150 + } + } + } + + ctx5.restore(); + } + }) + } drawhero() { core.clearMap(ctx2) if (core.domStyle.isVertical) { @@ -16654,12 +16780,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4.canvas.width = 2028; ctx4.canvas.height = 1248; } - core.drawWindowSkin("winskin.webp", ctx4, 600, 900, 900, 300, null, null, null, 3) + core.drawWindowSkin("winskin.webp", ctx4, 600, 920, 900, 300, null, null, null, 3) core.fillBoldText1( ctx4, hero.name, 630, - 980, + 1000, "#FFFFFF", "#000000", 6, @@ -16669,7 +16795,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, "状态", 880, - 980, + 1000, "#FFFFFF", "#000000", 6, @@ -16679,7 +16805,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '生命 ' + this.hero.hp, 630, - 1050, + 1070, "#FFFFFF", "#000000", 6, @@ -16689,7 +16815,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '攻击 ' + this.hero.atk, 630, - 1100, + 1120, "#FFFFFF", "#000000", 6, @@ -16699,7 +16825,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '防御 ' + this.hero.def, 630, - 1150, + 1170, "#FFFFFF", "#000000", 6, @@ -16709,7 +16835,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '法强 ' + this.hero.spell, 1080, - 1050, + 1070, "#FFFFFF", "#000000", 6, @@ -16719,7 +16845,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '法抗 ' + this.hero.mdef + "%", 1080, - 1100, + 1120, "#FFFFFF", "#000000", 6, @@ -16729,7 +16855,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '速度 ' + this.hero.speed, 1080, - 1150, + 1170, "#FFFFFF", "#000000", 6, @@ -16739,13 +16865,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.herobuff.forEach(v => { if (v) { const a = v.split(":") - core.drawIcon(ctx4, a[0], posx, 930, 64, 64) + core.drawIcon(ctx4, a[0], posx, 950, 64, 64) core.setTextAlign(ctx4, "right") core.fillBoldText1( ctx4, a[1], posx + 50, - 980, + 1000, "#FFFFFF", "#000000", 6, @@ -16963,12 +17089,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4.canvas.width = 2028; ctx4.canvas.height = 1248; } - core.drawWindowSkin("winskin.webp", ctx4, 600, 900 + posy, 900, 300, null, null, null, 3) + core.drawWindowSkin("winskin.webp", ctx4, 600, 920 + posy, 900, 300, null, null, null, 3) core.fillBoldText1( ctx4, hero.name, 630, - 980 + posy, + 1000 + posy, "#FFFFFF", "#000000", 6, @@ -16978,7 +17104,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, "状态", 880, - 980 + posy, + 1000 + posy, "#FFFFFF", "#000000", 6, @@ -16988,7 +17114,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '生命 ' + this.hero.hp, 630, - 1050 + posy, + 1070 + posy, "#FFFFFF", "#000000", 6, @@ -16998,7 +17124,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '攻击 ' + this.hero.atk, 630, - 1100 + posy, + 1120 + posy, "#FFFFFF", "#000000", 6, @@ -17008,7 +17134,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '防御 ' + this.hero.def, 630, - 1150 + posy, + 1170 + posy, "#FFFFFF", "#000000", 6, @@ -17018,7 +17144,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '法强 ' + this.hero.spell, 1080, - 1050 + posy, + 1070 + posy, "#FFFFFF", "#000000", 6, @@ -17028,7 +17154,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '法抗 ' + this.hero.mdef + "%", 1080, - 1100 + posy, + 1120 + posy, "#FFFFFF", "#000000", 6, @@ -17038,7 +17164,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ctx4, '速度 ' + this.hero.speed, 1080, - 1150 + posy, + 1170 + posy, "#FFFFFF", "#000000", 6, @@ -17048,13 +17174,13 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.herobuff.forEach(v => { if (v) { const a = v.split(":") - core.drawIcon(ctx4, a[0], posx, 930 + posy, 64, 64) + core.drawIcon(ctx4, a[0], posx, 950 + posy, 64, 64) core.setTextAlign(ctx4, "right") core.fillBoldText1( ctx4, a[1], posx + 50, - 980 + posy, + 1000 + posy, "#FFFFFF", "#000000", 6, @@ -17292,10 +17418,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = time = 0 globalAlpha = 1 core.unregisterAnimationFrame("closeblack") + core.unregisterAnimationFrame('enemyanimate') boss1.style.display = 'none' boss2.style.display = 'none' boss3.style.display = 'none' boss4.style.display = 'none' + boss5.style.display = 'none' core.registerAnimationFrame("closeblack2", true, (temptime) => { if (temptime - time > 1000 / 60) { time = temptime @@ -17316,8 +17444,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = globalAlpha -= 1 / 30 if (globalAlpha < 0) { core.unregisterAnimationFrame("closeblack2") + boss.style.display = 'none' - core.unlockControl() + resolve() } }