diff --git a/project/data.js b/project/data.js index 77d7812..fd3673a 100644 --- a/project/data.js +++ b/project/data.js @@ -1140,7 +1140,8 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "flags": { "itemDetail": true, "useBetweenLight": true, - "__mdef_buff__": 0 + "__mdef_buff__": 0, + "popmove": true }, "followers": [], "steps": 0, diff --git a/project/functions.js b/project/functions.js index c70a441..247a002 100644 --- a/project/functions.js +++ b/project/functions.js @@ -1869,54 +1869,49 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // core.stopAutomaticRoute(); }, "moveDirectly": function (x, y, ignoreSteps) { - // 瞬间移动;x,y为要瞬间移动的点;ignoreSteps为减少的步数,可能之前已经被计算过 - // 返回true代表成功瞬移,false代表没有成功瞬移 + // 瞬间移动;x,y为要瞬间移动的点;ignoreSteps为减少的步数,可能之前已经被计算过 + // 返回true代表成功瞬移,false代表没有成功瞬移 - // 判定能否瞬移到该点 - if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y); - if (ignoreSteps >= 0) { - // 中毒也允许瞬移 - if (core.hasFlag("poison")) { - var damage = ignoreSteps * core.values.poisonDamage; - if (damage >= core.status.hero.hp) return false; - core.status.hero.statistics.poisonDamage += damage; - core.status.hero.hp -= damage; - } + // 判定能否瞬移到该点 + if (ignoreSteps == null) ignoreSteps = core.canMoveDirectly(x, y); + if (ignoreSteps >= 0) { + // 中毒也允许瞬移 + if (core.hasFlag("poison")) { + var damage = ignoreSteps * core.values.poisonDamage; + if (damage >= core.status.hero.hp) return false; + core.status.hero.statistics.poisonDamage += damage; + core.status.hero.hp -= damage; + } - core.clearMap("hero"); - if ( - core.bigmap.width * 32 === core.bigmap.height * 32 && - core.bigmap.width * 32 === core.__PIXELS__ - ) - core.addPopMove( - 32 * core.status.hero.loc.x + 16, - 32 * core.status.hero.loc.y + 16, - 32 * x + 16, - 32 * y + 16 - ); - // 获得勇士最后的朝向 - var lastDirection = core.status.route[core.status.route.length - 1]; - if (["left", "right", "up", "down"].indexOf(lastDirection) >= 0) - core.setHeroLoc("direction", lastDirection); - // 设置坐标,并绘制 - core.control._moveDirectyFollowers(x, y); - core.status.hero.loc.x = x; - core.status.hero.loc.y = y; - core.drawHero(); - // 记录录像 - core.status.route.push("move:" + x + ":" + y); - // 统计信息 - core.status.hero.statistics.moveDirectly++; - core.status.hero.statistics.ignoreSteps += ignoreSteps; - if (core.hasFlag("poison")) { - core.updateStatusBar(false, true); - } + core.clearMap("hero"); + if ( + core.bigmap.width * 32 === core.bigmap.height * 32 && + core.bigmap.width * 32 === core.__PIXELS__ + ) + if (core.getFlag('popmove')) core.addPopMove(32 * core.status.hero.loc.x + 16, 32 * core.status.hero.loc.y + 16, 32 * x + 16, 32 * y + 16); + // 获得勇士最后的朝向 + var lastDirection = core.status.route[core.status.route.length - 1]; + if (["left", "right", "up", "down"].indexOf(lastDirection) >= 0) + core.setHeroLoc("direction", lastDirection); + // 设置坐标,并绘制 + core.control._moveDirectyFollowers(x, y); + core.status.hero.loc.x = x; + core.status.hero.loc.y = y; + core.drawHero(); + // 记录录像 + core.status.route.push("move:" + x + ":" + y); + // 统计信息 + core.status.hero.statistics.moveDirectly++; + core.status.hero.statistics.ignoreSteps += ignoreSteps; + if (core.hasFlag("poison")) { + core.updateStatusBar(false, true); + } - core.checkRouteFolding(); - return true; - } - return false; - }, + core.checkRouteFolding(); + return true; + } + return false; +}, "parallelDo": function (timestamp) { // 并行事件处理,可以在这里写任何需要并行处理的脚本或事件 // 该函数将被系统反复执行,每次执行间隔视浏览器或设备性能而定,一般约为16.6ms一次 diff --git a/project/plugins.js b/project/plugins.js index 394aed3..9efcc03 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -4345,6 +4345,117 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = this.afterBattle(id, x, y); if (callback) callback(); }; + actions.prototype._sys_ondown_lockControl = function (x, y, px, py) { + if (core.status.played && !core.status.lockControl) return false; + + switch (core.status.event.id) { + case 'battle': + core.plugin.battle_onclick(x, y, px, py); + break; + case 'centerFly': + this._clickCenterFly(x, y, px, py); + break; + case 'book': + this._clickBook(x, y, px, py); + break; + case 'book-detail': + this._clickBookDetail(x, y, px, py); + break; + case 'fly': + this._clickFly(x, y, px, py); + break; + case 'viewMaps': + this._clickViewMaps(x, y, px, py); + break; + case 'switchs': + this._clickSwitchs(x, y, px, py); + break; + case 'switchs-sounds': + this._clickSwitchs_sounds(x, y, px, py); + break; + case 'switchs-display': + this._clickSwitchs_display(x, y, px, py); + break; + case 'switchs-action': + this._clickSwitchs_action(x, y, px, py); + break; + case 'settings': + this._clickSettings(x, y, px, py); + break; + case 'selectShop': + this._clickQuickShop(x, y, px, py); + break; + case 'equipbox': + this._clickEquipbox(x, y, px, py); + break; + case 'toolbox': + this._clickToolbox(x, y, px, py); + break; + case 'save': + case 'load': + case 'replayLoad': + case 'replayRemain': + case 'replaySince': + this._clickSL(x, y, px, py); + break; + case 'confirmBox': + this._clickConfirmBox(x, y, px, py); + break; + case 'keyBoard': + this._clickKeyBoard(x, y, px, py); + break; + case 'action': + this._clickAction(x, y, px, py); + break; + case 'text': + core.drawText(); + break; + case 'notes': + this._clickNotes(x, y, px, py); + break; + case 'syncSave': + this._clickSyncSave(x, y, px, py); + break; + case 'syncSelect': + this._clickSyncSelect(x, y, px, py); + break; + case 'localSaveSelect': + this._clickLocalSaveSelect(x, y, px, py); + break; + case 'storageRemove': + this._clickStorageRemove(x, y, px, py); + break; + case 'cursor': + this._clickCursor(x, y, px, py); + break; + case 'replay': + this._clickReplay(x, y, px, py); + break; + case 'gameInfo': + this._clickGameInfo(x, y, px, py); + break; + case 'about': + case 'help': + core.ui.closePanel(); + break; + } + + // --- 长按判定 + if (core.timeout.onDownTimeout == null) { + core.timeout.onDownTimeout = setTimeout(function () { + if (core.interval.onDownInterval == null) { + core.interval.onDownInterval = setInterval(function () { + if (!core.actions.longClick(x, y, px, py)) { + clearInterval(core.interval.onDownInterval); + core.interval.onDownInterval = null; + } + }, 40) + } + }, 500); + } + return true; + } + core.registerAction('ondown', '_sys_ondown_lockControl', core.actions._sys_ondown_lockControl, 30);; }, "额外信息": function () { /* 宝石血瓶左下角显示数值 @@ -4503,6 +4614,171 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } } }, + "跳伤": function () { + // 在此增加新插件 + /** + 函数使用说明 + Dove.MorePerform.ShowDamagePop.PopDamage( + 'ui', // 画布名称或画布2d上下文对象 + 100, 200, // 位置 (x, y) + -50, // 伤害值 + 24, // 字体大小 + '#FF0000', // 字体颜色 + '#000000', // 描边颜色 + 0.5, // 水平速度 (speedX) + -10, // 垂直速度 (speedY) + 0.5, // 重力 (gravity) + 120 // 显示时长(帧数) + */ + if (!core.registerAnimationFrame) { + throw new Error('require 2.6.1 or higher version'); + } + + window.Dove = window.Dove || {}; + Dove.MorePerform = Dove.MorePerform || {}; + + Dove.MorePerform.ShowDamagePop = {}; + Dove.MorePerform.ShowDamagePop.version = 1.0; + + Dove.MorePerform.ShowDamagePop.AllPopingCanvas = []; + + // 每帧的处理 + Dove.MorePerform.ShowDamagePop.Update = function () { + this.AllPopingCanvas = this.AllPopingCanvas.filter(function (spr) { + spr.update(); + return spr.isAlive(); + }); + if (!this.AllPopingCanvas.length) PopSprite._count = 0; + }; + + // 弹出伤害气泡 + Dove.MorePerform.ShowDamagePop.PopDamage = function (canvasName, x, y, damageValue, fontSize, fontColor, outlineColor, speedX, speedY, gravity, duration) { + if (damageValue) { + var poper = new PopSprite(canvasName, x, y, damageValue, fontSize, fontColor, outlineColor, speedX, speedY, gravity, duration); + Dove.MorePerform.ShowDamagePop.AllPopingCanvas.push(poper); + } + }; + + // 战斗发生前后记录生命值并处理 + Dove.MorePerform.ShowDamagePop.OnBattle = core.events.battle; + core.events.battle = function () { + var hpBeforeBattle = core.status.hero.hp; + Dove.MorePerform.ShowDamagePop.OnBattle.apply(core.events, arguments); + Dove.MorePerform.ShowDamagePop.PopDamage( + 'ui', // 默认画布名称 + core.getHeroLoc('x') * 32, // 英雄位置 x + core.getHeroLoc('y') * 32, // 英雄位置 y + Math.floor(core.status.hero.hp - hpBeforeBattle), // 伤害值 + 16, // 默认字体大小 + null, // 默认颜色 + null, // 默认描边颜色 + null, // 默认水平速度 + null, // 默认垂直速度 + null, // 默认重力 + 180 // 默认显示时长(帧数) + ); + }; + let time = 0 + // 注册每帧事件 + core.registerAnimationFrame("ShowDamagePop", true, + (temptime) => { + if (temptime - time > 1000 / 60) { + time = temptime + + Dove.MorePerform.ShowDamagePop.Update.bind(Dove.MorePerform.ShowDamagePop)() + } + } + + ); + + // 弹出精灵类 + function PopSprite(canvasName, x, y, damage, fontSize, fontColor, outlineColor, speedX, speedY, gravity, duration) { + this.initialize.apply(this, arguments); + } + + PopSprite.prototype = Object.create(Object.prototype); + PopSprite.prototype.constructor = PopSprite; + + // 常量 + PopSprite._count = 0; + PopSprite._baseZOrder = 50; + PopSprite._floorDis = 20; + + // 初始化 + PopSprite.prototype.initialize = function (canvasName, x, y, damage, fontSize, fontColor, outlineColor, speedX, speedY, gravity, duration) { + this._canvasName = canvasName ?? 'ui'; // 默认画布名称 + this._x = x; + this._y = y; + this._damage = damage; + this._fontSize = fontSize ?? 16; // 默认字体大小 + this._fontColor = fontColor ?? (damage > 0 ? '#22FF44' : '#FF2244'); // 默认颜色 + this._outlineColor = outlineColor ?? '#000000'; // 默认描边颜色 + this._speedX = speedX ?? (-2 + Math.random() * 3); // 水平速度,默认随机 + this._speedY = speedY ?? (-3 - Math.random() * 4); // 垂直速度,默认随机 + this._gravity = gravity ?? 0.3; // 重力加速度,默认 0.5 + this._duration = duration ?? 180; // 显示时长(帧数),默认 180 帧 + this.initAllMembers(); + this.requestCanvas(); + }; + + // 自更新 + PopSprite.prototype.update = function () { + if (this._timer < this._duration) { // 使用传入的显示时长 + this._x += this._vx; + this._y += this._vy; + this._vy += this._gravity; + if (this._y >= this._floorY) { + this._y = this._floorY; + this._vy *= -0.75; // 反弹衰减 + } + core.relocateCanvas(this._symbol, this._x, this._y); + core.setOpacity(this._symbol, 1 - this._timer / this._duration); // 根据显示时长设置透明度 + } else { + this.dispose(); + } + this._timer++; + }; + + // 申请并描绘canvas + PopSprite.prototype.requestCanvas = function () { + core.createCanvas(this._symbol, this._x, this._y, this._width, this._height, this._z); + var canvas = core.ui.getContextByName(this._symbol); + canvas.font = this._fontSize + 'px pala'; // 动态设置字体大小 + canvas.fillStyle = this._fontColor; // 动态设置字体颜色 + canvas.strokeStyle = this._outlineColor; // 动态设置描边颜色 + canvas.strokeText(this._text, 2, this._height); + canvas.fillText(this._text, 2, this._height); + }; + + // 初始化所有成员变量 + PopSprite.prototype.initAllMembers = function () { + this._text = String(this._damage); + var uiContext = core.ui.getContextByName(this._canvasName); // 使用指定画布 + uiContext.font = this._fontSize + 'px pala'; // 动态设置字体大小 + var textRect = uiContext.measureText(this._text); + this._width = Math.round(textRect.width + 4); + this._height = this._fontSize + 4; // 动态设置高度 + this._z = PopSprite._baseZOrder + PopSprite._count; + this._symbol = 'popSprite' + PopSprite._count++; + this._alive = true; + this._vx = this._speedX; // 使用传入的水平速度 + this._vy = this._speedY; // 使用传入的垂直速度 + this._floorY = this._y + PopSprite._floorDis; + this._timer = 0; + }; + + // 判断是否存活 + PopSprite.prototype.isAlive = function () { + return this._alive; + }; + + // 释放 + PopSprite.prototype.dispose = function () { + this._alive = false; + core.deleteCanvas(this._symbol); + }; + +}, "编辑器显伤": function () { // 在此增加新插件 /////// 用户设置 /////// @@ -5647,7 +5923,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = var compare2; if (item.equipCls === "双手剑") compare2 = core.compareEquipment(null, core.getEquip(1)); - if (item.equipCls === "盾牌" && core.material.items[core.getEquip(0)].equipCls === "双手剑") + if (item.equipCls === "盾牌" && core.material.items[core.getEquip(0)]?.equipCls === "双手剑") compare2 = core.compareEquipment(null, core.getEquip(0)); if (info.select.action == "unload") compare = core.compareEquipment(null, item.id); @@ -12379,81 +12655,81 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "瞬移轨迹": function () { - // 在此增加新插件 - function popMove() { - var ctx = core.getContextByName("popMove"); - if (!ctx) - ctx = core.createCanvas( - "popMove", - 0, - 0, - core.__PIXELS__, - core.__PIXELS__, - 71 - ); - ctx.canvas.classList.add("gameCanvas", "anti-aliasing"); - core.clearMap(ctx); - if (core.status.replay.speed <= 3 && !flags.stopPop) { - var list = core.status.popMove || []; - var count = 0; - list.forEach(function (one) { - // 由frame计算出dy + // 在此增加新插件 + function popMove() { + var ctx = core.getContextByName("popMove"); + if (!ctx) + ctx = core.createCanvas( + "popMove", + 0, + 0, + core.__PIXELS__, + core.__PIXELS__, + 71 + ); + ctx.canvas.classList.add("gameCanvas", "anti-aliasing"); + core.clearMap(ctx); + if (core.status.replay.speed <= 3 && !flags.stopPop) { + var list = core.status.popMove || []; + var count = 0; + list.forEach(function (one) { + // 由frame计算出dy - one.frame++; - // 绘制 + one.frame++; + // 绘制 - if (one.frame >= 0) core.setAlpha(ctx, 1 - one.frame / 30); - else core.setAlpha(ctx, 1); + if (one.frame >= 0) core.setAlpha(ctx, 1 - one.frame / 30); + else core.setAlpha(ctx, 1); - var length = Math.sqrt( - Math.pow(one.px2 - one.px, 2) + Math.pow(one.py2 - one.py, 2) - ); - //console.log(length) - var li = length / 16; - var lx = (one.px2 - one.px) / li; - var ly = (one.py2 - one.py) / li; - for (var i = 0; i < li; i += 1) { - core.setAlpha(ctx, (1 - one.frame / 30) * ((i / li) * 0.8 + 0.2)); - core.drawLine( - "popMove", - one.px + i * lx, - one.py + i * ly, - one.px + (i + 0.5) * lx, - one.py + (i + 0.5) * ly, - "#E1E1E1", - 6 - ); - if (i == 0) - core.strokeCircle("popMove", one.px, one.py, 6, "#E1E1E1", 3); - } - core.strokeCircle("popMove", one.px2, one.py2, 6, "#E1E1E1", 3); - core.strokeCircle( - "popMove", - one.px2, - one.py2, - 6 + (16 * one.frame) / 30, - "#E1E1E1", - 6 * (1 - one.frame / 30) - ); - //core.drawLine('popMove', one.px, one.py, one.px2, one.py2, '#E1E1E1', 6); + var length = Math.sqrt( + Math.pow(one.px2 - one.px, 2) + Math.pow(one.py2 - one.py, 2) + ); + //console.log(length) + var li = length / 16; + var lx = (one.px2 - one.px) / li; + var ly = (one.py2 - one.py) / li; + for (var i = 0; i < li; i += 1) { + core.setAlpha(ctx, (1 - one.frame / 30) * ((i / li) * 0.8 + 0.2)); + core.drawLine( + "popMove", + one.px + i * lx, + one.py + i * ly, + one.px + (i + 0.5) * lx, + one.py + (i + 0.5) * ly, + "#E1E1E1", + 6 + ); + if (i == 0) + core.strokeCircle("popMove", one.px, one.py, 6, "#E1E1E1", 3); + } + core.strokeCircle("popMove", one.px2, one.py2, 6, "#E1E1E1", 3); + core.strokeCircle( + "popMove", + one.px2, + one.py2, + 6 + (16 * one.frame) / 30, + "#E1E1E1", + 6 * (1 - one.frame / 30) + ); + //core.drawLine('popMove', one.px, one.py, one.px2, one.py2, '#E1E1E1', 6); - if (one.frame >= 30) count++; - }); - if (count > 0) list.splice(0, count); - } - } + if (one.frame >= 30) count++; + }); + if (count > 0) list.splice(0, count); + } + } - if (!main.replayChecking) { - core.registerAnimationFrame("popMove", true, popMove); - } - this.addPopMove = function (px, py, px2, py2, frame) { - var data = { px: px, py: py, px2: px2, py2: py2, frame: frame || 0 }; - if (core.status.replay.speed <= 3) { - if (!core.status.popMove) core.status.popMove = [data]; - else core.status.popMove.push(data); - } - }; - }, + if (!main.replayChecking) { + core.registerAnimationFrame("popMove", true, popMove); + } + this.addPopMove = function (px, py, px2, py2, frame) { + var data = { px: px, py: py, px2: px2, py2: py2, frame: frame || 0 }; + if (core.status.replay.speed <= 3) { + if (!core.status.popMove) core.status.popMove = [data]; + else core.status.popMove.push(data); + } + }; +}, "墓碑(编辑器)": function () { // 在此增加新插件 if (main.mode != "editor") return; // 编辑器模式下使用 @@ -15964,491 +16240,489 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.ui.cgText = new cgText(); }, "旁白": function () { - // 在此增加新插件 - const over = document.createElement("canvas"); //over画布设置 - over.style.position = "absolute"; - over.style.zIndex = 310; - over.style.display = "none"; - over.id = "over"; - main.dom.gameGroup.insertAdjacentElement("afterend", over); - over.style.top = "50%"; - over.style.left = "50%"; - over.style.transform = "translate(-50%,-50%)"; - const ctx = over.getContext("2d"); - main.dom.over = over; + // 在此增加新插件 + const over = document.createElement("canvas"); //over画布设置 + over.style.position = "absolute"; + over.style.zIndex = 310; + over.style.display = "none"; + over.id = "over"; + main.dom.gameGroup.insertAdjacentElement("afterend", over); + over.style.top = "50%"; + over.style.left = "50%"; + over.style.transform = "translate(-50%,-50%)"; + const ctx = over.getContext("2d"); + main.dom.over = over; - this.over = function ( - image, - memory, - time = 100, - hidetime = 30, - sound = "", - textColor = "#FFFFFF", - boldColor = "#000000", - font = "bold 48px Verdana", - text = "" - ) { - if (!core.isPlaying()) { - return core.doAction(); - } - const img = core.material.images.images?.[image]; - over.style.display = "block"; - let frame = 0; - let sod = 0; - let now = 0; - core.registerAnimationFrame("over", true, (timestamp) => { - if (timestamp - now > 1000 / 60) { - now = timestamp; - core.clearMap(ctx); - if (core.domStyle.isVertical) { - ctx.canvas.width = 416 * 3; - ctx.canvas.height = 676 * 3; - ctx.save(); //保存设置 - ctx.translate(416 * 3, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } else { - ctx.canvas.width = 676 * 3; - ctx.canvas.height = 416 * 3; - } - ctx.globalAlpha = 1; - if (img) { - //绘制背景 - if (memory) ctx.filter = "sepia(50%)"; - ctx.drawImage(img, 0, 0, 676 * 3, 416 * 3); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 676 * 3, 416 * 3); - } - frame++; - // 绘制 - if (frame <= hidetime) - core.setAlpha(ctx, 1 - (hidetime - frame) / hidetime); - if (frame > hidetime && frame <= hidetime + time) ctx.globalAlpha = 1; - if (frame > hidetime + time && frame <= hidetime * 2 + time) - core.setAlpha(ctx, 1 - (frame - hidetime - time) / hidetime); - const lisen = - sound && core.sounds[sound] && core.musicStatus.soundStatus; - if (frame == hidetime && lisen) { - sod = core.playSound(sound); - } - if (frame > hidetime * 2 + time) { - core.unregisterAnimationFrame("over"); - ctx.restore(); - over.style.display = "none"; - core.stopSound(sod); - core.doAction(); - return; - } + this.over = function ( + image, + memory, + time = 100, + hidetime = 30, + sound = "", + textColor = "#FFFFFF", + boldColor = "#000000", + font = "bold 48px Verdana", + text = "" + ) { + if (!core.isPlaying()) { + return core.doAction(); + } + const img = core.material.images.images?.[image]; + over.style.display = "block"; + let frame = 0; + let sod = 0; + let now = 0; + core.registerAnimationFrame("over", true, (timestamp) => { + if (timestamp - now > 1000 / 60) { + now = timestamp; + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 416 * 3; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(416 * 3, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 416 * 3; + } + ctx.globalAlpha = 1; + if (img) { + //绘制背景 + if (memory) ctx.filter = "sepia(50%)"; + ctx.drawImage(img, 0, 0, 676 * 3, 416 * 3); + ctx.filter = "none"; + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 416 * 3); + } + frame++; + // 绘制 + if (frame <= hidetime) + core.setAlpha(ctx, 1 - (hidetime - frame) / hidetime); + if (frame > hidetime && frame <= hidetime + time) ctx.globalAlpha = 1; + if (frame > hidetime + time && frame <= hidetime * 2 + time) + core.setAlpha(ctx, 1 - (frame - hidetime - time) / hidetime); + const lisen = + sound && core.sounds[sound] && core.musicStatus.soundStatus; + if (frame == hidetime && lisen) { + sod = core.playSound(sound); + } + if (frame > hidetime * 2 + time) { + core.unregisterAnimationFrame("over"); + ctx.restore(); + over.style.display = "none"; + core.stopSound(sod); + core.doAction(); + return; + } - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - text, - 1014, - 624, - textColor, - boldColor, - 6, - font - ); + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + text, + 1014, + 624, + textColor, + boldColor, + 6, + font + ); - ctx.restore(); - } - }); - }; + ctx.restore(); + } + }); + }; - this.overlist = function ( - image, - memory, - hidetime = 30, - list = [ - { - text: "", - sound: "", - time: 50, - textColor: "#FFFFFF", - boldColor: "#000000", - font: "bold 48px Verdana", - frame: 0, - }, - ] - ) { - if (!core.isPlaying()) { - return core.doAction(); - } - const img = core.material.images.images?.[image]; - over.style.display = "block"; - let sod = 0; - let i = 0; - let now = 0; - core.registerAnimationFrame("overlist", true, (timestamp) => { - if (timestamp - now > 1000 / 60) { - now = timestamp; - core.clearMap(ctx); - if (core.domStyle.isVertical) { - ctx.canvas.width = 416 * 3; - ctx.canvas.height = 676 * 3; - ctx.save(); //保存设置 - ctx.translate(416 * 3, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } else { - ctx.canvas.width = 676 * 3; - ctx.canvas.height = 416 * 3; - } - ctx.globalAlpha = 1; - if (img) { - //绘制背景 - if (memory) ctx.filter = "sepia(50%)"; - ctx.drawImage(img, 0, 0, 676 * 3, 416 * 3); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 676 * 3, 416 * 3); - } - const a = list[i]; - const b = list[i - 1]; - const c = list[i - 2]; - const d = list[i - 3]; - let ay = 624, - by = 624, - cy = 624, - dy = 624; - if (i === 0 && !list[1]) { - core.over( - image, - memory, - a.time, - hidetime, - a.sound, - a.textColor, - a.boldColor, - a.font, - a.text - ); - } else { - const numa = - parseInt(a?.font?.match(/\s*[\d.-]+[a-zA-Z%]*\s*/)?.[0].trim()) || - 48; - const numb = - parseInt(b?.font?.match(/\s*[\d.-]+[a-zA-Z%]*\s*/)?.[0].trim()) || - 48; - const numc = - parseInt(c?.font?.match(/\s*[\d.-]+[a-zA-Z%]*\s*/)?.[0].trim()) || - 48; - const numd = - parseInt(d?.font?.match(/\s*[\d.-]+[a-zA-Z%]*\s*/)?.[0].trim()) || - 48; + this.overlist = function ( + image, + memory, + hidetime = 30, + list = [{ + text: "", + sound: "", + time: 50, + textColor: "#FFFFFF", + boldColor: "#000000", + font: "bold 48px Verdana", + frame: 0, + }, ] + ) { + if (!core.isPlaying()) { + return core.doAction(); + } + const img = core.material.images.images?.[image]; + over.style.display = "block"; + let sod = 0; + let i = 0; + let now = 0; + core.registerAnimationFrame("overlist", true, (timestamp) => { + if (timestamp - now > 1000 / 60) { + now = timestamp; + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 416 * 3; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(416 * 3, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 416 * 3; + } + ctx.globalAlpha = 1; + if (img) { + //绘制背景 + if (memory) ctx.filter = "sepia(50%)"; + ctx.drawImage(img, 0, 0, 676 * 3, 416 * 3); + ctx.filter = "none"; + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 416 * 3); + } + const a = list[i]; + const b = list[i - 1]; + const c = list[i - 2]; + const d = list[i - 3]; + let ay = 624, + by = 624, + cy = 624, + dy = 624; + if (i === 0 && !list[1]) { + core.over( + image, + memory, + a.time, + hidetime, + a.sound, + a.textColor, + a.boldColor, + a.font, + a.text + ); + } else { + const numa = + parseInt(a?.font?.match(/\s*[\d.-]+[a-zA-Z%]*\s*/)?.[0].trim()) || + 48; + const numb = + parseInt(b?.font?.match(/\s*[\d.-]+[a-zA-Z%]*\s*/)?.[0].trim()) || + 48; + const numc = + parseInt(c?.font?.match(/\s*[\d.-]+[a-zA-Z%]*\s*/)?.[0].trim()) || + 48; + const numd = + parseInt(d?.font?.match(/\s*[\d.-]+[a-zA-Z%]*\s*/)?.[0].trim()) || + 48; - // 绘制 - if (a) { - if (a.frame < hidetime / 2) { - a.frame++; - core.setAlpha(ctx, 1 - (hidetime - a.frame) / hidetime); - ay += ((numa * (hidetime - a.frame)) / hidetime) * 3; - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - a.text, - 1014, - ay, - a.textColor, - a.boldColor, - 6, - a.font - ); - } - if (a.frame === hidetime / 2) { - core.setAlpha(ctx, 1 - (hidetime - a.frame) / hidetime); - ay = 624 + ((numa * (hidetime - a.frame)) / hidetime) * 3; - core.setTextAlign(ctx, "center"); + // 绘制 + if (a) { + if (a.frame < hidetime / 2) { + a.frame++; + core.setAlpha(ctx, 1 - (hidetime - a.frame) / hidetime); + ay += ((numa * (hidetime - a.frame)) / hidetime) * 3; + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + a.text, + 1014, + ay, + a.textColor, + a.boldColor, + 6, + a.font + ); + } + if (a.frame === hidetime / 2) { + core.setAlpha(ctx, 1 - (hidetime - a.frame) / hidetime); + ay = 624 + ((numa * (hidetime - a.frame)) / hidetime) * 3; + core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - a.text, - 1014, - ay, - a.textColor, - a.boldColor, - 6, - a.font - ); - if (!b) { - a.frame++; - i++; - } - } - } - if (b) { - if (b.frame > hidetime / 2 && b.frame <= hidetime) { - b.frame++; - core.setAlpha(ctx, 1 - (hidetime - b.frame) / hidetime); - by += ((numb * (hidetime - b.frame)) / hidetime) * 3; - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - b.text, - 1014, - by, - b.textColor, - b.boldColor, - 6, - b.font - ); + core.fillBoldText1( + ctx, + a.text, + 1014, + ay, + a.textColor, + a.boldColor, + 6, + a.font + ); + if (!b) { + a.frame++; + i++; + } + } + } + if (b) { + if (b.frame > hidetime / 2 && b.frame <= hidetime) { + b.frame++; + core.setAlpha(ctx, 1 - (hidetime - b.frame) / hidetime); + by += ((numb * (hidetime - b.frame)) / hidetime) * 3; + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + b.text, + 1014, + by, + b.textColor, + b.boldColor, + 6, + b.font + ); - core.stopSound(sod); - } - const lisenb = - b.sound && core.sounds[b.sound] && core.musicStatus.soundStatus; - if (b.frame && lisenb) { - sod = core.playSound(sound); - } - if (b.frame > hidetime && b.frame < hidetime + b.time) { - b.frame++; - ctx.globalAlpha = 1; - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - b.text, - 1014, - by, - b.textColor, - b.boldColor, - 6, - b.font - ); - } + core.stopSound(sod); + } + const lisenb = + b.sound && core.sounds[b.sound] && core.musicStatus.soundStatus; + if (b.frame && lisenb) { + sod = core.playSound(sound); + } + if (b.frame > hidetime && b.frame < hidetime + b.time) { + b.frame++; + ctx.globalAlpha = 1; + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + b.text, + 1014, + by, + b.textColor, + b.boldColor, + 6, + b.font + ); + } - if (b.frame == hidetime + b.time) { - ctx.globalAlpha = 1; - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - b.text, - 1014, - by, - b.textColor, - b.boldColor, - 6, - b.font - ); - if (a) a.frame++; - if (b) b.frame++; - if (c) c.frame++; - i++; - } - } - if (c) { - if ( - c.frame > hidetime + c.time && - c.frame < (hidetime * 3) / 2 + c.time - ) { - c.frame++; - core.setAlpha( - ctx, - 1 - (c.frame - hidetime - c.time) / hidetime - ); - cy -= ((numc * (c.frame - hidetime - c.time)) / hidetime) * 3; - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - c.text, - 1014, - cy, - c.textColor, - c.boldColor, - 6, - c.font - ); - } - if (c.frame === (hidetime * 3) / 2 + c.time) { - core.setAlpha( - ctx, - 1 - (c.frame - hidetime - c.time) / hidetime - ); - cy = - 624 - ((numc * (c.frame - hidetime - c.time)) / hidetime) * 3; - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - c.text, - 1014, - cy, - c.textColor, - c.boldColor, - 6, - c.font - ); - if (!b) { - c.frame++; - i++; - } - } - } - if (d) { - if ( - d.frame > (hidetime * 3) / 2 + d.time && - d.frame < hidetime * 2 + d.time - ) { - d.frame++; - core.setAlpha( - ctx, - 1 - (d.frame - hidetime - d.time) / hidetime - ); - dy -= ((numd * (d.frame - hidetime - d.time)) / hidetime) * 3; - core.setTextAlign(ctx, "center"); - core.fillBoldText1( - ctx, - d.text, - 1014, - dy, - d.textColor, - d.boldColor, - 6, - d.font - ); - } - if (d.frame == hidetime * 2 + d.time && !c) { - core.unregisterAnimationFrame("overlist"); - ctx.restore(); - over.style.display = "none"; - core.stopSound(sod); - core.doAction(); - return; - } - } - } - ctx.restore(); - } - }); - }; + if (b.frame == hidetime + b.time) { + ctx.globalAlpha = 1; + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + b.text, + 1014, + by, + b.textColor, + b.boldColor, + 6, + b.font + ); + if (a) a.frame++; + if (b) b.frame++; + if (c) c.frame++; + i++; + } + } + if (c) { + if ( + c.frame > hidetime + c.time && + c.frame < (hidetime * 3) / 2 + c.time + ) { + c.frame++; + core.setAlpha( + ctx, + 1 - (c.frame - hidetime - c.time) / hidetime + ); + cy -= ((numc * (c.frame - hidetime - c.time)) / hidetime) * 3; + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + c.text, + 1014, + cy, + c.textColor, + c.boldColor, + 6, + c.font + ); + } + if (c.frame === (hidetime * 3) / 2 + c.time) { + core.setAlpha( + ctx, + 1 - (c.frame - hidetime - c.time) / hidetime + ); + cy = + 624 - ((numc * (c.frame - hidetime - c.time)) / hidetime) * 3; + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + c.text, + 1014, + cy, + c.textColor, + c.boldColor, + 6, + c.font + ); + if (!b) { + c.frame++; + i++; + } + } + } + if (d) { + if ( + d.frame > (hidetime * 3) / 2 + d.time && + d.frame < hidetime * 2 + d.time + ) { + d.frame++; + core.setAlpha( + ctx, + 1 - (d.frame - hidetime - d.time) / hidetime + ); + dy -= ((numd * (d.frame - hidetime - d.time)) / hidetime) * 3; + core.setTextAlign(ctx, "center"); + core.fillBoldText1( + ctx, + d.text, + 1014, + dy, + d.textColor, + d.boldColor, + 6, + d.font + ); + } + if (d.frame == hidetime * 2 + d.time && !c) { + core.unregisterAnimationFrame("overlist"); + ctx.restore(); + over.style.display = "none"; + core.stopSound(sod); + core.doAction(); + return; + } + } + } + ctx.restore(); + } + }); + }; - this.changebg = function (img1, memory1, img2, memory2, time, style) { - let globalAlpha1 = 0; - let globalAlpha2 = time; - img1 = core.material.images.images?.[img1]; - img2 = core.material.images.images?.[img2]; - over.style.display = "block"; - let now = 0; - switch (style) { - case "引入": - core.registerAnimationFrame("bgin", true, (timestamp) => { - if (timestamp - now > 1000 / 60) { - now = timestamp; - core.clearMap(ctx); - if (core.domStyle.isVertical) { - ctx.canvas.width = 1248; - ctx.canvas.height = 676 * 3; - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } else { - ctx.canvas.width = 676 * 3; - ctx.canvas.height = 1248; - } - ctx.globalAlpha = globalAlpha1 / time; - if (img2) { - //绘制背景 - if (memory2) ctx.filter = "sepia(50%)"; - ctx.drawImage(img2, 0, 0, 676 * 3, 1248); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 676 * 3, 1248); - } - globalAlpha1++; - ctx.restore(); - if (globalAlpha1 >= time) { - core.unregisterAnimationFrame("bgin"); - over.style.display = "none"; - core.doAction(); - } - } - }); + this.changebg = function (img1, memory1, img2, memory2, time, style) { + let globalAlpha1 = 0; + let globalAlpha2 = time; + img1 = core.material.images.images?.[img1]; + img2 = core.material.images.images?.[img2]; + over.style.display = "block"; + let now = 0; + switch (style) { + case "引入": + core.registerAnimationFrame("bgin", true, (timestamp) => { + if (timestamp - now > 1000 / 60) { + now = timestamp; + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 1248; + } + ctx.globalAlpha = globalAlpha1 / time; + if (img2) { + //绘制背景 + if (memory2) ctx.filter = "sepia(50%)"; + ctx.drawImage(img2, 0, 0, 676 * 3, 1248); + ctx.filter = "none"; + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + } + globalAlpha1++; + ctx.restore(); + if (globalAlpha1 >= time) { + core.unregisterAnimationFrame("bgin"); + over.style.display = "none"; + core.doAction(); + } + } + }); - break; - case "引出": - core.registerAnimationFrame("bgout", true, (timestamp) => { - if (timestamp - now > 1000 / 60) { - now = timestamp; - core.clearMap(ctx); - if (core.domStyle.isVertical) { - ctx.canvas.width = 1248; - ctx.canvas.height = 676 * 3; - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } else { - ctx.canvas.width = 676 * 3; - ctx.canvas.height = 1248; - } - ctx.globalAlpha = globalAlpha2 / time; - if (img1) { - //绘制背景 - if (memory1) ctx.filter = "sepia(50%)"; - ctx.drawImage(img1, 0, 0, 676 * 3, 1248); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 676 * 3, 1248); - } - globalAlpha2--; - ctx.restore(); - if (globalAlpha2 <= 0) { - core.unregisterAnimationFrame("bgout"); - over.style.display = "none"; - core.doAction(); - } - } - }); + break; + case "引出": + core.registerAnimationFrame("bgout", true, (timestamp) => { + if (timestamp - now > 1000 / 60) { + now = timestamp; + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 1248; + } + ctx.globalAlpha = globalAlpha2 / time; + if (img1) { + //绘制背景 + if (memory1) ctx.filter = "sepia(50%)"; + ctx.drawImage(img1, 0, 0, 676 * 3, 1248); + ctx.filter = "none"; + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + } + globalAlpha2--; + ctx.restore(); + if (globalAlpha2 <= 0) { + core.unregisterAnimationFrame("bgout"); + over.style.display = "none"; + core.doAction(); + } + } + }); - break; - case "场景切换": - core.registerAnimationFrame("changebg", true, (timestamp) => { - if (timestamp - now > 1000 / 60) { - now = timestamp; - core.clearMap(ctx); - if (core.domStyle.isVertical) { - ctx.canvas.width = 1248; - ctx.canvas.height = 676 * 3; - ctx.save(); //保存设置 - ctx.translate(1248, 0); //重新定位右上角为基准 - ctx.rotate(Math.PI / 2); //旋转90度 - } else { - ctx.canvas.width = 676 * 3; - ctx.canvas.height = 1248; - } - ctx.globalAlpha = 1; - core.fillRect(ctx, 0, 0, 676 * 3, 1248); - ctx.globalAlpha = globalAlpha2 / time; - if (img1) { - //绘制背景 - if (memory1) ctx.filter = "sepia(50%)"; - ctx.drawImage(img1, 0, 0, 676 * 3, 1248); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 676 * 3, 1248); - } - ctx.globalAlpha = globalAlpha1 / time; - if (img2) { - //绘制背景 - if (memory2) ctx.filter = "sepia(50%)"; - ctx.drawImage(img2, 0, 0, 676 * 3, 1248); - ctx.filter = "none"; - } else { - core.fillRect(ctx, 0, 0, 676 * 3, 1248); - } - globalAlpha2--; - globalAlpha1++; - ctx.restore(); - if (globalAlpha2 <= 0 || globalAlpha1 >= time) { - core.unregisterAnimationFrame("changebg"); - over.style.display = "none"; - core.doAction(); - } - } - }); + break; + case "场景切换": + core.registerAnimationFrame("changebg", true, (timestamp) => { + if (timestamp - now > 1000 / 60) { + now = timestamp; + core.clearMap(ctx); + if (core.domStyle.isVertical) { + ctx.canvas.width = 1248; + ctx.canvas.height = 676 * 3; + ctx.save(); //保存设置 + ctx.translate(1248, 0); //重新定位右上角为基准 + ctx.rotate(Math.PI / 2); //旋转90度 + } else { + ctx.canvas.width = 676 * 3; + ctx.canvas.height = 1248; + } + ctx.globalAlpha = 1; + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + ctx.globalAlpha = globalAlpha2 / time; + if (img1) { + //绘制背景 + if (memory1) ctx.filter = "sepia(50%)"; + ctx.drawImage(img1, 0, 0, 676 * 3, 1248); + ctx.filter = "none"; + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + } + ctx.globalAlpha = globalAlpha1 / time; + if (img2) { + //绘制背景 + if (memory2) ctx.filter = "sepia(50%)"; + ctx.drawImage(img2, 0, 0, 676 * 3, 1248); + ctx.filter = "none"; + } else { + core.fillRect(ctx, 0, 0, 676 * 3, 1248); + } + globalAlpha2--; + globalAlpha1++; + ctx.restore(); + if (globalAlpha2 <= 0 || globalAlpha1 >= time) { + core.unregisterAnimationFrame("changebg"); + over.style.display = "none"; + core.doAction(); + } + } + }); - break; - } - }; - }, + break; + } + }; +}, "回合制boss战": function () { // 在此增加新插件 const boss = document.createElement("canvas"); //boss战画布设置 @@ -20081,6 +20355,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = const ctx = animateAttack.getContext("2d"); core.plugin.playingattack = new Set() const ctx6 = main.dom.animate2.getContext('2d') + let easy = false function playanimate(name, x, y, scalex = 1, scaley = 1) { const data = { @@ -20226,7 +20501,36 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }) } + core.plugin.battle_onclick = function (x, y, 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]; + const easybox = makeBox([90, 212], [80, 22]), + easyclosebox = makeBox([290, 212], [40, 22]), + uneasybox = makeBox([250, 300], [80, 22]), + uneasyclosebox = makeBox([290, 325], [40, 22]); + if (inRect(pos, easybox) && easy) { + easy = false + } else if (inRect(pos, uneasybox) && !easy) { + easy = true + } else if ((inRect(pos, easyclosebox) && easy) || (inRect(pos, uneasyclosebox) && !easy)) { + core.status.event.id = '' + core.unregisterAnimationFrame("attackAnimate") + core.clearMap(ctx) + core.closePanel() + } + } main.dom.gameDraw.appendChild(animateAttack); const { lcm, gcd } = core.plugin.utils @@ -20239,6 +20543,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = damageInfo, onegcd ) { + core.lockControl() + core.status.event.id = 'battle' + let attack = false; if (heroInfo.isAttack) attack = true; if (enemyInfo.isAttack) attack = true; @@ -20247,297 +20554,512 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }); core.clearMap(ctx); let animate = Math.floor(farme / 30); - core.fillRect(ctx, 64, 64, 288, 288, "rgba(0,0,0,0.5)"); - core.strokeRect(ctx, 64, 64, 288, 288, "rgba(255,255,255,0.5)", 4); - core.setTextAlign(ctx, "center"); - core.fillBoldText( - ctx, - hero.name, - 127, - 128, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.setTextAlign(ctx, "left"); - core.drawIcon(ctx, "hp", 70, 190, 16, 16); - core.drawIcon(ctx, "atk", 70, 210, 16, 16); - core.drawIcon(ctx, "def", 70, 230, 16, 16); - core.drawIcon(ctx, "I374", 70, 250, 16, 16); - core.drawIcon(ctx, "I375", 70, 270, 16, 16); - core.drawIcon(ctx, "mdef", 70, 290, 16, 16); - core.drawIcon(ctx, "amulet", 70, 310, 16, 16); - core.drawIcon(ctx, "jumpShoes", 70, 330, 16, 16); - core.fillBoldText( - ctx, - "生命 " + - core.formatBigNumber(heroInfo.hp, true) + - 90, - 205, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - "攻击 " + core.formatBigNumber(heroInfo.atk), - 90, - 225, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - "防御 " + core.formatBigNumber(heroInfo.def), - 90, - 245, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - "法强 " + core.formatBigNumber(heroInfo.spell), - 90, - 265, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - "法攻 " + - core.formatBigNumber((heroInfo.matk / 100) * heroInfo.spell) + - "(" + - heroInfo.matk + - "%)", - 90, - 285, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - "护盾 " + - core.formatBigNumber((heroInfo.mhp / 100) * heroInfo.spell) + - "(" + - heroInfo.mhp + - "%)", - 90, - 305, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - "法抗 " + heroInfo.mdef + "%", - 90, - 325, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - "速度 " + core.formatBigNumber(heroInfo.speed), - 90, - 345, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - - core.strokeRect(ctx, 112, 139, 32, 48, "rgba(255,255,255,1)", 1); - core.drawImage( - ctx, - "hero.webp", - 32 * (animate % 4), - 0, - 32, - 48, - 112, - 139, - 32, - 48 - ); - - core.setTextAlign(ctx, "center"); - core.fillBoldText( - ctx, - enemyInfo.name, - 289, - 128, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - - core.setTextAlign(ctx, "right"); - if (enemyInfo.cls === "enemys") { - core.strokeRect(ctx, 272, 155, 32, 32, "rgba(255,255,255,1)", 1); - - core.drawImage( + if (easy) { + core.fillRect(ctx, 64, 64, 288, 180, "rgba(0,0,0,0.5)"); + core.strokeRect(ctx, 64, 64, 288, 180, "rgba(255,255,255,0.5)", 4); + core.setTextAlign(ctx, "center"); + core.fillBoldText( ctx, - core.getBlockInfo(enemyInfo.id).image, - 32 * (animate % 2), - core.getBlockInfo(enemyInfo.id).posY * 32, - 32, - 32, - 272, - 155, - 32, - 32 + hero.name, + 127, + 128, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.setTextAlign(ctx, "left"); + core.drawIcon(ctx, "hp", 70, 190, 16, 16); + core.fillBoldText( + ctx, + "生命 " + core.formatBigNumber(heroInfo.hp, true), + 90, + 205, + "#FFFFFF", + "#000000", + "bold 14px pala" ); - } else { - core.strokeRect(ctx, 272, 139, 32, 48, "rgba(255,255,255,1)", 1); + core.fillBoldText( + ctx, + "详细模式", + 90, + 230, + "#FFFF60", + "#000000", + "bold 18px pala" + ); + + + core.strokeRect(ctx, 112, 139, 32, 48, "rgba(255,255,255,1)", 1); core.drawImage( ctx, - core.getBlockInfo(enemyInfo.id).image, + "hero.webp", 32 * (animate % 4), - core.getBlockInfo(enemyInfo.id).posY * 48, + 0, 32, 48, - 272, + 112, 139, 32, 48 ); - } - core.drawIcon(ctx, "hp", 330, 190, 16, 16); - core.drawIcon(ctx, "atk", 330, 210, 16, 16); - core.drawIcon(ctx, "def", 330, 230, 16, 16); - core.drawIcon(ctx, "amulet", 330, 250, 16, 16); - core.drawIcon(ctx, "jumpShoes", 330, 270, 16, 16); - core.fillBoldText( - ctx, - core.formatBigNumber(enemyInfo.hp, true) + " 生命", - 330, - 205, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - core.formatBigNumber(enemyInfo.atk) + " 攻击", - 330, - 225, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - core.formatBigNumber(enemyInfo.def) + " 防御", - 330, - 245, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - (enemyInfo.mdef ?? 0) * 100 + "% 法抗", - 330, - 265, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - core.formatBigNumber(enemyInfo.speed) + " 速度", - 330, - 285, - "#FFFFFF", - "#000000", - "bold 14px pala" - ); - core.fillBoldText( - ctx, - "V", - 219, - 163, - "#FFFFFF", - "#000000", - "bold 48px pala" - ); - core.fillBoldText( - ctx, - "s", - 231, - 163, - "#FFFFFF", - "#000000", - "bold 36px pala" - ); - - if (!attack) enemyInfo.now += enemyInfo.speed / onegcd; - let enemynow = Math.min(100 + enemyInfo.now / oneTurn * 215, 315); - ctx.fillStyle = "#FFFFFF"; - ctx.beginPath(); - ctx.moveTo(enemynow, 100); - ctx.lineTo(enemynow + 5, 90); - ctx.lineTo(enemynow - 5, 90); - ctx.closePath(); - ctx.fill(); - - if (enemyInfo.cls === "enemys") { - core.drawImage( + core.setTextAlign(ctx, "center"); + core.fillBoldText( ctx, - core.getBlockInfo(enemyInfo.id).image, - 32, - core.getBlockInfo(enemyInfo.id).posY * 32, - 32, - 32, - enemynow - 16, - 64, - 32, - 32 + enemyInfo.name, + 289, + 128, + "#FFFFFF", + "#000000", + "bold 14px pala" ); - } else { - core.drawImage( + + core.setTextAlign(ctx, "right"); + if (enemyInfo.cls === "enemys") { + core.strokeRect(ctx, 272, 155, 32, 32, "rgba(255,255,255,1)", 1); + + core.drawImage( + ctx, + core.getBlockInfo(enemyInfo.id).image, + 32 * (animate % 2), + core.getBlockInfo(enemyInfo.id).posY * 32, + 32, + 32, + 272, + 155, + 32, + 32 + ); + } else { + core.strokeRect(ctx, 272, 139, 32, 48, "rgba(255,255,255,1)", 1); + + core.drawImage( + ctx, + core.getBlockInfo(enemyInfo.id).image, + 32 * (animate % 4), + core.getBlockInfo(enemyInfo.id).posY * 48, + 32, + 48, + 272, + 139, + 32, + 48 + ); + } + core.drawIcon(ctx, "hp", 330, 190, 16, 16); + + core.fillBoldText( ctx, - core.getBlockInfo(enemyInfo.id).image, - 32, - core.getBlockInfo(enemyInfo.id).posY * 48, - 32, - 19, - enemynow - 16, - 70, - 32, - 19 + core.formatBigNumber(enemyInfo.hp, true) + " 生命", + 330, + 205, + "#FFFFFF", + "#000000", + "bold 14px pala" ); - } - core.drawLine(ctx, 100, 105, 315, 105, "#FFFFFF", 5); - equipInfo.forEach(function (v) { - if (!attack) v.now += v.speed / onegcd; - let vnow = Math.min(100 + v.now / oneTurn * 215, 315); + core.fillBoldText( + ctx, + "跳过", + 330, + 230, + "#FFFF60", + "#000000", + "bold 18px pala" + ); + + core.fillBoldText( + ctx, + "V", + 219, + 163, + "#FFFFFF", + "#000000", + "bold 48px pala" + ); + core.fillBoldText( + ctx, + "s", + 231, + 163, + "#FFFFFF", + "#000000", + "bold 36px pala" + ); + + if (!attack) enemyInfo.now += enemyInfo.speed / onegcd; + let enemynow = Math.min(100 + enemyInfo.now / oneTurn * 215, 315); + ctx.fillStyle = "#FFFFFF"; ctx.beginPath(); - ctx.moveTo(vnow, 100); - ctx.lineTo(vnow + 5, 90); - ctx.lineTo(vnow - 5, 90); + ctx.moveTo(enemynow, 100); + ctx.lineTo(enemynow + 5, 90); + ctx.lineTo(enemynow - 5, 90); + ctx.closePath(); + ctx.fill(); + + if (enemyInfo.cls === "enemys") { + core.drawImage( + ctx, + core.getBlockInfo(enemyInfo.id).image, + 32, + core.getBlockInfo(enemyInfo.id).posY * 32, + 32, + 32, + enemynow - 16, + 64, + 32, + 32 + ); + } else { + core.drawImage( + ctx, + core.getBlockInfo(enemyInfo.id).image, + 32, + core.getBlockInfo(enemyInfo.id).posY * 48, + 32, + 19, + enemynow - 16, + 70, + 32, + 19 + ); + } + core.drawLine(ctx, 100, 105, 315, 105, "#FFFFFF", 5); + equipInfo.forEach(function (v) { + if (!attack) v.now += v.speed / onegcd; + let vnow = Math.min(100 + v.now / oneTurn * 215, 315); + ctx.beginPath(); + ctx.moveTo(vnow, 100); + ctx.lineTo(vnow + 5, 90); + ctx.lineTo(vnow - 5, 90); + ctx.closePath(); + + ctx.fill(); + + core.drawIcon(ctx, v.id, vnow - 16, 64, 32, 32); + }); + if (!attack) heroInfo.now += hero.speed / onegcd; + let heronow = Math.min(100 + heroInfo.now / oneTurn * 215, 315); + ctx.beginPath(); + ctx.moveTo(heronow, 100); + ctx.lineTo(heronow + 5, 90); + ctx.lineTo(heronow - 5, 90); ctx.closePath(); ctx.fill(); + core.drawImage(ctx, "hero.webp", 0, 0, 32, 19, heronow - 16, 70, 32, 19); + } else { + core.fillRect(ctx, 64, 64, 288, 288, "rgba(0,0,0,0.5)"); + core.strokeRect(ctx, 64, 64, 288, 288, "rgba(255,255,255,0.5)", 4); + core.setTextAlign(ctx, "center"); + core.fillBoldText( + ctx, + hero.name, + 127, + 128, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.setTextAlign(ctx, "left"); + core.drawIcon(ctx, "hp", 70, 190, 16, 16); + core.drawIcon(ctx, "atk", 70, 210, 16, 16); + core.drawIcon(ctx, "def", 70, 230, 16, 16); + core.drawIcon(ctx, "I374", 70, 250, 16, 16); + core.drawIcon(ctx, "I375", 70, 270, 16, 16); + core.drawIcon(ctx, "mdef", 70, 290, 16, 16); + core.drawIcon(ctx, "amulet", 70, 310, 16, 16); + core.drawIcon(ctx, "jumpShoes", 70, 330, 16, 16); + core.fillBoldText( + ctx, + "生命 " + core.formatBigNumber(heroInfo.hp, true), + 90, + 205, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); - core.drawIcon(ctx, v.id, vnow - 16, 64, 32, 32); - }); - if (!attack) heroInfo.now += hero.speed / onegcd; - let heronow = Math.min(100 + heroInfo.now / oneTurn * 215, 315); - ctx.beginPath(); - ctx.moveTo(heronow, 100); - ctx.lineTo(heronow + 5, 90); - ctx.lineTo(heronow - 5, 90); - ctx.closePath(); + core.fillBoldText( + ctx, + "攻击 " + core.formatBigNumber(heroInfo.atk), + 90, + 225, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + "防御 " + core.formatBigNumber(heroInfo.def), + 90, + 245, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + "法强 " + core.formatBigNumber(heroInfo.spell), + 90, + 265, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + "法攻 " + + core.formatBigNumber((heroInfo.matk / 100) * heroInfo.spell) + + "(" + + heroInfo.matk + + "%)", + 90, + 285, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + "护盾 " + + core.formatBigNumber((heroInfo.mhp / 100) * heroInfo.spell) + + "(" + + heroInfo.mhp + + "%)", + 90, + 305, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + "法抗 " + heroInfo.mdef + "%", + 90, + 325, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + "速度 " + core.formatBigNumber(heroInfo.speed), + 90, + 345, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); - ctx.fill(); - core.drawImage(ctx, "hero.webp", 0, 0, 32, 19, heronow - 16, 70, 32, 19); + core.strokeRect(ctx, 112, 139, 32, 48, "rgba(255,255,255,1)", 1); + core.drawImage( + ctx, + "hero.webp", + 32 * (animate % 4), + 0, + 32, + 48, + 112, + 139, + 32, + 48 + ); + + core.setTextAlign(ctx, "center"); + core.fillBoldText( + ctx, + enemyInfo.name, + 289, + 128, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + + core.setTextAlign(ctx, "right"); + if (enemyInfo.cls === "enemys") { + core.strokeRect(ctx, 272, 155, 32, 32, "rgba(255,255,255,1)", 1); + + core.drawImage( + ctx, + core.getBlockInfo(enemyInfo.id).image, + 32 * (animate % 2), + core.getBlockInfo(enemyInfo.id).posY * 32, + 32, + 32, + 272, + 155, + 32, + 32 + ); + } else { + core.strokeRect(ctx, 272, 139, 32, 48, "rgba(255,255,255,1)", 1); + + core.drawImage( + ctx, + core.getBlockInfo(enemyInfo.id).image, + 32 * (animate % 4), + core.getBlockInfo(enemyInfo.id).posY * 48, + 32, + 48, + 272, + 139, + 32, + 48 + ); + } + core.drawIcon(ctx, "hp", 330, 190, 16, 16); + core.drawIcon(ctx, "atk", 330, 210, 16, 16); + core.drawIcon(ctx, "def", 330, 230, 16, 16); + core.drawIcon(ctx, "amulet", 330, 250, 16, 16); + core.drawIcon(ctx, "jumpShoes", 330, 270, 16, 16); + core.fillBoldText( + ctx, + core.formatBigNumber(enemyInfo.hp, true) + " 生命", + 330, + 205, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + core.formatBigNumber(enemyInfo.atk) + " 攻击", + 330, + 225, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + core.formatBigNumber(enemyInfo.def) + " 防御", + 330, + 245, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + + core.fillBoldText( + ctx, + (enemyInfo.mdef ?? 0) * 100 + "% 法抗", + 330, + 265, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + core.formatBigNumber(enemyInfo.speed) + " 速度", + 330, + 285, + "#FFFFFF", + "#000000", + "bold 14px pala" + ); + core.fillBoldText( + ctx, + "简易模式", + 330, + 315, + "#FFFF60", + "#000000", + "bold 18px pala" + ); + core.fillBoldText( + ctx, + "跳过", + 330, + 340, + "#FFFF60", + "#000000", + "bold 18px pala" + ); + + core.fillBoldText( + ctx, + "V", + 219, + 163, + "#FFFFFF", + "#000000", + "bold 48px pala" + ); + core.fillBoldText( + ctx, + "s", + 231, + 163, + "#FFFFFF", + "#000000", + "bold 36px pala" + ); + + if (!attack) enemyInfo.now += enemyInfo.speed / onegcd; + let enemynow = Math.min(100 + enemyInfo.now / oneTurn * 215, 315); + ctx.fillStyle = "#FFFFFF"; + ctx.beginPath(); + ctx.moveTo(enemynow, 100); + ctx.lineTo(enemynow + 5, 90); + ctx.lineTo(enemynow - 5, 90); + ctx.closePath(); + ctx.fill(); + + if (enemyInfo.cls === "enemys") { + core.drawImage( + ctx, + core.getBlockInfo(enemyInfo.id).image, + 32, + core.getBlockInfo(enemyInfo.id).posY * 32, + 32, + 32, + enemynow - 16, + 64, + 32, + 32 + ); + } else { + core.drawImage( + ctx, + core.getBlockInfo(enemyInfo.id).image, + 32, + core.getBlockInfo(enemyInfo.id).posY * 48, + 32, + 19, + enemynow - 16, + 70, + 32, + 19 + ); + } + core.drawLine(ctx, 100, 105, 315, 105, "#FFFFFF", 5); + equipInfo.forEach(function (v) { + if (!attack) v.now += v.speed / onegcd; + let vnow = Math.min(100 + v.now / oneTurn * 215, 315); + ctx.beginPath(); + ctx.moveTo(vnow, 100); + ctx.lineTo(vnow + 5, 90); + ctx.lineTo(vnow - 5, 90); + ctx.closePath(); + + ctx.fill(); + + core.drawIcon(ctx, v.id, vnow - 16, 64, 32, 32); + }); + if (!attack) heroInfo.now += hero.speed / onegcd; + let heronow = Math.min(100 + heroInfo.now / oneTurn * 215, 315); + ctx.beginPath(); + ctx.moveTo(heronow, 100); + ctx.lineTo(heronow + 5, 90); + ctx.lineTo(heronow - 5, 90); + ctx.closePath(); + + ctx.fill(); + core.drawImage(ctx, "hero.webp", 0, 0, 32, 19, heronow - 16, 70, 32, 19); + } let nowattacking = false if (heroInfo.now >= oneTurn && !heroInfo.isAttack) { @@ -20596,9 +21118,19 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ]) + + if (heroInfo.hp <= 0 || enemyInfo.hp <= 0) { + core.status.event.id = '' + core.unregisterAnimationFrame("attackAnimate") + core.clearMap(ctx) + core.closePanel() + + } } + + }; function animateOnAttack(name, onenemy) {