From 27b4508f4108d2420d846fb37266d16094827fc8 Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期三, 26 十一月 2025 00:03:44 +0800
Subject: [PATCH] 0312 自动生成战斗公式代码;结算的时候不处理装备;优化装备计算性能
---
Main/Core/GameEngine/Launch/ConfigInitTask.cs | 27 +++++++++++++++++++++++----
1 files changed, 23 insertions(+), 4 deletions(-)
diff --git a/Main/Core/GameEngine/Launch/ConfigInitTask.cs b/Main/Core/GameEngine/Launch/ConfigInitTask.cs
index 1fe1122..bb9162e 100644
--- a/Main/Core/GameEngine/Launch/ConfigInitTask.cs
+++ b/Main/Core/GameEngine/Launch/ConfigInitTask.cs
@@ -82,6 +82,21 @@
code.AppendLine("public class FightPowerFormula");
code.AppendLine("{");
+ // 鐢熸垚甯搁噺瀛楃涓插畾涔�
+ var allVariables = new HashSet<string>();
+ allVariables.UnionWith(propertyVariables);
+ allVariables.UnionWith(fightPropertyVariables);
+ allVariables.UnionWith(fightPowerVariables);
+ allVariables.UnionWith(skillFightPowerVariables);
+
+ code.AppendLine(" // 鍙橀噺鍚嶅父閲忓畾涔�");
+ foreach (var variable in allVariables)
+ {
+ var constantName = variable.ToUpper() + "_VALUE";
+ code.AppendLine($" private const string {constantName} = \"{variable}\";");
+ }
+ code.AppendLine();
+
// 娣诲姞鍏紡娉ㄩ噴
code.AppendLine(" // 鍩虹灞炴�у叕寮�");
code.AppendLine($" // {propertyFormula}");
@@ -98,7 +113,8 @@
code.AppendLine(" {");
foreach (var variable in propertyVariables)
{
- code.AppendLine($" double {variable} = variables[\"{variable}\"];");
+ var constantName = variable.ToUpper() + "_VALUE";
+ code.AppendLine($" double {variable} = variables[{constantName}];");
}
code.AppendLine();
code.AppendLine($" return {processedPropertyFormula};");
@@ -110,7 +126,8 @@
code.AppendLine(" {");
foreach (var variable in fightPropertyVariables)
{
- code.AppendLine($" double {variable} = variables[\"{variable}\"];");
+ var constantName = variable.ToUpper() + "_VALUE";
+ code.AppendLine($" double {variable} = variables[{constantName}];");
}
code.AppendLine();
code.AppendLine($" return {processedFightPropertyFormula};");
@@ -122,7 +139,8 @@
code.AppendLine(" {");
foreach (var variable in fightPowerVariables)
{
- code.AppendLine($" double {variable} = variables[\"{variable}\"];");
+ var constantName = variable.ToUpper() + "_VALUE";
+ code.AppendLine($" double {variable} = variables[{constantName}];");
}
code.AppendLine();
code.AppendLine($" return {processedFightPowerFormula};");
@@ -134,7 +152,8 @@
code.AppendLine(" {");
foreach (var variable in skillFightPowerVariables)
{
- code.AppendLine($" double {variable} = variables[\"{variable}\"];");
+ var constantName = variable.ToUpper() + "_VALUE";
+ code.AppendLine($" double {variable} = variables[{constantName}];");
}
code.AppendLine();
code.AppendLine($" return {processedSkillFightPowerFormula};");
--
Gitblit v1.8.0