From 1df0f762e9a6adbe9cd544c98f5cab63c636d87e Mon Sep 17 00:00:00 2001 From: Mechanel Date: Sun, 26 May 2024 02:01:56 +0800 Subject: [PATCH] heg general maxHp enhance --- Fk/RoomElement/ChooseGeneralBox.qml | 18 ++++++++++++++++++ Fk/RoomElement/GeneralCardItem.qml | 10 +++++++++- lua/client/client_util.lua | 4 ++++ 3 files changed, 31 insertions(+), 1 deletion(-) diff --git a/Fk/RoomElement/ChooseGeneralBox.qml b/Fk/RoomElement/ChooseGeneralBox.qml index 1278a28c..4c5dd270 100644 --- a/Fk/RoomElement/ChooseGeneralBox.qml +++ b/Fk/RoomElement/ChooseGeneralBox.qml @@ -263,6 +263,7 @@ GraphicsBox { item.selectable = hegemony ? isHegPair(selectedItem[0], item) : true; if (hegemony) { + item.inPosition = 0; if (selectedItem[0]) { if (selectedItem[1]) { if (selectedItem[0] === item) { @@ -299,6 +300,23 @@ GraphicsBox { } } + if (hegemony) { + if (selectedItem[0]) { + if (selectedItem[0].mainMaxHp < 0) { + selectedItem[0].inPosition = 1; + } else if (selectedItem[0].deputyMaxHp < 0) { + selectedItem[0].inPosition = -1; + } + if (selectedItem[1]) { + if (selectedItem[1].mainMaxHp < 0) { + selectedItem[1].inPosition = -1; + } else if (selectedItem[1].deputyMaxHp < 0) { + selectedItem[1].inPosition = 1; + } + } + } + } + for (let i = 0; i < generalList.count; i++) { if (lcall("GetSameGenerals", generalList.get(i).name).length > 0) { convertBtn.enabled = true; diff --git a/Fk/RoomElement/GeneralCardItem.qml b/Fk/RoomElement/GeneralCardItem.qml index f7a39de5..94904fbe 100644 --- a/Fk/RoomElement/GeneralCardItem.qml +++ b/Fk/RoomElement/GeneralCardItem.qml @@ -22,6 +22,9 @@ CardItem { property int hp property int maxHp property int shieldNum + property int mainMaxHp + property int deputyMaxHp + property int inPosition: 0 property string pkgName: "" property bool detailed: true property alias hasCompanions: companions.visible @@ -119,12 +122,15 @@ CardItem { width: childrenRect.width height: childrenRect.height Image { + opacity: ((mainMaxHp < 0 || deputyMaxHp < 0) && (index * 2 + 1 === hp) && inPosition !== -1) + ? (inPosition === 0 ? 0.5 : 0) :1 height: 12; fillMode: Image.PreserveAspectFit source: SkinBank.getGeneralCardDir(kingdom) + kingdom + "-magatama-l" } Image { x: 4.4 - opacity: (index + 1) * 2 <= hp ? 1 : 0 + opacity: (index + 1) * 2 <= hp ? (((mainMaxHp < 0 || deputyMaxHp < 0) && inPosition !== -1 && ((index + 1) * 2 === hp)) + ? (inPosition === 0 ? 0.5 : 0) : 1) : 0 height: 12; fillMode: Image.PreserveAspectFit source: { const k = subkingdom ? subkingdom : kingdom; @@ -227,6 +233,8 @@ CardItem { hp = data.hp; maxHp = data.maxHp; shieldNum = data.shield; + mainMaxHp = data.mainMaxHpAdjustedValue; + deputyMaxHp = data.deputyMaxHpAdjustedValue; const splited = name.split("__"); if (splited.length > 1) { diff --git a/lua/client/client_util.lua b/lua/client/client_util.lua index a0c8dce3..2e50d6bb 100644 --- a/lua/client/client_util.lua +++ b/lua/client/client_util.lua @@ -19,6 +19,8 @@ function GetGeneralData(name) shield = general.shield, hidden = general.hidden, total_hidden = general.total_hidden, + mainMaxHpAdjustedValue = general.mainMaxHpAdjustedValue, + deputyMaxHpAdjustedValue = general.deputyMaxHpAdjustedValue, } end @@ -31,6 +33,8 @@ function GetGeneralDetail(name) kingdom = general.kingdom, hp = general.hp, maxHp = general.maxHp, + mainMaxHp = general.mainMaxHpAdjustedValue, + deputyMaxHp = general.deputyMaxHpAdjustedValue, gender = general.gender, skill = {}, related_skill = {},