From 5759384f488b6bb4a99e6cddc6761a1ce6c94309 Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期六, 11 五月 2019 13:47:14 +0800
Subject: [PATCH] 6740 【后端】【2.0】怪物时间掉血增加战力附加掉血

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py                   |   16 +++++++-
 PySysDB/PySysDBPY.h                                                                                    |    4 ++
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py |   53 +++++++++++++++++++-------
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                        |    1 
 4 files changed, 58 insertions(+), 16 deletions(-)

diff --git a/PySysDB/PySysDBPY.h b/PySysDB/PySysDBPY.h
index ab3df3a..eb00701 100644
--- a/PySysDB/PySysDBPY.h
+++ b/PySysDB/PySysDBPY.h
@@ -405,6 +405,10 @@
 	DWORD		LostHPPerSecond;	//单人每秒掉血量
 	BYTE		MaxPlayerCount;	//最大人数
 	DWORD		LostHPPerSecondEx;	//每增加一人附加掉血量
+	DWORD		FightPowerMin;	//标准战力
+	DWORD		FightPowerMax;	//上限战力
+	DWORD		EveryFightPower;	//每x点战力
+	DWORD		EveryFightPowerLostHPEx;	//每x点战力附加伤害
 };
 
 //装备套装属性表
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
index e091ed9..0a3a31a 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -1790,9 +1790,9 @@
 def UpdateTimeMonsterHP(curNPC, ipyData, tick):
     '''
     NPC总血量 = 单人每秒掉血量*理论击杀所需时间
-         掉血值 = 单人每秒掉血量+min(当前人数, 最大人数)*附加掉血量
+         掉血值 = 单人每秒掉血量+min(当前人数, 最大人数)*附加掉血量+(有效战力-标准战力)/x战力*x战力附加掉血
     '''
-        
+    
     lastLostHPTick = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_TimeLostHPTick)
     curNPC.SetDict(ChConfig.Def_NPC_Dict_TimeLostHPTick, tick)
     if not lastLostHPTick or tick - lastLostHPTick >= 2000:
@@ -1806,11 +1806,17 @@
     lostHPPerSecond = ipyData.GetLostHPPerSecond()
     maxPlayerCount = ipyData.GetMaxPlayerCount()
     lostHPPerSecondEx = ipyData.GetLostHPPerSecondEx()
+    fightPowerMin = ipyData.GetFightPowerMin()
+    fightPowerMax = ipyData.GetFightPowerMax()
+    everyFightPower = ipyData.GetEveryFightPower()
+    everyFightPowerLostHPEx = ipyData.GetEveryFightPowerLostHPEx()
     
+    effFightPower = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_TimeLostHPFightPower)
     effPlayerCount = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_TimeLostHPPlayerCount)
     refreshPlayerCountTick = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_TimeLostHPPlayerCountTick)
     if not refreshPlayerCountTick or tick - refreshPlayerCountTick >= 3000:
         curNPC.SetDict(ChConfig.Def_NPC_Dict_TimeLostHPPlayerCountTick, tick)
+        fightPowerTotal = 0
         effPlayerCount = 0
         for i in xrange(curNPC.GetInSightObjCount()):
             seeObj = curNPC.GetInSightObjByIndex(i)
@@ -1819,24 +1825,43 @@
             if not seeObj.GetVisible():
                 continue
             seeObjType = seeObj.GetGameObjType()
-            if seeObjType == IPY_GameWorld.gotPlayer:
-                effPlayerCount += 1
-                if maxPlayerCount and effPlayerCount >= maxPlayerCount:
-                    effPlayerCount = maxPlayerCount
-                    break
+            if seeObjType != IPY_GameWorld.gotPlayer:
+                continue
+            effPlayerCount += 1
+            if fightPowerMin:          
+                seePlayer = GameWorld.GetObj(seeObj.GetID(), seeObjType)
+                fightPowerTotal += (0 if not seePlayer else seePlayer.GetFightPower())
+                
+        effFightPower = int(fightPowerTotal / effPlayerCount)
+        if fightPowerMax and effFightPower > fightPowerMax:
+            effFightPower = fightPowerMax
+            
+        if maxPlayerCount and effPlayerCount > maxPlayerCount:
+            effPlayerCount = maxPlayerCount
+            
+        curNPC.SetDict(ChConfig.Def_NPC_Dict_TimeLostHPFightPower, effFightPower)
         curNPC.SetDict(ChConfig.Def_NPC_Dict_TimeLostHPPlayerCount, effPlayerCount)
-        #GameWorld.DebugLog("刷新影响人数: effPlayerCount=%s" % effPlayerCount)
+        #GameWorld.DebugLog("刷新影响人数: effPlayerCount=%s,effFightPower=%s" % (effPlayerCount, effFightPower))
         
+    hurtValuePerSecond = lostHPPerSecond
+    #人数附加伤害
     if effPlayerCount > 1:
