From a65d363c813b7d554de1ce2edad271162ad86d55 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期二, 19 八月 2025 17:33:53 +0800
Subject: [PATCH] 121 【武将】武将系统-服务端(计算战力支持属性系数参数,技能战力参数支持;)

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py |   20 ++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py    |    2 
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py       |  103 +++++++++++++++++++++++++
 PySysDB/PySysDBPY.h                                                                        |   47 +++++++++++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py            |   12 ++
 5 files changed, 180 insertions(+), 4 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index f6ad6a6..447571b 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -233,6 +233,53 @@
 	char		Parameter;	//属性名、参数名
 };
 
+//战力系数
+struct	FightPowerRatio
+{
+	DWORD		_RealmLV;	//境界等级
+	float		AtkRatio;	//攻击系数
+	float		MaxHPRatio;
+	float		DefRatio;
+	float		StunRateRatio;
+	float		SuperHitRateRatio;
+	float		ComboRateRatio;
+	float		MissRateRatio;
+	float		ParryRateRatio;
+	float		SuckHPPerRatio;
+	float		StunRateDefRatio;
+	float		SuperHitRateDefRatio;
+	float		ComboRateDefRatio;
+	float		MissRateDefRatio;
+	float		ParryRateDefRatio;
+	float		SuckHPPerDefRatio;
+	float		FinalDamPerRatio;
+	float		FinalDamPerDefRatio;
+	float		PhyDamPerRatio;
+	float		PhyDamPerDefRatio;
+	float		MagDamPerRatio;
+	float		MagDamPerDefRatio;
+	float		NormalSkillPerRatio;
+	float		NormalSkillPerDefRatio;
+	float		AngerSkillPerRatio;
+	float		AngerSkillPerDefRatio;
+	float		SuperDamPerRatio;
+	float		SuperDamPerDefRatio;
+	float		CurePerRatio;
+	float		CurePerDefRatio;
+	float		ShieldPerRatio;
+	float		ShieldPerDefRatio;
+	float		DOTPerRatio;
+	float		DOTPerDefRatio;
+	float		WeiFinalDamPerRatio;
+	float		WeiFinalDamPerDefRatio;
+	float		ShuFinalDamPerRatio;
+	float		ShuFinalDamPerDefRatio;
+	float		WuFinalDamPerRatio;
+	float		WuFinalDamPerDefRatio;
+	float		QunFinalDamPerRatio;
+	float		QunFinalDamPerDefRatio;
+};
+
 //主线章节表
 struct	MainChapter
 {
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
index f546b05..55da264 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py
@@ -237,6 +237,7 @@
     
     def GetSkillID(self): return self._ipyData.GetSkillID()
     def GetSkillTypeID(self): return self._ipyData.GetSkillTypeID()
+    def GetSkillLV(self): return self._ipyData.GetSkillLV()
     def GetSkillMaxLV(self): return self._ipyData.GetSkillMaxLV()
     def GetSkillName(self): return self._ipyData.GetSkillName()
     def GetFuncType(self): return self._ipyData.GetFuncType()
@@ -425,6 +426,7 @@
     
     def GetSkillID(self): return self._skillData.GetSkillID()
     def GetSkillTypeID(self): return self._skillData.GetSkillTypeID()
+    def GetSkillLV(self): return self._skillData.GetSkillLV()
     def GetSkillMaxLV(self): return self._skillData.GetSkillMaxLV()
     def GetSkillName(self): return self._skillData.GetSkillName()
     def GetFuncType(self): return self._skillData.GetFuncType()
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 4e35cc3..63e2843 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -152,7 +152,15 @@
 AttrID_ShieldPerDef,                        # 弱化护盾 54
 AttrID_DOTPer,                              # 持续增伤 55 (中毒、燃烧、流血)
 AttrID_DOTPerDef,                           # 持续减伤 56
-) = range(1, 1 + 56)
+AttrID_WeiFinalDamPer,                      # 对魏增伤 57
+AttrID_WeiFinalDamPerDef,                   # 对魏减伤 58
+AttrID_ShuFinalDamPer,                      # 对蜀增伤 59
+AttrID_ShuFinalDamPerDef,                   # 对蜀减伤 60
+AttrID_WuFinalDamPer,                       # 对吴增伤 61
+AttrID_WuFinalDamPerDef,                    # 对吴减伤 62
+AttrID_QunFinalDamPer,                      # 对群增伤 63
+AttrID_QunFinalDamPerDef,                   # 对群减伤 64
+) = range(1, 1 + 64)
 
 # 需要计算的武将战斗属性ID列表
 CalcBattleAttrIDList = [AttrID_Atk, AttrID_Def, AttrID_MaxHP, AttrID_StunRate, AttrID_StunRateDef, 
@@ -163,6 +171,8 @@
                         AttrID_NormalSkillPer, AttrID_NormalSkillPerDef, AttrID_AngerSkillPer, AttrID_AngerSkillPerDef,
                         AttrID_SuperDamPer, AttrID_SuperDamPerDef, AttrID_CurePer, AttrID_CurePerDef,
                         AttrID_ShieldPer, AttrID_ShieldPerDef, AttrID_DOTPer, AttrID_DOTPerDef,
+                        AttrID_WeiFinalDamPer, AttrID_WeiFinalDamPerDef, AttrID_ShuFinalDamPer, AttrID_ShuFinalDamPerDef,
+                        AttrID_WuFinalDamPer, AttrID_WuFinalDamPerDef, AttrID_QunFinalDamPer, AttrID_QunFinalDamPerDef,
                         ]
 
 # 基础三维属性ID列表
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index 65817b5..e98a113 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -234,6 +234,51 @@
                         ("char", "Parameter", 0),
                         ),
 
