From e3a0be98658eb6db45036db5f5e6b9033cdacb0f Mon Sep 17 00:00:00 2001 From: mengxinzxz <2223529500@qq.com> Date: Wed, 22 May 2024 07:43:33 +0800 Subject: [PATCH] =?UTF-8?q?=E9=9A=8F=E4=BB=8E=E8=B0=83=E9=81=A3bugfix?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit 1.修复调遣随从势力不会变为预期设置势力的bug 2.失去随从的onremove支持使用指代此随从的第二个参数了 --- noname/library/element/content.js | 19 ++++++++++++++++++- noname/library/element/player.js | 2 +- 2 files changed, 19 insertions(+), 2 deletions(-) diff --git a/noname/library/element/content.js b/noname/library/element/content.js index 447d1dd65..c940579d9 100644 --- a/noname/library/element/content.js +++ b/noname/library/element/content.js @@ -2095,6 +2095,11 @@ export const Content = { var cfg = player.storage[event.directresult]; player.storage.subplayer.name2 = event.directresult; player.reinit(current, event.directresult, [cfg.hp, cfg.maxHp]); + if (player.name == event.directresult || player.name1 == event.directresult) { + const groupx = cfg.group || "qun"; + player.group = groupx; + player.node.name.dataset.nature = get.groupnature(groupx); + } if (cfg.hs.length) player.directgain(cfg.hs); if (cfg.es.length) player.directequip(cfg.es); } @@ -2103,6 +2108,7 @@ export const Content = { "step 0"; if (player.storage.subplayer) { var current = player.storage.subplayer.name2; + const goon = player.name == current || player.name1 == current; if (event.remove) { player.lose(player.getCards("he"), ui.discardPile)._triggered = null; } else { @@ -2116,10 +2122,15 @@ export const Content = { player.storage.subplayer.hp, player.storage.subplayer.maxHp, ]); + if (goon) { + const groupx = player.storage.subplayer.group || "qun"; + player.group = groupx; + player.node.name.dataset.nature = get.groupnature(groupx); + } player.update(); if (event.remove) { if (player.storage[current].onremove) { - player.storage[current].onremove(player); + player.storage[current].onremove(player, current); } delete player.storage[current]; player.storage.subplayer.skills.remove(current); @@ -2182,9 +2193,15 @@ export const Content = { hs: player.getCards("h"), es: player.getCards("e"), intro2: cfg.intro2, + group: player.group, }; player.removeSkill(event.list); player.reinit(source, name, [cfg.hp, cfg.maxHp]); + if (player.name == name || player.name1 == name) { + const groupx = cfg.group || "qun"; + player.group = groupx; + player.node.name.dataset.nature = get.groupnature(groupx); + } player.addSkill("subplayer"); player.lose(player.getCards("he"), ui.special)._triggered = null; if (cfg.hs.length) player.directgain(cfg.hs); diff --git a/noname/library/element/player.js b/noname/library/element/player.js index 7e8d3e523..3d3801ce0 100644 --- a/noname/library/element/player.js +++ b/noname/library/element/player.js @@ -7348,7 +7348,7 @@ export class Player extends HTMLDivElement { this.exitSubPlayer(true); } else { if (player.storage[name].onremove) { - player.storage[name].onremove(player); + player.storage[name].onremove(player, name); } this.removeSkill(name); delete this.storage[name];