hch
2019-03-07 fe674f04c89b254f798282792be11e140d33489d
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/AttackLogic/AttackCommon.py
@@ -1604,6 +1604,7 @@
    atkObj = ElfChangeAttacker(attacker)  # Elf灵为替身攻击,要取玩家的属性
    
    resultHurtType = HurtType()
    atkObjType = attacker.GetGameObjType()
    defObjType = defObj.GetGameObjType()
    dHP = GameObj.GetHP(defObj)                # 防守方当前血量
    dMaxHP = GameObj.GetMaxHP(defObj)          # 防守方最大血量
@@ -1628,12 +1629,14 @@
            hurtValue = clientValue
        else:
            # 外挂最高伤害基本防范
            GameWorld.DebugAnswer(atkObj, "%s----客户端伤害 %s 服务端最高伤害 %s"%(atkObj.GetID(), [clientValue, hurtType], hurtValue))
            GameWorld.DebugLog(atkObj, "%s----客户端伤害 %s 服务端最高伤害 %s"%(atkObj.GetID(), [clientValue, hurtType], hurtValue))
            hurtValue = int(hurtValue*0.8)
        #GameWorld.DebugAnswer(atkObj, "客户端伤害 %s 服务端伤害 %s"%([defObj.GetID(), clientValue, hurtType], hurtValue))
    else:
        hurtValue, hurtType = CalcHurtHP(atkObj, defObj, curSkill, atkSkillValue, atkSkillPer, tick, orgAtkObj=attacker)
    WriteHurtLog(attacker, defObj, curSkill, hurtValue, hurtType, "公式层")
    
    # 优先处理神兵护盾
    hurtValue = CalcAtkProDef(atkObj, defObj, hurtValue, curSkill, tick)
@@ -1751,7 +1754,9 @@
    resultHurtType.LostHP = lostValue
    if defObjType == IPY_GameWorld.gotPlayer:
        FBLogic.OnFBLostHP(defObj, lostValue)
    WriteHurtLog(attacker, defObj, curSkill, resultHurtType.LostHP, resultHurtType.HurtType, "最终扣血")
    #攻击触发事件, 该代码应该放在DoAttack函数中处理逻辑比较清晰,也不会破坏GetHurtHP函数
    #因为DoAttack修改点比较多,暂不迁移,相关攻击事件逻辑,就往此函数中添加
    AttackEventTrigger(atkObj, defObj, curSkill, resultHurtType, tick)
@@ -1763,6 +1768,38 @@
    return resultHurtType
# GM 命令  HurtLog 查看战斗伤害日志
def WriteHurtLog(attacker, defObj, curSkill, hurtValue, hurtType, msg):
    logLevel = GameWorld.GetGameWorld().GetGameWorldDictByKey(ShareDefine.Def_Notify_WorldKey_HurtLog)
    if not logLevel:
        return
    if logLevel == 1:
        # 只看玩家伤害
        if not attacker:
            return
        if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
            return
        msg = "玩家" + msg
    attackerID = attacker.GetID() if attacker else 0
    defenderID = defObj.GetID() if defObj else 0
    skillID = curSkill.GetSkillID() if curSkill else 0
    skillName = curSkill.GetSkillName()  if curSkill else ""
    attackerName = attacker.GetName() if attacker else ""
    defenderName = defObj.GetName() if defObj else ""
    if attacker and attacker.GetGameObjType() == IPY_GameWorld.gotPlayer:
        attackerName = attackerName.decode("utf8").encode('gbk')
    if defObj and defObj.GetGameObjType() == IPY_GameWorld.gotPlayer:
        defenderName = defenderName.decode("utf8").encode('gbk')
    GameWorld.DebugLog("攻击伤害-%s:(%s %s)攻击(%s %s), 技能ID:(%s %s), 伤害值:%s, 伤害类型:%s "%(
                        msg, attackerID, attackerName, defenderID, defenderName,
                        skillID, skillName, hurtValue, hurtType))
# 血盾支持多个同时存在
def CalcBloodShield(atkObj, defObj, hurtValue):
    # 伤害值用于血盾抵消