+                "FightPowerRatio":(
+                        ("DWORD", "RealmLV", 1),
+                        ("float", "AtkRatio", 0),
+                        ("float", "MaxHPRatio", 0),
+                        ("float", "DefRatio", 0),
+                        ("float", "StunRateRatio", 0),
+                        ("float", "SuperHitRateRatio", 0),
+                        ("float", "ComboRateRatio", 0),
+                        ("float", "MissRateRatio", 0),
+                        ("float", "ParryRateRatio", 0),
+                        ("float", "SuckHPPerRatio", 0),
+                        ("float", "StunRateDefRatio", 0),
+                        ("float", "SuperHitRateDefRatio", 0),
+                        ("float", "ComboRateDefRatio", 0),
+                        ("float", "MissRateDefRatio", 0),
+                        ("float", "ParryRateDefRatio", 0),
+                        ("float", "SuckHPPerDefRatio", 0),
+                        ("float", "FinalDamPerRatio", 0),
+                        ("float", "FinalDamPerDefRatio", 0),
+                        ("float", "PhyDamPerRatio", 0),
+                        ("float", "PhyDamPerDefRatio", 0),
+                        ("float", "MagDamPerRatio", 0),
+                        ("float", "MagDamPerDefRatio", 0),
+                        ("float", "NormalSkillPerRatio", 0),
+                        ("float", "NormalSkillPerDefRatio", 0),
+                        ("float", "AngerSkillPerRatio", 0),
+                        ("float", "AngerSkillPerDefRatio", 0),
+                        ("float", "SuperDamPerRatio", 0),
+                        ("float", "SuperDamPerDefRatio", 0),
+                        ("float", "CurePerRatio", 0),
+                        ("float", "CurePerDefRatio", 0),
+                        ("float", "ShieldPerRatio", 0),
+                        ("float", "ShieldPerDefRatio", 0),
+                        ("float", "DOTPerRatio", 0),
+                        ("float", "DOTPerDefRatio", 0),
+                        ("float", "WeiFinalDamPerRatio", 0),
+                        ("float", "WeiFinalDamPerDefRatio", 0),
+                        ("float", "ShuFinalDamPerRatio", 0),
+                        ("float", "ShuFinalDamPerDefRatio", 0),
+                        ("float", "WuFinalDamPerRatio", 0),
+                        ("float", "WuFinalDamPerDefRatio", 0),
+                        ("float", "QunFinalDamPerRatio", 0),
+                        ("float", "QunFinalDamPerDefRatio", 0),
+                        ),
+
                 "MainChapter":(
                         ("BYTE", "ChapterID", 1),
                         ("list", "DailyBootyUpperList", 0),
@@ -3132,6 +3177,56 @@
         
     def GetAttrID(self): return self.attrTuple[0] # 属性ID DWORD
     def GetParameter(self): return self.attrTuple[1] # 属性名、参数名 char
+
+# 战力系数
+class IPY_FightPowerRatio():
+    
+    def __init__(self):
+        self.attrTuple = None
+        return
+        
+    def GetRealmLV(self): return self.attrTuple[0] # 境界等级 DWORD
+    def GetAtkRatio(self): return self.attrTuple[1] # 攻击系数 float
+    def GetMaxHPRatio(self): return self.attrTuple[2] # float
+    def GetDefRatio(self): return self.attrTuple[3] # float
+    def GetStunRateRatio(self): return self.attrTuple[4] # float
+    def GetSuperHitRateRatio(self): return self.attrTuple[5] # float
+    def GetComboRateRatio(self): return self.attrTuple[6] # float
+    def GetMissRateRatio(self): return self.attrTuple[7] # float
+    def GetParryRateRatio(self): return self.attrTuple[8] # float
+    def GetSuckHPPerRatio(self): return self.attrTuple[9] # float
+    def GetStunRateDefRatio(self): return self.attrTuple[10] # float
+    def GetSuperHitRateDefRatio(self): return self.attrTuple[11] # float
+    def GetComboRateDefRatio(self): return self.attrTuple[12] # float
+    def GetMissRateDefRatio(self): return self.attrTuple[13] # float
+    def GetParryRateDefRatio(self): return self.attrTuple[14] # float
+    def GetSuckHPPerDefRatio(self): return self.attrTuple[15] # float
+    def GetFinalDamPerRatio(self): return self.attrTuple[16] # float
+    def GetFinalDamPerDefRatio(self): return self.attrTuple[17] # float
+    def GetPhyDamPerRatio(self): return self.attrTuple[18] # float
+    def GetPhyDamPerDefRatio(self): return self.attrTuple[19] # float
+    def GetMagDamPerRatio(self): return self.attrTuple[20] # float
+    def GetMagDamPerDefRatio(self): return self.attrTuple[21] # float
+    def GetNormalSkillPerRatio(self): return self.attrTuple[22] # float
+    def GetNormalSkillPerDefRatio(self): return self.attrTuple[23] # float
+    def GetAngerSkillPerRatio(self): return self.attrTuple[24] # float
+    def GetAngerSkillPerDefRatio(self): return self.attrTuple[25] # float
+    def GetSuperDamPerRatio(self): return self.attrTuple[26] # float
+    def GetSuperDamPerDefRatio(self): return self.attrTuple[27] # float
+    def GetCurePerRatio(self): return self.attrTuple[28] # float
+    def GetCurePerDefRatio(self): return self.attrTuple[29] # float
+    def GetShieldPerRatio(self): return self.attrTuple[30] # float
+    def GetShieldPerDefRatio(self): return self.attrTuple[31] # float
+    def GetDOTPerRatio(self): return self.attrTuple[32] # float
+    def GetDOTPerDefRatio(self): return self.attrTuple[33] # float
+    def GetWeiFinalDamPerRatio(self): return self.attrTuple[34] # float
+    def GetWeiFinalDamPerDefRatio(self): return self.attrTuple[35] # float
+    def GetShuFinalDamPerRatio(self): return self.attrTuple[36] # float
+    def GetShuFinalDamPerDefRatio(self): return self.attrTuple[37] # float
+    def GetWuFinalDamPerRatio(self): return self.attrTuple[38] # float
+    def GetWuFinalDamPerDefRatio(self): return self.attrTuple[39] # float
+    def GetQunFinalDamPerRatio(self): return self.attrTuple[40] # float
+    def GetQunFinalDamPerDefRatio(self): return self.attrTuple[41] # float
 
 # 主线章节表
 class IPY_MainChapter():
@@ -7193,6 +7288,7 @@
         self.__LoadFileData("HeroQualityAwake", onlyCheck)
         self.__LoadFileData("HeroQualityLV", onlyCheck)
         self.__LoadFileData("PlayerAttr", onlyCheck)
+        self.__LoadFileData("FightPowerRatio", onlyCheck)
         self.__LoadFileData("MainChapter", onlyCheck)
         self.__LoadFileData("MainLevel", onlyCheck)
         self.__LoadFileData("NPCLineup", onlyCheck)
@@ -7798,6 +7894,13 @@
         self.CheckLoadData("PlayerAttr")
         return self.ipyPlayerAttrCache[index]
 
+    def GetFightPowerRatioCount(self):
+        self.CheckLoadData("FightPowerRatio")
+        return self.ipyFightPowerRatioLen
+    def GetFightPowerRatioByIndex(self, index):
+        self.CheckLoadData("FightPowerRatio")
+        return self.ipyFightPowerRatioCache[index]
+
     def GetMainChapterCount(self):
         self.CheckLoadData("MainChapter")
         return self.ipyMainChapterLen
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
index bf3a1e4..d9506f8 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerOnline.py
@@ -614,6 +614,7 @@
     baseAttrFormula = IpyGameDataPY.GetFuncCfg("HeroAttrFormula", 1)
     otherAttrFormula = IpyGameDataPY.GetFuncCfg("HeroAttrFormula", 2)
     fightPowerFormula = IpyGameDataPY.GetFuncCfg("HeroAttrFormula", 3)
+    skillFPFormula = IpyGameDataPY.GetFuncCfg("HeroAttrFormula", 4)
     
     lvAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_LV)
     equipAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_MainEquip)
