From 4f4e295bd2708674c63330a471ea8a31ced5d208 Mon Sep 17 00:00:00 2001 From: bdf1 Date: Sun, 28 Jul 2024 23:53:18 +0800 Subject: [PATCH] =?UTF-8?q?=E5=8A=A0=E4=BA=86=E6=89=93=E6=80=AA=E6=97=B6?= =?UTF-8?q?=E8=87=AA=E5=8A=A8=E8=A3=85=E5=A4=87=E6=9C=80=E4=BC=98=E8=A3=85?= =?UTF-8?q?=E5=A4=87=EF=BC=9B=E5=8A=A0=E4=BA=86=E4=B8=AA=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- _server/table/functions.comment.js | 6 ++++ project/floors/YS10.js | 3 +- project/functions.js | 49 +++++++++++++++++++++++++++- project/items.js | 51 ++++++++++++++++++++++++++++++ project/plugins.js | 35 +++++++++++++++++++- 5 files changed, 141 insertions(+), 3 deletions(-) diff --git a/_server/table/functions.comment.js b/_server/table/functions.comment.js index 9326bf1..843c433 100644 --- a/_server/table/functions.comment.js +++ b/_server/table/functions.comment.js @@ -99,6 +99,12 @@ var functions_comment_c456ea59_6018_45ef_8bcc_211a24c627dc = { "_type": "textarea", "_lint": true, "_data": "战斗伤害信息" + }, + "getDamageInfo1": { + "_leaf": true, + "_type": "textarea", + "_lint": true, + "_data": "lhjnb" } } }, diff --git a/project/floors/YS10.js b/project/floors/YS10.js index 809b7b7..7fc80ef 100644 --- a/project/floors/YS10.js +++ b/project/floors/YS10.js @@ -62,7 +62,8 @@ main.floors.YS10= ], "floorId": "GM1", "remove": true - } + }, + "提示:先去 GM8 ,然后去 SN10 ,最后去 GM2 。" ], "eachArrive": [], "parallelDo": "", diff --git a/project/functions.js b/project/functions.js index 070bc1e..25b956f 100644 --- a/project/functions.js +++ b/project/functions.js @@ -697,7 +697,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = "guards": guards, // 返回支援情况 }; }, - "getDamageInfo": function (enemy, hero, x, y, floorId) { + "getDamageInfo": function (enemy, hero, x, y, floorId, allEquip = false) { // 获得战斗伤害信息(实际伤害计算函数) // // 参数说明: @@ -706,6 +706,7 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = // x,y:该怪物的坐标(查看手册和强制战斗时为undefined) // floorId:该怪物所在的楼层 // 后面三个参数主要是可以在光环等效果上可以适用 + if (!allEquip && core.getFlag('bestEquip')) return this.getDamageInfo1(enemy, hero, x, y, floorId); floorId = floorId || core.status.floorId; var hero_hp = core.getRealStatusOrDefault(hero, 'hp'), @@ -917,6 +918,52 @@ var functions_d6ad677b_427a_4623_b50f_a445a3b0ef8a = "turn": Math.floor(turn), "damage": Math.floor(damage) }; +}, + "getDamageInfo1": function (enemy, hero, x, y, floorId) { + var changeLoc = hero ? Object.keys(hero)[0] : null, + change = hero ? hero[changeLoc] - core.status.hero[changeLoc] : null; + var cur = core.clone(core.status.hero.equipment); + core.setFlag("__quickLoadEquip__", true); + core.setFlag("__equipCalc__", true); + var info = null + for (var I = 0; I <= 10; I++) { + var current = core.getFlag("saveEquips", [])[I]; + if (I == 10) current = cur; + if (!current) continue; + // 检查所有的装备 + var equipSize = core.status.globalAttribute.equipName.length; + /*for (var i = 0; i < equipSize; i++) { + var v = current[i]; + if (v && !this.canEquip(v, true)) { current = null; break; } + } + if (!current) continue;*/ + // 快速换装 + var toEquip = []; + for (var i = 0; i < equipSize; i++) { + var now = core.status.hero.equipment[i]; + // --- 只考虑diff的装备 + var to = current[i]; + if (now != to) { + toEquip.push(to || null); + if (now) { + core.items.unloadEquip(i); + } + } + } + for (var i in toEquip) { + var to = toEquip[i]; + if (to) { + core.items.loadEquip(to); + } + } + if (changeLoc) hero[changeLoc] = core.status.hero[changeLoc] + change; + var damageInfo = this.getDamageInfo(enemy, hero, x, y, floorId, true) + if (damageInfo && (!info || info.damage > damageInfo.damage)) info = damageInfo + + } + core.removeFlag("__quickLoadEquip__"); + core.removeFlag("__equipCalc__"); + return info; } }, "actions": { diff --git a/project/items.js b/project/items.js index 300c10c..5eb45f1 100644 --- a/project/items.js +++ b/project/items.js @@ -1306,6 +1306,57 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = ] } ] + }, + { + "text": "自动计算最优装备", + "color": [ + 0, + 255, + 255, + 1 + ], + "action": [ + { + "type": "choices", + "text": "自动计算最优装备(需保存套装)", + "choices": [ + { + "text": "打开自动计算最优装备", + "color": [ + 237, + 3, + 120, + 1 + ], + "action": [ + "自动计算最优装备已打开!", + { + "type": "setValue", + "name": "flag:bestEquip", + "value": "true" + } + ] + }, + { + "text": "关闭自动计算最优装备", + "color": [ + 233, + 233, + 23, + 1 + ], + "action": [ + "自动计算最优装备已关闭!", + { + "type": "setValue", + "name": "flag:bestEquip", + "value": "false" + } + ] + } + ] + } + ] } ] } diff --git a/project/plugins.js b/project/plugins.js index e27bf51..0e81e30 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -6,7 +6,10 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } core.enemys.getDamageString = function (enemy, x, y, floorId) { if (typeof enemy == 'string') enemy = core.material.enemys[enemy]; - var damage = this.getDamage(enemy, x, y, floorId); + //console.log('start') + var damage = core.getFlag('bestEquip') ? this.enemydata.getDamageInfo1(enemy, null, x, y, floorId) : this.enemydata.getDamageInfo(enemy, null, x, y, floorId); + //console.log('end') + if (damage) damage = damage.damage var color = '#000000'; @@ -123,6 +126,36 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = core.updateStatusBar(); core.AllSprites(); } + core.items._realLoadEquip = function (type, loadId, unloadId, callback) { + var loadEquip = core.material.items[loadId] || {}, + unloadEquip = core.material.items[unloadId] || {}; + + // --- 音效 + this._realLoadEquip_playSound(); + + // --- 实际换装 + this._loadEquipEffect(loadId, unloadId); + + // --- 加减 + if (core.getFlag('__equipCalc__')) { + if (unloadId) core.status.hero.items.equips[unloadId] = (core.status.hero.items.equips[unloadId] || 0) + 1; + if (loadId) core.status.hero.items.equips[loadId] -= 1; + if (loadId && !core.status.hero.items.equips[loadId]) delete core.status.hero.items.equips[loadId]; + } else { + if (unloadId) core.status.hero.items.equips[unloadId] = (core.status.hero.items.equips[unloadId] || 0) + 1; + if (loadId) core.status.hero.items.equips[loadId] -= 1; + if (loadId && !core.status.hero.items.equips[loadId]) delete core.status.hero.items.equips[loadId]; + } + core.status.hero.equipment[type] = loadId || null; + + // --- 提示 + if (core.getFlag('__quickLoadEquip__')); + else + if (loadId) core.drawTip("已装备上" + loadEquip.name, loadId); + else if (unloadId) core.drawTip("已卸下" + unloadEquip.name, unloadId); + + if (callback) callback(); + } }, "drawLight": function () {