129 【战斗】战斗系统-服务端(主阵容变更时重新开始战斗;主阵容属性变化时实时更新主线战斗;主线战斗请求CD限制1秒;计算buff属性、buff添加删除通用逻辑;4012效果状态逻辑;)
| | |
| | | RegType = 0
|
| | | RegisterPackCount = 3
|
| | |
|
| | | PacketCMD_1=0xB4
|
| | | PacketSubCMD_1=0x10
|
| | | PacketCallFunc_1=OnTurnFight
|
| | | PacketCMD_1=
|
| | | PacketSubCMD_1=
|
| | | PacketCallFunc_1=
|
| | |
|
| | | PacketCMD_2=0xB4
|
| | | PacketSubCMD_2=0x13
|
| | |
| | | import ShareDefine
|
| | | import ChConfig
|
| | | import ObjPool
|
| | | import TurnPassive
|
| | | import TurnBuff
|
| | |
|
| | | class HurtObj():
|
| | | ## 伤血统计
|
| | |
| | | def GetBounceHP(self): return self._bounceHP
|
| | | def SetBounceHP(self, bounceHP): self._bounceHP = bounceHP
|
| | |
|
| | | class Effect():
|
| | | |
| | | def __init__(self, effID, values):
|
| | | self._effID = effID
|
| | | self._values = values
|
| | | return
|
| | | |
| | | def GetEffectID(self): return self._effID
|
| | | def GetEffectValue(self, index): return self._values[index] if len(self._values) > index else 0
|
| | | def GetEffectValueCount(self): return len(self._values)
|
| | | |
| | | class SklllData():
|
| | | |
| | | def __init__(self, ipyData):
|
| | | self._ipyData = ipyData
|
| | | self._effList = [] # [Effect, ...]
|
| | | for num in range(1, 1 + 3):
|
| | | effID = getattr(ipyData, "GetEffectID%s" % num)()
|
| | | values = getattr(ipyData, "GetEffectValues%s" % num)()
|
| | | self._effList.append(ObjPool.GetPoolMgr().acquire(Effect, effID, values))
|
| | | return
|
| | | |
| | | def GetSkillID(self): return self._ipyData.GetSkillID()
|
| | | def GetSkillTypeID(self): return self._ipyData.GetSkillTypeID()
|
| | | def GetSkillMaxLV(self): return self._ipyData.GetSkillMaxLV()
|
| | | def GetSkillName(self): return self._ipyData.GetSkillName()
|
| | | def GetFuncType(self): return self._ipyData.GetFuncType()
|
| | | def GetSkillType(self): return self._ipyData.GetSkillType()
|
| | | def GetHurtType(self): return self._ipyData.GetHurtType()
|
| | | def GetAtkType(self): return self._ipyData.GetAtkType()
|
| | | def GetTagAim(self): return self._ipyData.GetTagAim() # 瞄准位置
|
| | | def GetTagFriendly(self): return self._ipyData.GetTagFriendly() # 敌我目标
|
| | | def GetTagSelf(self): return self._ipyData.GetTagSelf() # 是否含自己
|
| | | def GetTagAffect(self): return self._ipyData.GetTagAffect() # 目标细分
|
| | | def GetTagCount(self): return self._ipyData.GetTagCount() # 目标个数
|
| | | def GetHappenRate(self): return self._ipyData.GetHappenRate() # 释放或添加几率
|
| | | def GetLastTime(self): return self._ipyData.GetLastTime() # 持续时间
|
| | | def GetCoolDownTime(self): return self._ipyData.GetCoolDownTime()
|
| | | def GetEffect(self, index): return self._effList[index] if len(self._effList) > index else 0
|
| | | def GetEffectCount(self): return len(self._effList)
|
| | | def GetConnSkill(self): return self._ipyData.GetConnSkill() # 关联技能
|
| | | def GetEnhanceSkillList(self): return self._ipyData.GetEnhanceSkillList() # 额外触发的技能ID列表
|
| | | def GetFightPower(self): return self._ipyData.GetFightPower()
|
| | | |
| | | class PyBuff():
|
| | |
|
| | | def __init__(self, skillData):
|
| | | self._skillData = skillData
|
| | | def __init__(self, ipyData):
|
| | | self._skillData = ObjPool.GetPoolMgr().acquire(SklllData, ipyData)
|
| | | self._buffID = 0
|
| | | self._ownerID = 0
|
| | | self._layer = 0
|
| | |
| | | def SetValueList(self, valueList): self._valueList = valueList
|
| | | def GetValue(self, index):
|
| | | return self._valueList[index] if len(self._valueList) > index else 0
|
| | |
|
| | | |
| | | class BuffManager():
|
| | | ## 战斗对象buff管理器
|
| | |
|
| | |
| | | self._buffList = [] # [PyBuff, ...]
|
| | | self._buffIDDict = {} # {buffID:PyBuff, ...}
|
| | | self._skillTypeIDBuffIDs = {} # 技能TypeID对应的buff {skillTypeID:[buffID, ...], ...}
|
| | | self._buffStateDict = {} # buff影响的状态 {state:[buffID, ...], ...}
|
| | | self._buffID = 0 # 该对象的唯一buffID,递增,不同对象buffID可重复,buffID非skillID,不同buffID的skillID可能一样
|
| | | # 该项目设定同一个对象可能同时存在多个相同skillID的buff,独立算CD
|
| | | return
|
| | |
| | |
|
| | | def AddBuff(self, skillID):
|
| | | buff = None
|
| | | skillData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
|
| | | if not skillData:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
|
| | | if not ipyData:
|
| | | return buff
|
| | | skillTypeID = skillData.GetSkillTypeID()
|
| | | skillTypeID = ipyData.GetSkillTypeID()
|
| | | self._buffID += 1
|
| | |
|
| | | buff = ObjPool.GetPoolMgr().acquire(PyBuff, skillData)
|
| | | buff = ObjPool.GetPoolMgr().acquire(PyBuff, ipyData)
|
| | | buff.SetBuffID(self._buffID)
|
| | |
|
| | | self._buffList.append(buff)
|
| | |
| | | #if False:
|
| | | # buff = PyBuff()
|
| | | return buff
|
| | | |
| | | def DelBuff(self, buffID):
|
| | | if buffID not in self._buffIDDict:
|
| | | return
|
| | | buff = self._buffIDDict.pop(buffID)
|
| | | if buff in self._buffList:
|
| | | self._buffList.remove(buff)
|
| | | for skillTypeID, buffIDList in self._skillTypeIDBuffIDs.items():
|
| | | if buffID not in buffIDList:
|
| | | continue
|
| | | buffIDList.remove(buffID)
|
| | | if not buffIDList:
|
| | | self._skillTypeIDBuffIDs.pop(skillTypeID)
|
| | | break
|
| | | return
|
| | |
|
| | | def GetBuff(self, buffID):
|
| | | buff = None
|
| | |
| | | buffs.append(self._buffIDDict[buffID])
|
| | | return buffs
|
| | |
|
| | | class PySkill():
|
| | | |
| | | def __init__(self, skillData):
|
| | | self._skillData = skillData
|
| | | self._remainTime = 0
|
| | | self._batType = 0 # 战斗类型,普通、连击、反击、追击等
|
| | | self._enhanceBySkill = None # 由哪个主技能触发的
|
| | | self._tagObjList = [] # 本次技能目标列表 [BatObj, ...]
|
| | | self._hurtList = [] # 本次伤血列表 [HurtObj, ...]
|
| | | def AddBuffState(self, state, buffID):
|
| | | ## 添加buff影响的状态,ChConfig.BatObjStateList
|
| | | if state not in self._buffStateDict:
|
| | | self._buffStateDict[state] = []
|
| | | buffIDList = self._buffStateDict[state]
|
| | | if buffID not in buffIDList:
|
| | | buffIDList.append(buffID)
|
| | | GameWorld.DebugLog(" AddBuffState state=%s,buffID=%s,%s" % (state, buffID, self._buffStateDict))
|
| | | return
|
| | |
|
| | | def SetSkillData(self, skillData): self._skillData = skillData
|
| | | def DelBuffState(self, state, buffID):
|
| | | ## 删除buff影响的状态
|
| | | if state not in self._buffStateDict: return
|
| | | buffIDList = self._buffStateDict[state]
|
| | | if buffID not in buffIDList:
|
| | | return
|
| | | buffIDList.remove(buffID)
|
| | | if not len(buffIDList):
|
| | | self._buffStateDict.pop(state)
|
| | | GameWorld.DebugLog(" DelBuffState state=%s,buffID=%s,%s" % (state, buffID, self._buffStateDict))
|
| | | return
|
| | | |
| | | def IsInBuffState(self, state):
|
| | | ## 是否处于某种状态下
|
| | | return state in self._buffStateDict and len(self._buffStateDict[state]) > 0
|
| | | |
| | | class PySkill():
|
| | | |
| | | def __init__(self, ipyData):
|
| | | self._skillData = ObjPool.GetPoolMgr().acquire(SklllData, ipyData)
|
| | | self._remainTime = 0
|
| | | self._batType = 0 # 战斗类型,普通、连击、反击、追击等
|
| | | self._tagObjList = [] # 本次技能目标列表 [BatObj, ...]
|
| | | self._hurtList = [] # 本次伤血列表,可能同一个对象有多个伤害,如弹射等 [HurtObj, ...]
|
| | | self._bySkill = None # 由哪个技能触发的
|
| | | self._isEnhanceSkill = False # 是否由主技能额外触发的(非被动触发,即主技能的EnhanceSkillList字段中的技能)
|
| | | return
|
| | | |
| | | def GetSkillID(self): return self._skillData.GetSkillID()
|
| | | def GetSkillTypeID(self): return self._skillData.GetSkillTypeID()
|
| | | def GetSkillMaxLV(self): return self._skillData.GetSkillMaxLV()
|
| | |
| | | def GetHappenRate(self): return self._skillData.GetHappenRate() # 释放或添加几率
|
| | | def GetLastTime(self): return self._skillData.GetLastTime() # 持续时间
|
| | | def GetCoolDownTime(self): return self._skillData.GetCoolDownTime()
|
| | | def FindEffectID(self, effID):
|
| | | ## 查找是否有某个效果ID
|
| | | # @return: 大于0该ID所在的效果ID编号; 0-不存在该效果ID
|
| | | for idNum in range(1, 1 + 3):
|
| | | if self.GetEffectID(idNum) == effID:
|
| | | return idNum
|
| | | return 0
|
| | | def GetEffectID(self, idNum):
|
| | | ## 获取效果ID
|
| | | # @param idNum: 效果ID编号,从1开始
|
| | | if idNum == 1:
|
| | | return self._skillData.GetEffectID1()
|
| | | if idNum == 2:
|
| | | return self._skillData.GetEffectID2()
|
| | | if idNum == 3:
|
| | | return self._skillData.GetEffectID3()
|
| | | return 0
|
| | | def GetEffectValue(self, idNum, index):
|
| | | ## 获取效果对应值
|
| | | # @param idNum: 效果ID编号,从1开始
|
| | | # @param index: 值索引,从0开始代表第1个值
|
| | | if idNum <= 0:
|
| | | return 0
|
| | | if idNum == 1:
|
| | | values = self._skillData.GetEffectValues1()
|
| | | elif idNum == 2:
|
| | | values = self._skillData.GetEffectValues2()
|
| | | elif idNum == 3:
|
| | | values = self._skillData.GetEffectValues3()
|
| | | else:
|
| | | return 0
|
| | | return values[index] if len(values) > index else 0
|
| | | def GetEffect(self, index): return self._skillData.GetEffect(index)
|
| | | def GetEffectCount(self): return self._skillData.GetEffectCount()
|
| | | def GetConnSkill(self): return self._skillData.GetConnSkill() # 关联技能
|
| | | def GetEnhanceSkillList(self): return self._skillData.GetEnhanceSkillList() # 额外触发的技能ID列表
|
| | | def GetFightPower(self): return self._skillData.GetFightPower()
|
| | |
| | | def SetRemainTime(self, remainTime): self._remainTime = remainTime
|
| | | def GetBatType(self): return self._batType
|
| | | def SetBatType(self, batType): self._batType = batType
|
| | | def GetEnhanceBySkill(self): return self._enhanceBySkill
|
| | | def SetEnhanceBySkill(self, enhanceBySkill): self._enhanceBySkill = enhanceBySkill
|
| | | def GetIsEnhanceSkill(self): return self._isEnhanceSkill
|
| | | def SetIsEnhanceSkill(self, isEnhanceSkill): self._isEnhanceSkill = isEnhanceSkill
|
| | | def GetBySkill(self): return self._bySkill
|
| | | def SetBySkill(self, bySkill): self._bySkill = bySkill
|
| | | def GetTagObjList(self): return self._tagObjList # 技能目标列表
|
| | | def SetTagObjList(self, tagObjList): self._tagObjList = tagObjList
|
| | | def ClearHurtObj(self):
|
| | |
| | | self._hurtList.append(hurtObj)
|
| | | return hurtObj
|
| | | def GetHurtObjList(self): return self._hurtList
|
| | | def GetHurtObj(self, tagID):
|
| | | ## 获取某个伤血,如果目标没有在伤血列表里则返回None
|
| | | for hurtObj in self._hurtList:
|
| | | if hurtObj.GetObjID() == tagID:
|
| | | return hurtObj
|
| | | return
|
| | |
|
| | | class SkillManager():
|
| | | ## 战斗对象技能管理器
|
| | |
| | | return
|
| | |
|
| | | def GetSkillCount(self): return len(self._skillList)
|
| | | def GetSkillByIndex(self, index):
|
| | | skill = self._skillList[index]
|
| | | #if False:
|
| | | # skill = PySkill()
|
| | | return skill
|
| | | def FindSkillByID(self, skillID):
|
| | | skill = self._skillDict.get(skillID, None)
|
| | | #if False:
|
| | | # skill = PySkill()
|
| | | return skill
|
| | | def GetSkillByIndex(self, index): return self._skillList[index]
|
| | | def FindSkillByID(self, skillID): return self._skillDict.get(skillID, None)
|
| | | def FindSkillByTypeID(self, skillTypeID):
|
| | | skill = None
|
| | | for s in self._skillList:
|
| | | if s.GetSkillTypeID() == skillTypeID:
|
| | | skill = s
|
| | | break
|
| | | #if False:
|
| | | # skill = PySkill()
|
| | | return skill
|
| | |
|
| | | def LearnSkillByID(self, skillID):
|
| | | skillData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
|
| | | if not skillData:
|
| | | ipyData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
|
| | | if not ipyData:
|
| | | return
|
| | | if skillID in self._skillDict:
|
| | | return
|
| | | skillTypeID = skillData.GetSkillTypeID()
|
| | | skillTypeID = ipyData.GetSkillTypeID()
|
| | | curSkill = self.FindSkillByTypeID(skillTypeID)
|
| | | if curSkill:
|
| | | if curSkill.GetSkillID() >= skillID:
|
| | | return
|
| | | # 升级技能
|
| | | curSkill.SetSkillData(skillData)
|
| | | else:
|
| | | # 学新技能
|
| | | curSkill = ObjPool.GetPoolMgr().acquire(PySkill, skillData)
|
| | | self._skillDict[skillID] = curSkill
|
| | | self._skillList.append(curSkill)
|
| | | self.__deleteSkill(curSkill)
|
| | | |
| | | # 学新技能
|
| | | curSkill = ObjPool.GetPoolMgr().acquire(PySkill, ipyData)
|
| | | self._skillDict[skillID] = curSkill
|
| | | self._skillList.append(curSkill)
|
| | | return curSkill
|
| | | |
| | | def __deleteSkill(self, curSkill):
|
| | | skillID = curSkill.GetSkillID()
|
| | | self._skillDict.pop(skillID, None)
|
| | | if curSkill in self._skillList:
|
| | | self._skillList.remove(curSkill)
|
| | | ObjPool.GetPoolMgr().release(curSkill)
|
| | | return
|
| | |
|
| | | class BatObj():
|
| | | ## 战斗实体对象数据,目前与某个NPCObj绑定
|
| | |
| | | self.faction = 0 # 所属阵营,一般只有双方阵营, 1 或 2,发起方默认1
|
| | | self.lineupNum = 1 # 阵容位置编号,一般多V多时有用,通常默认1
|
| | | self.posNum = 0 # 所在阵容站位
|
| | | self._hp = 0 # 当前生命值
|
| | | self._xp = 0 # 当前怒气值
|
| | | self._initAttrDict = {} # 初始化时的属性,固定不变,初始化时已经算好的属性 {attrID:value, ...}
|
| | | self._batAttrDict = {} # 实际战斗属性,包含buff层级的实际属性
|
| | | self._skillTempAttrDict = {} # 某次技能释放中临时的属性增减 {attrID:+-value, ...}
|
| | |
| | | return
|
| | |
|
| | | def InitBatAttr(self, initAttrDict, initXP=0):
|
| | | ## 初始化战斗属性
|
| | | '''初始化战斗属性
|
| | | @param initAttrDict: 已经算好的在阵容中的属性,包含羁绊、阵容属性等,战斗中只要计算buff属性即可
|
| | | @param initXP: 初始化的怒气值
|
| | | '''
|
| | | self._initAttrDict = initAttrDict
|
| | | self._batAttrDict = {}
|
| | | self._batAttrDict.update(initAttrDict)
|
| | | self._batAttrDict[ChConfig.AttrID_XP] = initXP
|
| | | self._batAttrDict[ChConfig.AttrID_HP] = initAttrDict.get(ChConfig.AttrID_MaxHP, 1)
|
| | | self._skillTempAttrDict = {}
|
| | | self._xp = initXP
|
| | | self._hp = initAttrDict.get(ChConfig.AttrID_MaxHP, 1)
|
| | | TurnBuff.RefreshBuffAttr(self)
|
| | | TurnPassive.RefreshPassive(self)
|
| | | return
|
| | | |
| | | def UpdInitBatAttr(self, initAttrDict):
|
| | | ## 更新战斗属性,一般只有主阵容需要更新,战斗中养成、装备变化等引起的主阵容属性变更时需要实时更新
|
| | | self._initAttrDict = initAttrDict
|
| | | TurnBuff.RefreshBuffAttr(self)
|
| | | return
|
| | | |
| | | def ResetBattleEffect(self):
|
| | | self._batAttrDict = {}
|
| | | self._batAttrDict.update(self._initAttrDict)
|
| | | return self._batAttrDict
|
| | | |
| | | def GetTFGUID(self): return self.tfGUID # 所属的某场战斗
|
| | | def SetTFGUID(self, tfGUID): self.tfGUID = tfGUID
|
| | | def GetTurnFight(self): return TurnAttack.GetTurnFightMgr().getTurnFight(self.tfGUID)
|
| | |
| | | # return False
|
| | | return True
|
| | |
|
| | | def IsInState(self, state):
|
| | | ## 是否处于某种状态下
|
| | | return self._buffMgr.IsInBuffState(state)
|
| | | |
| | | # 战斗属性
|
| | | def GetMaxHP(self): return self._batAttrDict.get(ChConfig.AttrID_MaxHP, 0)
|
| | | def SetMaxHP(self, maxHP): self._batAttrDict[ChConfig.AttrID_MaxHP] = maxHP
|
| | | def GetHP(self): return self._batAttrDict.get(ChConfig.AttrID_HP, 0)
|
| | | def SetMaxHP(self, maxHP, isNotify=False):
|
| | | self._batAttrDict[ChConfig.AttrID_MaxHP] = maxHP
|
| | | if isNotify:
|
| | | NotifyObjInfoRefresh(self, ChConfig.AttrID_MaxHP, maxHP)
|
| | | return
|
| | | def GetHP(self): return self._hp
|
| | | def SetHP(self, hp, isNotify=False):
|
| | | self._batAttrDict[ChConfig.AttrID_HP] = hp
|
| | | self._hp = hp
|
| | | if isNotify:
|
| | | NotifyObjInfoRefresh(self, ChConfig.AttrID_HP, hp)
|
| | | return
|
| | | def SetHPFull(self, isNotify=True): self.SetHP(self.GetMaxHP())
|
| | | def GetXP(self): return self._batAttrDict.get(ChConfig.AttrID_XP, 0)
|
| | | def SetHPFull(self, isNotify=True): self.SetHP(self.GetMaxHP(), isNotify)
|
| | | def GetXP(self): return self._xp
|
| | | def SetXP(self, xp, isNotify=True):
|
| | | self._batAttrDict[ChConfig.AttrID_XP] = xp
|
| | | self._xp = xp
|
| | | if isNotify:
|
| | | NotifyObjInfoRefresh(self, ChConfig.AttrID_XP, xp)
|
| | | return
|
| | | def GetAtk(self): return self.GetAttrValue(ChConfig.AttrID_Atk)
|
| | | def GetDef(self): return self.GetAttrValue(ChConfig.AttrID_Def)
|
| | | def GetAtk(self): return self.GetBatAttrValue(ChConfig.AttrID_Atk)
|
| | | def GetDef(self): return self.GetBatAttrValue(ChConfig.AttrID_Def)
|
| | |
|
| | | def GetAttrValue(self, attrID):
|
| | | def GetBatAttrValue(self, attrID, includeTemp=True):
|
| | | #ChConfig.AttrID_HP ChConfig.AttrID_XP
|
| | | value = self._batAttrDict.get(attrID, 0)
|
| | | if attrID in self._skillTempAttrDict:
|
| | | if includeTemp and attrID in self._skillTempAttrDict:
|
| | | value += self._skillTempAttrDict[attrID] # 支持正负值
|
| | | value = max(1, value)
|
| | | return value
|
| | | def SetBatAttrValue(self, attrID, value): self._batAttrDict[attrID] = value
|
| | | def AddSkillTempAttr(self, attrID, value):
|
| | | ## 增加技能临时属性,支持正负值
|
| | | # @param value: 正值-加属性;负值-减属性
|
| | |
| | | def TurnReset(self):
|
| | | ## 回合重置
|
| | | self._skillTurnUseCntDict = {}
|
| | | |
| | | def ResetBatObj(self, isReborn=True):
|
| | | ## 重置战斗相关
|
| | | # @param isReborn: 死亡的是否复活
|
| | | |
| | | # 重置统计
|
| | | self.hurtStat = 0
|
| | | self.defStat = 0
|
| | | self.cureStat = 0
|
| | | |
| | | if self.GetHP() <= 0 and not isReborn:
|
| | | return
|
| | | |
| | | # 清除buff
|
| | | |
| | | # 回满血
|
| | | self.SetHPFull()
|
| | | |
| | | # 重置怒气
|
| | | initXP = IpyGameDataPY.GetFuncCfg("AngerXP", 1)
|
| | | self.SetXP(initXP)
|
| | | return
|
| | | |
| | |
|
| | | class BattleObjMgr():
|
| | | ## 战斗对象管理器
|
| | |
| | | import time
|
| | | import json
|
| | |
|
| | | FighterNPCID = 100 # 战斗NPCID,仅后端用,除怪物外,所有玩家武将均使用该NPCID
|
| | | PosNumMax = 10 # 最大站位编号
|
| | | ActionNumStart = -1 # 起始行动位置编号,一般是从1开始,如果有加主公、红颜等则扣除相应位置值,如从0或-1开始
|
| | |
|
| | |
| | | SummonLineupObjs(self, self.faction, self.num, lineupInfo, self.getPlayerID())
|
| | | return
|
| | |
|
| | | def resetLineup(self, isReborn=True):
|
| | | ## 重置阵容
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for objID in self.posObjIDDict.values():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | batObj.ResetBatObj(isReborn)
|
| | | return
|
| | | |
| | | def clearLineup(self):
|
| | | ## 清除阵容
|
| | | if not self.posObjIDDict:
|
| | |
| | | self.lineupDict[num] = lineup
|
| | | return lineup
|
| | |
|
| | | def resetLineups(self):
|
| | | ## 重置所有战斗阵容
|
| | | for lineup in self.lineupDict.values():
|
| | | lineup.resetLineup()
|
| | | return
|
| | | |
| | | def clearLineups(self):
|
| | | ## 清除所有战斗阵容
|
| | | for lineup in self.lineupDict.values():
|
| | |
| | | self.curPlayer = GameWorld.GetPlayerManager().FindPlayerByID(playerID) if playerID else None
|
| | | self.mapID = mapID
|
| | | self.funcLineID = funcLineID
|
| | | self.state = -1 # -1 代表未战斗
|
| | | self.turnNum = 1 # 当前第x回合,默认第1回合开始
|
| | | self.turnMax = 15 # 最大回合数
|
| | | self.enterLogic = False # 是否已执行进场逻辑
|
| | |
| | | self.costTime = 0
|
| | | return
|
| | |
|
| | | def setFactionLineup(self, faction, lineupDict, onlyReset=False):
|
| | | def setFactionLineup(self, faction, lineupDict):
|
| | | ## 设置阵营阵容
|
| | | # @param lineupDict: {阵容编号:阵容信息, ...} 每个阵营支持多个阵容,即支持多V多
|
| | | # @param onlyReset: 是否仅重置,一般用于玩家的阵容,重复利用阵容实例,
|
| | | batFaction = self.getBatFaction(faction)
|
| | | if onlyReset:
|
| | | batFaction.resetLineups()
|
| | | else:
|
| | | batFaction.clearLineups()
|
| | | batFaction.clearLineups()
|
| | | for num, lineupInfo in lineupDict.items():
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | if onlyReset and not batLineup.isEmpty():
|
| | | continue
|
| | | if not lineupInfo:
|
| | | continue
|
| | | batLineup = batFaction.getBatlineup(num)
|
| | | batLineup.setLineup(lineupInfo)
|
| | | return
|
| | |
|
| | |
| | |
|
| | | return 0
|
| | |
|
| | | def clearBatFaction(self, faction):
|
| | | batFaction = self.getBatFaction(faction)
|
| | | batFaction.clearLineups()
|
| | | return
|
| | | |
| | | def clearFight(self):
|
| | | def exitFight(self):
|
| | | ## 退出战斗
|
| | | self.syncState(FightState_Over)
|
| | | for batFaction in self.factionDict.values():
|
| | | batFaction.clearLineups()
|
| | | self.state = -1
|
| | | return
|
| | | |
| | | def startFight(self):
|
| | | ## 准备就绪,开始战斗
|
| | | self.state = FightState_Start
|
| | | self.syncInit()
|
| | | return
|
| | | |
| | | def isInFight(self): return self.state != -1
|
| | |
|
| | | def syncInit(self):
|
| | | ## 初始化通知
|
| | |
| | | return
|
| | |
|
| | | def syncState(self, state, msgDict={}):
|
| | | self.state = state
|
| | | msg = json.dumps(msgDict, ensure_ascii=False)
|
| | | msg = msg.replace(" ", "")
|
| | | clientPack = ChPyNetSendPack.tagMCTurnFightState()
|
| | |
| | | turnFight = self.getTurnFight(guid)
|
| | | if not turnFight:
|
| | | return
|
| | | turnFight.clearFight()
|
| | | turnFight.exitFight()
|
| | | self.turnFightDict.pop(guid, None)
|
| | | return
|
| | |
|
| | |
| | | batObj.SetNPCID(npcID)
|
| | | elif lineupPlayerID:
|
| | | batObj.SetOwnerHero(lineupPlayerID, heroID, skinID)
|
| | | batObj.InitBatAttr({int(k):v for k, v in attrDict.items()}, initXP)
|
| | | |
| | | |
| | | if atkDistType == ChConfig.AtkDistType_Short:
|
| | | atkBackSkillID = atkBackSkillIDList[0] if len(atkBackSkillIDList) > 0 else 0
|
| | | elif atkDistType == ChConfig.AtkDistType_Long:
|
| | |
| | | skillManager.LearnSkillByID(skillID)
|
| | |
|
| | | batLineup.posObjIDDict[posNum] = objID
|
| | | GameWorld.DebugLog("AddBatObj ID:%s,faction:%s,num=%s,posNum=%s,skill=%s,atk=%s,def=%s,hp=%s" |
| | | % (objID, faction, num, posNum, skillIDList, batObj.GetAtk(), batObj.GetDef(), batObj.GetHP()))
|
| | | GameWorld.DebugLog("AddBatObj ID:%s,faction:%s,num=%s,posNum=%s,skill=%s" % (objID, faction, num, posNum, skillIDList))
|
| | | batObj.InitBatAttr({int(k):v for k, v in attrDict.items()}, initXP)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | if reqType == 2: # 前端主动请求开始关卡小怪的视为从休息中开始
|
| | | __doMainLevelWave(curPlayer, True)
|
| | | elif reqType == 3:
|
| | | __doMainBossStart(curPlayer, tick)
|
| | | __doMainBossStart(curPlayer)
|
| | | elif reqType == 4:
|
| | | __doMainFight(curPlayer, tick)
|
| | | else:
|
| | |
| | | mainFightMgr = GetMainFightMgr(curPlayer)
|
| | | turnFight = mainFightMgr.turnFight
|
| | | if turnFight:
|
| | | turnFight.clearFight()
|
| | | turnFight.exitFight()
|
| | | return
|
| | |
|
| | | def __doSetFightPoint(curPlayer, fightPoint):
|
| | |
| | |
|
| | | turnFight = mainFightMgr.turnFight
|
| | | turnFight.setTurn(mapID, funcLineID, turnMax, False, {"teamNum":teamNum, "teamMax":teamMax})
|
| | | turnFight.setFactionLineup(ChConfig.Def_FactionA, {1:lineupMainInfo}, True)
|
| | | turnFight.setFactionLineup(ChConfig.Def_FactionA, {1:lineupMainInfo})
|
| | | turnFight.setFactionLineup(ChConfig.Def_FactionB, {1:GetNPCLineupInfo(lineupID)})
|
| | | turnFight.sortActionQueue()
|
| | | turnFight.syncInit()
|
| | | turnFight.startFight()
|
| | | return
|
| | |
|
| | | def __doMainBossStart(curPlayer, tick):
|
| | | def __doMainBossStart(curPlayer):
|
| | | ## 开始挑战关卡boss
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | chapterID, levelNum, wave = PlayerControl.GetMainLevelPassInfo(curPlayer)
|
| | |
| | |
|
| | | turnFight = mainFightMgr.turnFight
|
| | | turnFight.setTurn(mapID, funcLineID, turnMax, False, {"teamNum":teamNum, "teamMax":teamMax})
|
| | | turnFight.setFactionLineup(ChConfig.Def_FactionA, {1:lineupMainInfo}, True)
|
| | | turnFight.setFactionLineup(ChConfig.Def_FactionA, {1:lineupMainInfo})
|
| | | turnFight.setFactionLineup(ChConfig.Def_FactionB, {1:GetNPCLineupInfo(lineupID)})
|
| | | turnFight.sortActionQueue()
|
| | | turnFight.syncInit()
|
| | | turnFight.startFight()
|
| | |
|
| | | # 挑战boss无中间过程,每次执行直接挑战一队结果
|
| | | __processTurnFight(turnFight.guid, tick)
|
| | | __processTurnFight(turnFight.guid)
|
| | | return
|
| | |
|
| | | def __doMainFight(curPlayer, tick):
|
| | | ## 主线执行战斗
|
| | | |
| | | # 限制请求CD
|
| | | #if not GameWorld.GetGameWorld().GetDebugLevel():
|
| | | key = "MainFightReqTick"
|
| | | lastTick = curPlayer.GetDictByKey(key)
|
| | | if lastTick and tick - lastTick <= 1000:
|
| | | GameWorld.DebugLog("主线战斗请求CD中")
|
| | | return
|
| | | curPlayer.SetDict(key, tick)
|
| | | |
| | | mainFightMgr = GetMainFightMgr(curPlayer)
|
| | | turnFight = mainFightMgr.turnFight
|
| | |
|
| | |
| | | # 切换小队时,玩家阵容不需要处理,保留状态
|
| | | turnFight.setFactionLineup(ChConfig.Def_FactionB, {1:GetNPCLineupInfo(lineupID)})
|
| | | turnFight.sortActionQueue()
|
| | | turnFight.syncInit()
|
| | | turnFight.startFight()
|
| | |
|
| | | if mainFightMgr.isLevelBoss():
|
| | | # 每次处理一小队的完整战斗,相当于一次完整战报
|
| | | __processTurnFight(turnFight.guid, tick)
|
| | | __processTurnFight(turnFight.guid)
|
| | | return
|
| | | else:
|
| | | __doMainLevelWave(curPlayer, False)
|
| | |
| | |
|
| | | return
|
| | |
|
| | | def __processTurnFight(guid, tick):
|
| | | def __processTurnFight(guid):
|
| | | ## 一次性处理完一个小队的战斗
|
| | | turnFight = GetTurnFightMgr().getTurnFight(guid)
|
| | | curPlayer = turnFight.curPlayer
|
| | |
| | | OnTurnAllOver(turnFight.guid)
|
| | | return
|
| | |
|
| | | #// B4 10 回合制战斗 #tagCMTurnFight
|
| | | #
|
| | | #struct tagCMTurnFight
|
| | | #{
|
| | | # tagHead Head;
|
| | | # DWORD MapID; // 自定义地图ID,可用于绑定战斗地图场景功能(如主线关卡、主线boss、爬塔、竞技场等)
|
| | | # DWORD FuncLineID; // MapID对应的扩展值,如具体某个关卡等
|
| | | # BYTE TagType; // 目标类型,0-NPC阵容,1-玩家
|
| | | # DWORD TagID; // 目标类型对应的ID,如阵容ID或玩家ID
|
| | | # BYTE ValueCount;
|
| | | # DWORD ValueList[ValueCount]; // 附加值列表,可选,具体含义由MapID决定
|
| | | #};
|
| | | def OnTurnFight(index, clientData, tick):
|
| | | #curPlayer = GameWorld.GetPlayerManager().GetPlayerByIndex(index)
|
| | | #mapID = clientData.MapID
|
| | | #funcLineID = clientData.FuncLineID
|
| | | return
|
| | |
|
| | | def GetObjName(batObj):
|
| | | faction = batObj.faction
|
| | | num = batObj.lineupNum
|
| | |
| | | curID = batObj.GetID()
|
| | | buffMgr = batObj.GetBuffManager()
|
| | | GameWorld.DebugLog("更新buff: curID=%s,buffCount=%s" % (curID, buffMgr.GetBuffCount()))
|
| | | for index in range(buffMgr.GetBuffCount()):
|
| | | for index in range(buffMgr.GetBuffCount())[::-1]:
|
| | | buff = buffMgr.GetBuffByIndex(index)
|
| | | curRemainTime = buff.GetRemainTime()
|
| | | if not curRemainTime:
|
| | | # 永久buff不处理
|
| | | continue
|
| | | buffID = buff.GetBuffID()
|
| | | skillID = buff.GetSkillID()
|
| | | updRemainTime = curRemainTime - 1
|
| | | GameWorld.DebugLog(" 更新buff剩余回合数: buffID=%s,updRemainTime=%s" % (buffID, updRemainTime))
|
| | | GameWorld.DebugLog(" 更新buff剩余回合数: buffID=%s,skillID=%s,updRemainTime=%s" % (buffID, skillID, updRemainTime))
|
| | | if updRemainTime > 0:
|
| | | buff.SetRemainTime(curRemainTime - 1)
|
| | | buff.SetRemainTime(updRemainTime)
|
| | | TurnBuff.SyncBuffRefresh(turnFight, batObj, buff)
|
| | | else:
|
| | | TurnBuff.SyncBuffDel(turnFight, batObj, buffID)
|
| | | TurnBuff.DoBuffDel(turnFight, batObj, buff)
|
| | |
|
| | | # SetTimeline(gameObj, turnNum, 0)
|
| | | # # 重置连击、反击数
|
| | |
| | | GameWorld.DebugLog("★回合%s %s 当前状态不可行动!" % (turnNum, objName))
|
| | | return
|
| | |
|
| | | GameWorld.DebugLog("★回合%s %s 行动 : curHP=%s" % (turnNum, objName, curHP))
|
| | | atk = curBatObj.GetAtk()
|
| | | curXP = curBatObj.GetXP()
|
| | | GameWorld.DebugLog("★回合%s %s 行动 : atk=%s,curHP=%s/%s,curXP=%s" % (turnNum, objName, atk, curHP, curBatObj.GetMaxHP(), curXP))
|
| | | turnFight.syncObjAction(turnNum, objID)
|
| | |
|
| | | curXP = curBatObj.GetXP()
|
| | | xpMax = IpyGameDataPY.GetFuncCfg("AngerXP", 2)
|
| | | skillManager = curBatObj.GetSkillManager()
|
| | | useSkillList = []
|
| | |
| | | Def_NPC_Dict_TimeLostHPFightPowerEx = 'TimeLostHPFightPowerEx' # 按时间掉血战力
|
| | |
|
| | | #玩家状态定义,不能超过31个,如超过,需扩展多个key支持
|
| | | BatObjStateList = (
|
| | | BatObjState_Normal, # 无 0
|
| | | BatObjState_Freezed, # 定身状态 1
|
| | | BatObjState_Slow, # 减速状态 2
|
| | | BatObjState_LoseBlood, # 持续掉血状态 3
|
| | | BatObjState_Shield, # 麒麟佑身4
|
| | | BatObjState_DamBackShield, # 东皇附体5
|
| | | BatObjState_Sneer, # 嘲讽 6
|
| | | BatObjState_Stun, # 晕眩状态 7
|
| | | BatObjState_AddAtk, # 加攻状态 8
|
| | | BatObjState_WeakDef, # 减防状态 9
|
| | | BatObjState_LimitSkill, # 禁魔状态 10
|
| | | BatObjState_LimitAddHP, # 禁疗状态 11
|
| | | BatObjState_Blind, # 致盲状态 12
|
| | | BatObjState_Burn, # 灼烧 13
|
| | | BatObjState_LoseBlood2, # 职业2持续掉血状态 14
|
| | | BatObjState_LoseBlood3, # 职业3持续掉血状态 15
|
| | | BatObjState_MissSneerAtk, # 对嘲讽攻击免疫表现为miss 16
|
| | | BatObjState_BeInAir, # 浮空(做法同眩晕类) 17
|
| | | BatObjState_zqdlj, # 紫气东来金灵根技能状态 18
|
| | | BatObjState_Ice, # 寒冰状态(同减速) 19
|
| | | ) = range(20)
|
| | |
|
| | | #玩家状态定义,不能超过31个,如超过,需扩展多个key支持
|
| | | Def_PlayerStateList = (
|
| | | Def_PlayerState_Normal, # 无 0
|
| | | Def_PlayerState_Freezed, # 定身状态 1
|
| | |
| | | #"""Version = 2025-07-02 17:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import BattleObj
|
| | | import TurnAttack
|
| | | import PyGameData
|
| | | import ShareDefine
|
| | |
| | | self.olPlayer = None
|
| | | self.shapeType = 0
|
| | | self.heroItemDict = {} # 阵容武将背包索引信息 {itemIndex:posNum, ...}
|
| | | self.lineupChange = False # 是否已变更阵容标记,在刷新属性后重置标记
|
| | | self.__refreshState = 0 # 刷属性标记, 0-不需要刷新了,1-需要刷新
|
| | |
|
| | | self.__freeLineupHeroObjs = [] # 释放的空闲对象[LineupHero, ...]
|
| | |
| | | @param shapeType: 阵型
|
| | | @param refreshForce: 是否强制刷属性
|
| | | '''
|
| | | self.lineupChange = True
|
| | | self.shapeType = shapeType
|
| | | self.heroItemDict = heroItemDict
|
| | | GameWorld.DebugLog("更新阵容: lineupID=%s,%s" % (self.lineupID, heroItemDict), self.playerID)
|
| | |
| | | if not self.__refreshState:
|
| | | return False
|
| | | doRefreshLineupAttr(self.olPlayer.curPlayer, self.olPlayer, self)
|
| | | self.lineupChange = False
|
| | | self.__refreshState = 0
|
| | | return True
|
| | |
|
| | |
| | | return
|
| | |
|
| | | def OnClear(self):
|
| | | self.mainFight.turnFight.clearFight()
|
| | | self.mainFight.turnFight.exitFight()
|
| | | return
|
| | |
|
| | | def SetPlayer(self, curPlayer):
|
| | |
| | | # 计算战力
|
| | | fightPower = FormulaControl.Eval("fightPowerFormula", fightPowerFormula, fightPowerParamDict)
|
| | |
|
| | | GameWorld.DebugLog(" fightPower=%s,heroSkillIDList=%s" % (fightPower, lineupHero.heroSkillIDList))
|
| | | GameWorld.DebugLog(" fightPower=%s,heroSkillIDList=%s" % (fightPower, lineupHero.heroSkillIDList), playerID)
|
| | | skillTypeIDDict = {}
|
| | | for skillID in lineupHero.heroSkillIDList:
|
| | | skillData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
|
| | |
| | | skillID = skillData.GetSkillID()
|
| | | lineupHero.heroSkillIDList.append(skillID)
|
| | | skillFightPower += skillData.GetFightPower()
|
| | | GameWorld.DebugLog(" skillFightPower=%s,heroSkillIDList=%s" % (skillFightPower, lineupHero.heroSkillIDList))
|
| | | GameWorld.DebugLog(" skillFightPower=%s,heroSkillIDList=%s" % (skillFightPower, lineupHero.heroSkillIDList), playerID)
|
| | |
|
| | | # 最终战力
|
| | | fightPowerTotal = fightPower + skillFightPower
|
| | |
| | | lineup.fightPower = lineupFightPower
|
| | | GameWorld.DebugLog(" 阵容最终战力: lineupID=%s,lineupFightPower=%s" % (lineupID, lineupFightPower), playerID)
|
| | |
|
| | | # 更新排行榜
|
| | | # 非主线阵容不处理以下内容
|
| | | if lineupID != ShareDefine.Lineup_Main:
|
| | | return
|
| | |
|
| | | PlayerControl.SetFightPower(curPlayer, lineupFightPower)
|
| | |
|
| | | mainFightMgr = TurnAttack.GetMainFightMgr(curPlayer)
|
| | | mainTurnFight = mainFightMgr.turnFight
|
| | | # 主线战斗如果有在战斗中,实时更新
|
| | | if mainTurnFight and mainTurnFight.isInFight():
|
| | | # 如果是阵容变化的,重新开始战斗
|
| | | if lineup.lineupChange:
|
| | | GameWorld.DebugLog("主阵容变化,重新开始战斗", playerID)
|
| | | if mainTurnFight.mapID == ChConfig.Def_FBMapID_Main:
|
| | | TurnAttack.__doMainLevelWave(curPlayer, True)
|
| | | elif mainTurnFight.mapID == ChConfig.Def_FBMapID_MainBoss:
|
| | | TurnAttack.__doMainBossStart(curPlayer)
|
| | | |
| | | # 否则只重新设置战斗属性
|
| | | else:
|
| | | GameWorld.DebugLog("主阵容卡牌属性变更,更新战斗武将属性", playerID)
|
| | | # lineup 为卡牌的阵容,仅有阵容属性相关,没有战斗对象
|
| | | # batLineup 为卡牌阵容体现到具体战斗的战斗阵容,有具体的战斗对象
|
| | | faction, num = ChConfig.Def_FactionA, 1 # 主线战斗玩家自己默认阵营A的第1个战斗阵容
|
| | | batLineup = mainTurnFight.getBatFaction(faction).getBatlineup(num)
|
| | | batObjMgr = BattleObj.GetBatObjMgr()
|
| | | for posNum, objID in batLineup.posObjIDDict.items():
|
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | lineupHero = lineup.GetLineupHero(posNum)
|
| | | if lineupHero.heroBatAttrDict:
|
| | | batObj.UpdInitBatAttr(lineupHero.heroBatAttrDict)
|
| | | else:
|
| | | GameWorld.DebugLog("主阵容没有在战斗中,不需要处理", playerID)
|
| | | |
| | | # 更新排行榜
|
| | | |
| | | return
|
| | |
| | | import ChConfig
|
| | | import GameWorld
|
| | | import ChPyNetSendPack
|
| | | import SkillCommon
|
| | | import TurnBuffs
|
| | | import ObjPool
|
| | |
|
| | | GameWorld.ImportAll("Script\\Skill\\", "TurnBuffs")
|
| | |
|
| | | def OnAddBuff(turnFight, batObj, curSkill, buffOwner=None):
|
| | | skillID = curSkill.GetSkillID()
|
| | | enhanceBySkill = curSkill.GetEnhanceBySkill()
|
| | | relatedSkillID = enhanceBySkill.GetSkillID() if enhanceBySkill else 0
|
| | | bySkill = curSkill.GetBySkill()
|
| | | relatedSkillID = bySkill.GetSkillID() if bySkill else 0
|
| | | curID = batObj.GetID()
|
| | | ownerID = buffOwner.GetID() if buffOwner else curID
|
| | | GameWorld.DebugLog("OnAddBuff: curID=%s,skillID=%s,ownerID=%s,relatedSkillID=%s" % (curID, skillID, ownerID, relatedSkillID))
|
| | | #检查是否几率触发
|
| | | if not enhanceBySkill:
|
| | | #检查是否几率触发,附加技能、被动触发的外层已检查过概率,不重复检查
|
| | | if not (curSkill.GetIsEnhanceSkill() or SkillCommon.isPassiveTriggerSkill(curSkill)):
|
| | | rate = curSkill.GetHappenRate()
|
| | | if rate and rate != ChConfig.Def_MaxRateValue and not GameWorld.CanHappen(rate, ChConfig.Def_MaxRateValue):
|
| | | GameWorld.DebugLog(" 概率不触发buff!")
|
| | |
| | | buff.SetRemainTime(curSkill.GetLastTime())
|
| | | #buff.SetLayer()
|
| | | SyncBuffRefresh(turnFight, batObj, buff, relatedSkillID)
|
| | | |
| | | DoBuffAddOver(turnFight, batObj, curSkill, buff, buffOwner)
|
| | | return True
|
| | |
|
| | | def SyncBuffRefresh(turnFight, curBatObj, curBuff, relatedSkillID=0):
|
| | |
| | | clientPack.RelatedSkillID = relatedSkillID
|
| | | turnFight.addBatPack(clientPack)
|
| | | return
|
| | |
|
| | | def DoBuffAddOver(turnFight, batObj, curSkill, addBuff, buffOwner=None):
|
| | | ## buff添加成功后处理
|
| | | |
| | | isRefreshAttr = False # 是否刷属性
|
| | | skillData = addBuff.GetSkillData()
|
| | | # buff效果加入
|
| | | for effectIndex in range(0, skillData.GetEffectCount()):
|
| | | curEffect = skillData.GetEffect(effectIndex)
|
| | | effectID = curEffect.GetEffectID()
|
| | | if effectID == 0:
|
| | | continue
|
| | | |
| | | if effectID in ChConfig.AttrIDList:
|
| | | isRefreshAttr = True
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(TurnBuffs, "Buff_%d.%s" % (effectID, "OnBuffAddOver"))
|
| | | if callFunc:
|
| | | GameWorld.DebugLog("OnBuffAddOver, objID=%s,buffID=%s,effectID=%s" % (batObj.GetID(), addBuff.GetBuffID(), effectID))
|
| | | callFunc(turnFight, batObj, curSkill, addBuff, curEffect, buffOwner)
|
| | | |
| | | #被动触发的
|
| | | #triggerType = PassiveBuffEffMng.GetBuffTriggerTypeByEffectID(effectID)
|
| | | #if triggerType == -1:
|
| | | # continue
|
| | | #passiveEff = PassiveBuffEffMng.GetPassiveEffManager().InitObjPassiveEff(curObj)
|
| | | #passiveEff.AddBuffInfoByEffect(curEffect, skillID, onwerID, onwerType)
|
| | | |
| | | if isRefreshAttr:
|
| | | RefreshBuffAttr(batObj)
|
| | | |
| | | return
|
| | |
|
| | | def DoBuffDel(turnFight, batObj, curBuff):
|
| | | ## 删除buff
|
| | | |
| | | buffMgr = batObj.GetBuffManager()
|
| | | buffID = curBuff.GetBuffID()
|
| | | skillData = curBuff.GetSkillData()
|
| | | #buff消失的触发
|
| | | for effectIndex in range(0, skillData.GetEffectCount()):
|
| | | curEffect = skillData.GetEffect(effectIndex)
|
| | | effectID = curEffect.GetEffectID()
|
| | | |
| | | if not effectID:
|
| | | continue
|
| | | |
| | | callFunc = GameWorld.GetExecFunc(TurnBuffs, "Buff_%d.%s" % (effectID, "OnBuffDel"))
|
| | | |
| | | if callFunc:
|
| | | callFunc(turnFight, batObj, curBuff, curEffect)
|
| | | |
| | | #passiveEff = PassiveBuffEffMng.GetPassiveEffManager().GetPassiveEff(curObj)
|
| | | #if passiveEff:
|
| | | # passiveEff.DelBuffInfo(skillData)
|
| | | |
| | | # 最后删除buff、通知
|
| | | buffMgr.DelBuff(buffID)
|
| | | SyncBuffDel(turnFight, batObj, buffID)
|
| | | return
|
| | |
|
| | | def RefreshBuffAttr(batObj):
|
| | | ''' 刷新buff属性,如果有涉及到buff属性变更的,只能全部buff重新刷
|
| | | '''
|
| | | |
| | | objID = batObj.GetID()
|
| | | befHP = batObj.GetHP()
|
| | | befMaxHP = batObj.GetMaxHP()
|
| | | |
| | | batAttrDict = batObj.ResetBattleEffect()
|
| | | |
| | | GameWorld.DebugLog("RefreshBuffAttr ID:%s,atk=%s,def=%s,hp=%s/%s,batAttrDict=%s" |
| | | % (objID, batObj.GetAtk(), batObj.GetDef(), befHP, befMaxHP, batAttrDict))
|
| | | |
| | | # buff
|
| | | buffAttrDict = {} # buff属性 {attrID:value, } value可能是负值
|
| | | buffMgr = batObj.GetBuffManager()
|
| | | for index in range(buffMgr.GetBuffCount()):
|
| | | buff = buffMgr.GetBuffByIndex(index)
|
| | | skillData = buff.GetSkillData()
|
| | | for eIndex in range(skillData.GetEffectCount()):
|
| | | effect = skillData.GetEffect(eIndex)
|
| | | effID = effect.GetEffectID()
|
| | | if effID not in ChConfig.AttrIDList:
|
| | | continue
|
| | | attrID = effID
|
| | | attrValue = effect.GetEffectValue(0)
|
| | | calcType = effect.GetEffectValue(1)
|
| | | if calcType == 2: # 减少,其他默认增加
|
| | | attrValue = -attrValue
|
| | | buffAttrDict[attrID] = buffAttrDict.get(attrID, 0) + attrValue
|
| | | |
| | | GameWorld.DebugLog(" __addBuffAttr buffAttrDict=%s" % buffAttrDict)
|
| | | |
| | | objID = batObj.GetID()
|
| | | # 先计算百分比加成或降低的
|
| | | perIDList = ChConfig.AttrPerDict.values()
|
| | | for attrID, attrPerID in ChConfig.AttrPerDict.items():
|
| | | if attrPerID not in buffAttrDict:
|
| | | continue
|
| | | attrPerValue = buffAttrDict[attrPerID] # 可能是负值
|
| | | attrValue = batObj.GetBatAttrValue(attrID, False)
|
| | | if attrValue <= 0:
|
| | | continue
|
| | | updValue = int(attrValue * (10000 + attrPerValue) / 10000.0)
|
| | | updValue = max(0, updValue) # 最多减到0,最大无上限
|
| | | batObj.SetBatAttrValue(attrID, updValue)
|
| | | GameWorld.DebugLog(" attrID=%s(PerID:%s),attrValue=%s(PerValue:%s),updValue=%s" % (attrID, attrPerID, attrValue, attrPerValue, updValue))
|
| | | |
| | | # 再累加非百分比的固定值
|
| | | for attrID, addValue in buffAttrDict.items():
|
| | | if attrID in perIDList:
|
| | | continue
|
| | | attrValue = batObj.GetBatAttrValue(attrID, False)
|
| | | updValue = max(0, attrValue + addValue) # 最多减到0,最大无上限
|
| | | batObj.SetBatAttrValue(attrID, updValue)
|
| | | GameWorld.DebugLog(" attrID=%s,attrValue=%s,addValue=%s,updValue=%s" % (attrID, attrValue, addValue, updValue))
|
| | | |
| | | aftHP = batObj.GetHP()
|
| | | aftMaxHP = batObj.GetMaxHP()
|
| | | if aftMaxHP != befMaxHP:
|
| | | batObj.SetMaxHP(aftMaxHP, True)
|
| | | if befHP and aftMaxHP > befMaxHP:
|
| | | aftHP += (aftMaxHP - befMaxHP)
|
| | | batObj.SetHP(aftHP, True)
|
| | | GameWorld.DebugLog(" befHP=%s/%s, aftHP=%s/%s" % (befHP, befMaxHP, aftHP, aftMaxHP))
|
| | | GameWorld.DebugLog(" 最终属性 ID:%s,atk=%s,def=%s,hp=%s/%s" % (objID, batObj.GetAtk(), batObj.GetDef(), aftHP, aftMaxHP))
|
| | | return
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Skill.TurnBuff.Buff_4012
|
| | | #
|
| | | # @todo:影响玩家状态效果
|
| | | # @author hxp
|
| | | # @date 2025-08-12
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 影响玩家状态效果
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-08-12 17:30"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | def OnBuffAddOver(turnFight, batObj, curSkill, addBuff, curEffect, buffOwner):
|
| | | stateType = curEffect.GetEffectValue(0)
|
| | | batObj.GetBuffManager().AddBuffState(stateType, addBuff.GetBuffID())
|
| | | |
| | | #curObj.SetDict("CurPyPlayerState", stateType)
|
| | | #PassiveBuffEffMng.OnPassiveSkillTrigger(curObj, None, None, ChConfig.TriggerType_BuffState, tick) |
| | | #buffOwner = SkillCommon.GetBuffOwner(addBuff)
|
| | | #if buffOwner:
|
| | | # PassiveBuffEffMng.OnPassiveSkillTrigger(buffOwner, curObj, None, ChConfig.TriggerType_TagBuffState, tick)
|
| | | return
|
| | |
|
| | | def OnBuffDel(turnFight, batObj, curBuff, curEffect):
|
| | | stateType = curEffect.GetEffectValue(0)
|
| | | batObj.GetBuffManager().DelBuffState(stateType, curBuff.GetBuffID())
|
| | | return
|
New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Skill.TurnPassive
|
| | | #
|
| | | # @todo:回合被动触发管理
|
| | | # @author hxp
|
| | | # @date 2025-8-11
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 回合被动管理,主要被动触发的技能、buff等管理
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-8-11 下午3:47:07"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | | import PassiveTrigger
|
| | |
|
| | | GameWorld.ImportAll("Script\\Skill\\", "PassiveTrigger")
|
| | |
|
| | |
|
| | | def RefreshPassive(batObj):
|
| | | return |
| | |
| | | ## 是否无视防御
|
| | | return useSkill.GetHurtType() / 10 == 1 # 2为真伤,待扩展
|
| | |
|
| | | def OnUseSkill(turnFight, curBatObj, useSkill, tagObjList=None, batType=ChConfig.TurnBattleType_Normal, enhanceBySkill=None):
|
| | | def OnUseSkill(turnFight, curBatObj, useSkill, tagObjList=None, batType=ChConfig.TurnBattleType_Normal, bySkill=None, isEnhanceSkill=False):
|
| | | '''使用技能通用入口
|
| | | @param useSkill: 使用的技能,注意并不一定是身上的技能,可能只是 SkillData 表数据
|
| | | @param enhanceBySkill: 由哪个主技能额外触发的
|
| | | @param bySkill: 由哪个技能额外触发的,比如附加触发的技能或被动技能均可能由某个技能触发
|
| | | @param isEnhanceSkill: 是否附加触发的技能,即主技能的EnhanceSkillList字段中的技能
|
| | | @return: 是否成功
|
| | | '''
|
| | | if not useSkill:
|
| | |
| | | tagCount = useSkill.GetTagCount()
|
| | | tagObjList = GetSkillTags(turnFight, curBatObj, tagAim, tagFriendly, tagAffect, tagCount)
|
| | |
|
| | | enhanceBySkillID = enhanceBySkill.GetSkillID() if enhanceBySkill else 0
|
| | | GameWorld.DebugLog("使用技能: curID=%s,skillID=%s,tagCnt=%s,batType=%s,enhanceBySkill=%s" |
| | | % (curBatObj.GetID(), skillID, len(tagObjList), batType, enhanceBySkillID))
|
| | | bySkillID = bySkill.GetSkillID() if bySkill else 0
|
| | | GameWorld.DebugLog("使用技能: curID=%s,skillID=%s,tagCnt=%s,batType=%s,bySkillID=%s,isEnhanceSkill=%s" |
| | | % (curBatObj.GetID(), skillID, len(tagObjList), batType, bySkillID, isEnhanceSkill))
|
| | | if not tagObjList:
|
| | | # 可扩展其他目标选择,如复活技能没有死亡单位时则使用另外的效果
|
| | | return
|
| | |
| | |
|
| | | useSkill.SetTagObjList(tagObjList)
|
| | | useSkill.SetBatType(batType)
|
| | | useSkill.SetEnhanceBySkill(enhanceBySkill)
|
| | | useSkill.SetBySkill(bySkill)
|
| | | useSkill.SetIsEnhanceSkill(isEnhanceSkill)
|
| | | useSkill.ClearHurtObj()
|
| | |
|
| | | curBatObj.ClearSkillTempAttr()
|
| | |
| | |
|
| | | objID = curBatObj.GetID()
|
| | | useTag = ""
|
| | | if not enhanceBySkill:
|
| | | if not isEnhanceSkill:
|
| | | # 因为可能触发连击,所以标记需带上累计使用技能次数,确保唯一
|
| | | useTag = "Skill_%s_%s_%s" % (objID, skillID, curBatObj.GetSkillUseCnt(skillID) + 1)
|
| | | clientPack = poolMgr.acquire(ChPyNetSendPack.tagSCTurnFightTag)
|
| | |
| | | clientPack.Sign = 1
|
| | | turnFight.addBatPack(clientPack)
|
| | |
|
| | | # 最后重置、清空回收对象池
|
| | | # 最后重置、回收对象
|
| | | useSkill.SetTagObjList([])
|
| | | useSkill.SetEnhanceBySkill(None) # 需重置,防止主技能被误回收
|
| | | useSkill.SetBySkill(None) # 需重置,防止被误回收
|
| | | useSkill.SetIsEnhanceSkill(False)
|
| | | useSkill.ClearHurtObj()
|
| | | if usePoolSkill:
|
| | | poolMgr.release(useSkill)
|
| | |
| | | # 血量最低
|
| | | if tagAffect == ChConfig.SkillTagAffect_HPLowest:
|
| | | aimObjList.sort(key=lambda o:(o.GetHP()), reverse=False)
|
| | | #GameWorld.DebugLog("血量最低排序: %s" % [[o.GetID(), o.GetHP(), o.GetMaxHP()] for o in aimObjList])
|
| | | aimObjList = aimObjList[:tagCount]
|
| | | |
| | | |
| | | # 血量最高
|
| | | elif tagAffect == ChConfig.SkillTagAffect_HPHighest:
|
| | | aimObjList.sort(key=lambda o:(o.GetHP()), reverse=True)
|
| | | #GameWorld.DebugLog("血量最高排序: %s" % [[o.GetID(), o.GetHP(), o.GetMaxHP()] for o in aimObjList])
|
| | | aimObjList = aimObjList[:tagCount]
|
| | |
|
| | | else:
|
| | |
| | |
|
| | | curID = curBatObj.GetID()
|
| | | skillID = useSkill.GetSkillID()
|
| | | enhanceBySkill = useSkill.GetEnhanceBySkill()
|
| | | relatedSkillID = enhanceBySkill.GetSkillID() if enhanceBySkill else 0
|
| | | bySkill = useSkill.GetBySkill()
|
| | | relatedSkillID = bySkill.GetSkillID() if bySkill else 0
|
| | |
|
| | | effIDNum = useSkill.FindEffectID(ChConfig.Def_Skill_Effect_Anger)
|
| | | angerPer = useSkill.GetEffectValue(effIDNum, 0) # 最大值的百分比,万分率
|
| | | angerValue = useSkill.GetEffectValue(effIDNum, 1) # 固定值
|
| | | calcType = useSkill.GetEffectValue(effIDNum, 2) # 计算方式(1增 2减 3偷)
|
| | | angerPer, angerValue, calcType = 0, 0, 0
|
| | | effect = SkillCommon.GetSkillEffectByEffectID(useSkill, ChConfig.Def_Skill_Effect_Anger)
|
| | | if effect:
|
| | | angerPer = effect.GetEffectValue(0)
|
| | | angerValue = effect.GetEffectValue(1)
|
| | | calcType = effect.GetEffectValue(2)
|
| | | xpMax = IpyGameDataPY.GetFuncCfg("AngerXP", 2)
|
| | | calcValue = int(xpMax * angerPer / 10000.0 + angerValue)
|
| | | attrID = ChConfig.AttrID_XP
|
| | |
| | | skillID = useSkill.GetSkillID()
|
| | | curBatObj.AddSkillUseCnt(skillID)
|
| | |
|
| | | # 需先通知伤血 - 前端按顺序优先表现主技能内容,
|
| | | enhanceBySkill = useSkill.GetEnhanceBySkill()
|
| | | if not enhanceBySkill:
|
| | | # 需先通知伤血 - 前端按顺序优先表现技能释放内容,
|
| | | isEnhanceSkill = useSkill.GetIsEnhanceSkill()
|
| | | if not isEnhanceSkill or len(useSkill.GetHurtObjList()):
|
| | | Sync_UseSkill(turnFight, curBatObj, useSkill)
|
| | | if not isEnhanceSkill:
|
| | | __doCostZhanchui(turnFight, curBatObj, useSkill)
|
| | | __doSkillUserAnger(turnFight, curBatObj, useSkill)
|
| | |
|
| | |
| | | killObjIDList = [] # 击杀的目标ID列表
|
| | | for tagObj in useSkill.GetTagObjList():
|
| | | tagID = tagObj.GetID()
|
| | | hurtObj = useSkill.GetHurtObj(tagID)
|
| | | if hurtObj and not hurtObj.HaveHurtType(ChConfig.HurtTYpe_Recovery):
|
| | | __doSkillHurtAnger(tagObj, hurtObj.GetLostHP(), useSkill)
|
| | | # 可能单个技能对同一目标造成多次伤害,所以这里遍历,如弹射等
|
| | | for hurtObj in useSkill.GetHurtObjList():
|
| | | if hurtObj.GetObjID() == tagID and not hurtObj.HaveHurtType(ChConfig.HurtTYpe_Recovery):
|
| | | __doSkillHurtAnger(tagObj, hurtObj.GetLostHP(), useSkill)
|
| | | if tagObj.GetHP() <= 0:
|
| | | killObjIDList.append(tagID)
|
| | | TurnAttack.SetObjKilled(turnFight, tagObj, curBatObj, useSkill)
|
| | |
| | | return
|
| | |
|
| | | def __doUseEnhanceSkill(turnFight, curBatObj, useSkill):
|
| | | if useSkill.GetEnhanceBySkill():
|
| | | if useSkill.GetIsEnhanceSkill():
|
| | | GameWorld.DebugLog("自身为额外触发的技能不再触发额外技能! skillID=%s" % useSkill.GetSkillID())
|
| | | return
|
| | | enhanceSkillIDList = useSkill.GetEnhanceSkillList()
|
| | |
| | | if tagObj.GetHP() <= 0:
|
| | | GameWorld.DebugLog(" 已被击杀不触发: tagID=%s" % (tagID))
|
| | | continue
|
| | | hurtObj = useSkill.GetHurtObj(tagID)
|
| | | if not hurtObj:
|
| | | inHurt = False
|
| | | for hurtObj in useSkill.GetHurtObjList():
|
| | | if hurtObj.GetObjID() != tagID:
|
| | | continue
|
| | | if not hurtObj.GetHurtHP() or hurtObj.HaveHurtType(ChConfig.HurtType_Miss):
|
| | | continue
|
| | | inHurt = True
|
| | | break
|
| | | if not inHurt:
|
| | | GameWorld.DebugLog(" 没有伤血不触发: tagID=%s" % (tagID))
|
| | | continue
|
| | | if hurtObj.HaveHurtType(ChConfig.HurtType_Miss):
|
| | | GameWorld.DebugLog(" 闪避的对象不再触发技能: tagID=%s,enhanceSkillID=%s" % (tagID, enhanceSkillID))
|
| | | continue
|
| | | if enhanceRate and enhanceRate != ChConfig.Def_MaxRateValue and not GameWorld.CanHappen(enhanceRate, ChConfig.Def_MaxRateValue):
|
| | | GameWorld.DebugLog(" 概率不触发: tagID=%s,enhanceRate=%s" % (tagID, enhanceRate))
|
| | |
| | | enchanceTagObjList.append(tagObj)
|
| | |
|
| | | if enchanceTagObjList:
|
| | | OnUseSkill(turnFight, curBatObj, enhanceSkillData, enchanceTagObjList, enhanceBySkill=useSkill)
|
| | | OnUseSkill(turnFight, curBatObj, enhanceSkillData, enchanceTagObjList, bySkill=useSkill, isEnhanceSkill=True)
|
| | |
|
| | | continue
|
| | |
|
| | | GameWorld.DebugLog(" 额外触发技能,重新锁定目标! enhanceSkillID=%s" % enhanceSkillID)
|
| | | OnUseSkill(turnFight, curBatObj, enhanceSkillData, enhanceBySkill=useSkill)
|
| | | OnUseSkill(turnFight, curBatObj, enhanceSkillData, bySkill=useSkill, isEnhanceSkill=True)
|
| | |
|
| | | return
|
| | |
|
| | |
| | | defID = defObj.GetID()
|
| | | hurtObj = curSkill.AddHurtObj(defID)
|
| | |
|
| | | #检查是否几率触发
|
| | | if not curSkill.GetEnhanceBySkill(): # 额外触发的技能概率在触发时判断
|
| | | #检查是否几率触发,附加技能、被动触发的外层已检查过概率,不重复检查
|
| | | if not (curSkill.GetIsEnhanceSkill() or SkillCommon.isPassiveTriggerSkill(curSkill)): # 额外触发的技能概率在触发时判断
|
| | | rate = curSkill.GetHappenRate()
|
| | | if rate and rate != ChConfig.Def_MaxRateValue and not GameWorld.CanHappen(rate, ChConfig.Def_MaxRateValue):
|
| | | #GameWorld.Log('检查是否几率触发 = %s失败 = %s'%(rate, useSkill.GetSkillName()))
|
| | |
| | | hurtObj.SetCurHP(defObj.GetHP())
|
| | | return hurtObj
|
| | |
|
| | | atkEffIDNum = curSkill.FindEffectID(ChConfig.Def_Skill_Effect_Attack)
|
| | | effect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_Attack)
|
| | | atkSkillValue = 0
|
| | | atkSkillPer = curSkill.GetEffectValue(atkEffIDNum, 0)
|
| | | atkSkillPer = effect.GetEffectValue(0) if effect else 0
|
| | |
|
| | | dHP = defObj.GetHP() # 防守方当前血量
|
| | | dMaxHP = defObj.GetMaxHP() # 防守方最大血量
|
| | |
| | | mustHit = False
|
| | | if isAngerSkill:
|
| | | mustHit = True
|
| | | GameWorld.DebugLog(" XP必命中")
|
| | | curXP = atkObj.GetXP()
|
| | | angerOverflow = max(atkObj.GetXP() - IpyGameDataPY.GetFuncCfg("AngerXP", 2), 0)
|
| | | GameWorld.DebugLog("XP必命中! curXP=%s,angerOverflow=%s" % (curXP, angerOverflow))
|
| | |
|
| | | #命中公式 攻击方类型不同,公式不同
|
| | | if not mustHit:
|
| | | aMissRateDef = atkObj.GetAttrValue(ChConfig.AttrID_MissRateDef) #atkObj.GetHit() # 抗闪避率 - 命中
|
| | | dMissRate = defObj.GetAttrValue(ChConfig.AttrID_MissRate) # 闪避率
|
| | | aMissRateDef = atkObj.GetBatAttrValue(ChConfig.AttrID_MissRateDef) #atkObj.GetHit() # 抗闪避率 - 命中
|
| | | dMissRate = defObj.GetBatAttrValue(ChConfig.AttrID_MissRate) # 闪避率
|
| | | missNum = defObj.GetDictByKey(ChConfig.Def_Obj_Dict_TurnMissNum)
|
| | | missRate = eval(IpyGameDataPY.GetFuncCompileCfg("MissCfg", 1))
|
| | | if GameWorld.CanHappen(missRate):
|
| | |
| | | #参与运算的数值
|
| | | rand = random.random() #种子数 0~1
|
| | |
|
| | | aAtk = atkObj.GetAttrValue(ChConfig.AttrID_Atk) # 攻击方最大攻击
|
| | | aAtk = atkObj.GetBatAttrValue(ChConfig.AttrID_Atk) # 攻击方最大攻击
|
| | |
|
| | | dHP = defObj.GetHP()
|
| | | dDef = 0 if ignoreDef else defObj.GetAttrValue(ChConfig.AttrID_Def) # 防守方防御力
|
| | | dDef = 0 if ignoreDef else defObj.GetBatAttrValue(ChConfig.AttrID_Def) # 防守方防御力
|
| | |
|
| | | aFinalDamPer = atkObj.GetAttrValue(ChConfig.AttrID_FinalDamPer) # 最终加成
|
| | | dFinalDamPerDef = defObj.GetAttrValue(ChConfig.AttrID_FinalDamPerDef) # 最终减伤
|
| | | aFinalDamPer = atkObj.GetBatAttrValue(ChConfig.AttrID_FinalDamPer) # 最终加成
|
| | | dFinalDamPerDef = defObj.GetBatAttrValue(ChConfig.AttrID_FinalDamPerDef) # 最终减伤
|
| | |
|
| | | aNormalSkillPer, dNormalSkillPerDef = 0, 0
|
| | | if isTurnNormalSkill:
|
| | | aNormalSkillPer = atkObj.GetAttrValue(ChConfig.AttrID_NormalSkillPer) # 普技增伤
|
| | | dNormalSkillPerDef = defObj.GetAttrValue(ChConfig.AttrID_NormalSkillPerDef) # 普技减伤
|
| | | aNormalSkillPer = atkObj.GetBatAttrValue(ChConfig.AttrID_NormalSkillPer) # 普技增伤
|
| | | dNormalSkillPerDef = defObj.GetBatAttrValue(ChConfig.AttrID_NormalSkillPerDef) # 普技减伤
|
| | |
|
| | | aAngerSkillPer, dAngerSkillPerDef = 0, 0
|
| | | if isAngerSkill:
|
| | | aAngerSkillPer = atkObj.GetAttrValue(ChConfig.AttrID_AngerSkillPer) # 普技增伤
|
| | | dAngerSkillPerDef = defObj.GetAttrValue(ChConfig.AttrID_AngerSkillPerDef) # 普技减伤
|
| | | aAngerSkillPer = atkObj.GetBatAttrValue(ChConfig.AttrID_AngerSkillPer) # 普技增伤
|
| | | dAngerSkillPerDef = defObj.GetBatAttrValue(ChConfig.AttrID_AngerSkillPerDef) # 普技减伤
|
| | |
|
| | | # 物法增减伤
|
| | | if pmType == IPY_GameWorld.ghtMag: # 法伤
|
| | | aPMDamPer = atkObj.GetAttrValue(ChConfig.AttrID_MagDamPer)
|
| | | dPMDamPerDef = defObj.GetAttrValue(ChConfig.AttrID_MagDamPerDef)
|
| | | aPMDamPer = atkObj.GetBatAttrValue(ChConfig.AttrID_MagDamPer)
|
| | | dPMDamPerDef = defObj.GetBatAttrValue(ChConfig.AttrID_MagDamPerDef)
|
| | | else: # 物伤
|
| | | aPMDamPer = atkObj.GetAttrValue(ChConfig.AttrID_PhyDamPer) |
| | | dPMDamPerDef = defObj.GetAttrValue(ChConfig.AttrID_PhyDamPerDef)
|
| | | aPMDamPer = atkObj.GetBatAttrValue(ChConfig.AttrID_PhyDamPer) |
| | | dPMDamPerDef = defObj.GetBatAttrValue(ChConfig.AttrID_PhyDamPerDef)
|
| | |
|
| | | # 所有万分率参数统一除10000.0
|
| | | atkSkillPer /= 10000.0
|
| | |
| | | remainHP = atkObj.GetHP() - bounceHP # 反弹允许弹到负值,如果最终吸血没有吸到正值则算死亡
|
| | | hurtObj.SetBounceHP(bounceHP)
|
| | | atkObj.SetHP(remainHP)
|
| | | GameWorld.DebugLog(" 反弹伤害=%s,remainHP=%s" % (bounceHP, remainHP))
|
| | | GameWorld.DebugLog(" 反弹伤害=%s,remainHP=%s/%s" % (bounceHP, remainHP, atkObj.GetMaxHP()))
|
| | |
|
| | | TurnAttack.AddTurnObjHurtValue(defObj, atkObj, bounceHP, bounceHP, isBounce=True)
|
| | | return
|
| | |
| | | ''' 计算治疗值
|
| | | '''
|
| | | cureBaseValue = 0 #治疗基础值
|
| | | effIDNum = curSkill.FindEffectID(ChConfig.Def_Skill_Effect_Cure)
|
| | | skillPer = curSkill.GetEffectValue(effIDNum, 0)
|
| | | cureType = curSkill.GetEffectValue(effIDNum, 1)
|
| | | effect = SkillCommon.GetSkillEffectByEffectID(curSkill, ChConfig.Def_Skill_Effect_Cure)
|
| | | skillPer = effect.GetEffectValue(0) if effect else 0
|
| | | cureType = effect.GetEffectValue(1) if effect else 0
|
| | |
|
| | | #获得基础治疗值
|
| | | if cureType == ChConfig.Def_Cure_Attack:
|