@@ -632,6 +633,12 @@
     GameWorld.DebugLog("    主公等级属性=%s" % lvAttrDict, playerID)
     GameWorld.DebugLog("    主公装备属性=%s" % equipAttrDict, playerID)
     GameWorld.DebugLog("    主公图鉴属性=%s" % bookAttrDict, playerID)
+    
+    PlayerLV = curPlayer.GetLV()
+    OfficialLV = curPlayer.GetOfficialRank()
+    GameWorld.DebugLog("    PlayerLV=%s,OfficialLV=%s" % (PlayerLV, OfficialLV), playerID)
+    
+    fpRatioIpyData = IpyGameDataPY.GetIpyGameData("FightPowerRatio", OfficialLV)
     
     lineupFightPower = 0 # 阵容总战力
     InitAddPer, LVAddPer, BreakLVAddPer, StarAddPer = InitAddPer / 10000.0, LVAddPer / 10000.0, BreakLVAddPer / 10000.0, StarAddPer / 10000.0
@@ -698,15 +705,20 @@
             
             attrIpyData = IpyGameDataPY.GetIpyGameData("PlayerAttr", attrID)
             attrName = attrIpyData.GetParameter() if attrIpyData else "%s" % attrID
+            attrRatioName = "%sRatio" % attrName
+            ratioValue = 0
+            if attrValue and hasattr(fpRatioIpyData, "Get%s" % attrRatioName):
+                ratioValue = getattr(fpRatioIpyData, "Get%s" % attrRatioName)()
             fightPowerParamDict[attrName] = attrValue