-        hurtValuePerSecond = lostHPPerSecond + (effPlayerCount - 1) * lostHPPerSecondEx
-    else:
-        hurtValuePerSecond = lostHPPerSecond
-    lostHPTotal = int(hurtValuePerSecond * passTick / 1000.0)
+        playerCountHurtEx = (effPlayerCount - 1) * lostHPPerSecondEx
+        hurtValuePerSecond += playerCountHurtEx
+        #GameWorld.DebugLog("playerCountHurtEx=%s,hurtValuePerSecond=%s" % (playerCountHurtEx, hurtValuePerSecond))
+        
+    #战力附加伤害
+    if fightPowerMin and effFightPower and everyFightPower and everyFightPowerLostHPEx:
+        fightPowerHurtEx = (effFightPower - fightPowerMin) / float(everyFightPower) * everyFightPowerLostHPEx # 可能为负值
+        hurtValuePerSecond += fightPowerHurtEx
+        #GameWorld.DebugLog("fightPowerHurtEx=%s,hurtValuePerSecond=%s" % (fightPowerHurtEx, hurtValuePerSecond))
+        
+    lostHPTotal = max(1, int(hurtValuePerSecond * passTick / 1000.0))
     
     remainHP = min(GameObj.GetMaxHP(curNPC), max(0, GameObj.GetHP(curNPC) - lostHPTotal))
     GameObj.SetHP(curNPC, remainHP, isByTime=True)
-    #GameWorld.DebugLog("怪物按时间掉血: npcID=%s,effPlayerCount=%s,hurtValuePerSecond=%s,passTick=%s,lostHPTotal=%s" 
-    #                   % (npcID, effPlayerCount, hurtValuePerSecond, passTick, lostHPTotal))
+    #GameWorld.DebugLog("怪物按时间掉血: npcID=%s,effPlayerCount=%s,effFightPower=%s,hurtValuePerSecond=%s,passTick=%s,lostHPTotal=%s" 
+    #                   % (curNPC.GetNPCID(), effPlayerCount, effFightPower, hurtValuePerSecond, passTick, lostHPTotal))
     return
 
 # 计算伤害后,因各种buff和状态的影响处理
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index fa4bf21..aadc296 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -3005,6 +3005,7 @@
 Def_NPC_Dict_TimeLostHPTick = 'TimeLostHPTick' # 上次按时间掉血tick
 Def_NPC_Dict_TimeLostHPPlayerCountTick = 'TimeLostHPPlayerCountTick ' # 上次刷新按时间掉血人数tick
 Def_NPC_Dict_TimeLostHPPlayerCount = 'TimeLostHPPlayerCount' # 按时间掉血有效人数
+Def_NPC_Dict_TimeLostHPFightPower = 'TimeLostHPFightPower' # 按时间掉血战力
 
 #玩家状态定义,不能超过31个,如超过,需扩展多个key支持
 Def_PlayerStateList = (
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
index ec990cc..2617274 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py
@@ -340,6 +340,10 @@
                         ("DWORD", "LostHPPerSecond", 0),
                         ("BYTE", "MaxPlayerCount", 0),
                         ("DWORD", "LostHPPerSecondEx", 0),
+                        ("DWORD", "FightPowerMin", 0),
+                        ("DWORD", "FightPowerMax", 0),
+                        ("DWORD", "EveryFightPower", 0),
+                        ("DWORD", "EveryFightPowerLostHPEx", 0),
                         ),
 
                 "EquipSuitAttr":(
@@ -2107,13 +2111,21 @@
         self.NPCID = 0
         self.LostHPPerSecond = 0
         self.MaxPlayerCount = 0
-        self.LostHPPerSecondEx = 0
+        self.LostHPPerSecondEx = 0
+        self.FightPowerMin = 0
+        self.FightPowerMax = 0
+        self.EveryFightPower = 0
+        self.EveryFightPowerLostHPEx = 0
         return
         
     def GetNPCID(self): return self.NPCID # NPCID
     def GetLostHPPerSecond(self): return self.LostHPPerSecond # 单人每秒掉血量
     def GetMaxPlayerCount(self): return self.MaxPlayerCount # 最大人数
-    def GetLostHPPerSecondEx(self): return self.LostHPPerSecondEx # 每增加一人附加掉血量
+    def GetLostHPPerSecondEx(self): return self.LostHPPerSecondEx # 每增加一人附加掉血量
+    def GetFightPowerMin(self): return self.FightPowerMin # 标准战力
+    def GetFightPowerMax(self): return self.FightPowerMax # 上限战力
+    def GetEveryFightPower(self): return self.EveryFightPower # 每x点战力
+    def GetEveryFightPowerLostHPEx(self): return self.EveryFightPowerLostHPEx # 每x点战力附加伤害
 
 # 装备套装属性表
 class IPY_EquipSuitAttr():

--
Gitblit v1.8.0