From ffcbbc7a2271debc0325cee697d4efd296c0df14 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 5 Jul 2025 09:16:11 +0800 Subject: [PATCH 01/16] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md=E4=BB=A5?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0Docker=E5=AE=89=E8=A3=85=E5=92=8C=E8=BF=90?= =?UTF-8?q?=E8=A1=8C=E8=AF=B4=E6=98=8E=EF=BC=8C=E6=96=B0=E5=A2=9EDockerfil?= =?UTF-8?q?e=E4=BB=A5=E6=94=AF=E6=8C=81=E5=AE=B9=E5=99=A8=E5=8C=96?= =?UTF-8?q?=E9=83=A8=E7=BD=B2?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- Dockerfile | 13 +++++++++++++ README.md | 49 +++++++++++++++++++++++++++++++++++++++++++++++-- 2 files changed, 60 insertions(+), 2 deletions(-) create mode 100644 Dockerfile diff --git a/Dockerfile b/Dockerfile new file mode 100644 index 00000000..e08663a7 --- /dev/null +++ b/Dockerfile @@ -0,0 +1,13 @@ +FROM python:3.12-slim-bookworm +COPY --from=docker.io/astral/uv:latest /uv /uvx /bin/ + +WORKDIR /app +COPY . /app + +RUN uv venv +RUN uv pip install . +ENV PATH=$PATH:/app/.venv/bin + +EXPOSE 8501 + +CMD ["zsim", "run"] diff --git a/README.md b/README.md index 487246f9..2256a42a 100644 --- a/README.md +++ b/README.md @@ -26,7 +26,10 @@ It provides a user-friendly interface to calculate the total damage output of a - Edit agents equipment - Edit APL code -## Install +> [!TIP] +> You can either install `ZZZ-Simulator` via `uv` or run it with dockers. + +## Install via UV Download the latest source code in release page or use `git clone` @@ -65,7 +68,7 @@ uv venv uv pip install . # there is a '.' refer to relative path ``` -## Run +### Run Open terminal anywhere in your device: @@ -84,6 +87,48 @@ uv run ./zsim/run.py run uv run zsim run ``` +Then you can access the simulator at `http://localhost:8501`. + +## Install via Docker + +You can also run `ZZZ-Simulator` with Docker. + +> [!NOTE] +> Make sure you have docker installed on your machine. If you haven't installed it yet, please refer to the [official Docker installation guide](https://docs.docker.com/get-docker/). +> +> On macOS, it is recommended to use [Orbstack](https://orbstack.com/docs/installation/) for a better experience. + +### Pull the image + +```bash +docker build -t zzzsimulator . +``` + +> [!TIP] +> There's a pre-built image on Docker Hub, you can pull it directly with `docker pull lucas0411/zsim:latest`. + +### Create a container + +```bash +# For self-built image +docker create --name zzzsimulator \ + -p 8501:8501 \ + zzzsimulator + +# For pre-built image +docker create --name zzzsimulator \ + -p 8501:8501 \ + lucas0411/zsim:latest +``` + +### Run the container + +```bash +docker start zzzsimulator +``` + +Then you can access the simulator at `http://localhost:8501`. + ## TODO LIST Go check issues for more details. From 15220186320ec92b33c9ffe4dd7764d23743e06e Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 5 Jul 2025 09:18:40 +0800 Subject: [PATCH 02/16] =?UTF-8?q?=E6=9B=B4=E6=96=B0Docker=E9=83=A8?= =?UTF-8?q?=E5=88=86=E7=9A=84=E8=AF=B4=E6=98=8E=EF=BC=8C=E5=BC=BA=E8=B0=83?= =?UTF-8?q?=E9=9C=80=E8=A6=81=E8=AE=BF=E9=97=AEDocker=20Hub=E4=BB=A5?= =?UTF-8?q?=E7=A1=AE=E4=BF=9D=E9=A1=BA=E5=88=A9=E8=BF=90=E8=A1=8CZZZ-Simul?= =?UTF-8?q?ator?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 2256a42a..b26c8188 100644 --- a/README.md +++ b/README.md @@ -94,7 +94,7 @@ Then you can access the simulator at `http://localhost:8501`. You can also run `ZZZ-Simulator` with Docker. > [!NOTE] -> Make sure you have docker installed on your machine. If you haven't installed it yet, please refer to the [official Docker installation guide](https://docs.docker.com/get-docker/). +> Make sure you have docker installed on your machine and can access to Docker Hub. If you haven't installed it yet, please refer to the [official Docker installation guide](https://docs.docker.com/get-docker/). > > On macOS, it is recommended to use [Orbstack](https://orbstack.com/docs/installation/) for a better experience. From 150466c29f14fd10479b5aa1442fc3a0063f82bc Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 5 Jul 2025 09:22:35 +0800 Subject: [PATCH 03/16] =?UTF-8?q?=E6=9B=B4=E6=96=B0Docker=E9=83=A8?= =?UTF-8?q?=E5=88=86=E7=9A=84=E8=AF=B4=E6=98=8E=EF=BC=8C=E4=BF=AE=E6=AD=A3?= =?UTF-8?q?Orbstack=E5=AE=89=E8=A3=85=E9=93=BE=E6=8E=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index b26c8188..23786a0b 100644 --- a/README.md +++ b/README.md @@ -96,7 +96,7 @@ You can also run `ZZZ-Simulator` with Docker. > [!NOTE] > Make sure you have docker installed on your machine and can access to Docker Hub. If you haven't installed it yet, please refer to the [official Docker installation guide](https://docs.docker.com/get-docker/). > -> On macOS, it is recommended to use [Orbstack](https://orbstack.com/docs/installation/) for a better experience. +> On macOS, it is recommended to use [Orbstack](https://docs.orbstack.dev/install) for a better experience. ### Pull the image From 0a7ae301591a19a829b6f11c572f540246982eb7 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 5 Jul 2025 09:24:53 +0800 Subject: [PATCH 04/16] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md=EF=BC=8C?= =?UTF-8?q?=E6=B7=BB=E5=8A=A0Orbstack=E7=94=A8=E6=88=B7=E8=AE=BF=E9=97=AEZ?= =?UTF-8?q?ZZ-Simulator=E7=9A=84=E6=8F=90=E7=A4=BA?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 3 +++ 1 file changed, 3 insertions(+) diff --git a/README.md b/README.md index 23786a0b..0b3758fb 100644 --- a/README.md +++ b/README.md @@ -129,6 +129,9 @@ docker start zzzsimulator Then you can access the simulator at `http://localhost:8501`. +> [!TIP] +> If you are using Orbstack, you can access the simulator at `https://zzzsimulator.orb.local/`. + ## TODO LIST Go check issues for more details. From a514266b75805eb57c1846e1733da1482681a2f7 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 5 Jul 2025 09:30:42 +0800 Subject: [PATCH 05/16] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md=EF=BC=8C?= =?UTF-8?q?=E4=BF=AE=E6=AD=A3macOS=E5=92=8CLinux=E7=9A=84=E5=AE=89?= =?UTF-8?q?=E8=A3=85=E8=AF=B4=E6=98=8E=EF=BC=8C=E6=B7=BB=E5=8A=A0Homebrew?= =?UTF-8?q?=E5=AE=89=E8=A3=85=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 7 ++++++- 1 file changed, 6 insertions(+), 1 deletion(-) diff --git a/README.md b/README.md index 0b3758fb..27460cd0 100644 --- a/README.md +++ b/README.md @@ -38,10 +38,15 @@ Download the latest source code in release page or use `git clone` Open terminal anywhere in your device: ```bash -# On macOS or Linux: +# On Linux or macOS without Homebrew: curl -LsSf https://astral.sh/uv/install.sh | sh ``` +```bash +# On macOS with Homebrew: +brew install uv +``` + ```bash # On Windows11 24H2 or later: winget install --id=astral-sh.uv -e From 058d202fab4369bab0730e7cfcde7c2145b04307 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 5 Jul 2025 09:56:09 +0800 Subject: [PATCH 06/16] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md=EF=BC=8C?= =?UTF-8?q?=E5=B0=86=E2=80=9CPull=20the=20image=E2=80=9D=E6=9B=B4=E6=94=B9?= =?UTF-8?q?=E4=B8=BA=E2=80=9CBuild=20the=20image=E2=80=9D=E4=BB=A5?= =?UTF-8?q?=E6=9B=B4=E5=87=86=E7=A1=AE=E5=9C=B0=E6=8F=8F=E8=BF=B0Docker?= =?UTF-8?q?=E6=93=8D=E4=BD=9C?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/README.md b/README.md index 27460cd0..282e653f 100644 --- a/README.md +++ b/README.md @@ -103,7 +103,7 @@ You can also run `ZZZ-Simulator` with Docker. > > On macOS, it is recommended to use [Orbstack](https://docs.orbstack.dev/install) for a better experience. -### Pull the image +### Build the image ```bash docker build -t zzzsimulator . From 290e1163ab4b60ff9bd9ca0fbd4a8b524e06e904 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 5 Jul 2025 10:37:40 +0800 Subject: [PATCH 07/16] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4Docker=20Hub=E7=9A=84=E6=8B=89=E5=8F=96?= =?UTF-8?q?=E6=8F=90=E7=A4=BA=EF=BC=8C=E7=AE=80=E5=8C=96Docker=E9=83=A8?= =?UTF-8?q?=E5=88=86=E8=AF=B4=E6=98=8E?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 5 +---- 1 file changed, 1 insertion(+), 4 deletions(-) diff --git a/README.md b/README.md index 282e653f..aedccb19 100644 --- a/README.md +++ b/README.md @@ -99,7 +99,7 @@ Then you can access the simulator at `http://localhost:8501`. You can also run `ZZZ-Simulator` with Docker. > [!NOTE] -> Make sure you have docker installed on your machine and can access to Docker Hub. If you haven't installed it yet, please refer to the [official Docker installation guide](https://docs.docker.com/get-docker/). +> Make sure you have docker installed on your machine. If you haven't installed it yet, please refer to the [official Docker installation guide](https://docs.docker.com/get-docker/). > > On macOS, it is recommended to use [Orbstack](https://docs.orbstack.dev/install) for a better experience. @@ -109,9 +109,6 @@ You can also run `ZZZ-Simulator` with Docker. docker build -t zzzsimulator . ``` -> [!TIP] -> There's a pre-built image on Docker Hub, you can pull it directly with `docker pull lucas0411/zsim:latest`. - ### Create a container ```bash From 6ebf407b645ab97a1045b058439909c389a8e859 Mon Sep 17 00:00:00 2001 From: Lucas Date: Sat, 5 Jul 2025 10:47:12 +0800 Subject: [PATCH 08/16] =?UTF-8?q?=E6=9B=B4=E6=96=B0README.md=EF=BC=8C?= =?UTF-8?q?=E7=A7=BB=E9=99=A4Docker=E9=83=A8=E5=88=86=E5=85=B3=E4=BA=8E?= =?UTF-8?q?=E9=A2=84=E6=9E=84=E5=BB=BA=E9=95=9C=E5=83=8F=E7=9A=84=E8=AF=B4?= =?UTF-8?q?=E6=98=8E=EF=BC=8C=E7=AE=80=E5=8C=96=E5=AE=B9=E5=99=A8=E5=88=9B?= =?UTF-8?q?=E5=BB=BA=E6=AD=A5=E9=AA=A4?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- README.md | 6 ------ 1 file changed, 6 deletions(-) diff --git a/README.md b/README.md index aedccb19..b37e0c0b 100644 --- a/README.md +++ b/README.md @@ -112,15 +112,9 @@ docker build -t zzzsimulator . ### Create a container ```bash -# For self-built image docker create --name zzzsimulator \ -p 8501:8501 \ zzzsimulator - -# For pre-built image -docker create --name zzzsimulator \ - -p 8501:8501 \ - lucas0411/zsim:latest ``` ### Run the container From 8c9c7fd1da1ff17685537e2df4a21de0130021c4 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 8 Jul 2025 23:49:54 +0800 Subject: [PATCH 09/16] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=89=AF?= =?UTF-8?q?=E8=AF=8D=E6=9D=A1=E6=9C=80=E5=A4=A7=E5=80=BC=E8=BF=87=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsim/lib_webui/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsim/lib_webui/constants.py b/zsim/lib_webui/constants.py index 19191536..aed4ddd1 100644 --- a/zsim/lib_webui/constants.py +++ b/zsim/lib_webui/constants.py @@ -198,7 +198,7 @@ def _init_char_mapping() -> dict[str, str]: } # 副词条最大值 -sc_max_value = 40 +sc_max_value = 4000 # 计算结果缓存文件路径 ID_CACHE_JSON = "./results/id_cache.json" From de159f123c785265f836cafaf6c9da255f69f4c0 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 8 Jul 2025 23:54:59 +0800 Subject: [PATCH 10/16] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsim/lib_webui/constants.py | 3 ++- zsim/page_character_config.py | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/zsim/lib_webui/constants.py b/zsim/lib_webui/constants.py index aed4ddd1..7af1b7d4 100644 --- a/zsim/lib_webui/constants.py +++ b/zsim/lib_webui/constants.py @@ -198,7 +198,8 @@ def _init_char_mapping() -> dict[str, str]: } # 副词条最大值 -sc_max_value = 4000 +sc_max_percent = 40 +sc_max_value = 1000 # 计算结果缓存文件路径 ID_CACHE_JSON = "./results/id_cache.json" diff --git a/zsim/page_character_config.py b/zsim/page_character_config.py index 027f6ae0..77c405e0 100644 --- a/zsim/page_character_config.py +++ b/zsim/page_character_config.py @@ -230,7 +230,7 @@ def page_character_config(): st.number_input( "攻击力%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scATK_percent", 0) if name in saved_char_config else 0, @@ -249,7 +249,7 @@ def page_character_config(): st.number_input( "生命值%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scHP_percent", 0) if name in saved_char_config else 0, @@ -268,7 +268,7 @@ def page_character_config(): st.number_input( "防御力%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scDEF_percent", 0) if name in saved_char_config else 0, @@ -287,7 +287,7 @@ def page_character_config(): st.number_input( "暴击率", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scCRIT", 0) if name in saved_char_config else 0, @@ -296,7 +296,7 @@ def page_character_config(): st.number_input( "暴击伤害", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scCRIT_DMG", 0) if name in saved_char_config else 0, @@ -306,7 +306,7 @@ def page_character_config(): st.number_input( "异常精通", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scAnomalyProficiency", 0) if name in saved_char_config else 0, @@ -315,7 +315,7 @@ def page_character_config(): st.number_input( "穿透值", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scPEN", 0) if name in saved_char_config else 0, From 7eaf0089ece87fd3b17d7bfec1651549f4fafc46 Mon Sep 17 00:00:00 2001 From: TigerSkin <145400218+Steinwaysj@users.noreply.github.com> Date: Tue, 8 Jul 2025 23:39:57 +0800 Subject: [PATCH 11/16] Fix/buff lable bug (#49) MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - 修复薇薇安Buff的label填写错误导致的Bug - 修复buff_label解析函数的问题 - 修复时流贤者的buff_label解析逻辑缺失的问题(未完成) * fix:修复角色初始化bug、修复聚宝箱bug、修复Judgetools 报错 --- ...0\346\264\273\345\210\244\346\226\255.csv" | 12 ++-- zsim/script/del_all_pycache.py | 1 + .../Buff/Buff0Manager/Buff0ManagerClass.py | 29 ++++++++- zsim/sim_progress/Buff/BuffAddStrategy.py | 3 +- zsim/sim_progress/Buff/BuffLoad.py | 4 ++ zsim/sim_progress/Buff/BuffXLogic/TheVault.py | 36 ++++------- zsim/sim_progress/Buff/JudgeTools/__init__.py | 2 +- zsim/sim_progress/Buff/ScheduleBuffSettle.py | 2 + zsim/sim_progress/Buff/buff_class.py | 3 + zsim/sim_progress/Character/character.py | 2 + .../sim_progress/ScheduledEvent/CalAnomaly.py | 8 ++- .../sim_progress/ScheduledEvent/Calculator.py | 10 ++-- zsim/sim_progress/ScheduledEvent/__init__.py | 2 +- .../sim_progress/data_struct/data_analyzer.py | 59 ++++++++++++++++--- 14 files changed, 122 insertions(+), 51 deletions(-) diff --git "a/zsim/data/\346\277\200\346\264\273\345\210\244\346\226\255.csv" "b/zsim/data/\346\277\200\346\264\273\345\210\244\346\226\255.csv" index cc79c70d..9c31b53a 100644 --- "a/zsim/data/\346\277\200\346\264\273\345\210\244\346\226\255.csv" +++ "b/zsim/data/\346\277\200\346\264\273\345\210\244\346\226\255.csv" @@ -469,7 +469,7 @@ Buff-角色-薇薇安-额外能力-全队侵蚀伤害增加,FALSE,TRUE,TRUE,FALS Buff-角色-薇薇安-额外能力-侵蚀紊乱伤害提升,FALSE,TRUE,TRUE,FALSE,薇薇安,FALSE,侵蚀状态被结算的紊乱伤害提升12%,FALSE,0,1,1,FALSE,FALSE,TRUE,TRUE,FALSE,0,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,0,1,FALSE,FALSE,FALSE,,, Buff-角色-薇薇安-1画-全属性异常和紊乱伤害提升,FALSE,TRUE,FALSE,TRUE,薇薇安,FALSE,处于薇薇安预言下的目标受到的所有属性异常伤害和紊乱伤害提高16%,FALSE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,1,1,FALSE,FALSE,TRUE,,, Buff-角色-薇薇安-2画-以太积蓄效率提升,FALSE,FALSE,FALSE,TRUE,薇薇安,FALSE,以太异常积蓄效率提升25%,FALSE,0,1,1,FALSE,FALSE,TRUE,TRUE,FALSE,0,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,2,1000,FALSE,FALSE,FALSE,,, -Buff-角色-薇薇安-2画-异放全属性抗性穿透,FALSE,TRUE,FALSE,TRUE,薇薇安,FALSE,专属于异放的15%全属性伤害抗性穿透,FALSE,0,1,1,FALSE,FALSE,TRUE,TRUE,FALSE,0,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,2,1,FALSE,FALSE,TRUE,"{""only_anomlay"":[""Abloom""]}",, +Buff-角色-薇薇安-2画-异放全属性抗性穿透,FALSE,TRUE,FALSE,TRUE,薇薇安,FALSE,专属于异放的15%全属性伤害抗性穿透,FALSE,0,1,1,FALSE,FALSE,TRUE,TRUE,FALSE,0,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,2,1,FALSE,FALSE,TRUE,"{""only_anomaly"":[""Abloom""]}",, Buff-角色-薇薇安-4画-悬落与落羽生花必暴,FALSE,FALSE,FALSE,TRUE,薇薇安,FALSE,普通攻击:悬落、落羽生花必暴,FALSE,0,1,1,FALSE,FALSE,TRUE,TRUE,FALSE,0,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,4,1000,FALSE,FALSE,FALSE,"{""only_skill_1"":[""1331_SNA_2""],""only_skill_2"":[""1331_CoAttack_A""]}",, Buff-角色-薇薇安-4画-局内攻击力增幅,FALSE,FALSE,FALSE,TRUE,薇薇安,FALSE,悬落、落雨生花命中后增加12%局内攻击力,TRUE,720,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,4,1000,FALSE,FALSE,TRUE,,, Buff-角色-薇薇安-6画-以太伤害增加,FALSE,FALSE,FALSE,TRUE,薇薇安,FALSE,以太伤害增加40%,FALSE,0,1,1,FALSE,FALSE,TRUE,TRUE,FALSE,0,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,TRUE,6,1000,FALSE,FALSE,FALSE,,, @@ -495,11 +495,11 @@ Buff-武器-精2时流贤者-精通提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FA Buff-武器-精3时流贤者-精通提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,E或强化E命中处于属性异常状态下的敌人时,精通提升,TRUE,900,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,3,1000,FALSE,FALSE,FALSE,,, Buff-武器-精4时流贤者-精通提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,E或强化E命中处于属性异常状态下的敌人时,精通提升,TRUE,900,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,4,1000,FALSE,FALSE,FALSE,,, Buff-武器-精5时流贤者-精通提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,E或强化E命中处于属性异常状态下的敌人时,精通提升,TRUE,900,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,5,1000,FALSE,FALSE,FALSE,,, -Buff-武器-精1时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,1,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""]}",, -Buff-武器-精2时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,2,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""]}",, -Buff-武器-精3时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,3,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""]}",, -Buff-武器-精4时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,4,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""]}",, -Buff-武器-精5时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,5,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""]}",, +Buff-武器-精1时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,1,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""], ""only_anomaly"":[""Disorder"", ""PolarityDisorder""]}",, +Buff-武器-精2时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,2,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""], ""only_anomaly"":[""Disorder"", ""PolarityDisorder""]}",, +Buff-武器-精3时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,3,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""], ""only_anomaly"":[""Disorder"", ""PolarityDisorder""]}",, +Buff-武器-精4时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,4,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""], ""only_anomaly"":[""Disorder"", ""PolarityDisorder""]}",, +Buff-武器-精5时流贤者-装备者紊乱伤害提升,TRUE,FALSE,FALSE,FALSE,时流贤者,FALSE,装备者精通大于375时,装备者造成的紊乱伤害提升,TRUE,999999,1,1,FALSE,FALSE,TRUE,FALSE,TRUE,0,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,FALSE,5,1000,FALSE,FALSE,FALSE,"{""only_active_by"":[""self""], ""only_anomaly"":[""Disorder"", ""PolarityDisorder""]}",, Buff-武器-精1淬锋钳刺-猎意,TRUE,FALSE,FALSE,FALSE,淬锋钳刺,FALSE,冲刺攻击使物理伤害提高,进场或极限闪避直接满层,TRUE,600,3,1,TRUE,FALSE,TRUE,FALSE,FALSE,30,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,1,1000,FALSE,FALSE,FALSE,,, Buff-武器-精2淬锋钳刺-猎意,TRUE,FALSE,FALSE,FALSE,淬锋钳刺,FALSE,冲刺攻击使物理伤害提高,进场或极限闪避直接满层,TRUE,600,3,1,TRUE,FALSE,TRUE,FALSE,FALSE,30,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,2,1000,FALSE,FALSE,FALSE,,, Buff-武器-精3淬锋钳刺-猎意,TRUE,FALSE,FALSE,FALSE,淬锋钳刺,FALSE,冲刺攻击使物理伤害提高,进场或极限闪避直接满层,TRUE,600,3,1,TRUE,FALSE,TRUE,FALSE,FALSE,30,TRUE,FALSE,TRUE,TRUE,TRUE,TRUE,TRUE,3,1000,FALSE,FALSE,FALSE,,, diff --git a/zsim/script/del_all_pycache.py b/zsim/script/del_all_pycache.py index 2bec0bde..9a73b701 100644 --- a/zsim/script/del_all_pycache.py +++ b/zsim/script/del_all_pycache.py @@ -5,6 +5,7 @@ def remove_pycache(directory): for root, dirs, files in os.walk(directory): + print(f"Scanning: {root}") for dir_name in dirs: if dir_name == "__pycache__": pycache_path = os.path.join(root, dir_name) diff --git a/zsim/sim_progress/Buff/Buff0Manager/Buff0ManagerClass.py b/zsim/sim_progress/Buff/Buff0Manager/Buff0ManagerClass.py index 05a1a8ea..ea7a9d1f 100644 --- a/zsim/sim_progress/Buff/Buff0Manager/Buff0ManagerClass.py +++ b/zsim/sim_progress/Buff/Buff0Manager/Buff0ManagerClass.py @@ -1,5 +1,6 @@ import copy import itertools +import uuid from typing import TYPE_CHECKING import pandas as pd @@ -17,6 +18,7 @@ if TYPE_CHECKING: from zsim.simulator.simulator_class import Simulator + from zsim.sim_progress.Character.character import Character class Buff0Manager: @@ -61,7 +63,11 @@ def __init__( self.__selector = self.__selector(self) self.__selector.select_buff_into_exist_buff_dict() self.__passively_updating_change() - self.__process_label() + # self.__process_label() + """ + 由于deepcopy存在问题,导致buff_0这里初始化好的only_active_by参数在后续复制的过程中可能丢失, + 所以这里索性不做处理,直接到data_struct中现场处理。 + """ self.__process_additional_ability_data() # self.initialize_buff_listener() @@ -100,12 +106,12 @@ def __process_label(self): continue if ( "only_active_by" in _buff_0.ft.label - and _buff_0.ft.label["only_active_by"] == "self" + and _buff_0.ft.label["only_active_by"][0] == "self" ): char_obj = JudgeTools.find_char_from_name( _buff_0.ft.operator, sim_instance=self.sim_instance ) - _buff_0.ft.label["only_active_by"] = char_obj.CID + _buff_0.ft.label["only_active_by"] = [char_obj.CID] def __process_judge_list_set(self): """将judge_list_set中的信息全部处理到self.char_equip_info 中""" @@ -186,6 +192,18 @@ def __passively_updating_change(self): else: _buff_0.ft.passively_updating = False + def search_equipper(self, equipment: str) -> str | None: + """ + 根据输入的装备名称寻找装备者 + 临时使用,该函数只能返回找到的第一个, + buff系统重构后将重写此逻辑 + """ + for _char_name, sub_list in self.weapon_dict.items(): + if sub_list[0] == equipment: + return _char_name + else: + return None + class __selector: def __init__(self, buff_0_manager_instance): self.buff_0_manager: Buff0Manager = buff_0_manager_instance @@ -385,7 +403,12 @@ def initiate_buff(self, buff_info_tuple, buff_name, benifiter, buff_orner): dict_1, dict_2, sim_instance=self.buff_0_manager.sim_instance ) buff_new.ft.beneficiary = benifiter + # buff_new.ft.buff0_id = uuid.uuid4() self.buff_0_manager.exist_buff_dict[benifiter][buff_name] = buff_new + # if not buff_new.ft.passively_updating: + # operator_obj: "Character" = self.buff_0_manager.char_obj_dict[buff_new.ft.operator] + # map_key = hash((buff_new.ft.index, operator_obj.NAME)) # 由Buff的index、buff实操者的名字组成的哈希值为key + # operator_obj.equip_buff_map[map_key] = buff_new # 将这些buff0的指针存入角色的equip_buff_map def processor_equipment_buff( self, adding_code, buff_info_tuple, buff_name, equipment_carrier diff --git a/zsim/sim_progress/Buff/BuffAddStrategy.py b/zsim/sim_progress/Buff/BuffAddStrategy.py index d255c45c..a7d3bb3d 100644 --- a/zsim/sim_progress/Buff/BuffAddStrategy.py +++ b/zsim/sim_progress/Buff/BuffAddStrategy.py @@ -63,8 +63,9 @@ def buff_add_strategy( ) for names in selected_characters: from copy import deepcopy - buff_new = deepcopy(copyed_buff) + buff_new.ft.operator = copyed_buff.ft.operator + buff_new.ft.passively_updating = copyed_buff.ft.passively_updating # buff_new = Buff.create_new_from_existing(copyed_buff) if ( copyed_buff.ft.simple_start_logic diff --git a/zsim/sim_progress/Buff/BuffLoad.py b/zsim/sim_progress/Buff/BuffLoad.py index 54f88469..5a83769c 100644 --- a/zsim/sim_progress/Buff/BuffLoad.py +++ b/zsim/sim_progress/Buff/BuffLoad.py @@ -94,6 +94,8 @@ def process_buff( sub_mission, ) if buff_new.dy.is_changed: + buff_new.ft.operator = buff_0.ft.operator + buff_new.ft.passively_updating = buff_0.ft.passively_updating LOADING_BUFF_DICT[char].append(buff_new) """ 这里要注意:process_buff函数中传入的buff_0,只会来自于角色, @@ -115,6 +117,8 @@ def process_buff( ) buff_new.logic.xeffect() if buff_new.dy.is_changed: + buff_new.ft.operator = buff_0.ft.operator + buff_new.ft.passively_updating = buff_0.ft.passively_updating LOADING_BUFF_DICT[char].append(buff_new) if char == "enemy": enemy_buff_0 = exist_buff_dict["enemy"][buff_0.ft.index] diff --git a/zsim/sim_progress/Buff/BuffXLogic/TheVault.py b/zsim/sim_progress/Buff/BuffXLogic/TheVault.py index f6c823f0..cfff07d6 100644 --- a/zsim/sim_progress/Buff/BuffXLogic/TheVault.py +++ b/zsim/sim_progress/Buff/BuffXLogic/TheVault.py @@ -1,6 +1,5 @@ from .. import Buff, JudgeTools, check_preparation - class TheVaultRecord: def __init__(self): self.equipper = None @@ -8,20 +7,6 @@ def __init__(self): self.action_stack = None -def is_hit(action_now): - """ - 检测当前tick是否有hit事件。 - """ - mission_dict = action_now.mission_dict - tick_now = JudgeTools.find_tick(sim_instance=self.buff_instance.sim_instance) - for sub_mission_start_tick in mission_dict.keys(): - if tick_now - 1 < sub_mission_start_tick <= tick_now: - if mission_dict[sub_mission_start_tick] == "hit": - return True - else: - return False - - class TheVault(Buff.BuffLogic): """ 聚宝箱的复杂逻辑模块,回能和增伤的判定逻辑都是一样的, @@ -59,19 +44,20 @@ def check_record_module(self): def special_judge_logic(self, **kwargs): """ - 由于聚宝箱的buff是命中判定,且后台生效,但是只能自己触发。 - 所以首先需要判定的是当前tick是否有hit事件。 + 聚宝箱的触发条件:自己的技能、技能命中帧、[强化E、大招、连携技] """ self.check_record_module() self.get_prepared(equipper="聚宝箱", action_stack=1) - action_now = self.record.action_stack.peek() - if not is_hit(action_now): + from zsim.sim_progress.Preload import SkillNode + skill_node: SkillNode | None = kwargs.get("skill_node", None) + if skill_node is None: return False - if action_now.mission_character != self.record.equipper: + if skill_node.char_name != self.record.char.NAME: return False - if ( - action_now.mission_node.skill.trigger_buff_level not in [2, 5, 6] - and action_now.mission_node.skill.element_type != 4 - ): + if skill_node.skill.trigger_buff_level not in [2, 5, 6]: return False - return True + tick = self.buff_instance.sim_instance.tick + if skill_node.is_hit_now(tick): + return True + return False + diff --git a/zsim/sim_progress/Buff/JudgeTools/__init__.py b/zsim/sim_progress/Buff/JudgeTools/__init__.py index 1a20aa4d..62fe4970 100644 --- a/zsim/sim_progress/Buff/JudgeTools/__init__.py +++ b/zsim/sim_progress/Buff/JudgeTools/__init__.py @@ -1,5 +1,5 @@ from typing import TYPE_CHECKING - +from .DetectEdges import detect_edge from .FindCharFromCID import find_char_from_CID from .FindCharFromName import find_char_from_name from .FindEquipper import find_equipper diff --git a/zsim/sim_progress/Buff/ScheduleBuffSettle.py b/zsim/sim_progress/Buff/ScheduleBuffSettle.py index 2a91d2e1..26947dce 100644 --- a/zsim/sim_progress/Buff/ScheduleBuffSettle.py +++ b/zsim/sim_progress/Buff/ScheduleBuffSettle.py @@ -158,6 +158,8 @@ def add_schedule_buff( """ for characters in selected_characters: buff_new = Buff.create_new_from_existing(buff) + buff_new.ft.operator = buff.ft.operator + buff_new.ft.passively_updating = buff.ft.passively_updating # if buff.ft.index == 'Buff-武器-精1啜泣摇篮-全队增伤自增长': # print(f'buff_0情况:{buff.dy.startticks, buff.dy.endticks}') # print(f'新buff情况:{buff_new.dy.startticks, buff_new.dy.endticks}') diff --git a/zsim/sim_progress/Buff/buff_class.py b/zsim/sim_progress/Buff/buff_class.py index d0e098be..d7dfcd39 100644 --- a/zsim/sim_progress/Buff/buff_class.py +++ b/zsim/sim_progress/Buff/buff_class.py @@ -236,6 +236,7 @@ def __init__(self, meta_config: pd.Series): self.label_effect_rule: int | None = self.__process_label_rule( config_dict ) + self.buff0_id = None __listener_id_str = config_dict.get( "listener_id" @@ -411,6 +412,8 @@ def __deepcopy__(self, memo): self.feature_config, self.judge_config, sim_instance=self.sim_instance ) memo[id(self)] = new_obj + # if "时流贤者-装备者紊乱伤害提升" in new_obj.ft.index: + # print(self.ft.beneficiary, self.ft.operator, new_obj.ft.operator) return new_obj @property diff --git a/zsim/sim_progress/Character/character.py b/zsim/sim_progress/Character/character.py index cc3a69a1..0822947e 100644 --- a/zsim/sim_progress/Character/character.py +++ b/zsim/sim_progress/Character/character.py @@ -20,6 +20,7 @@ from zsim.sim_progress.data_struct.sp_update_data import SPUpdateData from zsim.sim_progress.Preload.SkillsQueue import SkillNode from zsim.simulator.config_classes import AttrCurveConfig, WeaponConfig + from zsim.sim_progress.Buff.buff_class import Buff class Character: @@ -298,6 +299,7 @@ def __init__( self.skills_dict = self.skill_object.skills_dict self.dynamic = self.Dynamic(self) self.sim_instance = None # 模拟器实例 + self.equip_buff_map: dict[int, "Buff"] = {} # 来自装备的Buff0的指针 # fmt: off def __init_all_equip_static(self, drive4, drive5, drive6, diff --git a/zsim/sim_progress/ScheduledEvent/CalAnomaly.py b/zsim/sim_progress/ScheduledEvent/CalAnomaly.py index 6d13ec07..0a5c2202 100644 --- a/zsim/sim_progress/ScheduledEvent/CalAnomaly.py +++ b/zsim/sim_progress/ScheduledEvent/CalAnomaly.py @@ -9,6 +9,7 @@ Disorder, PolarityDisorder, ) +from zsim.sim_progress.Character.character import Character from zsim.sim_progress.Character.Yanagi import Yanagi from zsim.sim_progress.Enemy import Enemy from zsim.sim_progress.Report import report_to_log @@ -47,14 +48,17 @@ def __init__( self.element_type: ElementType = snapshot[0] # self.dmg_sp 以 array 形式储存,顺序为:基础伤害区、增伤区、异常精通区、等级、异常增伤区、异常暴击区、穿透率、穿透值、抗性穿透 self.dmg_sp: np.ndarray = snapshot[1] - + if anomaly_obj.activated_by is None: + print(f"【CalAnomaly Warnning】:检测到异常实例(属性类型:{anomaly_obj.element_type})的激活源为空,改异常实例将无法享受Buff加成。") + else: + char_obj = anomaly_obj.activated_by.skill.char_obj # 根据动态buff读取怪物面板 self.data: MulData = MulData( enemy_obj=self.enemy_obj, dynamic_buff=self.dynamic_buff, judge_node=anomaly_obj, + character_obj=char_obj ) - # 虚拟角色等级 v_char_level: int = int( np.floor(self.dmg_sp[0, 3] + 0.0000001) diff --git a/zsim/sim_progress/ScheduledEvent/Calculator.py b/zsim/sim_progress/ScheduledEvent/Calculator.py index f4817294..81df0362 100644 --- a/zsim/sim_progress/ScheduledEvent/Calculator.py +++ b/zsim/sim_progress/ScheduledEvent/Calculator.py @@ -10,6 +10,8 @@ from zsim.sim_progress.Enemy import Enemy from zsim.sim_progress.Preload import SkillNode from zsim.sim_progress.Report import report_to_log +from zsim .sim_progress.anomaly_bar.AnomalyBarClass import AnomalyBar + with open( file="./zsim/sim_progress/ScheduledEvent/buff_effect_trans.json", @@ -54,12 +56,12 @@ def __init__( enemy_obj: Enemy, dynamic_buff: dict | None = None, character_obj: Character | None = None, - judge_node: SkillNode | None = None, + judge_node: SkillNode| AnomalyBar | None = None, ): if dynamic_buff is None: dynamic_buff = {} if not hasattr(self, "char_name"): - self.judge_node: SkillNode | None = judge_node + self.judge_node: SkillNode | AnomalyBar | None = judge_node self.enemy_instance = enemy_obj if character_obj is None: self.char_name = None @@ -85,7 +87,7 @@ def __init__( dynamic_statement: dict = self.get_buff_bonus(dynamic_buff, self.judge_node) self.dynamic = self.DynamicStatement(dynamic_statement) - def get_buff_bonus(self, dynamic_buff: dict, skill_node: SkillNode | None) -> dict: + def get_buff_bonus(self, dynamic_buff: dict, node: SkillNode | AnomalyBar | None) -> dict: if self.char_name is None: char_buff: list = [] else: @@ -108,7 +110,7 @@ def get_buff_bonus(self, dynamic_buff: dict, skill_node: SkillNode | None) -> di ) enemy_buff = [] enabled_buff: tuple = tuple(char_buff + enemy_buff) - dynamic_statement: dict = cal_buff_total_bonus(enabled_buff, skill_node) + dynamic_statement: dict = cal_buff_total_bonus(enabled_buff, node, sim_instance=self.enemy_obj.sim_instance) return dynamic_statement class StaticStatement: diff --git a/zsim/sim_progress/ScheduledEvent/__init__.py b/zsim/sim_progress/ScheduledEvent/__init__.py index b18ee6b3..a6778be9 100644 --- a/zsim/sim_progress/ScheduledEvent/__init__.py +++ b/zsim/sim_progress/ScheduledEvent/__init__.py @@ -392,7 +392,7 @@ def disorder_event(self, event: Disorder): disorder_obj=event, enemy_obj=self.data.enemy, dynamic_buff=self.data.dynamic_buff, - sim_instance=self.sim_instance, + sim_instance=self.sim_instance ) dmg_disorder = cal_obj.cal_anomaly_dmg() stun = cal_obj.cal_disorder_stun() diff --git a/zsim/sim_progress/data_struct/data_analyzer.py b/zsim/sim_progress/data_struct/data_analyzer.py index df144772..08b9ca09 100644 --- a/zsim/sim_progress/data_struct/data_analyzer.py +++ b/zsim/sim_progress/data_struct/data_analyzer.py @@ -10,12 +10,14 @@ from zsim.sim_progress.anomaly_bar import AnomalyBar from zsim.sim_progress.Buff import Buff from zsim.sim_progress.Preload.SkillsQueue import SkillNode + from zsim.simulator.simulator_class import Simulator @lru_cache(maxsize=128) def cal_buff_total_bonus( enabled_buff: Sequence["Buff"], - judge_obj: "SkillNode" | "AnomalyBar" | None = None, + judge_obj: "SkillNode | AnomalyBar | None" = None, + sim_instance: "Simulator" = None ) -> dict[str, float]: """过滤并计算buff总加成。 @@ -37,7 +39,8 @@ def cal_buff_total_bonus( from zsim.sim_progress.anomaly_bar import AnomalyBar from zsim.sim_progress.Buff import Buff from zsim.sim_progress.Preload.SkillsQueue import SkillNode - + # FIXME: + # 已知bug:武器【时流贤者】的“对佩戴者造成的紊乱伤害增幅”的效果在部分紊乱、极性紊乱上会失效,原因未知,等待继续排查。 buff_obj: Buff for buff_obj in enabled_buff: # 确保buff是Buff类的实例 @@ -67,6 +70,8 @@ def cal_buff_total_bonus( buff_obj, judge_obj ): continue + if not __check_activation_origin(buff_obj=buff_obj, judge_obj=judge_obj, sim_instance=sim_instance): + continue # 获取buff的层数 count = buff_obj.dy.count count = count if count > 0 else 0 @@ -194,8 +199,6 @@ def __check_skill_node(buff: "Buff", skill_node: "SkillNode") -> bool: ): if skill_node.skill.skill_type in label_value: return True - else: - raise ValueError(f"{buff.ft.index}的标签类型 {label_key} 未定义!") else: # if buff.ft.index == "Buff-角色-仪玄-2画-强化E与终结技无视以太抗" and any([__tags in skill_node.skill_tag for __tags in ["1371_E_EX", "1371_Q"]]): # print(f"data_analyzer的报告:{buff.ft.index}与{skill_node.skill_tag}不匹配!") @@ -215,7 +218,7 @@ def __check_label_key(label_key: str, target_label_key: str): return base_key == target_label_key -def __check_special_anomly(buff: "Buff", anomly_node: "AnomalyBar") -> bool: +def __check_special_anomly(buff: "Buff", anomaly_node: "AnomalyBar") -> bool: """ 检查 buff 的标签是否与异常匹配。 @@ -249,7 +252,6 @@ def __check_special_anomly(buff: "Buff", anomly_node: "AnomalyBar") -> bool: "Abloom": Abloom, "PolarityDisorder": PolarityDisorder, } - # 获取buff的标签列表 buff_labels: dict[str, list[str] | str] = buff.ft.label # 如果buff没有标签限制,则直接返回True @@ -266,12 +268,12 @@ def __check_special_anomly(buff: "Buff", anomly_node: "AnomalyBar") -> bool: # 输入为单个字符串 if isinstance(label_value, str): if label_value in SELECT_ANOMALY_MAP.keys(): - if isinstance(anomly_node, SELECT_ANOMALY_MAP[label_value]): + if isinstance(anomaly_node, SELECT_ANOMALY_MAP[label_value]): return True # 输入为列表 if isinstance(label_value, list): if any( - isinstance(anomly_node, SELECT_ANOMALY_MAP[sig_value]) + isinstance(anomaly_node, SELECT_ANOMALY_MAP[sig_value]) for sig_value in label_value if sig_value in SELECT_ANOMALY_MAP.keys() ): @@ -279,6 +281,47 @@ def __check_special_anomly(buff: "Buff", anomly_node: "AnomalyBar") -> bool: return False +def __check_activation_origin(buff_obj: "Buff", judge_obj: "SkillNode | AnomalyBar", sim_instance: "Simulator"): + """检查buff的label是否存在“only_active_by”,然后再检查当前被检项目与源头是否匹配。 + - buff_obj: 被检查的buff + - judge_obj: 被检查的对象,可能是SkillNode或者异常""" + if buff_obj.ft.label is None: + return True + if "only_active_by" not in buff_obj.ft.label.keys(): + return True + from zsim.sim_progress.Preload import SkillNode + from zsim.sim_progress.anomaly_bar import AnomalyBar + CID_list = buff_obj.ft.label.get("only_active_by") + # FIXME: 由于Deepcopy无法正确拷贝Buff对象的Operator等后赋值的属性,所以这里的筛选会出错。 + # 目前该问题只能通过硬编码临时绕开(临时搜谁装备了这把武器),后续Buff系统全部重构的时候一起修改。 + # 已知缺陷:当队伍中同时存在两把“时流贤者”时,Buff源检验可能会出错。 + if CID_list[0] == "self": + buff_from = buff_obj.ft.bufffrom + if buff_from in sim_instance.init_data.name_box: + target_name = buff_from + else: + buff_0_manager = sim_instance.load_data.buff_0_manager + target_name = buff_0_manager.search_equipper(equipment=buff_from) + if target_name is None: + raise ValueError(f"{buff_obj.ft.index}存在但是却无法找到{buff_from}的携带者,请检查初始化逻辑!") + + if isinstance(judge_obj, SkillNode): + skill_result = target_name == judge_obj.char_name + return skill_result + elif isinstance(judge_obj, AnomalyBar): + if judge_obj.activated_by is None: + print(f"未检测到异常对象{judge_obj.element_type}的激活源!") + return False + anomaly_result = judge_obj.activated_by.char_name == target_name + return anomaly_result + else: + print(f"judge_obj的类型未定义!{type(judge_obj)}") + return False + else: + print(f"尚未定义的“only_active_by参数{CID_list}") + return False + + if __name__ == "__main__": base_key = "only_skill" key_1 = "only_skill_1" From 857d54e32d11a4f69534c1204de06ec70e4341ce Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 8 Jul 2025 23:49:54 +0800 Subject: [PATCH 12/16] =?UTF-8?q?fix:=20=E4=BF=AE=E6=AD=A3=E5=89=AF?= =?UTF-8?q?=E8=AF=8D=E6=9D=A1=E6=9C=80=E5=A4=A7=E5=80=BC=E8=BF=87=E5=B0=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsim/lib_webui/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsim/lib_webui/constants.py b/zsim/lib_webui/constants.py index 19191536..aed4ddd1 100644 --- a/zsim/lib_webui/constants.py +++ b/zsim/lib_webui/constants.py @@ -198,7 +198,7 @@ def _init_char_mapping() -> dict[str, str]: } # 副词条最大值 -sc_max_value = 40 +sc_max_value = 4000 # 计算结果缓存文件路径 ID_CACHE_JSON = "./results/id_cache.json" From d2d4a89dd437a03871c0a11208b001833556150b Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 8 Jul 2025 23:54:59 +0800 Subject: [PATCH 13/16] =?UTF-8?q?fix:=20=E6=9B=B4=E6=96=B0=E5=8F=98?= =?UTF-8?q?=E9=87=8F?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsim/lib_webui/constants.py | 3 ++- zsim/page_character_config.py | 14 +++++++------- 2 files changed, 9 insertions(+), 8 deletions(-) diff --git a/zsim/lib_webui/constants.py b/zsim/lib_webui/constants.py index aed4ddd1..7af1b7d4 100644 --- a/zsim/lib_webui/constants.py +++ b/zsim/lib_webui/constants.py @@ -198,7 +198,8 @@ def _init_char_mapping() -> dict[str, str]: } # 副词条最大值 -sc_max_value = 4000 +sc_max_percent = 40 +sc_max_value = 1000 # 计算结果缓存文件路径 ID_CACHE_JSON = "./results/id_cache.json" diff --git a/zsim/page_character_config.py b/zsim/page_character_config.py index 027f6ae0..77c405e0 100644 --- a/zsim/page_character_config.py +++ b/zsim/page_character_config.py @@ -230,7 +230,7 @@ def page_character_config(): st.number_input( "攻击力%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scATK_percent", 0) if name in saved_char_config else 0, @@ -249,7 +249,7 @@ def page_character_config(): st.number_input( "生命值%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scHP_percent", 0) if name in saved_char_config else 0, @@ -268,7 +268,7 @@ def page_character_config(): st.number_input( "防御力%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scDEF_percent", 0) if name in saved_char_config else 0, @@ -287,7 +287,7 @@ def page_character_config(): st.number_input( "暴击率", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scCRIT", 0) if name in saved_char_config else 0, @@ -296,7 +296,7 @@ def page_character_config(): st.number_input( "暴击伤害", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scCRIT_DMG", 0) if name in saved_char_config else 0, @@ -306,7 +306,7 @@ def page_character_config(): st.number_input( "异常精通", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scAnomalyProficiency", 0) if name in saved_char_config else 0, @@ -315,7 +315,7 @@ def page_character_config(): st.number_input( "穿透值", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scPEN", 0) if name in saved_char_config else 0, From 387b45281ab3d5b030f29cec31e4a66f28972531 Mon Sep 17 00:00:00 2001 From: Lucas Date: Tue, 8 Jul 2025 23:59:46 +0800 Subject: [PATCH 14/16] =?UTF-8?q?fix:=20=E6=B7=BB=E5=8A=A0=E5=89=AF?= =?UTF-8?q?=E8=AF=8D=E6=9D=A1=E6=9C=80=E5=A4=A7=E7=99=BE=E5=88=86=E6=AF=94?= =?UTF-8?q?=E5=B8=B8=E9=87=8F=E5=AF=BC=E5=85=A5?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- zsim/page_character_config.py | 1 + 1 file changed, 1 insertion(+) diff --git a/zsim/page_character_config.py b/zsim/page_character_config.py index 77c405e0..f9c228fa 100644 --- a/zsim/page_character_config.py +++ b/zsim/page_character_config.py @@ -223,6 +223,7 @@ def page_character_config(): key=f"{name}_main_stat6", ) from zsim.lib_webui.constants import sc_max_value + from zsim.lib_webui.constants import sc_max_percent st.text("副词条数量:") col1, col2, col3, col4, col5 = st.columns(5) From 5c3cfad9f8c3ca8a276b281a5fd0cdd31d126f11 Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 9 Jul 2025 00:06:15 +0800 Subject: [PATCH 15/16] fix: update max value for secondary attributes to use sc_max_percent --- zsim/lib_webui/constants.py | 3 ++- zsim/page_character_config.py | 15 ++++++++------- 2 files changed, 10 insertions(+), 8 deletions(-) diff --git a/zsim/lib_webui/constants.py b/zsim/lib_webui/constants.py index 19191536..4b9b7301 100644 --- a/zsim/lib_webui/constants.py +++ b/zsim/lib_webui/constants.py @@ -198,7 +198,8 @@ def _init_char_mapping() -> dict[str, str]: } # 副词条最大值 -sc_max_value = 40 +sc_max_value = 1500 +sc_max_percent = 40 # 计算结果缓存文件路径 ID_CACHE_JSON = "./results/id_cache.json" diff --git a/zsim/page_character_config.py b/zsim/page_character_config.py index 027f6ae0..f9c228fa 100644 --- a/zsim/page_character_config.py +++ b/zsim/page_character_config.py @@ -223,6 +223,7 @@ def page_character_config(): key=f"{name}_main_stat6", ) from zsim.lib_webui.constants import sc_max_value + from zsim.lib_webui.constants import sc_max_percent st.text("副词条数量:") col1, col2, col3, col4, col5 = st.columns(5) @@ -230,7 +231,7 @@ def page_character_config(): st.number_input( "攻击力%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scATK_percent", 0) if name in saved_char_config else 0, @@ -249,7 +250,7 @@ def page_character_config(): st.number_input( "生命值%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scHP_percent", 0) if name in saved_char_config else 0, @@ -268,7 +269,7 @@ def page_character_config(): st.number_input( "防御力%", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scDEF_percent", 0) if name in saved_char_config else 0, @@ -287,7 +288,7 @@ def page_character_config(): st.number_input( "暴击率", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scCRIT", 0) if name in saved_char_config else 0, @@ -296,7 +297,7 @@ def page_character_config(): st.number_input( "暴击伤害", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scCRIT_DMG", 0) if name in saved_char_config else 0, @@ -306,7 +307,7 @@ def page_character_config(): st.number_input( "异常精通", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scAnomalyProficiency", 0) if name in saved_char_config else 0, @@ -315,7 +316,7 @@ def page_character_config(): st.number_input( "穿透值", min_value=0, - max_value=sc_max_value, + max_value=sc_max_percent, value=saved_char_config[name].get("scPEN", 0) if name in saved_char_config else 0, From f54dc80ac164e2b21129d3b1d546275f441fcceb Mon Sep 17 00:00:00 2001 From: Lucas Date: Wed, 9 Jul 2025 00:12:31 +0800 Subject: [PATCH 16/16] chore: adjust variable values --- zsim/lib_webui/constants.py | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/zsim/lib_webui/constants.py b/zsim/lib_webui/constants.py index 4b9b7301..7af1b7d4 100644 --- a/zsim/lib_webui/constants.py +++ b/zsim/lib_webui/constants.py @@ -198,8 +198,8 @@ def _init_char_mapping() -> dict[str, str]: } # 副词条最大值 -sc_max_value = 1500 sc_max_percent = 40 +sc_max_value = 1000 # 计算结果缓存文件路径 ID_CACHE_JSON = "./results/id_cache.json"