+            fightPowerParamDict[attrRatioName] = ratioValue
             if attrValue:
                 lineupHero.heroBatAttrDict[attrID] = attrValue
                 logAttrDict["%s-%s" % (attrID, attrName)] = attrValue
-                
+            
         # 计算战力
         fightPower = FormulaControl.Eval("fightPowerFormula", fightPowerFormula, fightPowerParamDict)
         
-        GameWorld.DebugLog("    fightPower=%s,heroSkillIDList=%s" % (fightPower, lineupHero.heroSkillIDList), playerID)
+        GameWorld.DebugLog("    heroID=%s,fightPower=%s,heroSkillIDList=%s" % (heroID, fightPower, lineupHero.heroSkillIDList), playerID)
         skillTypeIDDict = {}
         for skillID in lineupHero.heroSkillIDList:
             skillData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
@@ -727,7 +739,9 @@
         for skillData in skillTypeIDDict.values():
             skillID = skillData.GetSkillID()
             lineupHero.heroSkillIDList.append(skillID)
-            skillFightPower += skillData.GetFightPower()
+            paramDict = {"SkillPower":skillData.GetFightPower(), "PlayerLV":PlayerLV, "OfficialLV":OfficialLV}
+            sFightPower = FormulaControl.Eval("skillFPFormula", skillFPFormula, paramDict)
+            skillFightPower += sFightPower
         GameWorld.DebugLog("    skillFightPower=%s,heroSkillIDList=%s" % (skillFightPower, lineupHero.heroSkillIDList), playerID)
         
         # 最终战力

--
Gitblit v1.8.0