| | |
| | | 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}"); |
| | |
| | | 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};"); |
| | |
| | | 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};"); |
| | |
| | | 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};"); |
| | |
| | | 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};"); |