From cc76d50a919f8f908cda1d03007ae91e340e8a74 Mon Sep 17 00:00:00 2001 From: strawberry42271 <2806566736@qq.com> Date: Tue, 14 Jan 2025 22:51:15 +0800 Subject: [PATCH] =?UTF-8?q?=E6=9B=B4=E6=94=B9=E5=B1=9E=E6=80=A7=E6=98=A0?= =?UTF-8?q?=E5=B0=84=E5=92=8C=E8=A3=85=E5=A4=87=E6=A0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- project/data.js | 6 ++-- project/items.js | 2 +- project/plugins.js | 80 ++++++++++++++++++++++++++++++---------------- 3 files changed, 57 insertions(+), 31 deletions(-) diff --git a/project/data.js b/project/data.js index f01d01b..95ad3ee 100644 --- a/project/data.js +++ b/project/data.js @@ -1053,9 +1053,9 @@ var data_a1e2fb4a_e986_4524_b0da_9b7ba7c0874d = "matk": 0, "speed": 0, "str": 5, - "agi": 10, - "int": 10, - "con": 10, + "agi": 5, + "int": 5, + "con": 5, "magic": false }, "startCanvas": [ diff --git a/project/items.js b/project/items.js index 0ca9007..385932e 100644 --- a/project/items.js +++ b/project/items.js @@ -234,7 +234,7 @@ var items_296f5d02_12fd_4166_a7c1_b5e830c9ee3a = "agi": -5 }, "percentage": { - "speed": 10 + "str": 10 } }, "itemEffect": "core.status.hero.def += 0", diff --git a/project/plugins.js b/project/plugins.js index f09c2cf..cb4d4b2 100644 --- a/project/plugins.js +++ b/project/plugins.js @@ -5264,6 +5264,16 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = itemText = core.replaceText(itemText); if (itemText[0] == "," || itemText[0] == ",") itemText = itemText.substring(1); + if (itemCls === 'equips' && item.id) { + let text = "" + + switch (item.id) { //此处写道具效果描述\n表示换行 + case 'sword1': + text = "普通攻击属性:物理\n作为主手时:物理攻击=力量+敏捷(" + (core.getRealStatusOrDefault(hero, 'str') + core.getRealStatusOrDefault(hero, 'agi')) + ")\n作为副手时:物理攻击+敏捷(" + core.getRealStatusOrDefault(hero, 'agi') + ")" + break; + } + itemText = text ? '【装备效果】\n' + text : "" + } /* 一个根据道具id修改道具名字(右栏)的例子 * if (item.id == "xxx") itemNameColor = "red"; */ @@ -5291,6 +5301,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = ); core.setTextAlign(ctx, "left"); core.setTextBaseline(ctx, "middle"); + if (itemCls === 'equips' && item.id) { + itemName = "【" + item.equipCls + "】" + itemName + } core.fillText( ctx, itemName, @@ -5309,7 +5322,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = itemClsFont ); - var statusText = "【装备类型】" + item.equipCls + "\n\n"; /*if (core.status.event.id == "equipbox") { var type = item.equip.type; if (typeof type == "string") type = core.getEquipTypeByName(type); @@ -5329,7 +5341,6 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = statusText += core.getStatusLabel(name) + " " + nowValue + "->\r[" + color + "]" + newValue + "\r\n"; } }*/ - let shuxing = "【装备属性】\n" const equipValue = core.material.items[item.id]?.equip if (equipValue) { let value = "" @@ -5403,10 +5414,9 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } } - if (value !== '') itemText += "\n\n" + shuxing + value + if (value !== '') itemText += "\n\n【装备属性】\n" + value } - itemText = item.equipCls ? statusText + itemText : itemText let needText = '\n【装备需求】\n' @@ -13969,8 +13979,7 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = }, "属性映射": function () { // 在此增加新插件 - this.statusEquip = function () { - const hero = core.status.hero; + this.statusEquip = function (hero = core.status.hero) { //装备具体效果在这里写,道具填写道具类型为equip并选择装备类型,道具的装备属性中装备类型遵循以下填写方式: //固定装备孔的填写0/1/2/3,分别对应主手、副手、防具、饰品 //主副手同时可使用的,填写 武器 @@ -13980,20 +13989,20 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (core.getEquip[0]) { switch (core.getEquip[0]) { case "sword1": - hero.atk = hero.str + hero.agi; + hero.atk = hero_str + hero_agi; hero.magic = false; break; case "twoHandedSword1": - hero.atk = Math.floor(hero.str * 2 + hero.con / 10); + hero.atk = Math.floor(hero_str * 2 + hero_con / 10); hero.magic = false; break; case "wand1": - hero.atk = hero.str + hero.int; + hero.atk = hero_str + hero_int; hero.magic = true; break; case "knife1": - hero.atk = Math.floor(hero.agi * 1.2); - hero.speed = hero.agi * 2 + hero.int; + hero.atk = Math.floor(hero_agi * 1.2); + hero.speed = hero_agi * 2 + hero_int; hero.magic = false; break; } @@ -14002,12 +14011,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (core.getEquip[1]) { switch (core.getEquip[1]) { case "sword1": - hero.atk += hero.agi; + hero.atk += hero_agi; break; case "knife1": - hero.speed += Math.floor(hero.agi * 0.6); + hero.speed += Math.floor(hero_agi * 0.6); if (core.getEquip[0] === "knife1") { - hero.atk += Math.floor(hero.agi * 0.6); + hero.atk += Math.floor(hero_agi * 0.6); } break; } @@ -14016,12 +14025,12 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (core.getEquip[2]) { switch (core.getEquip[2]) { case "armor1": - hero.def = hero.con + hero.agi; - hero.hpmax = Math.floor(2.5 * hero.con); + hero.def = hero_con + hero_agi; + hero.hpmax = Math.floor(2.5 * hero_con); break; case "armor2": - hero.mdef = hero.con + hero.int; - hero.hpmax = hero.con * 2 + hero.int; + hero.mdef = hero_con + hero_int; + hero.hpmax = hero_con * 2 + hero_int; break; } } @@ -14029,10 +14038,21 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = if (core.getEquip[3]) { switch (core.getEquip[3]) { case "jewel1": - hero.speed += Math.floor(0.4 * hero.int + 0.6 * hero.agi); + hero.speed += Math.floor(0.4 * hero_int + 0.6 * hero_agi); break; } } + const list = ['str', 'agi', 'int', 'con'] //四维 + //处理当前装备数值效果(四维数值已经处理过,无需再次处理) + for (let i = 0; i < 5; i++) { + const value = core.material.items[core.getEquip(i)]?.value + if (value) { + for (let item in value) { + if (!list.includes(item)) hero[item] += value[item] + } + } + } + return hero }; this.equipNeed = { //装备需求(无需求装备不写,只写需求的属性,无要求属性不写) "sword1": { str: 10 }, @@ -14040,16 +14060,22 @@ var plugins_bb40132b_638b_4a9f_b028_d3fe47acc8d1 = } this.updateStatus = function () { - const hero = core.status.hero; + let hero = core.status.hero; + //core.getRealStatusOrDefault计算增幅后属性 + const hero_str = core.getRealStatusOrDefault(hero, 'str') + const hero_agi = core.getRealStatusOrDefault(hero, 'agi') + const hero_int = core.getRealStatusOrDefault(hero, 'int') + const hero_con = core.getRealStatusOrDefault(hero, 'con') + //默认映射关系 - hero.hpmax = hero.str * 100 + hero.con * 100; - hero.atk = hero.str + hero.int; - hero.manamax = hero.agi + hero.int; - hero.def = hero.con + hero.agi; - hero.mdef = hero.con + hero.int; - hero.speed = hero.str + hero.agi; + hero.hpmax = hero_str * 100 + hero_con * 100; + hero.atk = hero_str + hero_int; + hero.manamax = hero_agi + hero_int; + hero.def = hero_con + hero_agi; + hero.mdef = hero_con + hero_int; + hero.speed = hero_str + hero_agi; hero.magic = false; - this.statusEquip(); //处理装备效果 + hero = this.statusEquip(hero); //处理装备效果 for (let v in hero) { //归整 if (typeof hero[v] === "number") {