| | |
| | | def __init__(self, batObj):
|
| | | self._batObj = batObj
|
| | | self._objID = batObj.GetID() if batObj else 0
|
| | | self._skillIDList = [] # 已有技能ID列表,获取被动中快速判断已学技能用
|
| | | self.noDeadSkill = None # 不死技能效果,暂时只支持最多1个这种技能
|
| | |
|
| | | # 技能
|
| | | self._AffectSkillDict = {} # 被动技能 {(触发方式, 有效来源):{技能ID:[effID, ...], ...}, ...}
|
| | |
| | | '''
|
| | | effList = []
|
| | |
|
| | | # 额外子技能的一般是未学习的技能,直接加载自身的被动效果
|
| | | # 触发自己未学习的技能,直接加载自身的被动效果,如额外子技能等
|
| | | if connSkill and not isinstance(connSkill, IpyGameDataPY.IPY_Skill) and self._objID == connSkill.GetObjID() \
|
| | | and connSkill.GetBatType() == ChConfig.TurnBattleType_Enhance:
|
| | | and connSkill.GetSkillID() not in self._skillIDList:
|
| | | skillID = connSkill.GetSkillID()
|
| | | if skillID not in self._affectSkillEnhanceDict:
|
| | | effDict = {}
|
| | |
| | |
|
| | | key = (tWay, tSrc)
|
| | | if key not in effDict:
|
| | | effDict[key] = {}
|
| | | effList = effDict[key]
|
| | | if effectID not in effList:
|
| | | effList.append(effList)
|
| | | effDict[key] = []
|
| | | effIDList = effDict[key]
|
| | | if effectID not in effIDList:
|
| | | effIDList.append(effectID)
|
| | | self._affectSkillEnhanceDict[skillID] = effDict
|
| | | GameWorld.DebugLogEx("加载未学技能被动: objID=%s,skillID=%s,%s", self._objID, skillID, effDict)
|
| | |
|
| | | key = (triggerWay, ChConfig.TriggerSrc_SkillSelf)
|
| | | effDict = self._affectSkillEnhanceDict[skillID]
|
| | | if triggerWay in effDict:
|
| | | effList.append(["skill", skillID, 0, effDict[triggerWay]])
|
| | | if key in effDict:
|
| | | effList.append(["skill", skillID, 0, effDict[key]])
|
| | |
|
| | | if triggerWay not in self._skillTriggerWayList and triggerWay not in self._buffTriggerWayList:
|
| | | return effList
|
| | |
| | | curSkill = skillManager.GetSkillByIndex(index)
|
| | | if not curSkill:
|
| | | continue
|
| | | skillID = curSkill.GetSkillID()
|
| | | # 附加添加已学技能,用于判断是否自身技能
|
| | | if skillID not in self._skillIDList:
|
| | | self._skillIDList.append(skillID)
|
| | | for index in xrange(curSkill.GetEffectCount()):
|
| | | curEffect = curSkill.GetEffect(index)
|
| | | effectID = curEffect.GetEffectID()
|
| | |
| | | effDict[skillID].append(effectID)
|
| | | if triggerWay not in self._skillTriggerWayList:
|
| | | self._skillTriggerWayList.append(triggerWay)
|
| | | |
| | | # 加载不死技能效果
|
| | | if triggerWay == ChConfig.TriggerWay_NoDead:
|
| | | self.noDeadSkill = curSkill
|
| | | |
| | | return
|
| | |
|
| | | def RefreshBuffPassiveEffect(self):
|
| | |
| | | return
|
| | |
|
| | | def GetBuffCount(self): return len(self._buffList)
|
| | | def GetBuffByIndex(self, index): return self._buffList[index]
|
| | | def GetBuffByIndex(self, index): return self._buffList[index] if len(self._buffList) > index else None
|
| | |
|
| | | def AddBuff(self, skillID):
|
| | | buff = None
|
| | |
| | | def GetLayerMax(self): return self._skillData.GetLayerMax()
|
| | | def GetBuffRepeat(self): return self._skillData.GetBuffRepeat() # Buff叠加规则
|
| | | def GetDispersedLimit(self): return self._skillData.GetDispersedLimit() # 驱散限制
|
| | | def GetBuffRetain(self): return self._ipyData.GetBuffRetain()
|
| | | def GetBuffRetain(self): return self._skillData.GetBuffRetain()
|
| | | def GetFightPower(self): return self._skillData.GetFightPower()
|
| | |
|
| | | ## ---------------------------------- 非技能表内容 ----------------------------------
|
| | |
| | | class BatObj():
|
| | | ## 战斗实体对象数据,目前与某个NPCObj绑定
|
| | |
|
| | | def __init__(self):
|
| | | def __init__(self, objID):
|
| | | self.tfGUID = "" # 所属的某场回合战斗的guid
|
| | | self.ownerID = 0 # 所属玩家ID,可能为0,0代表非玩家的战斗实体
|
| | | self.objID = 0
|
| | | self.objID = objID
|
| | | self.objName = ""
|
| | | self.npcID = 0
|
| | | self.heroID = 0
|
| | |
| | | self._hp = 0 # 当前生命值
|
| | | self._xp = 0 # 当前怒气值
|
| | | self._isAlive = True # 是否活着
|
| | | self._killer = None # 被谁击杀的
|
| | | self._initAttrDict = {} # 初始化时的属性,固定不变,初始化时已经算好的属性 {attrID:value, ...}
|
| | | self._batAttrDict = {} # 实际战斗属性,包含buff层级的实际属性 {attrID:+-value, ...} value可能是负值
|
| | | self._skillTempAttrDict = {} # 某次技能释放中临时的属性增减 {attrID:+-value, ...} value可能是负值
|
| | |
| | | def SetLV(self, lv): self.lv = lv
|
| | | def GetStar(self): return self._star
|
| | | def SetStar(self, star): self._star = star
|
| | | def GetDictByKey(self, key): return self._kvDict.get(key, 0)
|
| | | def SetDict(self, key, value): self._kvDict[key] = value
|
| | | |
| | | def GetDictByKey(self, key): |
| | | if key in self._kvDict:
|
| | | return self._kvDict[key]
|
| | | return 0
|
| | | def SetDict(self, key, value):
|
| | | if not value:
|
| | | self._kvDict.pop(key, None)
|
| | | else:
|
| | | self._kvDict[key] = value
|
| | | |
| | | def GetSkillManager(self): return self._skillMgr
|
| | | def GetBuffManager(self):return self._buffMgr
|
| | | def GetPassiveEffManager(self):return self._passiveEffMgr
|
| | |
| | | return False
|
| | | return True
|
| | |
|
| | | def CanNoDead(self):
|
| | | '''是否还可触发不死效果
|
| | | 暂定单个武将最多只支持配置1个不死效果,且单场战斗最多触发x次,即按技能cd判断即可
|
| | | '''
|
| | | noDeadSkill = self._passiveEffMgr.noDeadSkill # 固定有被动触发
|
| | | if not noDeadSkill:
|
| | | return
|
| | | if noDeadSkill.GetRemainTime():
|
| | | return
|
| | | return True
|
| | | |
| | | def GetSneerTagObj(self):
|
| | | ## 获取被嘲讽的目标,如果存在则一定是活着的目标
|
| | | buffIDList = self._buffMgr.GetStateBuffIDList(ChConfig.BatObjState_Sneer)
|
| | |
| | |
|
| | | # 战斗属性
|
| | | def IsAlive(self): return self._isAlive # 是否活着
|
| | | def SetDead(self):
|
| | | def SetDead(self, killer=None):
|
| | | self._killer = killer
|
| | | self._isAlive = False
|
| | | self._hp = 0
|
| | | def SetRevive(self, hp):
|
| | | self._killer = None
|
| | | self._isAlive = True
|
| | | self._hp = hp
|
| | | def GetKiller(self): return self._killer
|
| | | def GetMaxHP(self): return int(self._batAttrDict.get(ChConfig.AttrID_MaxHP, 0))
|
| | | def SetMaxHP(self, maxHP, isNotify=False):
|
| | | maxHP = int(maxHP)
|
| | |
| | | newObjID = self.__getNewObjID()
|
| | | if not newObjID:
|
| | | return newBatObj
|
| | | newBatObj = BatObj()
|
| | | newBatObj.objID = newObjID
|
| | | newBatObj = BatObj(newObjID)
|
| | | self.batObjDict[newObjID] = newBatObj
|
| | | GameWorld.DebugLogEx("添加战斗单位: objID=%s", newObjID)
|
| | | if False:
|