From 7b2117bcfbab798b979155957567b07d6f40296c Mon Sep 17 00:00:00 2001
From: hch <305670599@qq.com>
Date: 星期二, 28 八月 2018 19:23:43 +0800
Subject: [PATCH] fix: 2996 子 【设计】新增一个可均摊的技能 / 【后端】新增一个伤害均摊的技能

---
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py               |   53 ++++++++++++++++++++++++--
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py                        |    3 +
 ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillModule_42.py |   38 +++++++++++++++++++
 3 files changed, 89 insertions(+), 5 deletions(-)

diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
index aa5586e..8f294e4 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BaseAttack.py
@@ -714,6 +714,51 @@
     return True
 
 
+# 按仙盟成员均摊伤害
+def AttackerSkillAttackAreaByFamily(attacker, defender, srcPosX, srcPosY, curSkill,
+                            skillPercent, skillEnhance, tick, isExSkill = False):
+    #清空伤血列表
+    global g_skillHurtList
+    g_skillHurtList.Clear()
+    
+    #攻击方原有血量,用来通知反弹
+    attackerHP = GameObj.GetHP(attacker)
+    resultList = __GetAreaAtackObj(attacker, curSkill, srcPosX, srcPosY, tick, __CheckCanAttack)
+            
+    #有目标类技能,查找指定的攻击目标是否在列表中,不在添加
+    resultList = __AddObj_In_resultList(resultList, attacker, defender, curSkill, tick)
+
+    # 计算仙盟成员数量, 按人头均摊伤害
+    resultDict = {}
+    for obj in resultList:
+        if obj.GetGameObjType() != IPY_GameWorld.gotPlayer:
+            continue
+        
+        familyID = obj.GetFamilyID()
+        if familyID not in resultDict:
+            resultDict[familyID] = []
+
+        resultDict[familyID].append(obj)
+        
+    skillEffect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_AvgHurtFMCnt)
+    minSkillPer = 100   # 如果未配置默认最低值
+    if skillEffect:
+        minSkillPer = skillEffect.GetEffectValue(0)
+        
+    attackList = []
+    for familyID in resultDict:
+        cnt = len(resultDict[familyID]) if familyID != 0 else 1 # 无仙盟承受100%伤害
+        skillPercent = max(skillPercent/cnt, minSkillPer)
+        attackList.extend(__DoAreaAttack(attacker, curSkill, skillEnhance/cnt, skillPercent, resultDict[familyID],
+                                     [], g_skillHurtList, tick))
+
+    
+    __DoAreaAttackResult(attacker, defender, curSkill, attackList, attackerHP, tick, isExSkill)
+    
+    return True
+
+
+
 # 触发技能的类型为 单体攻击,或者单体buff并且非对自己释放的技能,可以对伤害目标一一执行触发技能逻辑
 # 否则只触发一次技能 # 群体BUFF的请参考IsPlayerUseSkill 客户端决定对象,一样可以实现同样效果
 # 返回真表示可以对每个伤害目标触发,返回假则为单体
@@ -789,7 +834,7 @@
                    powerList, g_skillHurtList, tick):
     attackList = []   #被攻击对象列表
 
-    checkComboOK = False
+    #checkComboOK = False
 
     #执行攻击结果
     for obj in resultList:
@@ -805,10 +850,10 @@
         if powerList != []:
             skillPercent, skillEnhance = powerList.pop(0)
 
-        if not checkComboOK:
+        #if not checkComboOK:
             #攻击前连击检查
-            SkillCommon.UpdateSkillCombo(attacker, curSkill, tick)
-            checkComboOK = True
+        #    SkillCommon.UpdateSkillCombo(attacker, curSkill, tick)
+        #    checkComboOK = True
             
         callFunc(attacker, obj, curSkill, skillEnhance, skillPercent, g_skillHurtList, tick)
         
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
index 162fee6..42e6675 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/ChConfig.py
@@ -554,7 +554,8 @@
 Def_Skill_Effect_SummonAttr = 1013 # 召唤兽属性
 Def_Skill_Effect_BoomSeedID = 1014 # 引爆BUFF种子
 Def_Skill_Effect_RandWarn = 1061 # 随机预警
-Def_Skill_Effect_AttackReplaceByNPCSeries = 1062 # 对指定系的伤害 
+Def_Skill_Effect_AttackReplaceByNPCSeries = 1062 # 对指定系的伤害
+Def_Skill_Effect_AvgHurtFMCnt = 1064 # NPC技能按仙盟成员数均摊伤害  
 Def_Skill_Effect_AreaAttackkCount = 1200    #区域技能攻击数量
 Def_Skill_Effect_PowerPart = 1206  # 充能能量分段,触发即算一次充能,拉进度条蓄力
 Def_Skill_Effect_ProcessAttack = 1314  # 间隔性攻击,A值为攻击次数,B值为是否广播客户端
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillModule_42.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillModule_42.py
new file mode 100644
index 0000000..c70a65c
--- /dev/null
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillModule_42.py
@@ -0,0 +1,38 @@
+#!/usr/bin/python
+# -*- coding: GBK -*-
+#
+##@package
+#
+# @todo: NPC技能,同盟均摊伤害
+#
+# @author: Alee
+# @date 2018-8-28 下午04:24:14
+# @version 1.0
+#
+# @note: 
+#
+#---------------------------------------------------------------------
+
+import ChConfig
+import BaseAttack
+import SkillShell
+import IPY_GameWorld
+
+
+def UseSkill(attacker, defender, curSkill, tagRoundPosX, tagRoundPosY, isEnhanceSkill, tick):
+
+    skillEffect = curSkill.GetEffect(0)
+    skillPer = skillEffect.GetEffectValue(0) / float(ChConfig.Def_MaxRateValue)
+    skillEnhance = skillEffect.GetEffectValue(1)
+    
+    #---攻击遍历起点优先级 1.找指定点 2.防守者(包括自己)---
+    if tagRoundPosX == -1 or tagRoundPosY == -1:
+        #起点是攻击方,还是受害方,还是点地
+        tagRoundPosX = defender.GetPosX()
+        tagRoundPosY = defender.GetPosY()
+        
+        
+    #使用技能
+    return BaseAttack.AttackerSkillAttackAreaByFamily(attacker, defender, tagRoundPosX, tagRoundPosY, 
+                                              curSkill, skillPer, skillEnhance, tick, isEnhanceSkill)
+

--
Gitblit v1.8.0