| | |
| | | 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:
|
| | |
| | | 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] = {}
|
| | |
| | | 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] = {}
|
| | |
| | | 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)
|
| | | def GetEffectValues(self): return self._values # 直接返回整个效果values
|
| | | def GetTriggerWay(self): return self._triggerWay
|
| | | def GetTriggerSrc(self): return self._triggerSrc
|
| | | #def GetTriggerParams(self, index): return self._triggerParams[index] if len(self._triggerParams) > index else 0
|
| | |
| | | def GetCalcType(self): return self._ipyData.GetCalcType()
|
| | | def GetSkillPer(self): return self._ipyData.GetSkillPer()
|
| | | def GetSkillValue(self): return self._ipyData.GetSkillValue()
|
| | | def GetHurtAtkPerMax(self): return self._ipyData.GetHurtAtkPerMax()
|
| | | def GetHappenRate(self): return self._ipyData.GetHappenRate() # 触发概率
|
| | | def GetEffect(self, index): return self._effList[index] if len(self._effList) > index else 0
|
| | | def GetEffectCount(self): return len(self._effList)
|
| | |
| | | self._buffList = []
|
| | | self._buffIDDict = {}
|
| | | self._skillTypeIDBuffIDs = {}
|
| | | self._buffStateDict = {}
|
| | | self._buffID = 0
|
| | | return
|
| | |
|
| | |
| | | return
|
| | |
|
| | | def GetBuff(self, buffID): return self._buffIDDict.get(buffID, None)
|
| | | def FindBuffBySkillID(self, skillID):
|
| | | def FindBuffListBySkillID(self, skillID):
|
| | | ## 返回该技能ID的所有buff列表
|
| | | skillData = IpyGameDataPY.GetIpyGameData("Skill", skillID)
|
| | | if not skillData:
|
| | | return []
|
| | | return self.FindBuffBySkillTypeID(skillData.GetSkillTypeID())
|
| | | def FindBuffBySkillTypeID(self, skillTypeID):
|
| | | return self.FindBuffListBySkillTypeID(skillData.GetSkillTypeID())
|
| | | def FindBuffListBySkillTypeID(self, skillTypeID):
|
| | | ## 返回该技能TypeID的所有buff列表
|
| | | if skillTypeID not in self._skillTypeIDBuffIDs:
|
| | | return []
|
| | |
| | | continue
|
| | | buffs.append(self._buffIDDict[buffID])
|
| | | return buffs
|
| | | def FindBuffByState(self, state):
|
| | | ## 查找某种buff状态的buff
|
| | | buffIDList = self._buffStateDict.get(state, [])
|
| | | if not buffIDList:
|
| | | return
|
| | | buffID = buffIDList[0]
|
| | | return self._buffIDDict.get(buffID, None)
|
| | |
|
| | | def AddBuffState(self, state, buffID):
|
| | | ## 添加buff影响的状态,ChConfig.BatObjStateList
|
| | |
| | | def GetCalcType(self): return self._skillData.GetCalcType()
|
| | | def GetSkillPer(self): return self._skillData.GetSkillPer()
|
| | | def GetSkillValue(self): return self._skillData.GetSkillValue()
|
| | | def GetHurtAtkPerMax(self): return self._skillData.GetHurtAtkPerMax()
|
| | | def GetHappenRate(self): return self._skillData.GetHappenRate() # 触发概率
|
| | | def GetEffect(self, index): return self._skillData.GetEffect(index)
|
| | | def GetEffectCount(self): return self._skillData.GetEffectCount()
|
| | |
| | |
|
| | | def GetSkillCount(self): return len(self._skillList)
|
| | | def GetSkillByIndex(self, index): return self._skillList[index]
|
| | | def GetSkillIDList(self): return self._skillDict.keys()
|
| | | def FindSkillByID(self, skillID): return self._skillDict.get(skillID, None)
|
| | | def FindSkillByTypeID(self, skillTypeID):
|
| | | skill = None
|
| | |
| | | self.skinID = 0
|
| | | self.country = 0
|
| | | self.atkDistType = 0
|
| | | self.specialty = 0 # 特长
|
| | | self.sex = 0
|
| | | self.lv = 1
|
| | | self.fightPower = 0
|
| | |
| | | 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, ...}
|
| | | self._skillMgr = ObjPool.GetPoolMgr().acquire(SkillManager)
|
| | | self._buffMgr = ObjPool.GetPoolMgr().acquire(BuffManager, self)
|
| | | self._passiveEffMgr = ObjPool.GetPoolMgr().acquire(PassiveEffManager, self)
|
| | | self._lastHurtValue = 0
|
| | |
|
| | | # 统计
|
| | | self.hurtStat = 0 # 输出统计
|
| | |
| | | TurnPassive.RefreshPassive(self)
|
| | | return
|
| | |
|
| | | def TurnReset(self):
|
| | | ## 回合重置
|
| | | self._skillTurnUseCntDict = {}
|
| | | |
| | | def UpdInitBatAttr(self, initAttrDict, skillIDList):
|
| | | ## 更新战斗属性,一般只有主阵容需要更新,战斗中养成、装备变化等引起的主阵容属性变更时需要实时更新
|
| | | self._initAttrDict = initAttrDict
|
| | |
| | | def SetCountry(self, country): self.country = country
|
| | | def GetAtkDistType(self): return self.atkDistType
|
| | | def SetAtkDistType(self, atkDistType): self.atkDistType = atkDistType
|
| | | def GetSpecialty(self): return self.specialty
|
| | | def SetSpecialty(self, specialty): self.specialty = specialty
|
| | | def GetSex(self): return self.sex
|
| | | def SetSex(self, sex): self.sex = sex
|
| | | def GetNPCID(self): return self.npcID # 如果是NPC战斗单位,则该值非0
|
| | |
| | | # 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):
|
| | |
| | | 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):
|
| | |
| | | self._skillUseCntDict[skillID] = self._skillUseCntDict.get(skillID, 0) + 1
|
| | | self._skillTurnUseCntDict[skillID] = self._skillTurnUseCntDict.get(skillID, 0) + 1
|
| | |
|
| | | def GetLastHurtValue(self): return self._lastHurtValue
|
| | | def SetLastHurtValue(self, lastHurtValue): self._lastHurtValue = lastHurtValue
|
| | | |
| | | def StatHurtValue(self, hurtValue):
|
| | | ## 统计输出
|
| | | self.hurtStat += hurtValue
|
| | |
| | | ## 统计治疗
|
| | | self.cureStat += cureValue
|
| | | return self.cureStat
|
| | | |
| | | def TurnReset(self):
|
| | | ## 回合重置
|
| | | self._skillTurnUseCntDict = {}
|
| | |
|
| | | class BattleObjMgr():
|
| | | ## 战斗对象管理器
|
| | |
| | | return
|
| | | objID = batObj.objID
|
| | | GameWorld.DebugLog("回收战斗单位: objID=%s" % (objID))
|
| | | turnFight = batObj.GetTurnFight()
|
| | | if turnFight:
|
| | | # //04 07 NPC消失#tagNPCDisappear 此处通知消失,与回合制死亡区分
|
| | | clientPack = ChNetSendPack.tagNPCDisappear()
|
| | | clientPack.NPCID = [objID]
|
| | | clientPack.Count = len(clientPack.NPCID)
|
| | | turnFight.addBatPack(clientPack)
|
| | | |
| | | #前端确认不需要通知消失
|
| | | #turnFight = batObj.GetTurnFight()
|
| | | #if turnFight:
|
| | | # # //04 07 NPC消失#tagNPCDisappear 此处通知消失,与回合制死亡区分
|
| | | # clientPack = ChNetSendPack.tagNPCDisappear()
|
| | | # clientPack.NPCID = [objID]
|
| | | # clientPack.Count = len(clientPack.NPCID)
|
| | | # turnFight.addBatPack(clientPack)
|
| | | |
| | | # 最后回收对象
|
| | | ObjPool.GetPoolMgr().release(batObj)
|
| | | if objID not in self._freeIDList: # 回收ID,重复利用
|