ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -1293,7 +1293,10 @@
def IsHappenStateByType(happenState, cmpType):
    return happenState & cmpType
def CalcHurtTypeResult(atkObj, defObj, atkObjType, defObjType, happenState):
# 表现形式 致命一击>(重击>暴击)>会心>格挡>境界压制
# 重击定义:当触发重击时,则增加双倍暴击固定值伤害(重击与暴击互斥,优先判断重击,当重击触发时,暴击不触发)
def CalcHurtTypeResult(atkObj, defObj, atkObjType, defObjType, happenState, curSkill):
    ''' 获取伤害类型结果 
    支持多种伤害类型同时触发, 飘字表现以最终表现伤害类型为主
    @return: 最终表现伤害类型, {伤害类型:[是否触发, 伤害计算值, 触发时防守方的伤害减免值], ...}
@@ -1306,12 +1309,14 @@
                          ChConfig.Def_HurtType_Parry:[False, 0, 0],
                          ChConfig.Def_HurtType_Zhuxian:[False, 0, 0],
                          ChConfig.Def_HurtType_DeadlyHit:[False, 0, 0],
                          ChConfig.Def_HurtType_ThumpHit:[False, 0, 0],
                          }
    
    calcTypeList =  []
    if atkObjType == IPY_GameWorld.gotPlayer:
        calcTypeList += [ChConfig.Def_HurtType_LuckyHit, ChConfig.Def_HurtType_SuperHit, 
                         ChConfig.Def_HurtType_Zhuxian, ChConfig.Def_HurtType_DeadlyHit]
                         ChConfig.Def_HurtType_Zhuxian, ChConfig.Def_HurtType_DeadlyHit,
                         ChConfig.Def_HurtType_ThumpHit]
    if defObjType == IPY_GameWorld.gotPlayer:
        calcTypeList += [ChConfig.Def_HurtType_Parry]
    # 暂时只计算玩家
@@ -1321,11 +1326,12 @@
    # 优先级列表, 互斥列表
    priorityList, mutexList = ReadChConfig.GetEvalChConfig("CalcHurtTypeInfo")
    happenFunc = {
                  ChConfig.Def_HurtType_LuckyHit:lambda aObj, dObj, hState:__HurtTypeHappen_LuckyHit(aObj, dObj, hState),
                  ChConfig.Def_HurtType_SuperHit:lambda aObj, dObj, hState:__HurtTypeHappen_SuperHit(aObj, dObj, hState),
                  ChConfig.Def_HurtType_Parry:lambda aObj, dObj, hState:__HurtTypeHappen_Parry(aObj, dObj, hState),
                  #ChConfig.Def_HurtType_Zhuxian:lambda aObj, dObj, hState:__HurtTypeHappen_Zhuxian(aObj, dObj, hState),
                  ChConfig.Def_HurtType_DeadlyHit:lambda aObj, dObj, hState:__HurtTypeHappen_Deadly(aObj, dObj, hState),
                  ChConfig.Def_HurtType_LuckyHit:__HurtTypeHappen_LuckyHit,
                  ChConfig.Def_HurtType_SuperHit:__HurtTypeHappen_SuperHit,
                  ChConfig.Def_HurtType_Parry:__HurtTypeHappen_Parry,
                  #ChConfig.Def_HurtType_Zhuxian:__HurtTypeHappen_Zhuxian,
                  ChConfig.Def_HurtType_DeadlyHit:__HurtTypeHappen_Deadly,
                  ChConfig.Def_HurtType_ThumpHit:__HurtTypeHappen_ThumpHit,
                  }
    
    hadCheckList = [] # 已经处理过的伤害类型列表
@@ -1342,7 +1348,7 @@
            if curMHHappen:
                # 只要其中一个已触发的则后面的均为默认不触发
                continue
            result = happenFunc[hType](atkObj, defObj, happenState)
            result = happenFunc[hType](atkObj, defObj, happenState, curSkill)
            if result: # 如果触发,更新相关数值
                hurtTypeResultDict[hType] = result
                curMHHappen = True
@@ -1353,7 +1359,7 @@
            continue
        if hType not in hadCheckList:
            hadCheckList.append(hType)
            result = happenFunc[hType](atkObj, defObj, happenState)
            result = happenFunc[hType](atkObj, defObj, happenState, curSkill)
            if result: # 如果触发,更新相关数值
                hurtTypeResultDict[hType] = result
                
@@ -1364,7 +1370,7 @@
    return hurtType, hurtTypeResultDict
def __HurtTypeHappen_LuckyHit(atkObj, defObj, happenState):
def __HurtTypeHappen_LuckyHit(atkObj, defObj, happenState, curSkill):
    ''' 判断伤害类型是否发生 - 会心一击
    @return: 是否触发, 触发时伤害计算固定值, 触发时防守方的伤害减免固定值
    '''
@@ -1382,7 +1388,7 @@
        return True, atkObj.GetLuckyHitVal(), PlayerControl.GetLuckyHitReduce(defObj)
    return
def __HurtTypeHappen_SuperHit(atkObj, defObj, happenState):
def __HurtTypeHappen_SuperHit(atkObj, defObj, happenState, curSkill):
    ''' 判断伤害类型是否发生 - 暴击
    @return: 是否触发, 触发时伤害计算固定值, 触发时防守方的伤害减免固定值
    '''
@@ -1401,7 +1407,7 @@
        return True, atkObj.GetSuperHit(), PlayerControl.GetSuperHitReduce(defObj)
    return
def __HurtTypeHappen_Parry(atkObj, defObj, happenState):
def __HurtTypeHappen_Parry(atkObj, defObj, happenState, curSkill):
    ''' 判断伤害类型是否发生 - 防守方抵御
    @return: 是否触发, 触发时伤害计算值, 触发时防守方的伤害减免值
    '''
@@ -1412,7 +1418,7 @@
        return True, 0, chanceDefPer
    return
#def __HurtTypeHappen_Zhuxian(atkObj, defObj, happenState):
#def __HurtTypeHappen_Zhuxian(atkObj, defObj, happenState, curSkill):
#    """诛仙一击"""
#    rate = PlayerControl.GetZhuXianRate(atkObj)
#    if not rate:
@@ -1423,11 +1429,27 @@
#    return
# 致命一击
def __HurtTypeHappen_Deadly(atkObj, defObj, happenState):
def __HurtTypeHappen_Deadly(atkObj, defObj, happenState, curSkill):
    if PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, None, ChConfig.TriggerType_IsDealy):
        return True, 0, 0
    return
#重击定义:当触发重击时,则增加双倍暴击固定值伤害(重击与暴击互斥,优先判断重击,当重击触发时,暴击不触发)
def __HurtTypeHappen_ThumpHit(atkObj, defObj, happenState, curSkill):
    if IsHappenStateByType(happenState, ChConfig.Def_Skill_HappenState_ThumpHit):
        return True, atkObj.GetSuperHit()*2, PlayerControl.GetSuperHitReduce(defObj)
    thumpHitRate = 0
    thumpHitRate += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill,
                                                                       ChConfig.TriggerType_AddThumpHitRate)
    thumpHitRate += PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(atkObj, defObj, curSkill,
                                                                       ChConfig.TriggerType_AddThumpHitRate)
    if thumpHitRate <= 0:
        return
    if GameWorld.CanHappen(thumpHitRate):
        return True, atkObj.GetSuperHit()*2, PlayerControl.GetSuperHitReduce(defObj)
    return
def ChangeSkillHurtPer(atkObj, defObj, curSkill, skillPer):
@@ -1602,6 +1624,36 @@
    PassiveBuffEffMng.OnPassiveSkillTrigger(defObj, atkObj, None, ChConfig.TriggerType_ProDefValue, tick)
    return hurtValue - absortValue
# 设置玩家一次主动型攻击中的第一个防御者
def SetFirstDefender(attacker, defObj, curSkill):
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
        return
    if curSkill and curSkill.GetFuncType() not in [ChConfig.Def_SkillFuncType_FbSkill,
                                          ChConfig.Def_SkillFuncType_NormalAttack]:
        return
    if attacker.GetDictByKey(ChConfig.Def_PlayerKey_FirstDefender):
        return
    attacker.SetDict(ChConfig.Def_PlayerKey_FirstDefender, defObj.GetID())
    return
# 清除第一目标
def ClearFirstDefender(attacker):
    if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
        return
    attacker.SetDict(ChConfig.Def_PlayerKey_FirstDefender, 0)
    return
def GetFirstDefenderID(attacker):
    return attacker.GetDictByKey(ChConfig.Def_PlayerKey_FirstDefender)
## 计算伤血值
#  @param atkObj 攻击者
#  @param defObj 防御者
@@ -1615,6 +1667,9 @@
#  @remarks 函数详细说明.
def GetHurtHP(attacker, defObj, curSkill, atkSkillValue, atkSkillPer, tick):
    atkObj = ElfChangeAttacker(attacker)  # Elf灵为替身攻击,要取玩家的属性
    #设置第一个防御者
    SetFirstDefender(atkObj, defObj, curSkill)
    
    resultHurtType = HurtType()
    atkObjType = attacker.GetGameObjType()
@@ -1749,13 +1804,7 @@
    
    WriteHurtLog(attacker, defObj, curSkill, resultHurtType.LostHP, resultHurtType.HurtType, "最终扣血")
    
    #攻击触发事件, 该代码应该放在DoAttack函数中处理逻辑比较清晰,也不会破坏GetHurtHP函数
    #因为DoAttack修改点比较多,暂不迁移,相关攻击事件逻辑,就往此函数中添加
    AttackEventTrigger(atkObj, defObj, curSkill, resultHurtType, tick)
    #===========================================================================
    # if atkObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
    #    GameWorld.DebugAnswer(atkObj, "--%s剩余血量 %s"%(defObj.GetID(), defObj.GetHP()))
    #===========================================================================
    
    return resultHurtType
@@ -2008,10 +2057,21 @@
            return 0, ChConfig.Def_HurtType_Miss
    
    hurtType, hurtTypeResultDict = CalcHurtTypeResult(atkObj, defObj, atkObjType, defObjType, happenState)
    hurtType, hurtTypeResultDict = CalcHurtTypeResult(atkObj, defObj, atkObjType, defObjType, happenState, curSkill)
    #GameWorld.DebugLog("GetHurtHP hurtType=%s, hurtTypeResultDict=%s" % (hurtType, hurtTypeResultDict))
    isLuckyHit, aLuckyHit, dLuckyHitReduce = hurtTypeResultDict[ChConfig.Def_HurtType_LuckyHit] # 幸运一击
    isSuperHit, aSuperHit, dSuperHitReduce = hurtTypeResultDict[ChConfig.Def_HurtType_SuperHit] # 暴击
    # 重击和暴击互斥,并且使用同一个参数
    isSuperHit, aSuperHit, dSuperHitReduce = hurtTypeResultDict[ChConfig.Def_HurtType_ThumpHit]
    if not isSuperHit:
        isSuperHit, aSuperHit, dSuperHitReduce = hurtTypeResultDict[ChConfig.Def_HurtType_SuperHit]
    else:
        # 重击加成
        thumpPer = 0
        thumpPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_AddThumpHitPer)
        thumpPer += PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_AddThumpHitPer)
        aSuperHit = aSuperHit*(thumpPer + 10000)/10000
    dDamChanceDef = hurtTypeResultDict[ChConfig.Def_HurtType_Parry][2] # 抵御, 大于0代表触发抵御效果
    isZhuxianHit, aZhuxianHurtPer, dZhuxianReducePer = hurtTypeResultDict[ChConfig.Def_HurtType_Zhuxian] # 诛仙一击
    isDeadlyHit = hurtTypeResultDict[ChConfig.Def_HurtType_DeadlyHit][0] # 致命一击
@@ -2424,7 +2484,7 @@
        #PVP 攻击回血
        atkBackHP += PlayerControl.GetPVPAtkBackHP(atkObj)
        # 百分比吸血
        atkBackHPPer = PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(atkObj, defObj, None, ChConfig.TriggerType_Buff_SuckBloodPer)
        atkBackHPPer = PassiveBuffEffMng.GetValueByPassiveBuffTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_Buff_SuckBloodPer)
        atkBackHPPer += PassiveBuffEffMng.GetPassiveSkillValueByTriggerType(atkObj, defObj, curSkill, ChConfig.TriggerType_Buff_SuckBloodPer)
        
        atkBackHP += int(hurtValue * atkBackHPPer*1.0 / ChConfig.Def_MaxRateValue)