From 070a0dfddf2d5f85ac348a8d37a606bdbcd0ea0a Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期三, 05 十一月 2025 16:45:46 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(完善技能目标选择逻辑;支持软控魅惑、混乱、嘲讽,及反击复仇目标,buff状态细分目标,属性细分目标等优先级处理;修复反击逻辑bug;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py | 271 +++++++++++++++++++++++++++++++++++++----------------
1 files changed, 188 insertions(+), 83 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
index 775dd50..bdb1453 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/TurnSkill.py
@@ -45,11 +45,12 @@
## 是否无视防御
return useSkill.GetHurtType() / 10 == 1 # 2为真伤,待扩展
-def OnUseSkill(turnFight, curBatObj, useSkill, tagObjList=None, batType=ChConfig.TurnBattleType_Normal, bySkill=None, byBuff=None, comboLimit=False):
+def OnUseSkill(turnFight, curBatObj, useSkill, tagObjList=None, batType=ChConfig.TurnBattleType_Normal, bySkill=None, byBuff=None, comboLimit=False, atkBackTag=None):
'''使用技能通用入口
@param useSkill: 使用的技能,注意并不一定是身上的技能,可能只是 SkillData 表数据
@param bySkill: 由哪个技能额外触发的,比如附加触发的技能或被动技能均可能由某个技能触发
@param comboLimit: 是否强制限制连击
+ @param atkBackTag: 反击目标
@return: 是否成功
'''
if not useSkill:
@@ -60,6 +61,10 @@
return
objID = curBatObj.GetID()
+
+ if hasattr(useSkill, "GetRemainTime") and useSkill.GetRemainTime() > 0:
+ GameWorld.DebugLog("技能CD中! skillID=%s,RemainTime=%s" % (skillID, useSkill.GetRemainTime()))
+ return
buffStateGroups = useSkill.GetBuffStateLimit()
if buffStateGroups:
@@ -73,7 +78,7 @@
#没有指定目标,则按技能自身的目标逻辑
if not tagObjList:
- tagObjList = GetSkillTags(turnFight, curBatObj, useSkill)
+ tagObjList = GetSkillTags(turnFight, curBatObj, useSkill, atkBackTag)
rate = useSkill.GetHappenRate()
if rate:
rate += TurnPassive.GetTriggerEffectValue(turnFight, curBatObj, None, ChConfig.PassiveEff_AddSkillRate, useSkill)
@@ -83,7 +88,7 @@
if not tagObjList:
# 可扩展其他目标选择,如复活技能没有死亡单位时则使用另外的效果
- GameWorld.ErrLog("找不到技能目标! skillID=%s,mapID=%s,funcLineID=%s" % (skillID, turnFight.mapID, turnFight.funcLineID), turnFight.playerID)
+ GameWorld.DebugLog("找不到技能目标! skillID=%s,mapID=%s,funcLineID=%s" % (skillID, turnFight.mapID, turnFight.funcLineID), turnFight.playerID)
return
oneActionUseCnt = turnFight.GetOneActionUseSkillCnt(objID)
@@ -189,9 +194,13 @@
def IsNeedSyncSkill(useSkill):
## 使用需要同步B427使用技能
- return useSkill.GetSkillType() in [ChConfig.Def_SkillType_Atk, ChConfig.Def_SkillType_Cure, ChConfig.Def_SkillType_CleanBuff]
+ if useSkill.GetSkillType() in [ChConfig.Def_SkillType_Atk, ChConfig.Def_SkillType_Cure, ChConfig.Def_SkillType_CleanBuff]:
+ return True
+ if useSkill.GetFuncType() in [ChConfig.Def_SkillFuncType_TurnNormaSkill, ChConfig.Def_SkillFuncType_AngerSkill]:
+ return True
+ return False
-def GetSkillTags(turnFight, curBatObj, useSkill):
+def GetSkillTags(turnFight, curBatObj, useSkill, atkBackTag=None):
## 获取技能目标
# @return: [主目标, 目标2, ...]
@@ -212,38 +221,74 @@
return [curBatObj]
tagCount += TurnPassive.GetTriggerEffectValue(turnFight, curBatObj, None, ChConfig.PassiveEff_AddSkillTagCnt, useSkill)
+ #GameWorld.DebugLog("搜索技能目标: skillID=%s,tagAim=%s,tagFriendly=%s,tagAffect=%s,tagCount=%s" % (useSkill.GetSkillID(), tagAim, tagFriendly, tagAffect, tagCount))
- # 目标选择优先级,集火 > 魅惑 > 混乱 > 嘲讽 > 常规
- # 集火:直接通过效果5015指定了目标,所以这里可不处理
- # 魅惑: 敌友互换; 不打自己,只剩自己互换后是己方时不释放技能
- # 混乱: 随机敌友; 不打自己,只剩自己随机后是己方时不释放技能
+ # 目标选择优先级,集火 > changeRet > 魅惑 > 混乱 > 嘲讽 > 反击 > 常规
+ # 集火:直接通过效果5015指定了目标,不会走到这里,所以这里可不处理
+ # 魅惑: 敌友互换; 直接攻击技能不包含自己,只剩自己互换后是己方时不释放技能
+ # 混乱: 随机敌友; 直接攻击技能不包含自己,只剩自己互换后是己方时不释放技能
# 嘲讽: 目标是敌方时强制目标一定包含施法者
+ # 反击: 修改技能纵横为反击目标所在纵横且为主目标(优先级低于软控、指定buff状态目标,高于属性条件目标)
+ # 确认敌友
+ inCharm, inChaos = False, False # 是否魅惑中, 是否混乱中
+ if changeRet:
+ pass
+ elif curBatObj.CheckInState(ChConfig.BatObjState_Charm):
+ inCharm = True
+ tagFriendly = 0 if tagFriendly else 1 # 魅惑: 敌友互换
+ elif curBatObj.CheckInState(ChConfig.BatObjState_Chaos):
+ inChaos = True
+ tagFriendly = random.randint(0, 1) # 混乱: 随机敌友
+ #GameWorld.DebugLog("inCharm=%s,inChaos=%s,tagFriendly=%s" % (inCharm, inChaos, tagFriendly))
+ isNoSelf = False # 是否不包含自己
+ if inCharm or inChaos:
+ if SkillCommon.isAttackDirectSkill(useSkill):
+ isNoSelf = True
+ #GameWorld.DebugLog("特殊不包含自己")
+
+ # 根据敌友关系确定阵营及一些敌友关系的特殊逻辑
+ sneerObjFirst = True # 嘲讽目标是否优先
+ sneerTagObj = None # 嘲讽目标
+ atkBackTagFrist = True # 反击目标是否优先
+ specMainObj = None # 特殊主目标,目前仅敌对关系有效,如嘲讽、反击等优先设定为主目标,可兼容魅惑、混乱
+ specObjID, specObjPosNum, sepcObjLineupNum = 0, 0, 0
curFaction = curBatObj.GetFaction()
- sneerObj = None # 嘲讽目标
- sneerObjID, sneerObjPosNum = 0, 0
if tagFriendly:
tagFaction = curFaction
+ sneerTagObj = None
+ atkBackTag = None
else:
tagFaction = ChConfig.Def_FactionB if curFaction == ChConfig.Def_FactionA else ChConfig.Def_FactionA
- sneerObj = curBatObj.GetSneerTagObj() # 被嘲讽的目标,对敌的强制锁定被嘲讽目标
-
- sneerObjFirst = True # 嘲讽目标优先
- if sneerObj:
- sneerObjID = sneerObj.GetID()
- sneerObjPosNum = sneerObj.GetPosNum()
-
+ sneerTagObj = curBatObj.GetSneerTagObj() # 被嘲讽的目标,对敌的强制锁定被嘲讽目标
+ if sneerTagObj:
+ specMainObj = sneerTagObj
+ #GameWorld.DebugLog("嘲讽特殊主目标")
+ elif atkBackTag:
+ specMainObj = atkBackTag
+ #GameWorld.DebugLog("反击特殊主目标")
+
+ if specMainObj:
+ specObjID = specMainObj.GetID()
+ specObjPosNum = specMainObj.GetPosNum()
+ sepcObjLineupNum = specMainObj.GetLineupNum()
+
batObjMgr = BattleObj.GetBatObjMgr()
lineupNum = curBatObj.GetLineupNum()
posNum = curBatObj.GetPosNum()
+ # 确认阵容编号顺序,多V多时有用
batFaction = turnFight.getBatFaction(tagFaction)
if lineupNumSet != None and not tagFriendly:
lineupNumList = [lineupNumSet] # 已经有指定敌方的某一阵容
elif tagFaction == curFaction:
lineupNumList = [lineupNum] # 友方暂时仅限制自己阵容
else:
- lineupNumList = [lineupNum] # 敌方优先对位阵容,再其他阵容
+ # 敌方优先: 特殊目标阵容 > 对位阵容 > 其他阵容
+ if specMainObj:
+ lineupNumList = [sepcObjLineupNum]
+ else:
+ lineupNumList = [lineupNum]
for tagNum in batFaction.lineupDict.keys():
if tagNum not in lineupNumList:
lineupNumList.append(tagNum)
@@ -255,8 +300,8 @@
# 对位
if tagAim == ChConfig.SkillTagAim_Relative:
- if sneerObj:
- aimObjList.append(sneerObj)
+ if specMainObj:
+ aimObjList.append(specMainObj)
else:
relativeObj = __GetRelativeObjDefault(batObjMgr, curBatObj, posNum, batLineup)
if relativeObj:
@@ -264,11 +309,11 @@
# 前排
elif tagAim == ChConfig.SkillTagAim_FrontRow:
- aimObjList = __getRowAimObjList(batObjMgr, posNum, sneerObj, batLineup, tagAffect, False)
+ aimObjList = __getRowAimObjList(batObjMgr, curBatObj, specMainObj, batLineup, tagAffect, False, isNoSelf)
# 后排
elif tagAim == ChConfig.SkillTagAim_BackRow:
- aimObjList = __getRowAimObjList(batObjMgr, posNum, sneerObj, batLineup, tagAffect, True)
+ aimObjList = __getRowAimObjList(batObjMgr, curBatObj, specMainObj, batLineup, tagAffect, True, isNoSelf)
# 竖排/纵排
elif tagAim == ChConfig.SkillTagAim_Vertical:
@@ -279,14 +324,14 @@
colNumList.remove(inColNum)
colNumList.insert(0, inColNum)
- # 优先嘲讽所在纵
- if sneerObj:
- sneerInColNum = ChConfig.GetInColNum(sneerObjPosNum)
- if sneerInColNum in colNumList:
- colNumList.remove(sneerInColNum)
- colNumList.insert(0, sneerInColNum)
+ # 优先特殊目标所在纵
+ if specMainObj:
+ specInColNum = ChConfig.GetInColNum(specObjPosNum)
+ if specInColNum in colNumList:
+ colNumList.remove(specInColNum)
+ colNumList.insert(0, specInColNum)
- GameWorld.DebugLog("纵排: colNumList=%s,sneerObjID-PosNum=%s-%s" % (colNumList, sneerObjID, sneerObjPosNum))
+ GameWorld.DebugLog("纵排: colNumList=%s,specObjID-PosNum=%s-%s" % (colNumList, specObjID, specObjPosNum))
for col in colNumList:
for row in range(1, 1 + ChConfig.TurnFightRows):
pNum = (row - 1) * ChConfig.TurnFightCols + col
@@ -295,7 +340,7 @@
continue
tagObjID = batLineup.posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
- if not __skillTagFilter(tagBatObj, tagAffect):
+ if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
continue
aimObjList.append(tagBatObj)
if aimObjList:
@@ -310,7 +355,7 @@
colNumList.remove(inColNum)
colNumList.insert(0, inColNum)
- GameWorld.DebugLog("全部: colNumList=%s,sneerObjID-PosNum=%s-%s" % (colNumList, sneerObjID, sneerObjPosNum))
+ GameWorld.DebugLog("全部: colNumList=%s,specObjID-PosNum=%s-%s" % (colNumList, specObjID, specObjPosNum))
# 按前排优先原则
for row in range(1, 1 + ChConfig.TurnFightRows):
for col in colNumList:
@@ -320,7 +365,7 @@
continue
tagObjID = batLineup.posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
- if not __skillTagFilter(tagBatObj, tagAffect):
+ if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
continue
aimObjList.append(tagBatObj)
@@ -348,6 +393,7 @@
# 灼烧/玄火目标优先
elif tagAffect == ChConfig.SkillTagAffect_Burn:
+ atkBackTagFrist = False
relativeObj = __GetRelativeObjDefault(batObjMgr, curBatObj, posNum, batLineup)
sortObjList = [] # 优先灼烧目标,再对位
for aimObj in aimObjList:
@@ -363,6 +409,7 @@
# 仅焚血(毒奶)目标
elif tagAffect == ChConfig.SkillTagAffect_PoisonCure:
+ atkBackTagFrist = False
for aimObj in aimObjList[::-1]:
if not aimObj.CheckInState(ChConfig.BatObjState_PoisonCure):
aimObjList.remove(aimObj)
@@ -371,17 +418,24 @@
if tagCount and len(aimObjList) > tagCount:
random.shuffle(aimObjList)
+ # 以下优先级先处理的优先级视为较低
+ if atkBackTagFrist and atkBackTag:
+ if atkBackTag in aimObjList and aimObjList.index(atkBackTag) != 0:
+ aimObjList.remove(atkBackTag)
+ aimObjList.insert(0, atkBackTag)
+
# 嘲讽优先
- if sneerObjFirst and sneerObj:
- if sneerObj in aimObjList and aimObjList.index(sneerObj) != 0:
- aimObjList.remove(sneerObj)
- aimObjList.insert(0, sneerObj)
+ if sneerObjFirst and sneerTagObj:
+ if sneerTagObj in aimObjList and aimObjList.index(sneerTagObj) != 0:
+ aimObjList.remove(sneerTagObj)
+ aimObjList.insert(0, sneerTagObj)
# 一定包含自己
- if tagFriendly == 2:
+ if tagFriendly == 2 and not isNoSelf:
if curBatObj not in aimObjList:
aimObjList.append(curBatObj)
+ # 最后去除多余的目标
if tagCount and len(aimObjList) > tagCount:
aimObjList = aimObjList[:tagCount]
@@ -419,9 +473,10 @@
return lineupNum, changeTagSet
return
-def __getRowAimObjList(batObjMgr, posNum, sneerObj, batLineup, tagAffect, rowReverse):
- ## 获取行排目标对象列表
+def __getRowAimObjList(batObjMgr, curBatObj, specMainObj, batLineup, tagAffect, rowReverse, isNoSelf=False):
+ ## 获取横排目标对象列表
# @param rowReverse: 是否后排优先原则
+ # @param noSelf: 是否限制包含自己
# 前后排顺序
if rowReverse:
@@ -429,24 +484,24 @@
else:
rowNumList = range(1, 1 + ChConfig.TurnFightRows)
- # 优先嘲讽对象所在行
- sneerObjID, sneerObjPosNum = 0, 0
- if sneerObj:
- sneerObjID = sneerObj.GetID()
- sneerObjPosNum = sneerObj.GetPosNum()
- sneerInRowNum = ChConfig.GetInRowNum(sneerObjPosNum) # 所在行排
+ # 优先特殊对象所在行
+ specObjID, specObjPosNum = 0, 0
+ if specMainObj:
+ specObjID = specMainObj.GetID()
+ specObjPosNum = specMainObj.GetPosNum()
+ sneerInRowNum = ChConfig.GetInRowNum(specObjPosNum) # 所在行排
if sneerInRowNum in rowNumList:
rowNumList.remove(sneerInRowNum)
rowNumList.insert(0, sneerInRowNum)
- inColNum = ChConfig.GetInColNum(posNum) # 玩家所在纵列
+ inColNum = ChConfig.GetInColNum(curBatObj.GetPosNum()) # 玩家所在纵列
# 优先自己所在纵,为主目标
colNumList = range(1, 1 + ChConfig.TurnFightCols)
if inColNum in colNumList:
colNumList.remove(inColNum)
colNumList.insert(0, inColNum)
- GameWorld.DebugLog("前后排: rowNumList=%s,colNumList=%s,sneerObjID-PosNum=%s-%s" % (rowNumList, colNumList, sneerObjID, sneerObjPosNum))
+ GameWorld.DebugLog("前后排: rowNumList=%s,colNumList=%s,specObjID-PosNum=%s-%s" % (rowNumList, colNumList, specObjID, specObjPosNum))
aimObjList = []
for row in rowNumList:
for col in colNumList:
@@ -456,7 +511,7 @@
continue
tagObjID = batLineup.posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
- if not __skillTagFilter(tagBatObj, tagAffect):
+ if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf):
continue
aimObjList.append(tagBatObj)
if aimObjList:
@@ -465,11 +520,7 @@
return aimObjList
def GetRelativeObj(turnFight, curBatObj):
- '''获取对位目标,嘲讽时优先对位嘲讽目标
- 对位目标用途:
- 1. 对位目标并不代表仅攻击该目标
- 2. 攻击时根据技能攻击目标范围优先攻击对位目标所在的横排或纵排
- 3. 对位目标可用于判断连击、弱疗
+ '''获取对位目标,仅用于非技能目标的对位逻辑,如连击、弱疗等相对属性的判断,技能目标统一使用 GetSkillTags
'''
sneerObj = curBatObj.GetSneerTagObj()
if sneerObj:
@@ -496,11 +547,11 @@
if relativeObj:
return relativeObj
- # 理论上只要战斗没有结束,一定会有对位目标,这里默认返回自己,外层可不需要判断是否存在对位目标
+ # 理论上只要战斗没有结束,一定会有对位目标,这里默认返回自己,方便外层逻辑处理,外层可不需要判断是否存在对位目标
return curBatObj
def __GetRelativeObjDefault(batObjMgr, curBatObj, posNum, batLineup):
- ## 获取在某一阵营中的默认对位目标
+ ## 获取在某一阵容中的默认对位目标,不包括自己
if not batLineup:
return
tagAffect = ChConfig.SkillTagAffect_None # 默认对位目标不需要细分目标,默认规则即可
@@ -519,13 +570,13 @@
continue
tagObjID = batLineup.posObjIDDict[pNum]
tagBatObj = batObjMgr.getBatObj(tagObjID)
- if not __skillTagFilter(tagBatObj, tagAffect):
+ if not __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf=True):
continue
return tagBatObj
return
-def __skillTagFilter(tagBatObj, tagAffect):
+def __skillTagFilter(curBatObj, tagBatObj, tagAffect, isNoSelf=False):
## 技能目标过滤器
# @return: 是否允许添加该单位
if not tagBatObj:
@@ -534,6 +585,10 @@
return False
if tagAffect == ChConfig.SkillTagAffect_Death and tagBatObj.IsAlive():
return False
+ if isNoSelf:
+ if tagBatObj.GetID() == curBatObj.GetID():
+ #GameWorld.DebugLog("不包含自己")
+ return False
#if not tagBatObj.GetCanAttack(): 策划要求不可攻击的对象也要可选中
# return False
return True
@@ -655,22 +710,24 @@
def SkillModule_2(turnFight, curBatObj, useSkill):
## 治疗
+ relativeObj = GetRelativeObj(turnFight, curBatObj)
for tagBatObj in useSkill.GetTagObjList():
- __doCureObj(turnFight, curBatObj, tagBatObj, useSkill)
+ __doCureObj(turnFight, curBatObj, tagBatObj, useSkill, relativeObj)
return
def SkillModule_9(turnFight, curBatObj, useSkill):
## 弹射治疗(多次治疗,切换目标,单目标可多次)
+ relativeObj = GetRelativeObj(turnFight, curBatObj)
ricochetObjList = GetRicochetObjList(turnFight, curBatObj, useSkill)
for tagBatObj in ricochetObjList:
- __doCureObj(turnFight, curBatObj, tagBatObj, useSkill)
+ __doCureObj(turnFight, curBatObj, tagBatObj, useSkill, relativeObj)
return
-def __doCureObj(turnFight, curBatObj, tagBatObj, useSkill):
- cureHP = CalcCureHP(turnFight, curBatObj, tagBatObj, useSkill, largeNum=True)
+def __doCureObj(turnFight, curBatObj, tagBatObj, useSkill, relativeObj=None):
+ cureHP = CalcCureHP(turnFight, curBatObj, tagBatObj, useSkill, largeNum=True, relativeObj=relativeObj)
if cureHP <= 0:
return
@@ -888,11 +945,11 @@
if not tagObjList:
return
tagObj = tagObjList[0] # 第一个默认为主目标,技能对象选择逻辑时决定主目标
- atkBackSkill = __getCanAtkBackSkill(useSkill, tagObj)
+ atkBackSkill = __getCanAtkBackSkill(atkObj, tagObj, useSkill)
if atkBackSkill:
# 可以反击,打断连击
GameWorld.DebugLog("● %s 【反击】" % TurnAttack.GetObjName(tagObj))
- OnUseSkill(turnFight, tagObj, atkBackSkill, [atkObj], ChConfig.TurnBattleType_AtkBack)
+ OnUseSkill(turnFight, tagObj, atkBackSkill, batType=ChConfig.TurnBattleType_AtkBack, atkBackTag=atkObj)
return
if not tagObj:
@@ -919,19 +976,30 @@
OnUseSkill(turnFight, atkObj, useSkill, batType=ChConfig.TurnBattleType_Combo)
return True
-def __getCanAtkBackSkill(useSkill, tagObj):
- ## 获取是否可反击及反击技能
+def __getCanAtkBackSkill(atkObj, tagObj, useSkill):
+ '''获取是否可反击及反击技能
+ B进攻A1 A2 A3,主目标(从A1 A2 A3选)
+ 主目标触发格挡时,若B为近战,发动反击,非近战,不发动反击,反击以普攻进行反击
+ 若为非攻击类,则按技能原来的目标
+ 若普攻是攻击类技能则修改技能纵横为B所在纵横且B为主目标(优先级低于软控、指定buff状态目标,高于属性条件目标)
+ '''
if not tagObj:
return
+ atkID = atkObj.GetID()
tagID = tagObj.GetID()
if not tagObj.CanAction():
GameWorld.DebugLog("当前状态无法反击! tagID=%s" % (tagID))
return
+ if atkObj.GetFaction() == tagObj.GetFaction():
+ #GameWorld.DebugLog("同阵营不触发反击!") # 魅惑可能导致打自己人
+ return
+
canAtkbackDictTypeList = IpyGameDataPY.GetFuncEvalCfg("ParryCfg", 2)
- if tagObj.GetAtkDistType() not in canAtkbackDictTypeList:
- GameWorld.DebugLog("该远近类型武将不可反击! tagID=%s,AtkDistType=%s not in %s" % (tagID, tagObj.GetAtkDistType(), canAtkbackDictTypeList))
+ if atkObj.GetAtkDistType() not in canAtkbackDictTypeList:
+ heroID = atkObj.GetHeroID()
+ GameWorld.DebugLog("攻击方远近类型武将不可反击! atkID=%s,heroID=%s,AtkDistType=%s not in %s" % (atkID, heroID, atkObj.GetAtkDistType(), canAtkbackDictTypeList))
return
canAtkBack = False
@@ -993,13 +1061,17 @@
# 统计击杀
killObjList = [] # 击杀其他阵营目标列表
+ dieObjList = [] # 死亡的单位列表
for tagObj in useSkill.GetTagObjList():
tagID = tagObj.GetID()
- if tagObj.IsAlive() and tagObj.GetHP() <= 0 and tagObj.GetFaction() != curObj.GetFaction():
- killObjList.append(tagObj)
- TurnAttack.SetObjKilled(turnFight, tagObj, curObj, useSkill)
+ if tagObj.IsAlive() and tagObj.GetHP() <= 0:
+ dieObjList.append(tagObj)
+ if tagObj.GetFaction() != curObj.GetFaction():
+ killObjList.append(tagObj)
+ TurnAttack.SetObjKilled(turnFight, tagObj, curObj, useSkill)
useSkill.SetKillObjList(killObjList)
if curObj.IsAlive() and curObj.GetHP() <= 0:
+ dieObjList.append(curObj)
TurnAttack.SetObjKilled(turnFight, curObj)
# 统计伤血,可能单个技能对同一目标造成多次伤害
@@ -1079,9 +1151,26 @@
TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_KillOneObj, tagObj, connSkill=useSkill)
TurnPassive.OnTriggerPassiveEffect(turnFight, curObj, ChConfig.TriggerWay_KillTagObj, tagObj, connSkill=useSkill)
+ if dieObjList:
+ for faction in [ChConfig.Def_FactionA, ChConfig.Def_FactionB]:
+ batFaction = turnFight.getBatFaction(faction)
+ for lineupNum in batFaction.lineupDict.keys():
+ batLineup = batFaction.getBatlineup(lineupNum)
+ for lineupObjID in batLineup.posObjIDDict.values():
+ lineupObj = batObjMgr.getBatObj(lineupObjID)
+ if not lineupObj.IsAlive():
+ continue
+ for dieObj in dieObjList:
+ # 敌方单位死亡时
+ if lineupObj.GetFaction() != dieObj.GetFaction():
+ TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_EnemyDie, dieObj, connSkill=useSkill)
+ # 己方单位死亡时
+ else:
+ TurnPassive.OnTriggerPassiveEffect(turnFight, lineupObj, ChConfig.TriggerWay_FriendDie, dieObj, connSkill=useSkill)
+
triggerOne = False
batType = useSkill.GetBatType()
- isAttackDirect = (isUseSkill and not SkillCommon.IsBuff(useSkill) and useSkill.GetSkillType() in [ChConfig.Def_SkillType_Atk])
+ isAttackDirect = (isUseSkill and SkillCommon.isAttackDirectSkill(useSkill)) # 是否直接攻击
for tagObj in useSkill.GetTagObjList():
tagID = tagObj.GetID()
if tagID in effIgnoreObjIDList:
@@ -1099,7 +1188,10 @@
TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeAttackedDirect, curObj, connSkill=useSkill)
else:
TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeAnyEffect, curObj, connSkill=useSkill)
-
+ # 受到持续伤害
+ if tagID in beHurtObjIDList:
+ TurnPassive.OnTriggerPassiveEffect(turnFight, tagObj, ChConfig.TriggerWay_BeDOTHurt, curObj, connSkill=useSkill)
+
# 使用技能后
if isUseSkill:
if not triggerOne:
@@ -1346,6 +1438,10 @@
#GameWorld.DebugLog("###被动触发技能不触发自身,防止死循环! effSkillID=%s,effectID=%s,passiveSkillID=%s" % (effSkillID, effectID, passiveSkillID))
return
+ if hasattr(passiveSkill, "GetRemainTime") and passiveSkill.GetRemainTime() > 0:
+ #GameWorld.DebugLog("被动触发技能CD中! skillID=%s,RemainTime=%s" % (passiveSkillID, passiveSkill.GetRemainTime()))
+ return
+
isOK = False
# 继承主技能目标
if passiveSkill.GetTagAim() == ChConfig.SkillTagAim_MainSkill:
@@ -1420,6 +1516,7 @@
'''计算伤害,默认按攻击计算
'''
+ mapID = turnFight.mapID
skillID = curSkill.GetSkillID()
pmType = GetPMType(atkObj, curSkill)
ignoreDef = IsIgnoreDef(curSkill)
@@ -1535,6 +1632,11 @@
if batType == ChConfig.TurnBattleType_Pursue:
aPursueDamPer = atkObj.GetBatAttrValue(ChConfig.AttrID_PursueDamPer)
+ aArenaDamPer, dArenaDamPerDef = 0, 0 # 竞技增伤、竞技减伤
+ if mapID == ChConfig.Def_FBMapID_ArenaBattle:
+ aArenaDamPer = atkObj.GetBatAttrValue(ChConfig.AttrID_ArenaDamPer)
+ dArenaDamPerDef = atkObj.GetBatAttrValue(ChConfig.AttrID_ArenaDamPerDef)
+
# 所有万分率参数统一除10000.0
atkSkillPer /= 10000.0
aNormalSkillPer /= 10000.0
@@ -1550,6 +1652,8 @@
dFinalDamPerDef /= 10000.0
aComboDamPer /= 10000.0
aPursueDamPer /= 10000.0
+ aArenaDamPer /= 10000.0
+ dArenaDamPerDef /= 10000.0
if calcType != ChConfig.Def_Calc_Attack:
aAtk = GetCalcBaseValue(calcType, atkObj, defObj, curSkill)
@@ -1831,23 +1935,28 @@
TurnAttack.AddTurnObjHurtValue(atkObj, defObj, hurtValue, lostHP, curSkill.GetSkillID())
return True
-def CalcCureHP(turnFight, userObj, tagObj, curSkill, largeNum=False):
+def CalcCureHP(turnFight, userObj, tagObj, curSkill, largeNum=False, relativeObj=None):
''' 计算治疗值
'''
+
+ # 对位目标
+ if not relativeObj:
+ relativeObj = GetRelativeObj(turnFight, userObj)
+
cureType = curSkill.GetCalcType()
skillPer = curSkill.GetSkillPer()
#skillValue = curSkill.GetSkillValue()
skillPer += GetAddSkillPer(turnFight, userObj, tagObj, curSkill)
- cureHP = __calcCureHP(turnFight, userObj, tagObj, curSkill, cureType, skillPer, largeNum)
+ cureHP = __calcCureHP(turnFight, userObj, tagObj, relativeObj, curSkill, cureType, skillPer, largeNum)
cureWayExEff = curSkill.GetEffectByID(ChConfig.SkillEff_CureWayEx)
if cureWayExEff:
cureType = cureWayExEff.GetEffectValue(0)
skillPer = cureWayExEff.GetEffectValue(1)
GameWorld.DebugLog("额外计算治疗方式: cureType=%s,skillPer=%s" % (cureType, skillPer))
- cureHPEx = __calcCureHP(turnFight, userObj, tagObj, curSkill, cureType, skillPer, largeNum)
+ cureHPEx = __calcCureHP(turnFight, userObj, tagObj, relativeObj, curSkill, cureType, skillPer, largeNum)
cureHP += cureHPEx
hurtShareEff = curSkill.GetEffectByID(ChConfig.SkillEff_HurtShare)
@@ -1858,19 +1967,15 @@
return max(1, int(cureHP)) # 保底1点
-def __calcCureHP(turnFight, userObj, tagObj, curSkill, cureType, skillPer, largeNum=False):
+def __calcCureHP(turnFight, userObj, tagObj, relativeObj, curSkill, cureType, skillPer, largeNum=False):
cureBaseValue = GetCalcBaseValue(cureType, userObj, tagObj, curSkill)
# 回合制
- curePer = 0 # 治疗加成
- cureDefPer = 0 # 敌方的弱化治疗
+ curePer = userObj.GetBatAttrValue(ChConfig.AttrID_CurePer) # 治疗加成
+ cureDefPer = relativeObj.GetBatAttrValue(ChConfig.AttrID_CurePerDef) # 对位的弱化治疗
angerOverflow = 0 # 怒气溢出值
if SkillCommon.isAngerSkill(curSkill):
angerOverflow = max(userObj.GetXP() - IpyGameDataPY.GetFuncCfg("AngerXP", 2), 0)
- #enemyObj = TurnAttack.GetEnemyObj(userObj)
- #curePer += GameObj.GetCurePer(userObj)
- #if enemyObj:
- # cureDefPer += GameObj.GetCureDefPer(enemyObj)
skillPer /= float(ChConfig.Def_MaxRateValue)
curePer /= float(ChConfig.Def_MaxRateValue)
--
Gitblit v1.8.0