hxp
2019-05-11 5759384f488b6bb4a99e6cddc6761a1ce6c94309
6740 【后端】【2.0】怪物时间掉血增加战力附加掉血
4个文件已修改
68 ■■■■ 已修改文件
PySysDB/PySysDBPY.h 4 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py 51 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py 1 ●●●● 补丁 | 查看 | 原始文档 | blame | 历史
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/IpyGameDataPY.py 12 ●●●●● 补丁 | 查看 | 原始文档 | blame | 历史
PySysDB/PySysDBPY.h
@@ -405,6 +405,10 @@
    DWORD        LostHPPerSecond;    //单人每秒掉血量
    BYTE        MaxPlayerCount;    //最大人数
    DWORD        LostHPPerSecondEx;    //每增加一人附加掉血量
    DWORD        FightPowerMin;    //标准战力
    DWORD        FightPowerMax;    //上限战力
    DWORD        EveryFightPower;    //每x点战力
    DWORD        EveryFightPowerLostHPEx;    //每x点战力附加伤害
};
//装备套装属性表
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -1790,7 +1790,7 @@
def UpdateTimeMonsterHP(curNPC, ipyData, tick):
    '''
    NPC总血量 = 单人每秒掉血量*理论击杀所需时间
         掉血值 = 单人每秒掉血量+min(当前人数, 最大人数)*附加掉血量
         掉血值 = 单人每秒掉血量+min(当前人数, 最大人数)*附加掉血量+(有效战力-标准战力)/x战力*x战力附加掉血
    '''
        
    lastLostHPTick = curNPC.GetDictByKey(ChConfig.Def_NPC_Dict_TimeLostHPTick)
@@ -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:
            if seeObjType != IPY_GameWorld.gotPlayer:
                continue
                effPlayerCount += 1
                if maxPlayerCount and effPlayerCount >= maxPlayerCount:
                    effPlayerCount = maxPlayerCount
                    break
        curNPC.SetDict(ChConfig.Def_NPC_Dict_TimeLostHPPlayerCount, effPlayerCount)
        #GameWorld.DebugLog("刷新影响人数: effPlayerCount=%s" % effPlayerCount)
            if fightPowerMin:
                seePlayer = GameWorld.GetObj(seeObj.GetID(), seeObjType)
                fightPowerTotal += (0 if not seePlayer else seePlayer.GetFightPower())
        
    if effPlayerCount > 1:
        hurtValuePerSecond = lostHPPerSecond + (effPlayerCount - 1) * lostHPPerSecondEx
    else:
        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,effFightPower=%s" % (effPlayerCount, effFightPower))
        hurtValuePerSecond = lostHPPerSecond
    lostHPTotal = int(hurtValuePerSecond * passTick / 1000.0)
    #人数附加伤害
    if effPlayerCount > 1:
        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和状态的影响处理
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 = (
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":(
@@ -2108,12 +2112,20 @@
        self.LostHPPerSecond = 0
        self.MaxPlayerCount = 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 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():