From f81399f4530ae55ba46278b0793f98e9f6ee7412 Mon Sep 17 00:00:00 2001 From: strawberry42271 <2806566736@qq.com> Date: Thu, 6 Feb 2025 15:49:40 +0800 Subject: [PATCH] =?UTF-8?q?=E4=BF=AE=E5=A4=8D=E6=BB=91=E5=B1=8F/=E5=9B=BA?= =?UTF-8?q?=E4=BC=A4bug?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/table/comment.js | 2 +- project/enemys.js | 10 +- project/functions.js | 251 ++-------- project/plugins.js | 1019 +++++++++++++++++++------------------- 4 files changed, 552 insertions(+), 730 deletions(-) diff --git a/_server/table/comment.js b/_server/table/comment.js index 3cf5699..d35742e 100644 --- a/_server/table/comment.js +++ b/_server/table/comment.js @@ -368,7 +368,7 @@ var comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_docs": "退化扣防", "_data": "退化时勇士下降的防御力点数" }, - "damage": { + "damage2": { "_leaf": true, "_type": "textarea", "_range": "thiseval==~~thiseval||thiseval==null", diff --git a/project/enemys.js b/project/enemys.js index 8c80082..d1ff382 100644 --- a/project/enemys.js +++ b/project/enemys.js @@ -1,7 +1,7 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = { - "greenSlime": {"name":"绿头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"magic":false,"mdef":0}, - "redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10,"magic":false}, + "greenSlime": {"name":"绿头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"mdef":0}, + "redSlime": {"name":"红头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[],"value":10}, "blackSlime": {"name":"青头怪","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "slimelord": {"name":"怪王","hp":100,"atk":120,"def":0,"money":10,"exp":0,"point":0,"special":[1,9]}, "bat": {"name":"小蝙蝠","hp":100,"atk":120,"def":0,"money":2,"exp":0,"point":0,"special":[1],"mdef":0,"speed":15}, @@ -10,9 +10,9 @@ var enemys_fcae963b_31c9_42b4_b48c_bb48d09f3f80 = "vampire": {"name":"冥灵魔王","hp":888,"atk":888,"def":888,"money":888,"exp":888,"point":0,"special":[6],"n":8}, "skeleton": {"name":"骷髅人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "skeletonCaptain": {"name":"骷髅队长","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, - "zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0,"magic":false}, - "zombieKnight": {"name":"兽人武士","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, - "rock": {"name":"石头人","hp":50,"atk":50,"def":0,"money":3,"exp":0,"point":0,"special":3}, + "zombie": {"name":"兽人","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":[22]}, + "zombieKnight": {"name":"兽人武士","hp":10000,"atk":100,"def":100,"money":0,"exp":0,"point":0,"special":[22],"speed":10,"mdef":0,"damage2":20}, + "rock": {"name":"石头人","hp":50,"atk":50,"def":0,"money":3,"exp":0,"point":0,"special":3,"damage2":15}, "bluePriest": {"name":"初级法师","hp":100,"atk":120,"def":0,"money":3,"exp":0,"point":1,"special":[9]}, "redPriest": {"name":"高级法师","hp":0,"atk":0,"def":0,"money":0,"exp":0,"point":0,"special":0}, "brownWizard": {"name":"初级巫师","hp":100,"atk":120,"def":0,"money":16,"exp":0,"point":0,"special":15,"value":100,"range":2}, diff --git a/project/functions.js b/project/functions.js index 5e413e0..d5e7ddc 100644 --- a/project/functions.js +++ b/project/functions.js @@ -524,222 +524,41 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = }, "enemys": { "getSpecials": function () { - // 获得怪物的特殊属性,每一行定义一个特殊属性。 - // 分为五项,第一项为该特殊属性的数字,第二项为特殊属性的名字,第三项为特殊属性的描述 - // 第四项为该特殊属性的颜色,可以写十六进制 #RRGGBB 或者 [r,g,b,a] 四元数组 - // 第五项为该特殊属性的标记;目前 1 代表是地图类技能(需要进行遍历全图) - // 名字和描述可以直接写字符串,也可以写个function将怪物传进去 - return [ - [1, "先攻", "怪物首先攻击", "#ffcc33"], - [3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"], - [ - 6, - function (enemy) { - return (enemy.n || "") + "连击"; - }, - function (enemy) { - return "怪物每回合攻击" + (enemy.n || 4) + "次"; - }, - "#ffee77", - ], - [ - 7, - "破甲", - function (enemy) { - return ( - "战斗前,怪物附加角色防御的" + - Math.floor( - 100 * (enemy.breakArmor || core.values.breakArmor || 0) - ) + - "%作为伤害" - ); - }, - "#88c0ff", - ], - [ - 8, - "反击", - function (enemy) { - return ( - "战斗时,怪物每回合附加角色攻击的" + - Math.floor( - 100 * (enemy.counterAttack || core.values.counterAttack || 0) - ) + - "%作为伤害,无视角色防御" - ); - }, - "#ffaa44", - ], - [ - 9, - "净化", - function (enemy) { - return ( - "战斗前,怪物附加角色护盾的" + - (enemy.purify || core.values.purify) + - "倍作为伤害" - ); - }, - "#80eed6", - ], - [10, "模仿", "怪物的攻防和角色攻防相等", "#b0c0dd"], - [ - 11, - "吸血", - function (enemy) { - return ( - "战斗前,怪物首先吸取角色的" + - Math.floor(100 * enemy.vampire || 0) + - "%生命(约" + - Math.floor((enemy.vampire || 0) * core.getStatus("hp")) + - "点)作为伤害" + - (enemy.add ? ",并把伤害数值加到自身生命上" : "") - ); - }, - "#dd4448", - ], - [ - 12, - "中毒", - "战斗后,角色陷入中毒状态,每一步损失生命" + - core.values.poisonDamage + - "点", - "#99ee88", - ], - [ - 13, - "衰弱", - "战斗后,角色陷入衰弱状态,攻防暂时下降" + - (core.values.weakValue >= 1 - ? core.values.weakValue + "点" - : parseInt(core.values.weakValue * 100) + "%"), - "#f0bbcc", - ], - [ - 14, - "诅咒", - "战斗后,角色陷入诅咒状态,战斗无法获得金币和经验", - "#bbeef0", - ], - [ - 15, - "领域", - function (enemy) { - return ( - "经过怪物周围" + - (enemy.zoneSquare ? "九宫格" : "十字") + - "范围内" + - (enemy.range || 1) + - "格时自动减生命" + - (enemy.zone || 0) + - "点" - ); - }, - "#c677dd", - ], - [16, "夹击", "经过两只相同的怪物中间,角色生命值变成一半", "#bb99ee"], - [ - 17, - "仇恨", - "战斗前,怪物附加之前积累的仇恨值作为伤害;战斗后,释放一半的仇恨值。(每杀死一个怪物获得" + - (core.values.hatred || 0) + - "点仇恨值)", - "#b0b666", - ], - [ - 18, - "阻击", - function (enemy) { - return ( - "经过怪物周围" + - (enemy.zoneSquare ? "九宫格" : "十字") + - "时自动减生命" + - (enemy.repulse || 0) + - "点,同时怪物后退一格" - ); - }, - "#8888e6", - ], - [19, "自爆", "战斗后角色的生命值变成1", "#ff6666"], - [20, "无敌", "角色无法打败怪物,除非拥有十字架", "#aaaaaa"], - [ - 21, - "退化", - function (enemy) { - return ( - "战斗后角色永久下降" + - (enemy.atkValue || 0) + - "点攻击和" + - (enemy.defValue || 0) + - "点防御" - ); - }, - ], - [ - 22, - "固伤", - function (enemy) { - return ( - "战斗前,怪物对角色造成" + - (enemy.damage || 0) + - "点固定伤害,未开启负伤时无视角色护盾。" - ); - }, - "#ff9977", - ], - [23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现", "#a0e0ff"], - [ - 24, - "激光", - function (enemy) { - return "经过怪物同行或同列时自动减生命" + (enemy.laser || 0) + "点"; - }, - "#dda0dd", - ], - [ - 25, - "光环", - function (enemy) { - return ( - (enemy.range != null - ? (enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") + - enemy.haloRange + - "格范围内" - : "同楼层所有") + - "怪物生命提升" + - (enemy.hpBuff || 0) + - "%,攻击提升" + - (enemy.atkBuff || 0) + - "%,防御提升" + - (enemy.defBuff || 0) + - "%," + - (enemy.haloAdd ? "可叠加" : "不可叠加") - ); - }, - "#e6e099", - 1, - ], - [ - 26, - "支援", - "当周围一圈的怪物受到攻击时将上前支援,并组成小队战斗。", - "#77c0b6", - 1, - ], - [ - 27, - "捕捉", - function (enemy) { - return ( - "当走到怪物周围" + - (enemy.zoneSquare ? "九宫格" : "十字") + - "时会强制进行战斗。" - ); - }, - "#c0ddbb", - ], - ]; - }, + // 获得怪物的特殊属性,每一行定义一个特殊属性。 + // 分为五项,第一项为该特殊属性的数字,第二项为特殊属性的名字,第三项为特殊属性的描述 + // 第四项为该特殊属性的颜色,可以写十六进制 #RRGGBB 或者 [r,g,b,a] 四元数组 + // 第五项为该特殊属性的标记;目前 1 代表是地图类技能(需要进行遍历全图) + // 名字和描述可以直接写字符串,也可以写个function将怪物传进去 + return [ + [1, "先攻", "怪物首先攻击", "#ffcc33"], + [2, "魔攻", "怪物无视角色的防御", "#bbb0ff"], + [3, "坚固", "怪物防御不小于角色攻击-1", "#c0b088"], + [4, "2连击", "怪物每回合攻击2次", "#ffee77"], + [5, "3连击", "怪物每回合攻击3次", "#ffee77"], + [6, function (enemy) { return (enemy.n || '') + "连击"; }, function (enemy) { return "怪物每回合攻击" + (enemy.n || 4) + "次"; }, "#ffee77"], + [7, "破甲", function (enemy) { return "战斗前,怪物附加角色防御的" + Math.floor(100 * (enemy.breakArmor || core.values.breakArmor || 0)) + "%作为伤害"; }, "#88c0ff"], + [8, "反击", function (enemy) { return "战斗时,怪物每回合附加角色攻击的" + Math.floor(100 * (enemy.counterAttack || core.values.counterAttack || 0)) + "%作为伤害,无视角色防御"; }, "#ffaa44"], + [9, "净化", function (enemy) { return "战斗前,怪物附加角色护盾的" + (enemy.purify || core.values.purify) + "倍作为伤害"; }, "#80eed6"], + [10, "模仿", "怪物的攻防和角色攻防相等", "#b0c0dd"], + [11, "吸血", function (enemy) { return "战斗前,怪物首先吸取角色的" + Math.floor(100 * enemy.vampire || 0) + "%生命(约" + Math.floor((enemy.vampire || 0) * core.getStatus('hp')) + "点)作为伤害" + (enemy.add ? ",并把伤害数值加到自身生命上" : ""); }, "#dd4448"], + [12, "中毒", "战斗后,角色陷入中毒状态,每一步损失生命" + core.values.poisonDamage + "点", "#99ee88"], + [13, "衰弱", "战斗后,角色陷入衰弱状态,攻防暂时下降" + (core.values.weakValue >= 1 ? core.values.weakValue + "点" : parseInt(core.values.weakValue * 100) + "%"), "#f0bbcc"], + [14, "诅咒", "战斗后,角色陷入诅咒状态,战斗无法获得金币和经验", "#bbeef0"], + [15, "领域", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "范围内" + (enemy.range || 1) + "格时自动减生命" + (enemy.zone || 0) + "点"; }, "#c677dd"], + [16, "夹击", "经过两只相同的怪物中间,角色生命值变成一半", "#bb99ee"], + [17, "仇恨", "战斗前,怪物附加之前积累的仇恨值作为伤害;战斗后,释放一半的仇恨值。(每杀死一个怪物获得" + (core.values.hatred || 0) + "点仇恨值)", "#b0b666"], + [18, "阻击", function (enemy) { return "经过怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时自动减生命" + (enemy.repulse || 0) + "点,同时怪物后退一格"; }, "#8888e6"], + [19, "自爆", "战斗后角色的生命值变成1", "#ff6666"], + [20, "无敌", "角色无法打败怪物,除非拥有十字架", "#aaaaaa"], + [21, "退化", function (enemy) { return "战斗后角色永久下降" + (enemy.atkValue || 0) + "点攻击和" + (enemy.defValue || 0) + "点防御"; }], + [22, "固伤", function (enemy) { return "战斗前,怪物对角色造成" + (enemy.damage2 || 0) + "点固定伤害,未开启负伤时无视角色护盾。"; }, "#ff9977"], + [23, "重生", "怪物被击败后,角色转换楼层则怪物将再次出现", "#a0e0ff"], + [24, "激光", function (enemy) { return "经过怪物同行或同列时自动减生命" + (enemy.laser || 0) + "点"; }, "#dda0dd"], + [25, "光环", function (enemy) { return (enemy.range != null ? ((enemy.haloSquare ? "该怪物九宫格" : "该怪物十字") + enemy.haloRange + "格范围内") : "同楼层所有") + "怪物生命提升" + (enemy.hpBuff || 0) + "%,攻击提升" + (enemy.atkBuff || 0) + "%,防御提升" + (enemy.defBuff || 0) + "%," + (enemy.haloAdd ? "可叠加" : "不可叠加"); }, "#e6e099", 1], + [26, "支援", "当周围一圈的怪物受到攻击时将上前支援,并组成小队战斗。", "#77c0b6", 1], + [27, "捕捉", function (enemy) { return "当走到怪物周围" + (enemy.zoneSquare ? "九宫格" : "十字") + "时会强制进行战斗。"; }, "#c0ddbb"] + ]; +}, "getEnemyInfo": function (enemy, hero, x, y, floorId) { // 获得某个怪物变化后的数据;该函数将被伤害计算和怪物手册使用 // 例如:坚固、模仿、仿攻等等 diff --git a/project/plugins.js b/project/plugins.js index 8aad116..6f351f4 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -4750,357 +4750,359 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "手册区分特殊属性": function () { - // 在此增加新插件 - this.arrsame = function (Arraya, Arrayb) { - let a = Arraya || []; - let b = Arrayb || []; - if (typeof a === "number") a = [a]; - if (typeof b === "number") b = [b]; - let c = [...a, ...b]; - for (const i of c) - if (!a.includes(i) || !b.includes(i)) { - return false; - } - return true; - }; - enemys.prototype.getCurrentEnemys = function (floorId) { - floorId = floorId || core.status.floorId; - var enemys = [], - used = {}; - core.extractBlocks(floorId); - core.status.maps[floorId].blocks.forEach(function (block) { - if (!block.disable && block.event.cls.indexOf("enemy") == 0) { - this._getCurrentEnemys_addEnemy( - block.event.id, - enemys, - used, - block.x, - block.y, - floorId - ); - } - }, this); - return this._getCurrentEnemys_sort(enemys); - }; + // 在此增加新插件 + this.arrsame = function (Arraya, Arrayb) { + let a = Arraya || []; + let b = Arrayb || []; + if (typeof a === "number") a = [a]; + if (typeof b === "number") b = [b]; + let c = [...a, ...b]; + for (const i of c) + if (!a.includes(i) || !b.includes(i)) { + return false; + } + return true; + }; + enemys.prototype.getCurrentEnemys = function (floorId) { + floorId = floorId || core.status.floorId; + var enemys = [], + used = {}; + core.extractBlocks(floorId); + core.status.maps[floorId].blocks.forEach(function (block) { + if (!block.disable && block.event.cls.indexOf("enemy") == 0) { + this._getCurrentEnemys_addEnemy( + block.event.id, + enemys, + used, + block.x, + block.y, + floorId + ); + } + }, this); + return this._getCurrentEnemys_sort(enemys); + }; - enemys.prototype._getCurrentEnemys_getEnemy = function (enemyId) { - var enemy = core.material.enemys[enemyId]; - if (!enemy) return null; + enemys.prototype._getCurrentEnemys_getEnemy = function (enemyId) { + var enemy = core.material.enemys[enemyId]; + if (!enemy) return null; - // 检查朝向;displayIdInBook - return ( - core.material.enemys[enemy.displayIdInBook] || - core.material.enemys[(enemy.faceIds || {}).down] || - enemy - ); - }; + // 检查朝向;displayIdInBook + return ( + core.material.enemys[enemy.displayIdInBook] || + core.material.enemys[(enemy.faceIds || {}).down] || + enemy + ); + }; - enemys.prototype._getCurrentEnemys_addEnemy = function ( - enemyId, - enemys, - used, - x, - y, - floorId - ) { - var enemy = this._getCurrentEnemys_getEnemy(enemyId); - if (enemy == null) return; + enemys.prototype._getCurrentEnemys_addEnemy = function ( + enemyId, + enemys, + used, + x, + y, + floorId + ) { + var enemy = this._getCurrentEnemys_getEnemy(enemyId); + if (enemy == null) return; - var id = enemy.id; + var id = enemy.id; - var enemyInfo = this.getEnemyInfo(enemy, null, null, null, floorId); - var locEnemyInfo = this.getEnemyInfo(enemy, null, x, y, floorId); - if ( - !core.flags.enableEnemyPoint || - (locEnemyInfo.atk == enemyInfo.atk && - locEnemyInfo.def == enemyInfo.def && - locEnemyInfo.hp == enemyInfo.hp && - core.plugin.arrsame(locEnemyInfo.special, enemyInfo.special)) - ) { - x = null; - y = null; - } else { - // 检查enemys里面是否使用了存在的内容 - for (var i = 0; i < enemys.length; ++i) { - var one = enemys[i]; - if ( - id == one.id && - one.locs != null && - locEnemyInfo.atk == one.atk && - locEnemyInfo.def == one.def && - locEnemyInfo.hp == one.hp && - core.plugin.arrsame(locEnemyInfo.special, one.special) - ) { - one.locs.push([x, y]); - return; - } - } - enemyInfo = locEnemyInfo; - } + var enemyInfo = this.getEnemyInfo(enemy, null, null, null, floorId); + var locEnemyInfo = this.getEnemyInfo(enemy, null, x, y, floorId); + if ( + !core.flags.enableEnemyPoint || + (locEnemyInfo.atk == enemyInfo.atk && + locEnemyInfo.def == enemyInfo.def && + locEnemyInfo.hp == enemyInfo.hp && + core.plugin.arrsame(locEnemyInfo.special, enemyInfo.special)) + ) { + x = null; + y = null; + } else { + // 检查enemys里面是否使用了存在的内容 + for (var i = 0; i < enemys.length; ++i) { + var one = enemys[i]; + if ( + id == one.id && + one.locs != null && + locEnemyInfo.atk == one.atk && + locEnemyInfo.def == one.def && + locEnemyInfo.hp == one.hp && + core.plugin.arrsame(locEnemyInfo.special, one.special) + ) { + one.locs.push([x, y]); + return; + } + } + enemyInfo = locEnemyInfo; + } - var id = enemy.id + ":" + x + ":" + y; - if (used[id]) return; - used[id] = true; + var id = enemy.id + ":" + x + ":" + y; + if (used[id]) return; + used[id] = true; - var specialText = core.enemys.getSpecialText(enemy, x, y, floorId); - var specialColor = core.enemys.getSpecialColor(enemy, x, y, floorId); + var specialText = core.enemys.getSpecialText(enemy, x, y, floorId); + var specialColor = core.enemys.getSpecialColor(enemy, x, y, floorId); - var critical = this.nextCriticals(enemy, 1, x, y, floorId); - if (critical.length > 0) critical = critical[0]; + var critical = this.nextCriticals(enemy, 1, x, y, floorId); + if (critical.length > 0) critical = critical[0]; - var e = core.clone(enemy); - for (var v in enemyInfo) { - e[v] = enemyInfo[v]; - } - if (x != null && y != null) { - e.locs = [[x, y]]; - } - e.name = core.getEnemyValue(enemy, "name", x, y, floorId); - e.specialText = specialText; - e.specialColor = specialColor; - e.damage = this.getDamage(enemy, x, y, floorId); - e.critical = critical[0]; - e.criticalDamage = critical[1]; - e.defDamage = this._getCurrentEnemys_addEnemy_defDamage( - enemy, - x, - y, - floorId - ); - enemys.push(e); - }; + var e = core.clone(enemy); + for (var v in enemyInfo) { + e[v] = enemyInfo[v]; + } + if (x != null && y != null) { + e.locs = [ + [x, y] + ]; + } + e.name = core.getEnemyValue(enemy, "name", x, y, floorId); + e.specialText = specialText; + e.specialColor = specialColor; + e.damage = this.getDamage(enemy, x, y, floorId); + e.critical = critical[0]; + e.criticalDamage = critical[1]; + e.defDamage = this._getCurrentEnemys_addEnemy_defDamage( + enemy, + x, + y, + floorId + ); + enemys.push(e); + }; - enemys.prototype._getCurrentEnemys_addEnemy_defDamage = function ( - enemy, - x, - y, - floorId - ) { - var ratio = core.status.maps[floorId || core.status.floorId].ratio || 1; - return this.getDefDamage(enemy, ratio, x, y, floorId); - }; + enemys.prototype._getCurrentEnemys_addEnemy_defDamage = function ( + enemy, + x, + y, + floorId + ) { + var ratio = core.status.maps[floorId || core.status.floorId].ratio || 1; + return this.getDefDamage(enemy, ratio, x, y, floorId); + }; - enemys.prototype._getCurrentEnemys_sort = function (enemys) { - return enemys.sort(function (a, b) { - if (a.damage == b.damage) { - return a.money - b.money; - } - if (a.damage == null) { - return 1; - } - if (b.damage == null) { - return -1; - } - return a.damage - b.damage; - }); - }; + enemys.prototype._getCurrentEnemys_sort = function (enemys) { + return enemys.sort(function (a, b) { + if (a.damage == b.damage) { + return a.money - b.money; + } + if (a.damage == null) { + return 1; + } + if (b.damage == null) { + return -1; + } + return a.damage - b.damage; + }); + }; - ////// 获得所有特殊属性的名称 ////// - enemys.prototype.getSpecialText = function (enemy, x, y, floorId) { - if (typeof enemy == "string") - enemy = this.getEnemyInfo(enemy, null, x, y, floorId); - if (!enemy) return []; - var special = enemy.special; - var text = []; + ////// 获得所有特殊属性的名称 ////// + enemys.prototype.getSpecialText = function (enemy, x, y, floorId) { + if (typeof enemy == "string") + enemy = this.getEnemyInfo(enemy, null, x, y, floorId); + if (!enemy) return []; + var special = enemy.special; + var text = []; - var specials = this.getSpecials(); - if (specials) { - for (var i = 0; i < specials.length; i++) { - if (this.hasSpecial(special, specials[i][0])) - text.push(this._calSpecialContent(enemy, specials[i][1])); - } - } - return text; - }; + var specials = this.getSpecials(); + if (specials) { + for (var i = 0; i < specials.length; i++) { + if (this.hasSpecial(special, specials[i][0])) + text.push(this._calSpecialContent(enemy, specials[i][1])); + } + } + return text; + }; - ////// 获得所有特殊属性的颜色 ////// - enemys.prototype.getSpecialColor = function (enemy, x, y, floorId) { - if (typeof enemy == "string") - enemy = this.getEnemyInfo(enemy, null, x, y, floorId); - if (!enemy) return []; - var special = enemy.special; - var colors = []; + ////// 获得所有特殊属性的颜色 ////// + enemys.prototype.getSpecialColor = function (enemy, x, y, floorId) { + if (typeof enemy == "string") + enemy = this.getEnemyInfo(enemy, null, x, y, floorId); + if (!enemy) return []; + var special = enemy.special; + var colors = []; - var specials = this.getSpecials(); - if (specials) { - for (var i = 0; i < specials.length; i++) { - if (this.hasSpecial(special, specials[i][0])) - colors.push(specials[i][3] || null); - } - } - return colors; - }; + var specials = this.getSpecials(); + if (specials) { + for (var i = 0; i < specials.length; i++) { + if (this.hasSpecial(special, specials[i][0])) + colors.push(specials[i][3] || null); + } + } + return colors; + }; - ////// 获得所有特殊属性的额外标记 ////// - enemys.prototype.getSpecialFlag = function (enemy, x, y, floorId) { - if (typeof enemy == "string") - enemy = getEnemyInfo(enemy, null, x, y, floorId); - if (!enemy) return []; - var special = enemy.special; - var flag = 0; + ////// 获得所有特殊属性的额外标记 ////// + enemys.prototype.getSpecialFlag = function (enemy, x, y, floorId) { + if (typeof enemy == "string") + enemy = getEnemyInfo(enemy, null, x, y, floorId); + if (!enemy) return []; + var special = enemy.special; + var flag = 0; - var specials = this.getSpecials(); - if (specials) { - for (var i = 0; i < specials.length; i++) { - if (this.hasSpecial(special, specials[i][0])) - flag |= specials[i][4] || 0; - } - } - return flag; - }; + var specials = this.getSpecials(); + if (specials) { + for (var i = 0; i < specials.length; i++) { + if (this.hasSpecial(special, specials[i][0])) + flag |= specials[i][4] || 0; + } + } + return flag; + }; - ////// 获得每个特殊属性的说明 ////// - enemys.prototype.getSpecialHint = function (enemy, special) { - var specials = this.getSpecials(); - if (special == null) { - if (specials == null) return []; - var hints = []; - for (var i = 0; i < specials.length; i++) { - if (this.hasSpecial(enemy, specials[i][0])) - hints.push( - "\r[" + - core.arrayToRGBA(specials[i][3] || "#FF6A6A") + - "]\\d" + - this._calSpecialContent(enemy, specials[i][1]) + - ":\\d\r[]" + - this._calSpecialContent(enemy, specials[i][2]) - ); - } - return hints; - } + ////// 获得每个特殊属性的说明 ////// + enemys.prototype.getSpecialHint = function (enemy, special) { + var specials = this.getSpecials(); + if (special == null) { + if (specials == null) return []; + var hints = []; + for (var i = 0; i < specials.length; i++) { + if (this.hasSpecial(enemy, specials[i][0])) + hints.push( + "\r[" + + core.arrayToRGBA(specials[i][3] || "#FF6A6A") + + "]\\d" + + this._calSpecialContent(enemy, specials[i][1]) + + ":\\d\r[]" + + this._calSpecialContent(enemy, specials[i][2]) + ); + } + return hints; + } - if (specials == null) return ""; - for (var i = 0; i < specials.length; i++) { - if (special == specials[i][0]) - return ( - "\r[#FF6A6A]\\d" + - this._calSpecialContent(enemy, specials[i][1]) + - ":\\d\r[]" + - this._calSpecialContent(enemy, specials[i][2]) - ); - } - return ""; - }; - ui.prototype._drawBook_drawName = function ( - index, - enemy, - top, - left, - width - ) { - // 绘制第零列(名称和特殊属性) - // 如果需要添加自己的比如怪物的称号等,也可以在这里绘制 - core.setTextAlign("ui", "center"); - if (core.enemys.getSpecialText(enemy).length == 0) { - core.fillText( - "ui", - enemy.name, - left + width / 2, - top + 35, - "#DDDDDD", - this._buildFont(17, true), - width - ); - } else { - core.fillText( - "ui", - enemy.name, - left + width / 2, - top + 28, - "#DDDDDD", - this._buildFont(17, true), - width - ); - switch (core.enemys.getSpecialText(enemy).length) { - case 1: - core.fillText( - "ui", - core.enemys.getSpecialText(enemy)[0], - left + width / 2, - top + 50, - core.arrayToRGBA( - (core.enemys.getSpecialColor(enemy) || [])[0] || "#FF6A6A" - ), - this._buildFont(15, true), - width - ); - break; - case 2: - // Step 1: 计算字体 - var text = - core.enemys.getSpecialText(enemy)[0] + - " " + - core.enemys.getSpecialText(enemy)[1]; - core.setFontForMaxWidth( - "ui", - text, - width, - this._buildFont(15, true) - ); - // Step 2: 计算总宽度 - var totalWidth = core.calWidth("ui", text); - var leftWidth = core.calWidth( - "ui", - core.enemys.getSpecialText(enemy)[0] - ); - var rightWidth = core.calWidth( - "ui", - core.enemys.getSpecialText(enemy)[1] - ); - // Step 3: 绘制 - core.fillText( - "ui", - core.enemys.getSpecialText(enemy)[0], - left + (width + leftWidth - totalWidth) / 2, - top + 50, - core.arrayToRGBA( - (core.enemys.getSpecialColor(enemy) || [])[0] || "#FF6A6A" - ) - ); - core.fillText( - "ui", - core.enemys.getSpecialText(enemy)[1], - left + (width + totalWidth - rightWidth) / 2, - top + 50, - core.arrayToRGBA( - (core.enemys.getSpecialColor(enemy) || [])[1] || "#FF6A6A" - ) - ); - break; - default: - core.fillText( - "ui", - "多属性...", - left + width / 2, - top + 50, - "#FF6A6A", - this._buildFont(15, true), - width - ); - } - } - }; - ui.prototype._drawBookDetail_getInfo = function (index) { - var floorId = - core.floorIds[(core.status.event.ui || {}).index] || - core.status.floorId; - // 清除浏览地图时的光环缓存 - if (floorId != core.status.floorId && core.status.checkBlock) { - core.status.checkBlock.cache = {}; - } - var enemys = core.enemys.getCurrentEnemys(floorId); - console.log(123); - if (enemys.length == 0) return []; - index = core.clamp(index, 0, enemys.length - 1); - var enemy = enemys[index]; - var texts = core.enemys.getSpecialHint(enemy); - if (texts.length == 0) texts.push("该怪物无特殊属性。"); - if (enemy.description) texts.push(enemy.description + "\r"); - this._drawBookDetail_getTexts(enemy, floorId, texts); - texts.push(""); - return [enemy, texts]; - }; - }, + if (specials == null) return ""; + for (var i = 0; i < specials.length; i++) { + if (special == specials[i][0]) + return ( + "\r[#FF6A6A]\\d" + + this._calSpecialContent(enemy, specials[i][1]) + + ":\\d\r[]" + + this._calSpecialContent(enemy, specials[i][2]) + ); + } + return ""; + }; + ui.prototype._drawBook_drawName = function ( + index, + enemy, + top, + left, + width + ) { + // 绘制第零列(名称和特殊属性) + // 如果需要添加自己的比如怪物的称号等,也可以在这里绘制 + core.setTextAlign("ui", "center"); + if (core.enemys.getSpecialText(enemy).length == 0) { + core.fillText( + "ui", + enemy.name, + left + width / 2, + top + 35, + "#DDDDDD", + this._buildFont(17, true), + width + ); + } else { + core.fillText( + "ui", + enemy.name, + left + width / 2, + top + 28, + "#DDDDDD", + this._buildFont(17, true), + width + ); + switch (core.enemys.getSpecialText(enemy).length) { + case 1: + core.fillText( + "ui", + core.enemys.getSpecialText(enemy)[0], + left + width / 2, + top + 50, + core.arrayToRGBA( + (core.enemys.getSpecialColor(enemy) || [])[0] || "#FF6A6A" + ), + this._buildFont(15, true), + width + ); + break; + case 2: + // Step 1: 计算字体 + var text = + core.enemys.getSpecialText(enemy)[0] + + " " + + core.enemys.getSpecialText(enemy)[1]; + core.setFontForMaxWidth( + "ui", + text, + width, + this._buildFont(15, true) + ); + // Step 2: 计算总宽度 + var totalWidth = core.calWidth("ui", text); + var leftWidth = core.calWidth( + "ui", + core.enemys.getSpecialText(enemy)[0] + ); + var rightWidth = core.calWidth( + "ui", + core.enemys.getSpecialText(enemy)[1] + ); + // Step 3: 绘制 + core.fillText( + "ui", + core.enemys.getSpecialText(enemy)[0], + left + (width + leftWidth - totalWidth) / 2, + top + 50, + core.arrayToRGBA( + (core.enemys.getSpecialColor(enemy) || [])[0] || "#FF6A6A" + ) + ); + core.fillText( + "ui", + core.enemys.getSpecialText(enemy)[1], + left + (width + totalWidth - rightWidth) / 2, + top + 50, + core.arrayToRGBA( + (core.enemys.getSpecialColor(enemy) || [])[1] || "#FF6A6A" + ) + ); + break; + default: + core.fillText( + "ui", + "多属性...", + left + width / 2, + top + 50, + "#FF6A6A", + this._buildFont(15, true), + width + ); + } + } + }; + ui.prototype._drawBookDetail_getInfo = function (index) { + var floorId = + core.floorIds[(core.status.event.ui || {}).index] || + core.status.floorId; + // 清除浏览地图时的光环缓存 + if (floorId != core.status.floorId && core.status.checkBlock) { + core.status.checkBlock.cache = {}; + } + var enemys = core.enemys.getCurrentEnemys(floorId); + console.log(123); + if (enemys.length == 0) return []; + index = core.clamp(index, 0, enemys.length - 1); + var enemy = enemys[index]; + var texts = core.enemys.getSpecialHint(enemy); + if (texts.length == 0) texts.push("该怪物无特殊属性。"); + if (enemy.description) texts.push(enemy.description + "\r"); + this._drawBookDetail_getTexts(enemy, floorId, texts); + texts.push(""); + return [enemy, texts]; + }; +}, "一防减伤": function () { // 在此增加新插件 ui.prototype._drawBook_drawRow3 = function ( @@ -14797,195 +14799,196 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }; }, "滑动转场": function () { - // 在此增加新插件 - const defaultChange = { - left: "leftPortal", // 左箭头 - up: "upPortal", // 上箭头 - right: "rightPortal", // 右箭头 - down: "downPortal", // 下箭头 - upFloor: "upFloor", // 上楼 - downFloor: "downFloor", // 下楼 - }; - const dirData = { - //方向坐标 - up: [-1, 0], - down: [1, 0], - left: [0, -1], - right: [0, 1], - upFloor: [0, 0], - downFloor: [0, 0], - }; - let allChangeEntries = Object.entries(defaultChange); - const move = document.createElement("canvas"); - const speed = 12; - let modedata = 0; + // 在此增加新插件 + const defaultChange = { + left: "leftPortal", // 左箭头 + up: "upPortal", // 上箭头 + right: "rightPortal", // 右箭头 + down: "downPortal", // 下箭头 + upFloor: "upFloor", // 上楼 + downFloor: "downFloor", // 下楼 + }; + const dirData = { + //方向坐标 + up: [-1, 0], + down: [1, 0], + left: [0, -1], + right: [0, 1], + upFloor: [0, 0], + downFloor: [0, 0], + }; + let allChangeEntries = Object.entries(defaultChange); + const move = document.createElement("canvas"); + const speed = 12; + let modedata = 0; - move.width = 1248; - move.height = 1248; + move.width = 1248; + move.height = 1248; - const ctx = move.getContext("2d"); + const ctx = move.getContext("2d"); - events.prototype.changeFloor = function ( - floorId, - stair, - heroLoc, - time, - callback - ) { - let block = core.getBlock(hero.loc.x, hero.loc.y); - var info = this._changeFloor_getInfo(floorId, stair, heroLoc, time); + events.prototype.changeFloor = function ( + floorId, + stair, + heroLoc, + time, + callback + ) { + let block = core.getBlock(hero.loc.x, hero.loc.y); + var info = this._changeFloor_getInfo(floorId, stair, heroLoc, time); - if (info == null) { - if (callback) callback(); - return; - } - floorId = info.floorId; - info.locked = core.status.lockControl; + if (info == null) { + if (callback) callback(); + return; + } + floorId = info.floorId; + info.locked = core.status.lockControl; - core.dom.floorNameLabel.innerText = core.status.maps[floorId].title; - core.lockControl(); - core.stopAutomaticRoute(); - core.clearContinueAutomaticRoute(); - core.status.replay.animate = true; - clearInterval(core.interval.onDownInterval); - core.interval.onDownInterval = "tmp"; + core.dom.floorNameLabel.innerText = core.status.maps[floorId].title; + core.lockControl(); + core.stopAutomaticRoute(); + core.clearContinueAutomaticRoute(); + core.status.replay.animate = true; + clearInterval(core.interval.onDownInterval); + delete core.animateFrame.tip + core.interval.onDownInterval = "tmp"; - this._changeFloor_beforeChange(info, block, callback); - }; - events.prototype._changeFloor_beforeChange = function ( - info, - block, - callback - ) { - this._changeFloor_playSound(); - if ( - block && - block?.event && - !main.replayChecking && - !core.isReplaying() - ) { - const dirEntries = allChangeEntries.find( - (v) => v[1] === block.event.id - ); - if (block?.event?.trigger === "changeFloor" && dirEntries) { - const toFloorId = block.event.data.floorId; - const dir = dirEntries[0]; + this._changeFloor_beforeChange(info, block, callback); + }; + events.prototype._changeFloor_beforeChange = function ( + info, + block, + callback + ) { + this._changeFloor_playSound(); + if ( + block && + block?.event && + !main.replayChecking && + !core.isReplaying() + ) { + const dirEntries = allChangeEntries.find( + (v) => v[1] === block.event.id + ); + if (block?.event?.trigger === "changeFloor" && dirEntries) { + const toFloorId = block.event.data.floorId; + const dir = dirEntries[0]; - const data = core.ui._drawViewMaps_buildData( - core.floorIds.indexOf(core.status.floorId) - ); - const dataTo = core.ui._drawViewMaps_buildData( - core.floorIds.indexOf(toFloorId) - ); - const v = dirData[dir][1], // 水平数值 - h = dirData[dir][0]; //竖直数值 - ctx.clearRect(0, 0, 1248, 1248); - core.drawThumbnail(core.status.floorId, null, { - damage: data.damage, - ctx: ctx, - x: 416, - y: 416, - size: 1, - all: data.all, - }); - if (dir !== "upFloor" && dir !== "downFloor") { - core.drawThumbnail(toFloorId, null, { - damage: dataTo.damage, - ctx: ctx, - x: 416 + 416 * v, - y: 416 + 416 * h, - size: 1, - all: dataTo.all, - }); + const data = core.ui._drawViewMaps_buildData( + core.floorIds.indexOf(core.status.floorId) + ); + const dataTo = core.ui._drawViewMaps_buildData( + core.floorIds.indexOf(toFloorId) + ); + const v = dirData[dir][1], // 水平数值 + h = dirData[dir][0]; //竖直数值 + ctx.clearRect(0, 0, 1248, 1248); + core.drawThumbnail(core.status.floorId, null, { + damage: data.damage, + ctx: ctx, + x: 416, + y: 416, + size: 1, + all: data.all, + }); + if (dir !== "upFloor" && dir !== "downFloor") { + core.drawThumbnail(toFloorId, null, { + damage: dataTo.damage, + ctx: ctx, + x: 416 + 416 * v, + y: 416 + 416 * h, + size: 1, + all: dataTo.all, + }); - var _run = function () { - var cb = function () { - modedata = 0; - core.clearUI(); - core.clearMap("data"); - core.events._changeFloor_changing(info, callback); - }; + var _run = function () { + var cb = function () { + modedata = 0; + core.clearUI(); + core.clearMap("data"); + core.events._changeFloor_changing(info, callback); + }; - var animate = window.setInterval( - function () { - if (modedata >= 416) { - delete core.animateFrame.asyncId[animate]; - clearInterval(animate); - cb(); - } else { - core.clearUI(); - core.clearMap("data"); + var animate = window.setInterval( + function () { + if (modedata >= 416) { + delete core.animateFrame.asyncId[animate]; + clearInterval(animate); + cb(); + } else { + core.clearUI(); + core.clearMap("data"); - core.canvas.data.drawImage( - move, - 416 + modedata * v, - 416 + modedata * h, - 416, - 416, - 0, - 0, - 416, - 416 - ); - let status = "leftFoot"; + core.canvas.data.drawImage( + move, + 416 + modedata * v, + 416 + modedata * h, + 416, + 416, + 0, + 0, + 416, + 416 + ); + let status = "leftFoot"; - if (modedata > 208) { - status = "rightFoot"; - } - const img = core.material.images.hero; - const heroIconArr = core.material.icons.hero; - const width = core.material.icons.hero.width || 32; - const height = core.material.icons.hero.height; - const heroIcon = heroIconArr[dir]; + if (modedata > 208) { + status = "rightFoot"; + } + const img = core.material.images.hero; + const heroIconArr = core.material.icons.hero; + const width = core.material.icons.hero.width || 32; + const height = core.material.icons.hero.height; + const heroIcon = heroIconArr[dir]; - core.canvas.data.drawImage( - img, - (heroIcon[status] % 4) * width, - heroIcon.loc * height, - width, - height, - core.status.hero.loc.x * 32 - - core.bigmap.offsetX - - (modedata - (modedata * 32) / 416) * v, - core.status.hero.loc.y * 32 - - 16 - - (modedata - (modedata * 32) / 416) * h, - width, - height - ); - modedata += speed; - clearInterval(animate); - delete core.animateFrame.asyncId[animate]; - _run(); - } - }, - core.status.replay.speed == 24 - ? 1 - : 10 / core.status.replay.speed - ); + core.canvas.data.drawImage( + img, + (heroIcon[status] % 4) * width, + heroIcon.loc * height, + width, + height, + core.status.hero.loc.x * 32 - + core.bigmap.offsetX - + (modedata - (modedata * 32) / 416) * v, + core.status.hero.loc.y * 32 - + 16 - + (modedata - (modedata * 32) / 416) * h, + width, + height + ); + modedata += speed; + clearInterval(animate); + delete core.animateFrame.asyncId[animate]; + _run(); + } + }, + core.status.replay.speed == 24 ? + 1 : + 10 / core.status.replay.speed + ); - core.animateFrame.lastAsyncId = animate; - core.animateFrame.asyncId[animate] = cb; - }; - _run(); - return; - } - } - } - // 需要 setTimeout 执行,不然会出错 - window.setTimeout(function () { - if (info.time == 0) core.events._changeFloor_changing(info, callback); - else - core.showWithAnimate( - core.dom.floorMsgGroup, - info.time / 2, - function () { - core.events._changeFloor_changing(info, callback); - } - ); - }, 25); - }; - }, + core.animateFrame.lastAsyncId = animate; + core.animateFrame.asyncId[animate] = cb; + }; + _run(); + return; + } + } + } + // 需要 setTimeout 执行,不然会出错 + window.setTimeout(function () { + if (info.time == 0) core.events._changeFloor_changing(info, callback); + else + core.showWithAnimate( + core.dom.floorMsgGroup, + info.time / 2, + function () { + core.events._changeFloor_changing(info, callback); + } + ); + }, 25); + }; +}, "剧情cg": function () { // 在此增加新插件 // 在此增加新插件