129 【战斗】战斗系统-服务端(何太后技能;优化孙坚技能buff额外属性逻辑;增加技能计算伤害类型6-按自残血量值;增加效果7008 5021 5022;)
| | |
| | | self._value2 = 0
|
| | | self._value3 = 0
|
| | | self._isCopy = 0 # 是否复制的buff
|
| | | self._effExDict = {} # 效果ID额外数值 {effID:value, ...} # 计算方式取决于本buff技能中属性效果ID的配置
|
| | | return
|
| | |
|
| | | def onRelease(self):
|
| | |
| | | def SetValue3(self, value): self._value3 = value
|
| | | def GetIsCopy(self): return self._isCopy
|
| | | def SetIsCopy(self, isCopy): self._isCopy = isCopy
|
| | | def GetEffectValueEx(self, effID): return self._effExDict.get(effID, 0)
|
| | | def ResetEffectValueEx(self): self._effExDict = {}
|
| | | def AddEffectValueEx(self, effID, valueEx): self._effExDict[effID] = self._effExDict.get(effID, 0) + valueEx
|
| | |
|
| | | class BuffManager():
|
| | | ## 战斗对象buff管理器
|
| | |
| | | self._buffMgr = ObjPool.GetPoolMgr().acquire(BuffManager, self)
|
| | | self._passiveEffMgr = ObjPool.GetPoolMgr().acquire(PassiveEffManager, self)
|
| | | self._lastHurtValue = 0
|
| | | self._harmSelfHP = 0 # 自残值
|
| | | self._mainTagIDList = [] # 主技能目标ID列表,一般用于技能拆分成多个技能效果时,子技能可能会用到主技能的对象做逻辑
|
| | | self._timing = 0 # 当前武将时间节点: 0-回合前;1-回合后
|
| | |
|
| | |
| | | def GetLastHurtValue(self): return self._lastHurtValue
|
| | | def SetLastHurtValue(self, lastHurtValue): self._lastHurtValue = lastHurtValue
|
| | |
|
| | | def GetHarmSelfHP(self): return self._harmSelfHP
|
| | | def SetHarmSelfHP(self, harmSelfHP): self._harmSelfHP = harmSelfHP
|
| | | |
| | | def GetMainTagIDList(self): return self._mainTagIDList
|
| | | def SetMainTagIDList(self, mainTagIDList): self._mainTagIDList = mainTagIDList
|
| | |
|
| | |
| | | HurtType_Miss, # 闪避 9
|
| | | HurtType_PoisonCureHurt, # 伤害毒奶 10
|
| | | HurtType_PoisonCureSuck, # 吸血毒奶 11
|
| | | ) = range(12)
|
| | | HurtType_HarmSelf, # 自残 12
|
| | | ) = range(13)
|
| | |
|
| | | #伤害类型
|
| | | (
|
| | |
| | | Def_Calc_TagMaxHP, # 目标最大生命值 3
|
| | | Def_Calc_ByBuffValue, # 触发buff的buff值 4
|
| | | Def_Calc_TagLostHP, # 目标已损失生命 5
|
| | | ) = range(6)
|
| | | Def_Calc_HarmSelfHP, # 按本次自残耗血值 6
|
| | | ) = range(7)
|
| | |
|
| | | #治疗类型(影响公式参数)
|
| | | Def_CureTypeList = (
|
| | |
| | | BatObjState_DamBackShield, # 荆棘盾 22
|
| | | BatObjState_BurnPlus, # 玄火(灼烧2) 23
|
| | | BatObjState_PoisonCure, # 焚血(毒奶) 24
|
| | | ) = range(1 + 24)
|
| | | BatObjState_RebornLimit, # 无法复活 25
|
| | | BatObjState_26, # 脆弱 26
|
| | | BatObjState_27, # 阴咒 27
|
| | | ) = range(1 + 27)
|
| | |
|
| | | #玩家状态定义,不能超过31个,如超过,需扩展多个key支持
|
| | | Def_PlayerStateList = (
|
| | |
| | | TriggerWay_UseSkillOverOne, # 使用技能后(多目标仅触发一次)20
|
| | | TriggerWay_AttackOverDirectOne, # 直接攻击后(除dot或buff外的攻击,多目标仅触发一次)21
|
| | | TriggerWay_BeAnyEffect, # 受到任意效果时(除直接攻击外的任意效果,如buff、dot、治疗、额外怒技)22
|
| | | ) = range(1, 1 + 22)
|
| | | TriggerWay_BuffAddByOwner, # buff添加时(施法者触发) 23
|
| | | ) = range(1, 1 + 23)
|
| | |
|
| | | # 不加载的被动触发方式,一般用于本技能固定触发逻辑用的
|
| | | TriggerWayNoLoadList = [TriggerWay_CurSkillEff, TriggerWay_CurSkillEffLst]
|
| | |
| | | SkillEff_MustHit = 7005 # 技能必命中
|
| | | SkillEff_ActionUseInvalid = 7006 # 行动时不可释放技能(可连击、反击、追击)
|
| | | SkillEff_AngerSkillNoXP = 7007 # 无论多少怒气均可释放该怒气技能
|
| | | SkillEff_UseSkillHarmSelf = 7008 # 释放技能时自残(先扣血)
|
| | |
|
| | | (
|
| | | TriggerType_BeSuperHit, # 被暴击触发技能 1
|
| | |
| | | family = familyMgr.GetAt(index)
|
| | | if not family:
|
| | | continue
|
| | | familyID = family.GetID()
|
| | | #familyID = family.GetID()
|
| | | lvMin = family.GetJoinLVMin()
|
| | | if lvMin and realmLV < lvMin:
|
| | | GameWorld.DebugLog(" 官职不足的不处理! familyID=%s,lvMin=%s" % (familyID, lvMin), playerID)
|
| | | #GameWorld.DebugLog(" 官职不足的不处理! familyID=%s,lvMin=%s" % (familyID, lvMin), playerID)
|
| | | continue
|
| | | if family.GetJoinReview():
|
| | | GameWorld.DebugLog(" 需要审核的不处理! familyID=%s" % familyID, playerID)
|
| | | #GameWorld.DebugLog(" 需要审核的不处理! familyID=%s" % familyID, playerID)
|
| | | continue
|
| | | MemberMax = GetFamilySetting(family.GetLV(), "MemberMax")
|
| | | if family.GetCount() >= MemberMax:
|
| | | GameWorld.DebugLog(" 成员已满的不处理! familyID=%s" % familyID, playerID)
|
| | | #GameWorld.DebugLog(" 成员已满的不处理! familyID=%s" % familyID, playerID)
|
| | | continue
|
| | |
|
| | | #直接加入
|
| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Skill.PassiveTrigger.PassiveEff_5021
|
| | | #
|
| | | # @todo:额外增加buff效果ID/属性ID值(每击中x状态目标)
|
| | | # @author hxp
|
| | | # @date 2025-10-30
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 额外增加buff效果ID/属性ID值(每击中x状态目标)
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-10-30 16:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | |
|
| | | def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
|
| | | if not connSkill or not connBuff:
|
| | | return
|
| | | |
| | | bySkill = connSkill.GetBySkill()
|
| | | if not bySkill:
|
| | | return
|
| | | |
| | | attrID = curEffect.GetEffectValue(0)
|
| | | attrValue = curEffect.GetEffectValue(1)
|
| | | checkInStateList = curEffect.GetEffectValue(2)
|
| | | if not checkInStateList or not attrID or not attrValue:
|
| | | return
|
| | | |
| | | hitCnt = 0
|
| | | effIgnoreObjIDList = bySkill.GetEffIgnoreObjIDList()
|
| | | tagObjList = bySkill.GetTagObjList()
|
| | | for tagObj in tagObjList:
|
| | | tagID = tagObj.GetID()
|
| | | if tagID in effIgnoreObjIDList:
|
| | | #GameWorld.DebugLog(" 闪避或免疫的目标: tagID=%s" % (tagID))
|
| | | continue
|
| | | if not tagObj.CheckInState(checkInStateList):
|
| | | #GameWorld.DebugLog(" 不在状态下的目标: tagID=%s not in state:%s" % (tagID, checkInStateList))
|
| | | continue
|
| | | hitCnt += 1
|
| | | |
| | | attrValue *= hitCnt
|
| | | connBuff.AddEffectValueEx(attrID, attrValue)
|
| | | GameWorld.DebugLog("每击中x状态目标额外增加buff效果ID/属性ID值: hitCnt=%s,attrID=%s,attrValue=%s" % (hitCnt, attrID, attrValue))
|
| | | return True
|
| New file |
| | |
| | | #!/usr/bin/python
|
| | | # -*- coding: GBK -*-
|
| | | #-------------------------------------------------------------------------------
|
| | | #
|
| | | ##@package Skill.PassiveTrigger.PassiveEff_5022
|
| | | #
|
| | | # @todo:额外增加buff效果ID/属性ID值
|
| | | # @author hxp
|
| | | # @date 2025-10-30
|
| | | # @version 1.0
|
| | | #
|
| | | # 详细描述: 额外增加buff效果ID/属性ID值
|
| | | #
|
| | | #-------------------------------------------------------------------------------
|
| | | #"""Version = 2025-10-30 16:00"""
|
| | | #-------------------------------------------------------------------------------
|
| | |
|
| | | import GameWorld
|
| | |
|
| | | def DoSkillEffectLogic(turnFight, batObj, tagObj, effSkill, curEffect, connSkill, connBuff, **kwargs):
|
| | | attrID = curEffect.GetEffectValue(0)
|
| | | attrValue = curEffect.GetEffectValue(1)
|
| | | GameWorld.DebugLog("额外增加buff效果ID/属性ID值: attrID=%s,attrValue=%s" % (attrID, attrValue))
|
| | | connBuff.AddEffectValueEx(attrID, attrValue)
|
| | | return True
|
| | |
| | | buff.SetRemainTime(buffSkill.GetLastTime())
|
| | | buff.SetLayer(updLayerCnt)
|
| | | buff.SetBuffValueList(buffValueList)
|
| | | buff.ResetEffectValueEx()
|
| | | if afterLogic and bySkill:
|
| | | bySkill.AddAfterLogic(ChConfig.AfterLogic_AddBuff, [batObj, buff, buffOwner])
|
| | | elif isSync:
|
| | | SyncBuffRefresh(turnFight, batObj, buff, relatedSkillID, isNewAdd=True)
|
| | |
|
| | | if nowLayerCnt != updLayerCnt:
|
| | | RefreshBuffEffect(turnFight, batObj, buff, False)
|
| | | RefreshBuffEffect(turnFight, batObj, buff, buffSkill, buffOwner, refreshType=2)
|
| | | return buff
|
| | |
|
| | | return __addNewBuff(turnFight, batObj, buffMgr, buffSkill, buffValueList, buffOwner, bySkill, afterLogic, setLayerCnt=addLayerCnt, isSync=isSync)
|
| | |
| | | elif isSync:
|
| | | SyncBuffRefresh(turnFight, batObj, buff, relatedSkillID, isNewAdd=True)
|
| | |
|
| | | RefreshBuffEffect(turnFight, batObj, buff, True)
|
| | | RefreshBuffEffect(turnFight, batObj, buff, buffSkill, buffOwner, refreshType=1)
|
| | | return buff
|
| | |
|
| | | def RefreshBuffEffect(turnFight, batObj, curBuff, isNewBuff=False):
|
| | | def RefreshBuffEffect(turnFight, batObj, curBuff, buffSkill=None, buffOwner=None, refreshType=0):
|
| | | ## 刷新buff效果
|
| | | # @param buffSkill: 添加该buff时对应的buff技能ID,可能为None,如非添加时的刷新
|
| | | # @param refreshType: 0-普通刷新;1-新添加刷新;2-覆盖刷新
|
| | |
|
| | | isRefreshAttr = False # 是否刷属性
|
| | |
|
| | |
| | | continue
|
| | |
|
| | | if curEffect.GetTriggerWay():
|
| | | if curEffect.GetTriggerSrc() not in [ChConfig.TriggerSrc_Skill, ChConfig.TriggerSrc_SkillSelf] and isNewBuff:
|
| | | if curEffect.GetTriggerSrc() not in [ChConfig.TriggerSrc_Skill, ChConfig.TriggerSrc_SkillSelf] and refreshType == 1:
|
| | | passiveEffMgr.AddBuffPassiveEffect(curBuff, skillData, curEffect)
|
| | |
|
| | | elif effectID in ChConfig.AttrIDList:
|
| | | isRefreshAttr = True
|
| | |
|
| | | if refreshType and buffSkill and buffOwner:
|
| | | TurnPassive.OnTriggerPassiveEffect(turnFight, buffOwner, ChConfig.TriggerWay_BuffAddByOwner, connSkill=buffSkill, connBuff=curBuff)
|
| | | |
| | | if isRefreshAttr:
|
| | | RefreshBuffAttr(batObj)
|
| | |
|
| | |
| | | curBuff.SetLayer(updLayer)
|
| | | relatedSkillID = relatedSkill.GetSkillID() if relatedSkill else 0
|
| | | SyncBuffRefresh(turnFight, batObj, curBuff, relatedSkillID)
|
| | | RefreshBuffEffect(turnFight, batObj, curBuff, False)
|
| | | RefreshBuffEffect(turnFight, batObj, curBuff)
|
| | | return
|
| | | DoBuffDel(turnFight, batObj, curBuff, relatedSkill)
|
| | | return
|
| | |
| | | buff = buffMgr.GetBuffByIndex(index)
|
| | | layer = max(1, buff.GetLayer())
|
| | | skillData = buff.GetSkillData()
|
| | | atkType = skillData.GetAtkType()
|
| | | if atkType:
|
| | | callFunc = GameWorld.GetExecFunc(TurnBuffs, "BuffAtkType_%d.%s" % (atkType, "CalcBuffAttrEx"))
|
| | | if callFunc:
|
| | | callFunc(batObj, buff, skillData, layer, buffAttrDict)
|
| | | |
| | | |
| | | 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) * layer
|
| | | attrValue = (effect.GetEffectValue(0) + buff.GetEffectValueEx(attrID)) * layer
|
| | | calcType = effect.GetEffectValue(1)
|
| | | if calcType == 2: # 减少,其他默认增加
|
| | | attrValue = -attrValue
|
| | |
| | |
|
| | | atkType = useSkill.GetAtkType()
|
| | | GameWorld.DebugLog("__doUseSkill: curID=%s,skillID=%s,atkType=%s" % (curBatObj.GetID(), useSkill.GetSkillID(), atkType))
|
| | | |
| | | __doHarmSelf(turnFight, curBatObj, useSkill)
|
| | | |
| | | # 通用攻击
|
| | | if atkType == 1:
|
| | | SkillModule_1(turnFight, curBatObj, useSkill)
|
| | |
| | | elif atkType == 9:
|
| | | SkillModule_9(turnFight, curBatObj, useSkill)
|
| | |
|
| | | return
|
| | |
|
| | | def __doHarmSelf(turnFight, curBatObj, useSkill):
|
| | | harmEff = useSkill.GetEffectByID(ChConfig.SkillEff_UseSkillHarmSelf)
|
| | | if not harmEff:
|
| | | return
|
| | | harmPer = harmEff.GetEffectValue(0) # 自残百分比
|
| | | noEnoughDo = harmEff.GetEffectValue(1) # 不足时扣除方式 0-不扣;1-自杀;2-扣剩1点
|
| | | curHP = curBatObj.GetHP()
|
| | | maxHP = curBatObj.GetMaxHP()
|
| | | harmHP = int(maxHP * harmPer / 100.0)
|
| | | lostHP = harmHP
|
| | | if curHP <= harmHP:
|
| | | if noEnoughDo == 0:
|
| | | lostHP = 0
|
| | | elif noEnoughDo == 2:
|
| | | lostHP -= 1
|
| | | |
| | | updHP = max(curHP - lostHP, 0)
|
| | | curBatObj.SetHP(updHP, False)
|
| | | GameWorld.DebugLog("使用技能时自残: curHP=%s/%s,harmPer=%s,harmHP=%s,lostHP=%s,updHP=%s,noEnoughDo=%s" |
| | | % (curHP, maxHP, harmPer, harmHP, lostHP, updHP, noEnoughDo))
|
| | | |
| | | curBatObj.SetHarmSelfHP(harmHP) # 无视实际扣血量,直接更新
|
| | | |
| | | # 单独通知前端表现
|
| | | hurtTypes = pow(2, ChConfig.HurtType_HarmSelf)
|
| | | diffType, diffValue = 0, lostHP
|
| | | skillID = relatedSkillID = useSkill.GetSkillID()
|
| | | Sync_PropertyRefreshView(turnFight, curBatObj, ChConfig.AttrID_HP, updHP, diffValue, diffType, skillID, relatedSkillID, hurtTypes)
|
| | | return
|
| | |
|
| | | def SkillModule_1(turnFight, curBatObj, useSkill):
|
| | |
| | | hurtTypes |= pow(2, ChConfig.HurtType_Parry)
|
| | |
|
| | | if ignoreDef:
|
| | | GameWorld.DebugLog("无视防御/真实伤害!")
|
| | | hurtTypes |= pow(2, ChConfig.HurtType_IgnoreDef)
|
| | |
|
| | | if isStun:
|
| | |
| | | if byBuff:
|
| | | baseValue = byBuff.GetValue1() + byBuff.GetValue2() * ChConfig.Def_PerPointValue
|
| | | GameWorld.DebugLog("根据buff值: %s" % baseValue)
|
| | | elif calcType == ChConfig.Def_Calc_HarmSelfHP:
|
| | | baseValue = curObj.GetHarmSelfHP()
|
| | | GameWorld.DebugLog("根据自残值: %s" % baseValue)
|
| | | |
| | | return baseValue
|
| | |
|
| | | def DoDOTAttack(turnFight, batObj, curBuff, hurtValue, hurtTypes, **kwargs):
|