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/GameSkills/SkillCommon.py | 337 ++++++++++---------------------------------------------
1 files changed, 65 insertions(+), 272 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
index ab93e74..8b990af 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Skill/GameSkills/SkillCommon.py
@@ -521,38 +521,6 @@
return summonNPCList, maxBornIndex
-## 获得持续性技能的总量(技能类型 -> 12,13)
-# @param curPlayer 当前玩家
-# @param curSkill 当前技能
-# @param skillPlus ,技能增益
-# @return value
-# @remarks 函数详细说明.
-def GetLastSkillMaxValue(curPlayer , curSkill , skillPlus=None):
- #根据约定,总量一定是第0个效果
- curEffect = curSkill.GetEffect(0)
- index = curEffect.GetEffectValue(0)
- skillPer = curEffect.GetEffectValue(1)
- effect = curEffect.GetEffectValue(2)
- maxValue = EffGetSet.GetValueByEffIndex(curPlayer, index)
- #GameWorld.Log("持续伤害总值设置curSkill = %s,maxValue = %s skillPer = %s,effect = %s"%(curSkill.GetSkillName(),maxValue,skillPer,effect))
- if maxValue == None:
- GameWorld.Log("计算附加技能总量错误,skillID = %s,index = %s" % (curSkill.GetSkillID(), index) , curPlayer.GetPlayerID())
- return effect
-
- #总值
- value = 0
- if skillPlus == None :
- value = (maxValue * skillPer / ChConfig.Def_MaxRateValue) + effect
- #GameWorld.Log("持续伤害总值设置 value = %s"%value)
- else:
- plus = 1 + skillPlus / float(ChConfig.Def_MaxRateValue)
- value = (maxValue * (skillPer * plus) / ChConfig.Def_MaxRateValue) + effect
- #GameWorld.Log("持续伤害总值设置 value = %s 技能附加 = %s"%(value,plus))
-
- return int(value)
-
-
-
## 玩家召唤NPC(当前玩家,召唤技能,召唤兽ID,召唤兽属性列表, 召唤兽离自己的距离, 当前时间)
# @param curPlayer 当前玩家
# @param curSkill 召唤技能
@@ -648,21 +616,6 @@
if curSkill:
Calc_Summon_BaseEffectBySkillPer(curPlayer, summonNPC, curSkill)
return
-
-# #同一个召唤兽有10个等级, 所以必须用GetFunctionType来决定召唤兽的类型
-# summonID = summonNPC.GetFunctionType()
-#
-# summonList = None
-# if ChConfig.Def_SummonProperty.has_key(summonID):
-# summonList = ChConfig.Def_SummonProperty[summonID]
-#
-# #设置玩家被动技能对召唤兽属性的影响
-# __PassiveSkill_AddSummonAttribute(curPlayer, summonNPC, summonID)
-#
-# if summonList != None:
-# lvSummonNPC = summonNPC.GetLV()
-# #设置召唤兽战斗信息
-# __CalcSummonEffectValue(lvSummonNPC, summonNPC, summonList)
#计算基础总值
Calc_Summon_BaseEffect(summonNPC)
@@ -910,67 +863,6 @@
#返回值,技能释放成功
return summonNPC
-
-## 召唤兽使用技能召唤
-# @param curNPC 当前NPC
-# @param curSkill 当前技能
-# @param maxSummonCount 最大召唤数量
-# @param maxAngryCount 最大怒值数量
-# @param posX 重生坐标X
-# @param posY 重生坐标Y
-# @param tick 当前时间
-# @return 召唤兽
-# @remarks 函数详细说明.
-#def SummonNPC_UseSkill_SummonNPC(curNPC, curSkill , maxSummonCount , maxAngryCount , posX, posY, tick):
-# #获得召唤兽ID
-# summonNPCID = curSkill.GetEffect(0).GetEffectValue(0)
-#
-# if not summonNPCID:
-# return
-#
-# #第一次召唤的时候,需要初始化最大召唤个数
-# if not curNPC.GetSummonCount() :
-# curNPC.SetSummonCount(maxSummonCount, summonNPCID, maxAngryCount)
-#
-# #召唤兽召唤补足
-# elif curNPC.GetGameNPCObjType() == IPY_GameWorld.gnotSummon and maxSummonCount > curNPC.GetSummonCount():
-# curNPC.AddSummonCount(maxSummonCount - curNPC.GetSummonCount(), summonNPCID, maxAngryCount)
-#
-# #寻找一个可以召唤的NPC
-# summonIsFull = True
-# summonNPC = None
-#
-# for i in range(0, curNPC.GetSummonCount()):
-# summonNPC = curNPC.GetSummonNPCAt(i)
-# if GameObj.GetHP(summonNPC) > 0:
-# continue
-#
-# summonIsFull = False
-# break
-#
-# #已经没有可召唤兽的召唤兽,满了
-# if summonIsFull:
-# return
-#
-# #设置这个NPC属性,并召唤出这个NPC
-# NPCCommon.InitNPC(summonNPC)
-#
-# summonNPC.Reborn(posX , posY)
-# summonNPC.SetBornTime(tick)
-# summonNPC.SetLastTime(curSkill.GetLastTime())
-#
-# #返回summonNPC,技能释放成功
-# return summonNPC
-
-## 设置玩家被动技能对召唤兽属性的影响
-# @param curPlayer 当前玩家
-# @param summonNPC 当前召唤兽
-# @param summonID 召唤兽ID
-# @return None
-# @remarks 函数详细说明.
-def __PassiveSkill_AddSummonAttribute(curPlayer, summonNPC, summonID):
- return
-
## 根据效果获得值
# @param valueList
# @param curSkill 当前技能
@@ -985,21 +877,6 @@
returnList.append(value)
return returnList
-
-## 计算NPC属性效果
-# @param lvSummonNPC 玩家
-# @param summonNPC 效果
-# @param summonList NPC
-# @return True
-# @remarks 函数详细说明.
-def __CalcSummonEffectValue(lvSummonNPC, summonNPC, summonList):
- for value in summonList:
- curValue = EffGetSet.GetValueByEffIndex(summonNPC, value[0])
- #GameWorld.Log("当期属性 = %s index = %s"%(curValue,value[0]))
- #GameWorld.Log("设置属性 = %s"%(curValue + value[1] * lvSummonNPC))
- EffGetSet.SetValueByEffIndex(summonNPC, value[0], curValue + value[1] * lvSummonNPC)
-
- return True
## 设置这个召唤兽的基础属性
# @param summonNPC 召唤兽
@@ -1406,12 +1283,12 @@
AttackCommon.OnPVPDamage(attackerOwner, lostValue, curObj, "SkillLostHP")
elif curObjType == IPY_GameWorld.gotNPC:
AttackCommon.NPCAddObjInHurtList(attackerOwner, curObj, curObjHP_BeforeAttack, lostValue)
-
- TurnAttack.AddTurnObjHurtValue(buffOwner, curObj, hurtType, lostValue, lostHP, curSkill)
#统一调用攻击结束动作
if isDoAttackResult:
BaseAttack.DoLogic_AttackResult(buffOwner, curObj, None, tick)
+
+ #TurnAttack.OnTurnfightAttackResult(buffOwner, curObj, curSkill)
return lostHP
## 检查增加淬毒buff
@@ -1971,13 +1848,21 @@
#0通哟 1 PVP类型 2PVE类型
return curSkill.GetHurtType() % 10
-def isXPSkill(curSkill):
- ## 是否xp怒气技能
- return curSkill and curSkill.GetXP() > 0
+def isDamageShieldSkill(skillData):
+ ## 是否承伤盾技能
+ return skillData.GetAtkType() == ChConfig.BuffAtkType_DamageShield
-def isTurnNormalAtkSkill(curSkill):
+def isAngerSkill(curSkill):
+ ## 是否怒气技能
+ return curSkill and curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_AngerSkill
+
+def isTurnNormalSkill(curSkill):
## 是否回合普攻技能,区别与无技能的普通A一下,该普攻同样可以有各种技能效果,只是他属于普攻
- return curSkill and curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_TurnNormaAttack
+ return curSkill and curSkill.GetFuncType() == ChConfig.Def_SkillFuncType_TurnNormaSkill
+
+def isAttackDirectSkill(curSkill):
+ ## 是否直接攻击技能
+ return curSkill and not IsBuff(curSkill) and curSkill.GetSkillType() in [ChConfig.Def_SkillType_Atk]
## 检查技能是否为被动技能, 用于控制不可释放技能
def isPassiveSkill(curSkill):
@@ -2192,12 +2077,12 @@
cureBaseValue = GetCureBaseValue(userObj, curSkill)
elif cureType == ChConfig.Def_Cure_MaxHP:
cureBaseValue = GameObj.GetMaxHP(userObj)
- elif cureType == ChConfig.Def_Cure_PNE:
- cureBaseValue = userObj.GetPNE()
- addPer = curSkill.GetEffect(0).GetEffectValue(2)/float(ChConfig.Def_MaxRateValue)
- addExValue = GetCureBaseValue(userObj, curSkill)*addPer
- elif cureType == ChConfig.Def_Cure_PHY:
- cureBaseValue = GameObj.GetMaxHP(userObj)
+ #elif cureType == ChConfig.Def_Cure_PNE:
+ # cureBaseValue = userObj.GetPNE()
+ # addPer = curSkill.GetEffect(0).GetEffectValue(2)/float(ChConfig.Def_MaxRateValue)
+ # addExValue = GetCureBaseValue(userObj, curSkill)*addPer
+ #elif cureType == ChConfig.Def_Cure_PHY:
+ # cureBaseValue = GameObj.GetMaxHP(userObj)
elif cureType == ChConfig.Def_Cure_HurtValue:
cureBaseValue = GameObj.GetLastHurtValue(userObj)
elif cureType == ChConfig.Def_Cure_TagMaxHP:
@@ -2221,7 +2106,7 @@
cureDefPer = 0 # 敌方的弱化治疗
angerOverflow = 0 # 怒气溢出值
if userObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnFightPosInfo):
- if isXPSkill(curSkill):
+ if isAngerSkill(curSkill):
angerOverflow = max(GameObj.GetXP(userObj) - IpyGameDataPY.GetFuncCfg("AngerXP", 2), 0)
#enemyObj = TurnAttack.GetEnemyObj(userObj)
#curePer += GameObj.GetCurePer(userObj)
@@ -2284,146 +2169,54 @@
# @return
def UpdateSkillCombo(attacker, skill, tick):
return
- #===========================================================================
- # if attacker.GetGameObjType() != IPY_GameWorld.gotPlayer:
- # return
- #
- # SkillComboDict = ReadChConfig.GetEvalChConfig("SkillCombo")
- # jobType = ChConfig.JOB_TYPE_DICT[attacker.GetJob()]
- #
- # if jobType not in SkillComboDict:
- # return
- #
- # jobSkillComboDict = SkillComboDict[jobType]
- #
- # curSkillTypeID = skill.GetSkillTypeID()
- #
- # isCombo = False
- # lastComboTick = attacker.GetDictByKey(ChConfig.Def_PlayerKey_LastSkillComboTick)
- # comboCnt = attacker.GetDictByKey(ChConfig.Def_PlayerKey_SkillComboCnt)
- # buffProcessState = attacker.GetDictByKey(ChConfig.Def_PlayerKey_ComboBuffProcessState)
- # # 持续性伤害buff已处理过不再处理
- # if curSkillTypeID in ChConfig.Ded_ComboBuffProcessSkillIDList and buffProcessState:
- # #GameWorld.DebugLog("持续性伤害buff已处理过不再处理:%s" % curSkillTypeID)
- # return
- #
- # for comboNum, comboInfo in jobSkillComboDict.items():
- #
- # skillList = comboInfo[0]
- # stateSkillReq = comboInfo[1]
- # comboInterval = comboInfo[2]
- # addHurtPerFormat = comboInfo[3]
- # modulusPlusHappenRate = comboInfo[4] # 伤害系数加成概率万分率
- # modulusPlusFormat = comboInfo[5] # 伤害系数公式
- #
- # if curSkillTypeID not in skillList:
- # continue
- #
- # # 如果有姿态要求
- # if stateSkillReq != 0:
- # buffState = attacker.GetBuffState()
- # if buffState.FindBuff(stateSkillReq) == None:
- # #GameWorld.DebugLog("非对应职业姿态(%s),无法连击!" % stateSkillReq)
- # continue
- #
- # curComboCnt = skillList.index(curSkillTypeID) + 1 # 当前技能所在连击数
- #
- # # 在规定时间内完成连击
- # #GameWorld.DebugLog("skillList=%s, curSkillTypeID=%s,comboCnt=%s,curComboCnt=%s,tick=%s,lastComboTick=%s,(%s),comboInterval=%s"
- # # % (skillList, curSkillTypeID, comboCnt, curComboCnt, tick, lastComboTick, tick - lastComboTick, comboInterval))
- # if comboCnt > 0 and (comboCnt + 1) == curComboCnt and (tick - lastComboTick) <= comboInterval:
- # isCombo = True
- # #GameWorld.DebugLog(" 连击成功!")
- #
- # # 第一击
- # elif curComboCnt == 1:
- # GameWorld.DebugLog(" 技能第一击!")
- # comboCnt = 0
- # isCombo = True
- #
- # if isCombo:
- # STR = attacker.GetSTR()
- # PHY = attacker.GetPHY()
- # modulus = 1 # 伤害系数
- # if GameWorld.CanHappen(modulusPlusHappenRate):
- # modulus = eval(modulusPlusFormat)
- # addHurtPer = eval(addHurtPerFormat)
- # attacker.SetDict(ChConfig.Def_PlayerKey_LastSkillComboTick, tick)
- # attacker.SetDict(ChConfig.Def_PlayerKey_SkillComboCnt, curComboCnt)
- # attacker.SetDict(ChConfig.Def_PlayerKey_ComboSkillTypeID, curSkillTypeID)
- # attacker.SetDict(ChConfig.Def_PlayerKey_ComboAddHurtPer, addHurtPer)
- # if curSkillTypeID in ChConfig.Ded_ComboBuffProcessSkillIDList:
- # attacker.SetDict(ChConfig.Def_PlayerKey_ComboBuffProcessState, 1)
- # #GameWorld.DebugLog(" 持续性伤害buff连击!%s" % curSkillTypeID)
- #
- #
- # # 通知客户端连击数
- # skillComboPack = ChPyNetSendPack.tagMCSkillCombo()
- # skillComboPack.Clear()
- # skillComboPack.ComboNum = comboNum
- # skillComboPack.ComboCnt = curComboCnt
- # NetPackCommon.SendFakePack(attacker, skillComboPack)
- # GameWorld.DebugLog("技能连击: num=%s,curCnt=%s,comboCnt=%s,力=%s,敏=%s,modulus=%s,addHurtPer=%s"
- # % (comboNum, curComboCnt, comboCnt, STR, PHY, modulus, addHurtPer))
- # break
- #
- # # 没有连击成功, 重置连击信息
- # if not isCombo and comboCnt != 0:
- # attacker.SetDict(ChConfig.Def_PlayerKey_LastSkillComboTick, 0)
- # attacker.SetDict(ChConfig.Def_PlayerKey_SkillComboCnt, 0)
- # attacker.SetDict(ChConfig.Def_PlayerKey_ComboSkillTypeID, 0)
- # attacker.SetDict(ChConfig.Def_PlayerKey_ComboAddHurtPer, 0)
- # attacker.SetDict(ChConfig.Def_PlayerKey_ComboBuffProcessState, 0)
- # GameWorld.DebugLog("连击失败!curSkillTypeID=%s" % curSkillTypeID)
- #
- # return
- #===========================================================================
-
+
def GetSkillAddPerByID(curPlayer, skillTypeID):
## 获取技能伤害百分比提升值
# @param skillTypeID: 技能TypeID
- SkillAddPerAttrIDDict = IpyGameDataPY.GetConfigEx("SkillAddPerAttrIDDict")
- if not SkillAddPerAttrIDDict:
- SkillAddPerAttrIDDict = {}
- skillPlusAttrIDDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 2, {})
- for attrIDStr, skillTypeIDList in skillPlusAttrIDDict.items():
- attrID = int(attrIDStr)
- if attrID not in ShareDefine.SkillAddPerAttrIDList:
- continue
- for cfgSkillTypeID in skillTypeIDList:
- SkillAddPerAttrIDDict[cfgSkillTypeID] = attrID
- IpyGameDataPY.SetConfigEx("SkillAddPerAttrIDDict", SkillAddPerAttrIDDict)
-
- if skillTypeID not in SkillAddPerAttrIDDict:
- return 0
- curAttrID = SkillAddPerAttrIDDict[skillTypeID]
- attrInfo = ChConfig.ItemEffect_AttrDict.get(curAttrID, [])
- if attrInfo == []:
- return 0
- effIndex = attrInfo[0][0]
- return EffGetSet.GetValueByEffIndex(curPlayer, effIndex)
+ return 0
+# SkillAddPerAttrIDDict = IpyGameDataPY.GetConfigEx("SkillAddPerAttrIDDict")
+# if not SkillAddPerAttrIDDict:
+# SkillAddPerAttrIDDict = {}
+# skillPlusAttrIDDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 2, {})
+# for attrIDStr, skillTypeIDList in skillPlusAttrIDDict.items():
+# attrID = int(attrIDStr)
+# if attrID not in ShareDefine.SkillAddPerAttrIDList:
+# continue
+# for cfgSkillTypeID in skillTypeIDList:
+# SkillAddPerAttrIDDict[cfgSkillTypeID] = attrID
+# IpyGameDataPY.SetConfigEx("SkillAddPerAttrIDDict", SkillAddPerAttrIDDict)
+#
+# if skillTypeID not in SkillAddPerAttrIDDict:
+# return 0
+# curAttrID = SkillAddPerAttrIDDict[skillTypeID]
+# attrInfo = ChConfig.ItemEffect_AttrDict.get(curAttrID, [])
+# if attrInfo == []:
+# return 0
+# effIndex = attrInfo[0][0]
+# return EffGetSet.GetValueByEffIndex(curPlayer, effIndex)
def GetSkillReducePerByID(curPlayer, skillTypeID):
## 获取技能伤害百分比减伤值
# @param skillTypeID: 技能TypeID
- SkillReducePerAttrIDDict = IpyGameDataPY.GetConfigEx("SkillReducePerAttrIDDict")
- if not SkillReducePerAttrIDDict:
- SkillReducePerAttrIDDict = {}
- skillPlusAttrIDDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 2, {})
- for attrIDStr, skillTypeIDList in skillPlusAttrIDDict.items():
- attrID = int(attrIDStr)
- if attrID not in ShareDefine.SkillReducePerAttrIDList:
- continue
- for cfgSkillTypeID in skillTypeIDList:
- SkillReducePerAttrIDDict[cfgSkillTypeID] = attrID
- IpyGameDataPY.SetConfigEx("SkillReducePerAttrIDDict", SkillReducePerAttrIDDict)
-
- if skillTypeID not in SkillReducePerAttrIDDict:
- return 0
- curAttrID = SkillReducePerAttrIDDict[skillTypeID]
- attrInfo = ChConfig.ItemEffect_AttrDict.get(curAttrID, [])
- if attrInfo == []:
- return 0
- effIndex = attrInfo[0][0]
- return EffGetSet.GetValueByEffIndex(curPlayer, effIndex)
+ return 0
+# SkillReducePerAttrIDDict = IpyGameDataPY.GetConfigEx("SkillReducePerAttrIDDict")
+# if not SkillReducePerAttrIDDict:
+# SkillReducePerAttrIDDict = {}
+# skillPlusAttrIDDict = IpyGameDataPY.GetFuncEvalCfg("SkillPlusAttrID", 2, {})
+# for attrIDStr, skillTypeIDList in skillPlusAttrIDDict.items():
+# attrID = int(attrIDStr)
+# if attrID not in ShareDefine.SkillReducePerAttrIDList:
+# continue
+# for cfgSkillTypeID in skillTypeIDList:
+# SkillReducePerAttrIDDict[cfgSkillTypeID] = attrID
+# IpyGameDataPY.SetConfigEx("SkillReducePerAttrIDDict", SkillReducePerAttrIDDict)
+#
+# if skillTypeID not in SkillReducePerAttrIDDict:
+# return 0
+# curAttrID = SkillReducePerAttrIDDict[skillTypeID]
+# attrInfo = ChConfig.ItemEffect_AttrDict.get(curAttrID, [])
+# if attrInfo == []:
+# return 0
+# effIndex = attrInfo[0][0]
+# return EffGetSet.GetValueByEffIndex(curPlayer, effIndex)
--
Gitblit v1.8.0