From 2b34924e06c0c36d77d9ccec4c4f10f1ebd16e84 Mon Sep 17 00:00:00 2001 From: hxp <ale99527@vip.qq.com> Date: 星期二, 16 九月 2025 19:03:17 +0800 Subject: [PATCH] 129 【战斗】战斗系统-服务端(NPC表加特长字段;) --- ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py | 39 ++++++++++++++++++++++++++++++++------- 1 files changed, 32 insertions(+), 7 deletions(-) diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py index 8b7a961..efa0231 100644 --- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py +++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/BattleObj.py @@ -45,7 +45,7 @@ effList = [] # 优先取关联技能的 - if connSkillTypeID and connSkillTypeID not in [ChConfig.TriggerSrc_Skill, ChConfig.TriggerSrc_Buff]: + if connSkillTypeID and connSkillTypeID not in [ChConfig.TriggerSrc_Skill, ChConfig.TriggerSrc_Buff, ChConfig.TriggerSrc_SkillSelf, ChConfig.TriggerSrc_BuffSelf]: # 技能 key = (triggerWay, connSkillTypeID) if key in self._AffectSkillDict: @@ -99,13 +99,19 @@ return if triggerWay == ChConfig.TriggerWay_CurSkillEff: return - if triggerSrc == ChConfig.TriggerSrc_Buff: + if triggerSrc in [ChConfig.TriggerSrc_Buff, ChConfig.TriggerSrc_BuffSelf]: # buff有效的不加进来 return skillID = curSkill.GetSkillID() effectID = effect.GetEffectID() + if triggerWay == ChConfig.TriggerWay_CalcEffValue: + triggerWay = "%s_%s" % (triggerWay, effectID) + + if triggerSrc == ChConfig.TriggerSrc_SkillSelf: + triggerSrc = curSkill.GetSkillTypeID() + key = (triggerWay, triggerSrc) if key not in self._AffectSkillDict: self._AffectSkillDict[key] = {} @@ -143,13 +149,19 @@ return if triggerWay == ChConfig.TriggerWay_CurSkillEff: return - if triggerSrc == ChConfig.TriggerSrc_Skill: + if triggerSrc in [ChConfig.TriggerSrc_Skill, ChConfig.TriggerSrc_SkillSelf]: # 技能有效的不加进来 return buffID = buff.GetBuffID() effectID = effect.GetEffectID() + if triggerWay == ChConfig.TriggerWay_CalcEffValue: + triggerWay = "%s_%s" % (triggerWay, effectID) + + if triggerSrc == ChConfig.TriggerSrc_BuffSelf: + triggerSrc = skillData.GetSkillTypeID() + key = (triggerWay, triggerSrc) if key not in self._AffectBuffDict: self._AffectBuffDict[key] = {} @@ -618,8 +630,8 @@ self._xp = 0 # 当前怒气值 self._isAlive = True # 是否活着 self._initAttrDict = {} # 初始化时的属性,固定不变,初始化时已经算好的属性 {attrID:value, ...} - self._batAttrDict = {} # 实际战斗属性,包含buff层级的实际属性 - self._skillTempAttrDict = {} # 某次技能释放中临时的属性增减 {attrID:+-value, ...} + self._batAttrDict = {} # 实际战斗属性,包含buff层级的实际属性 {attrID:+-value, ...} value可能是负值 + self._skillTempAttrDict = {} # 某次技能释放中临时的属性增减 {attrID:+-value, ...} value可能是负值 self._kvDict = {} # 自定义kv字典 self._skillUseCntDict = {} # 技能累计使用次数 {skillID:useCnt, ...} self._skillTurnUseCntDict = {} # 技能单回合累计使用次数 {skillID:useCnt, ...} @@ -720,8 +732,20 @@ # return False return True - def IsInState(self, state): + def CheckInState(self, checkInState): ## 是否处于某种状态下 + if isinstance(checkInState, int): + checkInStateList = [checkInState] + elif isinstance(checkInState, list) or isinstance(checkInState, tuple): + checkInStateList = checkInState + else: + return False + for state in checkInStateList: + if self._buffMgr.IsInBuffState(state): + return True + return False + def IsInState(self, state): + ## 是否处于指定状态下 return self._buffMgr.IsInBuffState(state) def IsInControlled(self): @@ -781,12 +805,13 @@ def GetAtk(self): return self.GetBatAttrValue(ChConfig.AttrID_Atk) def GetDef(self): return self.GetBatAttrValue(ChConfig.AttrID_Def) + def GetBatAttrDict(self): return self._batAttrDict def GetBatAttrValue(self, attrID, includeTemp=True): #ChConfig.AttrID_HP ChConfig.AttrID_XP value = self._batAttrDict.get(attrID, 0) if includeTemp and attrID in self._skillTempAttrDict: value += self._skillTempAttrDict[attrID] # 支持正负值 - value = max(1, value) + #value = max(1, value) return value def SetBatAttrValue(self, attrID, value): self._batAttrDict[attrID] = value def AddSkillTempAttr(self, attrID, value): -- Gitblit v1.8.0