129 【战斗】战斗系统-服务端(陆逊技能;增加效果ID5009:检测场上最高层buff复制buff到目标上; 增加效果ID5020:引爆目标所有持续buff所有回合效果(只算按回合结算的))
| | |
| | | self._value1 = 0 # 值需要通知前端,开发时注意20亿问题
|
| | | self._value2 = 0
|
| | | self._value3 = 0
|
| | | self._isCopy = 0 # 是否复制的buff
|
| | | return
|
| | |
|
| | | def onRelease(self):
|
| | |
| | | def SetValue2(self, value): self._value2 = value
|
| | | def GetValue3(self): return self._value3
|
| | | def SetValue3(self, value): self._value3 = value
|
| | | def GetIsCopy(self): return self._isCopy
|
| | | def SetIsCopy(self, isCopy): self._isCopy = isCopy
|
| | |
|
| | | class BuffManager():
|
| | | ## 战斗对象buff管理器
|
| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Skill.PassiveTrigger.PassiveEff_5009
|
| | | #
|
| | | # @todo:检测场上最高层buff复制buff到目标上
|
| | | # @author hxp
|
| | | # @date 2025-10-28
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 检测场上最高层buff复制buff到目标上
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-10-28 10:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import TurnBuff
|
| | | import GameWorld
|
| | | import BattleObj
|
| | | import ChConfig
|
| | |
|
| | | def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
|
| | | #effectID = curEffect.GetEffectID()
|
| | | buffStateList = curEffect.GetEffectValue(0)
|
| | | includeFriend = curEffect.GetEffectValue(1) # 统计buff时是否包含己方单位
|
| | | GameWorld.DebugLog("检测复制最高层buff! buffStateList=%s,includeFriend=%s" % (buffStateList, includeFriend))
|
| | | if not buffStateList:
|
| | | return
|
| | | |
| | | faction = batObj.GetFaction()
|
| | | lineupNum = batObj.GetLineupNum()
|
| | | if includeFriend:
|
| | | tagFaction = faction
|
| | | else:
|
| | | tagFaction = ChConfig.Def_FactionB if faction == ChConfig.Def_FactionA else ChConfig.Def_FactionA
|
| | | |
| | | batFaction = turnFight.getBatFaction(tagFaction)
|
| | | batLineup = batFaction.getBatlineup(lineupNum)
|
| | | |
| | | maxLayer = 0
|
| | | maxLayerBuffList = []
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in batLineup.posObjIDDict.values():
|
| | | tObj = batObjMgr.getBatObj(objID)
|
| | | if not tObj:
|
| | | continue
|
| | | |
| | | layerTotal = 0
|
| | | curBuffList = []
|
| | | buffMgr = tObj.GetBuffManager()
|
| | | for buffState in buffStateList:
|
| | | buffList = buffMgr.FindBuffListByState(buffState)
|
| | | if not buffList:
|
| | | #GameWorld.DebugLog("目标没有该状态buff! objID=%s,buffState=%s" % (objID, buffState))
|
| | | continue
|
| | | for buff in buffList:
|
| | | if buff.GetIsCopy():
|
| | | #GameWorld.DebugLog("本身是复制的buff不算! objID=%s,buffID=%s" % (objID, buff.GetBuffID()))
|
| | | continue
|
| | | layerTotal += buff.GetLayer()
|
| | | curBuffList += buffList
|
| | | GameWorld.DebugLog("目标该状态buff! objID=%s,layerTotal=%s" % (objID, layerTotal))
|
| | | |
| | | if maxLayer < layerTotal:
|
| | | maxLayer = layerTotal
|
| | | maxLayerBuffList = curBuffList
|
| | | |
| | | if not maxLayerBuffList:
|
| | | return
|
| | | |
| | | # 复制给目标
|
| | | buffOwner = batObj
|
| | | for tagBuff in maxLayerBuffList:
|
| | | skillID = tagBuff.GetSkillID()
|
| | | addBuff = TurnBuff.DoAddBuffBySkillID(turnFight, tagObj, skillID, buffOwner, connSkill, isSync=False)
|
| | | if not addBuff:
|
| | | GameWorld.DebugLog("复制添加buff失败! skillID=%s" % skillID)
|
| | | continue
|
| | | GameWorld.DebugLog("复制添加buff成功! skillID=%s,addBuffID=%s" % (skillID, addBuff.GetBuffID()))
|
| | | TurnBuff.CopyBuff(turnFight, batObj, addBuff, tagBuff, connSkill, True, refreshTimeLayer=False)
|
| | | |
| | | return True
|
| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Skill.PassiveTrigger.PassiveEff_5020
|
| | | #
|
| | | # @todo:引爆目标所有持续buff所有回合效果(只算按回合结算的)
|
| | | # @author hxp
|
| | | # @date 2025-10-28
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 引爆目标所有持续buff所有回合效果(只算按回合结算的)
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-10-28 10:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import TurnBuff
|
| | | import GameWorld
|
| | | import TurnPassive
|
| | | import ChConfig
|
| | |
|
| | | def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
|
| | | #effectID = curEffect.GetEffectID()
|
| | | noDel = curEffect.GetEffectValue(0)
|
| | | |
| | | buffList = []
|
| | | buffMgr = tagObj.GetBuffManager()
|
| | | for index in range(buffMgr.GetBuffCount()):
|
| | | buff = buffMgr.GetBuffByIndex(index)
|
| | | skillData = buff.GetSkillData()
|
| | | if skillData.GetSkillType() != ChConfig.Def_SkillType_LstDepBuff:
|
| | | continue
|
| | | isByTurn = False # 只算按回合结算的
|
| | | for effIndex in range(skillData.GetEffectCount()):
|
| | | effect = skillData.GetEffect(effIndex)
|
| | | if effect.GetEffectID() == 5001:
|
| | | isByTurn = True
|
| | | break
|
| | | if not isByTurn:
|
| | | continue
|
| | | buffList.append(buff)
|
| | | |
| | | FinalDamPer = TurnPassive.GetTriggerEffectValue(turnFight, batObj, tagObj, ChConfig.AttrID_FinalDamPer, connSkill)
|
| | | GameWorld.DebugLog("引爆目标所有持续buff所有回合效果: tagID=%s,buffCnt=%s,noDel=%s,FinalDamPer=%s" % (tagObj.GetID(), len(buffList), noDel, FinalDamPer))
|
| | | for buff in buffList:
|
| | | GameWorld.DebugLog("buffID=%s,RemainTime=%s" % (buff.GetBuffID(), buff.GetRemainTime()))
|
| | | for _ in range(buff.GetRemainTime()):
|
| | | TurnBuff.DoBuffProcess(turnFight, tagObj, buff, FinalDamPer=FinalDamPer)
|
| | | if noDel:
|
| | | continue
|
| | | TurnBuff.DoBuffDel(turnFight, tagObj, buff)
|
| | | |
| | | return True
|
| | |
| | | return []
|
| | | return ret
|
| | |
|
| | | def CopyBuff(turnFight, curBatObj, curBuff, tagBuff, bySkill=None, isNewAdd=False):
|
| | | def CopyBuff(turnFight, curBatObj, curBuff, tagBuff, bySkill=None, isNewAdd=False, refreshTimeLayer=True):
|
| | | '''拷贝buff数据,不含目标buffID、归属,并刷新时间
|
| | | @param refreshTimeLayer: 刷新剩余时间、层级
|
| | | '''
|
| | | skillData = curBuff.GetSkillData()
|
| | | curBuff.SetCalcTime(turnFight.getTimeline())
|
| | | if refreshTimeLayer:
|
| | | curBuff.SetRemainTime(max(tagBuff.GetRemainTime(), skillData.GetLastTime()))
|
| | | curBuff.SetLayer(max(tagBuff.GetLayer(), skillData.GetLayerMax()))
|
| | | else:
|
| | | curBuff.SetRemainTime(tagBuff.GetRemainTime())
|
| | | curBuff.SetLayer(tagBuff.GetLayer())
|
| | | curBuff.SetValue1(tagBuff.GetValue1())
|
| | | curBuff.SetValue2(tagBuff.GetValue2())
|
| | | curBuff.SetValue3(tagBuff.GetValue3())
|
| | | curBuff.SetIsCopy(1)
|
| | | GameWorld.DebugLog(" 拷贝buff: curBuffID=%s,tagBuffID=%s,Remain=%s,Layer=%s,Value=%s"
|
| | | % (curBuff.GetBuffID(), tagBuff.GetBuffID(), curBuff.GetRemainTime(), curBuff.GetLayer(),
|
| | | [curBuff.GetValue1(), curBuff.GetValue2(), curBuff.GetValue3()]))
|
| | |
| | | ObjPool.GetPoolMgr().release(curBuff)
|
| | | return
|
| | |
|
| | | def DoBuffProcess(turnFight, batObj, curBuff):
|
| | | def DoBuffProcess(turnFight, batObj, curBuff, **kwargs):
|
| | | skillData = curBuff.GetSkillData()
|
| | | if not skillData.GetAtkType():
|
| | | return
|
| | | callFunc = GameWorld.GetExecFunc(TurnBuffs, "BuffAtkType_%d.%s" % (skillData.GetAtkType(), "DoBuffProcess"))
|
| | | if callFunc:
|
| | | callFunc(turnFight, batObj, curBuff)
|
| | | callFunc(turnFight, batObj, curBuff, **kwargs)
|
| | | return
|
| | |
|
| | | def RefreshBuffAttr(batObj):
|
| | |
| | | hurtValue, hurtTypes = TurnSkill.CalcHurtHP(turnFight, attacker, defender, curSkill, skillValue, skillPer, damageoftime=1)
|
| | | return [hurtValue % ChConfig.Def_PerPointValue, hurtValue / ChConfig.Def_PerPointValue, hurtTypes]
|
| | |
|
| | | def DoBuffProcess(turnFight, batObj, curBuff):
|
| | | def DoBuffProcess(turnFight, batObj, curBuff, **kwargs):
|
| | | ## 执行单次逻辑
|
| | | hurtValue = curBuff.GetValue1() + curBuff.GetValue2() * ChConfig.Def_PerPointValue # 单次伤害
|
| | | hurtTypes = curBuff.GetValue3()
|
| | | TurnSkill.DoDOTAttack(turnFight, batObj, curBuff, hurtValue, hurtTypes)
|
| | | TurnSkill.DoDOTAttack(turnFight, batObj, curBuff, hurtValue, hurtTypes, **kwargs)
|
| | | return
|
| | |
|
| | |
| | | if hurtValue <= 0:
|
| | | return 0, 0, hurtTypes
|
| | |
|
| | | hurtValue = int(hurtValue)
|
| | | buffMgr = defObj.GetBuffManager()
|
| | | wudiBuffList = buffMgr.FindBuffListByState(ChConfig.BatObjState_Wudi)
|
| | | if wudiBuffList:
|
| | |
| | | GameWorld.DebugLog("根据buff值: %s" % baseValue)
|
| | | return baseValue
|
| | |
|
| | | def DoDOTAttack(turnFight, batObj, curBuff, hurtValue, hurtTypes):
|
| | | def DoDOTAttack(turnFight, batObj, curBuff, hurtValue, hurtTypes, **kwargs):
|
| | | ## 执行单次dot逻辑
|
| | | skillID = curBuff.GetSkillID()
|
| | | skillIpyData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
|
| | |
| | | if layer > 0:
|
| | | hurtValue *= layer
|
| | | GameWorld.DebugLog(" 多层buff伤害: hurtValue=%s,layer=%s" % (hurtValue, layer))
|
| | | if "FinalDamPer" in kwargs:
|
| | | FinalDamPer = kwargs["FinalDamPer"]
|
| | | hurtValue *= (10000 + FinalDamPer) / 10000.0
|
| | | GameWorld.DebugLog(" 增伤: hurtValue=%s,FinalDamPer=%s" % (hurtValue, FinalDamPer))
|
| | | hurtValue, realHurtHP, hurtTypes = CalcHurtHPWithBuff(turnFight, atkObj, defObj, useSkill, hurtValue, hurtTypes)
|
| | |
|
| | | remainHP = max(0, dHP - realHurtHP) # 剩余血量
|