| | |
| | | import TurnAttack
|
| | | import PyGameData
|
| | | import ShareDefine
|
| | | import PlayerPreset
|
| | | import PlayerControl
|
| | | import IpyGameDataPY
|
| | | import FormulaControl
|
| | | import PlayerPrestigeSys
|
| | | import GameLogic_Dingjunge
|
| | | import PlayerMingge
|
| | | import PlayerBeauty
|
| | | import PlayerFamily
|
| | | import PlayerHorse
|
| | |
| | | self.skillFightPower = 0 # 技能战力
|
| | | return
|
| | |
|
| | | class Lineup():
|
| | | ## 阵容
|
| | | class PresetHero():
|
| | | '''武将阵容预设方案,可用于任何一个全局战斗预设方案
|
| | | 虽然是同个武将物品阵容预设,但是在不同的战斗预设方案中最终的武将属性可能不一样
|
| | | 故该类无关任何武将战力、属性等,只汇总某个武将阵容预设相关公共数据,如武将站位、生效卡牌等
|
| | | '''
|
| | |
|
| | | def __init__(self, playerID, lineupID, exclusiveMapID=0):
|
| | | self.playerID = playerID
|
| | | self.lineupID = lineupID
|
| | | self.exclusiveMapID = exclusiveMapID # 大于0时代表是某个功能地图专用,如定军阁,阵容与主阵容相同,只是属性、战力可能不一样
|
| | | self.olPlayer = None
|
| | | def __init__(self, heroPresetID=1):
|
| | | self.heroPresetID = heroPresetID
|
| | | self.shapeType = 0
|
| | | self.heroItemDict = {} # 阵容武将背包索引信息 {itemIndex:posNum, ...}
|
| | | self.lineupChange = False # 是否已变更阵容标记,在刷新属性后重置标记
|
| | | self.__refreshState = 0 # 刷属性标记, 0-不需要刷新了,1-需要刷新
|
| | | self._effectiveCardDict = {} # 加成属性生效的武将卡牌信息 {heroID:[cardAddPer, itemIndex, inThis], ...}
|
| | | self.isHeroChange = False
|
| | | return
|
| | | |
| | | def SetHeroItemPreset(self, curPlayer, heroItemDict, shapeType=0, isReload=False):
|
| | | self.shapeType = shapeType
|
| | | self.heroItemDict = heroItemDict
|
| | | if not isReload: # 非重读阵容的视为变更
|
| | | self.isHeroChange = True
|
| | | reloadEffHeroCard(curPlayer, self) # 更新武将阵容强制重刷生效卡牌
|
| | | return
|
| | | |
| | | def IsHeroItemIn(self, itemIndex): return itemIndex in self.heroItemDict
|
| | |
|
| | | def GetHeroEffectiveCard(self, heroID): return self._effectiveCardDict.get(heroID, [-1, -1, False])
|
| | | def SetHeroEffectiveCard(self, heroID, cardAddPer, itemIndex, inThis):
|
| | | ## 更新某个武将生效的卡牌信息
|
| | | self._effectiveCardDict[heroID] = [cardAddPer, itemIndex, inThis]
|
| | | return
|
| | | |
| | | def SetEffectiveCardDict(self, effectiveCardDict): self._effectiveCardDict = effectiveCardDict
|
| | | def GetEffCardAddPer(self):
|
| | | effCardAddPer = 0
|
| | | for effInfo in self._effectiveCardDict.values():
|
| | | effCardAddPer += effInfo[0]
|
| | | return effCardAddPer
|
| | | |
| | | class PresetLineup():
|
| | | ## 全局战斗预设方案
|
| | | |
| | | def __init__(self, playerID, batPresetID, exclusiveMapID=0):
|
| | | self.playerID = playerID
|
| | | self.batPresetID = batPresetID
|
| | | self.exclusiveMapID = exclusiveMapID # 大于0时代表是某个功能地图专用,如定军阁,阵容与主阵容相同,只是属性、战力可能不一样
|
| | | self.olPlayer = None
|
| | | self.__refreshState = 1 # 刷属性标记,初始需要刷新, 0-不需要刷新了,1-需要刷新
|
| | | self.fightPower = 0 # 阵容总战力
|
| | |
|
| | | self.__freeLineupHeroObjs = [] # 释放的空闲对象[LineupHero, ...]
|
| | | self.__lineupHeroDict = {} # 刷新阵容后的武将信息 {posNum:LineupHero, ...}
|
| | | self.fightPower = 0 # 阵容总战力
|
| | | return
|
| | |
|
| | | def UpdLineup(self, heroItemDict, shapeType=0, refreshForce=False, isReload=False):
|
| | | '''变更阵容时更新
|
| | | @param heroItemDict: 武将背包索引信息 {itemIndex:posNum, ...}
|
| | | @param shapeType: 阵型
|
| | | @param refreshForce: 是否强制刷属性
|
| | | '''
|
| | | if not isReload: # 非重读阵容的视为变更
|
| | | self.lineupChange = True
|
| | | self.shapeType = shapeType
|
| | | self.heroItemDict = heroItemDict
|
| | | GameWorld.DebugLog("更新阵容: lineupID=%s,exclusiveMapID=%s,%s" % (self.lineupID, self.exclusiveMapID, heroItemDict), self.playerID)
|
| | | self.RefreshLineupAttr(refreshForce)
|
| | | if not isReload and self.olPlayer.curPlayer and not self.exclusiveMapID:
|
| | | PlayerHero.Sync_Lineup(self.olPlayer.curPlayer, self.lineupID)
|
| | | return
|
| | | |
| | | def IsEmpty(self): return (not self.__lineupHeroDict or not self.heroItemDict)
|
| | | def IsEmpty(self): return not self.__lineupHeroDict
|
| | |
|
| | | def GetPosNumList(self): return self.__lineupHeroDict.keys()
|
| | |
|
| | |
| | | return False
|
| | | self.__refreshState = 0
|
| | | doRefreshLineupAttr(self.olPlayer.curPlayer, self.olPlayer, self)
|
| | | self.lineupChange = False
|
| | | return True
|
| | | |
| | | def CheckHeroItemUpdate(self, itemIndex):
|
| | | if itemIndex not in self.heroItemDict:
|
| | | return
|
| | | self.RefreshLineupAttr()
|
| | | return True
|
| | |
|
| | | class OnlinePlayer():
|
| | |
| | | # 属性、阵容
|
| | | self._calcAttrDict = {} # 功能点属性统计 {calcIndex:{attrID:value, ...}, ...}
|
| | | self._calcSpecEffDict = {} # 功能点特殊效果统计 {calcIndex:effInfo, ...}
|
| | | self._lineupDict = {} # 上阵阵容 {lineKey:Lineup, ...} lineKey 为 lineupID 或者 (lineupID, exclusiveMapID)
|
| | | self._effectiveCardDict = {} # 加成属性生效的武将卡牌信息 {heroID:[cardAddPer, itemIndex, inMain], ...}
|
| | | self._heroPresetDict = {} # 武将预设方案公共数据 {heroPresetID:PresetHero, ...}
|
| | | self._presetLineupDict = {} # 战斗预设方案阵容 {lineKey:PresetLineup, ...} lineKey 为 batPresetID 或者 (batPresetID, exclusiveMapID)
|
| | |
|
| | | # 主线战斗
|
| | | self.mainFight = TurnAttack.MainFight(playerID)
|
| | | |
| | | self._lastBatBufferInfo = [] # 最后一场战斗临时回放 ["guid", "buffer"]
|
| | | return
|
| | |
|
| | | def OnClear(self):
|
| | |
| | | ## 是否真的在线
|
| | | return self.curPlayer != None
|
| | |
|
| | | def GetLineup(self, lineupID, checkAttr=True, exclusiveMapID=0):
|
| | | def GetHeroPreset(self, heroPresetID):
|
| | | ## 武将预设方案公共数据
|
| | | if heroPresetID in self._heroPresetDict:
|
| | | heroPreset = self._heroPresetDict[heroPresetID]
|
| | | else:
|
| | | heroPreset = PresetHero(heroPresetID)
|
| | | self._heroPresetDict[heroPresetID] = heroPreset
|
| | | return heroPreset
|
| | | |
| | | def GetPresetLineup(self, batPresetID, checkAttr=True, exclusiveMapID=0):
|
| | | # @param checkAttr: 检查刷新到最新阵容属性
|
| | | lineup = None
|
| | | lineKey = lineupID
|
| | | lineKey = batPresetID
|
| | | if exclusiveMapID:
|
| | | if exclusiveMapID in ChConfig.ExclusiveBatAttrMapIDList:
|
| | | lineKey = (lineupID, exclusiveMapID)
|
| | | lineKey = (batPresetID, exclusiveMapID)
|
| | | else:
|
| | | exclusiveMapID = 0
|
| | | if lineKey in self._lineupDict:
|
| | | lineup = self._lineupDict[lineKey]
|
| | | if lineKey in self._presetLineupDict:
|
| | | lineup = self._presetLineupDict[lineKey]
|
| | | else:
|
| | | lineup = Lineup(self.playerID, lineupID, exclusiveMapID)
|
| | | self._lineupDict[lineKey] = lineup
|
| | | lineup = PresetLineup(self.playerID, batPresetID, exclusiveMapID)
|
| | | self._presetLineupDict[lineKey] = lineup
|
| | | GameWorld.DebugLog("创建战斗方案: %s" % str(lineKey))
|
| | | |
| | | lineup.olPlayer = self
|
| | | if checkAttr:
|
| | | lineup.CheckRefreshLineupAttr()
|
| | | return lineup
|
| | |
|
| | | def GetHeroEffectiveCard(self, heroID): return self._effectiveCardDict.get(heroID, [-1, -1, False])
|
| | | def SetHeroEffectiveCard(self, heroID, cardAddPer, itemIndex, inMain):
|
| | | ## 更新某个武将生效的卡牌信息
|
| | | self._effectiveCardDict[heroID] = [cardAddPer, itemIndex, inMain]
|
| | | self.RefreshRoleAttr()
|
| | | |
| | | def SetEffectiveCardDict(self, effectiveCardDict): self._effectiveCardDict = effectiveCardDict
|
| | | def GetEffectiveCardDict(self): return self._effectiveCardDict
|
| | | |
| | | def GetCalcSpecInfo(self, calcIndex): return self._calcSpecEffDict.get(calcIndex, {})
|
| | | def GetCalcAttr(self, calcIndex): return self._calcAttrDict.get(calcIndex, {})
|
| | | def SetCalcAttr(self, calcIndex, attrDict, specEffInfo=None):
|
| | | def GetCalcSpecInfo(self, calcIndex, presetID=0):
|
| | | calcKey = (calcIndex, presetID) if presetID else calcIndex
|
| | | return self._calcSpecEffDict.get(calcKey, {})
|
| | | def GetCalcAttr(self, calcIndex, presetID=0):
|
| | | calcKey = (calcIndex, presetID) if presetID else calcIndex
|
| | | return self._calcAttrDict.get(calcKey, {})
|
| | | def SetCalcAttr(self, calcIndex, attrDict, specEffInfo=None, presetID=0):
|
| | | ## 设置某个功能点计算的属性
|
| | | # @param specEffDict: 特殊效果缓存,功能自定义数据结构
|
| | | self._calcAttrDict[calcIndex] = attrDict
|
| | | calcKey = (calcIndex, presetID) if presetID else calcIndex
|
| | | self._calcAttrDict[calcKey] = attrDict
|
| | | if specEffInfo != None:
|
| | | self._calcSpecEffDict[calcIndex] = specEffInfo
|
| | | self._calcSpecEffDict[calcKey] = specEffInfo
|
| | | return
|
| | |
|
| | | def ReCalcAllAttr(self):
|
| | |
| | |
|
| | | self._calcAttrDict = {}
|
| | | self._calcSpecEffDict = {}
|
| | | self._lineupDict = {}
|
| | | self._effectiveCardDict = {}
|
| | | self._heroPresetDict = {}
|
| | | self._presetLineupDict = {}
|
| | |
|
| | | doCalcAllAttr(curPlayer)
|
| | | doReloadLineup(curPlayer, self)
|
| | | reloadEffHeroCard(curPlayer, self)
|
| | |
|
| | | self.RefreshRoleAttr()
|
| | | #至少确保有主线战斗预设刷新,其他的可以用到再处理
|
| | | mainBatPresetID = PlayerPreset.GetBatPresetID(self.curPlayer, ShareDefine.BatPreset_Main)
|
| | | GameWorld.DebugLog("mainBatPresetID=%s" % mainBatPresetID, self.playerID)
|
| | | self.GetPresetLineup(mainBatPresetID)
|
| | | return
|
| | | |
| | | def GetHeroPresetIDList(self): return self._heroPresetDict.keys()
|
| | | def GetBatPresetIDList(self):
|
| | | presetIDList = []
|
| | | for k in self._presetLineupDict.keys():
|
| | | if isinstance(k, int):
|
| | | presetIDList.append(k)
|
| | | return presetIDList
|
| | | def GetPresetLineupDict(self): return self._presetLineupDict
|
| | | |
| | | def RefreshByFuncPreset(self, funcPresetType, funcPresetID):
|
| | | ## 刷新属性,由某个功能预设属性变更引起的刷新,需要同步刷新所有用到该功能预设的
|
| | | curPlayer = self.curPlayer
|
| | | GameWorld.DebugLog("请求刷功能预设属性变更: funcPresetType=%s,funcPresetID=%s" % (funcPresetType, funcPresetID), self.playerID)
|
| | | for presetLineup in self._presetLineupDict.values():
|
| | | batPresetID = presetLineup.batPresetID
|
| | | if funcPresetID and funcPresetID != PlayerPreset.GetFuncPresetID(curPlayer, batPresetID, funcPresetType):
|
| | | continue
|
| | | presetLineup.RefreshLineupAttr()
|
| | | return
|
| | | |
| | | def RefreshBatPreset(self, batPresetID):
|
| | | ## 刷新某个全局战斗预设,一般是预设切换时需要重新刷新一下
|
| | | GameWorld.DebugLog("请求刷全局预设方案属性: batPresetID=%s" % (batPresetID), self.playerID)
|
| | | presetLineup = self.GetPresetLineup(batPresetID, False)
|
| | | presetLineup.RefreshLineupAttr()
|
| | | return
|
| | |
|
| | | def RefreshRoleAttr(self, refreshForce=False, isAllLineup=False, exclusiveMapID=0):
|
| | |
| | | @param refreshForce: 是否强制立马刷新
|
| | | @param isAllLineup: 是否只同步刷所有阵容属性,如果设置False则默认仅刷主阵容属性
|
| | | '''
|
| | | GameWorld.DebugLog("请求刷属性: refreshForce=%s" % (refreshForce), self.playerID)
|
| | | GameWorld.DebugLog("请求刷主公属性: refreshForce=%s,exclusiveMapID=%s" % (refreshForce, exclusiveMapID), self.playerID)
|
| | | |
| | | # 主公属性刷新时,所有阵容都要同步刷新
|
| | | for lineup in self._lineupDict.values():
|
| | | for lineup in self._presetLineupDict.values():
|
| | | if exclusiveMapID and lineup.exclusiveMapID != exclusiveMapID:
|
| | | # 有指定的话只要指定的即可
|
| | | continue
|
| | |
| | | return
|
| | |
|
| | | def DoRefreshRoleAttr(self, isAllLineup=False, exclusiveMapID=0):
|
| | | '''执行刷属性,默认额外刷主阵容,其他阵容可以用到的时候再刷新
|
| | | @param isAllLineup: 是否刷所有阵容,如果设置False则默认仅刷主阵容属性
|
| | | '''执行刷属性,默认只刷当前预设方案阵容,其他阵容可以用到的时候再刷新
|
| | | @param isAllLineup: 是否刷所有阵容,如果设置False则默认仅刷当前预设方案阵容属性
|
| | | @return: 是否有刷属性,0-无;1-有
|
| | | '''
|
| | |
|
| | | curPlayer = self.curPlayer
|
| | | batPresetID = PlayerPreset.GetBatPresetID(curPlayer, ShareDefine.BatPreset_Main)
|
| | | |
| | | isRefresh = False
|
| | | # 同步执行阵容属性刷新
|
| | | for lineup in self._lineupDict.values():
|
| | | for lineup in self._presetLineupDict.values():
|
| | | if not isAllLineup:
|
| | | # 有指定的话只要指定的即可
|
| | | if exclusiveMapID:
|
| | | if lineup.exclusiveMapID != exclusiveMapID:
|
| | | continue
|
| | |
|
| | | # 否则只刷主阵容,指定地图有效的也不需要刷
|
| | | elif lineup.lineupID != ShareDefine.Lineup_Main or lineup.exclusiveMapID != 0:
|
| | | # 否则只刷当前预设方案,指定地图有效的也不需要刷
|
| | | elif lineup.batPresetID != batPresetID or lineup.exclusiveMapID != 0:
|
| | | continue
|
| | | if lineup.CheckRefreshLineupAttr():
|
| | | isRefresh = True
|
| | |
|
| | | return isRefresh
|
| | |
|
| | | def OnHeroItemUpate(self, heroItem):
|
| | | '''武将物品变化时需要处理的逻辑
|
| | | @param heroItem: 变化武将物品
|
| | | @param return: 影响的阵容ID列表
|
| | | def UpdHeroItemPreset(self, heroPresetID, heroItemDict, shapeType=0, isReload=False):
|
| | | '''变更武将预设阵容时更新
|
| | | @param heroPresetID: 武将预设ID
|
| | | @param heroItemDict: 武将背包索引信息 {itemIndex:posNum, ...}
|
| | | @param shapeType: 阵型
|
| | | @param refreshForce: 是否强制刷属性
|
| | | '''
|
| | | effLineupIDList = []
|
| | | curPlayer = self.curPlayer
|
| | | heroPreset = self.GetHeroPreset(heroPresetID)
|
| | | heroPreset.SetHeroItemPreset(curPlayer, heroItemDict, shapeType, isReload)
|
| | | self.RefreshByFuncPreset(ShareDefine.FuncPreset_Hero, heroPresetID)
|
| | |
|
| | | checkUpdEffHeroCard(self, heroItem) # 检查更新生效的卡牌
|
| | | |
| | | itemIndex = heroItem.GetItemPlaceIndex()
|
| | | for lineKey, lineup in self._lineupDict.items():
|
| | | if lineup.CheckHeroItemUpdate(itemIndex):
|
| | | if lineKey not in effLineupIDList:
|
| | | effLineupIDList.append(lineKey)
|
| | | |
| | | GameWorld.DebugLog("武将物品变化: itemIndex=%s, 影响阵容:%s" % (itemIndex, effLineupIDList), self.playerID)
|
| | | if not isReload:
|
| | | PlayerHero.Sync_HeroPreset(curPlayer, heroPresetID)
|
| | | return
|
| | |
|
| | | def GetLastBatBuffer(self): return self._lastBatBufferInfo
|
| | | def SetLastBatBuffer(self, guid, batBuffer):
|
| | | self._lastBatBufferInfo = [guid, batBuffer]
|
| | | def OnHeroItemUpate(self, heroItem):
|
| | | '''某个武将物品变化时需要处理的逻辑
|
| | | @param heroItem: 变化武将物品
|
| | | '''
|
| | | curPlayer = self.curPlayer
|
| | | itemIndex = heroItem.GetItemPlaceIndex()
|
| | | for heroPreset in self._heroPresetDict.values():
|
| | | effCardAddPerBef = heroPreset.GetEffCardAddPer()
|
| | | |
| | | checkUpdEffHeroCard(curPlayer, heroPreset, heroItem)
|
| | | |
| | | effCardAddPerAft = heroPreset.GetEffCardAddPer()
|
| | | |
| | | if effCardAddPerBef == effCardAddPerAft:
|
| | | continue
|
| | | heroPresetID = heroPreset.heroPresetID
|
| | | GameWorld.DebugLog("武将物品变化影响: itemIndex=%s,heroPresetID=%s,effCardAddPerBef=%s,effCardAddPerAft=%s" |
| | | % (itemIndex, heroPresetID, effCardAddPerBef, effCardAddPerAft), self.playerID)
|
| | | self.RefreshByFuncPreset(ShareDefine.FuncPreset_Hero, heroPresetID)
|
| | | |
| | | return
|
| | |
|
| | | class OnlineMgr():
|
| | |
| | | GetOnlinePlayer(curPlayer).SetCalcAttr(ChConfig.Def_CalcAttr_LV, lvAttrDict)
|
| | | return
|
| | |
|
| | | def checkUpdEffHeroCard(olPlayer, heroItem, isNotify=True):
|
| | | def checkUpdEffHeroCard(curPlayer, heroPreset, heroItem, isNotify=True):
|
| | | ## 玩家武将背包卡牌变更时调用
|
| | | # @return: 加成是否变更
|
| | | if not hasattr(heroItem, "GetItemPlaceIndex"):
|
| | | return
|
| | | curPlayer = olPlayer.curPlayer
|
| | | if not curPlayer:
|
| | | return
|
| | | heroPresetID = heroPreset.heroPresetID
|
| | | itemIndex = heroItem.GetItemPlaceIndex()
|
| | | heroID = heroItem.GetItemTypeID()
|
| | | curAddPer = getHeroCardAddPer(heroItem)
|
| | | effAddPer, effItemIndex, inMain = olPlayer.GetHeroEffectiveCard(heroID)
|
| | | effAddPer, effItemIndex, inThis = heroPreset.GetHeroEffectiveCard(heroID)
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | hisEffItem = curPack.GetAt(effItemIndex) if curPack.GetCount() > effItemIndex else None
|
| | | if not hisEffItem or hisEffItem.IsEmpty():
|
| | | GameWorld.DebugLog("历史生效的物品不在了,强制设置空! effAddPer=%s,effItemIndex=%s,inMain=%s" % (effAddPer, effItemIndex, inMain))
|
| | | effAddPer, effItemIndex, inMain = -1, -1, False
|
| | | GameWorld.DebugLog("历史生效的物品不在了,强制设置空! heroPresetID=%s,effAddPer=%s,effItemIndex=%s,inThis=%s" % (heroPresetID, effAddPer, effItemIndex, inThis))
|
| | | effAddPer, effItemIndex, inThis = -1, -1, False
|
| | |
|
| | | if itemIndex == effItemIndex:
|
| | | if curAddPer == effAddPer:
|
| | | GameWorld.DebugLog("生效的卡牌不变且加成也不变,不用处理! heroID=%s,itemIndex=%s,inMain=%s,effAddPer=%s,curAddPer=%s" % (heroID, itemIndex, inMain, effAddPer, curAddPer))
|
| | | GameWorld.DebugLog("生效的卡牌不变且加成也不变,不用处理! heroPresetID=%s,heroID=%s,itemIndex=%s,inThis=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroPresetID, heroID, itemIndex, inThis, effAddPer, curAddPer))
|
| | | return
|
| | | olPlayer.SetHeroEffectiveCard(heroID, curAddPer, itemIndex, inMain)
|
| | | heroPreset.SetHeroEffectiveCard(heroID, curAddPer, itemIndex, inThis)
|
| | | if curAddPer > effAddPer:
|
| | | GameWorld.DebugLog("生效的卡牌不变且加成提升了! heroID=%s,itemIndex=%s,inMain=%s,effAddPer=%s,curAddPer=%s" % (heroID, itemIndex, inMain, effAddPer, curAddPer))
|
| | | GameWorld.DebugLog("生效的卡牌不变且加成提升了! heroPresetID=%s,heroID=%s,itemIndex=%s,inThis=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroPresetID, heroID, itemIndex, inThis, effAddPer, curAddPer))
|
| | | return
|
| | | if inMain:
|
| | | GameWorld.DebugLog("生效的卡牌效果加成降低了,但在主阵容中依旧保持生效! heroID=%s,itemIndex=%s,inMain=%s,effAddPer=%s,curAddPer=%s" % (heroID, itemIndex, inMain, effAddPer, curAddPer))
|
| | | if inThis:
|
| | | GameWorld.DebugLog("生效的卡牌效果加成降低了,但在主阵容中依旧保持生效! heroPresetID=%s,heroID=%s,itemIndex=%s,inThis=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroPresetID, heroID, itemIndex, inThis, effAddPer, curAddPer))
|
| | | return
|
| | | GameWorld.DebugLog("生效的卡牌效果加成降低了,未在主阵容中重新检索是否有加成更高的! heroID=%s,itemIndex=%s,inMain=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroID, itemIndex, inMain, effAddPer, curAddPer))
|
| | | GameWorld.DebugLog("生效的卡牌效果加成降低了,未在主阵容中重新检索是否有加成更高的! heroPresetID=%s,heroID=%s,itemIndex=%s,inThis=%s,effAddPer=%s,curAddPer=%s" |
| | | % (heroPresetID, heroID, itemIndex, inThis, effAddPer, curAddPer))
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for index in range(curPack.GetCount()):
|
| | | if index == itemIndex:
|
| | |
| | | packCardPer = getHeroCardAddPer(packItem)
|
| | | if packCardPer <= curAddPer:
|
| | | continue
|
| | | GameWorld.DebugLog("有更高加成的同名武将! heroID=%s,index=%s,packCardPer=%s > curAddPer=%s" % (heroID, index, packCardPer, curAddPer))
|
| | | checkUpdEffHeroCard(olPlayer, packItem, isNotify)
|
| | | GameWorld.DebugLog("有更高加成的同名武将! heroPresetID=%s,heroID=%s,index=%s,packCardPer=%s > curAddPer=%s" % (heroPresetID, heroID, index, packCardPer, curAddPer))
|
| | | checkUpdEffHeroCard(curPlayer, heroPreset, packItem, isNotify)
|
| | | return
|
| | |
|
| | | GameWorld.DebugLog("没有更高加成的同名武将,保留本卡生效! heroID=%s,itemIndex=%s,curAddPer=%s" % (heroID, itemIndex, curAddPer))
|
| | | GameWorld.DebugLog("没有更高加成的同名武将,保留本卡生效! heroPresetID=%s,heroID=%s,itemIndex=%s,curAddPer=%s" % (heroPresetID, heroID, itemIndex, curAddPer))
|
| | | return
|
| | |
|
| | | if inMain:
|
| | | GameWorld.DebugLog("没有在主阵容中且当前生效的卡牌在主阵容中不处理! heroID=%s,effItemIndex=%s,itemIndex=%s" % (heroID, effItemIndex, itemIndex))
|
| | | if inThis:
|
| | | GameWorld.DebugLog("没有在主阵容中且当前生效的卡牌在主阵容中不处理! heroPresetID=%s,heroID=%s,effItemIndex=%s,itemIndex=%s" % (heroPresetID, heroID, effItemIndex, itemIndex))
|
| | | return
|
| | |
|
| | | if curAddPer <= effAddPer:
|
| | | GameWorld.DebugLog("都没有在主阵容中且不高于当前生效卡牌加成不处理! heroID=%s,itemIndex=%s,curAddPer=%s <= %s,effItemIndex=%s" |
| | | % (heroID, itemIndex, curAddPer, effAddPer, effItemIndex))
|
| | | GameWorld.DebugLog("都没有在主阵容中且不高于当前生效卡牌加成不处理! heroPresetID=%s,heroID=%s,itemIndex=%s,curAddPer=%s <= %s,effItemIndex=%s" |
| | | % (heroPresetID, heroID, itemIndex, curAddPer, effAddPer, effItemIndex))
|
| | | return
|
| | | GameWorld.DebugLog("都没有在主阵容中且高于当前生效卡牌加成替换生效卡牌! heroID=%s,itemIndex=%s,curAddPer=%s > %s,effItemIndex=%s" |
| | | % (heroID, itemIndex, curAddPer, effAddPer, effItemIndex))
|
| | | olPlayer.SetHeroEffectiveCard(heroID, curAddPer, itemIndex, inMain)
|
| | | GameWorld.DebugLog("都没有在主阵容中且高于当前生效卡牌加成替换生效卡牌! heroPresetID=%s,heroID=%s,itemIndex=%s,curAddPer=%s > %s,effItemIndex=%s" |
| | | % (heroPresetID, heroID, itemIndex, curAddPer, effAddPer, effItemIndex))
|
| | | heroPreset.SetHeroEffectiveCard(heroID, curAddPer, itemIndex, inThis)
|
| | |
|
| | | item = heroItem.GetItem()
|
| | | item.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 1)
|
| | | item.AddUserAttr(ShareDefine.Def_IudetHeroEffPresetID, heroPresetID)
|
| | | isNotify and heroItem.Sync_Item()
|
| | |
|
| | | if effItemIndex >= 0:
|
| | |
| | | hisEffItem = curPack.GetAt(effItemIndex) if curPack.GetCount() > effItemIndex else None
|
| | | if hisEffItem and not hisEffItem.IsEmpty():
|
| | | item = hisEffItem.GetItem()
|
| | | item.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 0)
|
| | | item.DelUserAttr(ShareDefine.Def_IudetHeroEffPresetID, heroPresetID)
|
| | | isNotify and hisEffItem.Sync_Item()
|
| | |
|
| | | return
|
| | |
|
| | | def reloadEffHeroCard(curPlayer, olPlayer):
|
| | | def reloadEffHeroCard(curPlayer, heroPreset):
|
| | | ## 重新检查载入生效的卡牌,一般用于比较复杂的情况,直接重新遍历一遍,如登录时、重新保存主阵容时
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | heroPresetID = heroPreset.heroPresetID
|
| | | hisEffCardIndexList = [] # 历史生效的卡牌 [index, ...]
|
| | | updEffectiveCardDict = {} # 更新生效的卡牌 {heroID:[cardAddPer, itemIndex, inMain], ...}
|
| | | updEffectiveCardDict = {} # 更新生效的卡牌 {heroID:[cardAddPer, itemIndex, inThis], ...}
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | GameWorld.DebugLog("重新检查载入生效的卡牌: heroPresetID=%s" % (heroPresetID), playerID)
|
| | | for index in range(curPack.GetCount()):
|
| | | heroItem = curPack.GetAt(index)
|
| | | if not heroItem or heroItem.IsEmpty():
|
| | | continue
|
| | |
|
| | | inThis = False # 是否在此预设中
|
| | | lineupCount = heroItem.GetUserAttrCount(ShareDefine.Def_IudetHeroLineup)
|
| | | for lpIndex in range(lineupCount):
|
| | | lineupValue = heroItem.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | if PlayerHero.GetLineupValue(lineupValue)[0] == heroPresetID:
|
| | | inThis = True
|
| | | break
|
| | | |
| | | heroID = heroItem.GetItemTypeID()
|
| | | inMain = PlayerHero.InMainLineup(heroItem)
|
| | | cardAddPer = getHeroCardAddPer(heroItem)
|
| | | |
| | | hisEffPresetIDList = PlayerHero.GetHeroEffPresetIDList(heroItem)
|
| | | # 历史生效的
|
| | | if heroItem.GetUserAttr(ShareDefine.Def_IudetHeroCardEffective): # 是否生效的
|
| | | if heroPresetID in hisEffPresetIDList:
|
| | | hisEffCardIndexList.append(index)
|
| | |
|
| | | # 最新生效的: 主阵容中的优先生效,非主阵容中的最高加成的生效
|
| | | if inMain:
|
| | | updEffectiveCardDict[heroID] = [cardAddPer, index, inMain]
|
| | | if inThis:
|
| | | updEffectiveCardDict[heroID] = [cardAddPer, index, inThis]
|
| | | else:
|
| | | effInfo = updEffectiveCardDict.get(heroID, [-1, -1, False])
|
| | | if effInfo[2] == True:
|
| | | pass #GameWorld.Log(" 已经有在阵容中的生效卡了: index=%s" % effInfo[1])
|
| | | elif cardAddPer > effInfo[0]:
|
| | | updEffectiveCardDict[heroID] = [cardAddPer, index, inMain]
|
| | | updEffectiveCardDict[heroID] = [cardAddPer, index, inThis]
|
| | |
|
| | | # 更新生效变更的卡牌
|
| | | syncItemDict = {} # 需要同步的异常物品 {index:heroItem, ...}
|
| | | GameWorld.DebugLog("历史生效的卡牌索引: %s" % hisEffCardIndexList)
|
| | | GameWorld.DebugLog("最新生效的卡牌信息: %s" % updEffectiveCardDict)
|
| | | GameWorld.DebugLog(" 历史生效的卡牌索引: %s,%s" % (len(hisEffCardIndexList), hisEffCardIndexList), playerID)
|
| | | GameWorld.DebugLog(" 最新生效的卡牌信息: %s,%s" % (len(updEffectiveCardDict), updEffectiveCardDict), playerID)
|
| | | cardPerTotal = 0
|
| | | olPlayer.SetEffectiveCardDict(updEffectiveCardDict)
|
| | | heroPreset.SetEffectiveCardDict(updEffectiveCardDict)
|
| | | for heroID, effInfo in updEffectiveCardDict.items():
|
| | | cardAddPer, itemIndex, inMain = effInfo
|
| | | cardAddPer, itemIndex, inThis = effInfo
|
| | | cardPerTotal += cardAddPer
|
| | | if itemIndex in hisEffCardIndexList:
|
| | | hisEffCardIndexList.remove(itemIndex) # 不变的直接移除,剩余未移除的就是失效的
|
| | | #GameWorld.DebugLog("生效的卡牌不变的: heroID=%s,itemIndex=%s,inMain=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inMain, cardAddPer, cardPerTotal))
|
| | | #GameWorld.DebugLog(" 生效的卡牌不变的: heroID=%s,itemIndex=%s,inThis=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inThis, cardAddPer, cardPerTotal), playerID)
|
| | | else:
|
| | | GameWorld.DebugLog("生效的卡牌变化的: heroID=%s,itemIndex=%s,inMain=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inMain, cardAddPer, cardPerTotal))
|
| | | GameWorld.DebugLog(" 生效的卡牌变化的: heroID=%s,itemIndex=%s,inThis=%s,cardAddPer=%s,cardPerTotal=%s" % (heroID, itemIndex, inThis, cardAddPer, cardPerTotal), playerID)
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | | item = heroItem.GetItem()
|
| | | item.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 1)
|
| | | item.AddUserAttr(ShareDefine.Def_IudetHeroEffPresetID, heroPresetID)
|
| | | syncItemDict[itemIndex] = heroItem
|
| | |
|
| | | # 移除历史失效的卡牌
|
| | | GameWorld.DebugLog("移除失效的卡牌索引: %s" % hisEffCardIndexList)
|
| | | GameWorld.DebugLog(" 移除失效的卡牌索引: %s" % hisEffCardIndexList, playerID)
|
| | | for itemIndex in hisEffCardIndexList:
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | | item = heroItem.GetItem()
|
| | | item.SetUserAttr(ShareDefine.Def_IudetHeroCardEffective, 0)
|
| | | item.DelUserAttr(ShareDefine.Def_IudetHeroEffPresetID, heroPresetID)
|
| | | syncItemDict[itemIndex] = heroItem
|
| | |
|
| | | GameWorld.DebugLog(" 最终生效卡牌加成: %s,heroPresetID=%s" % (cardPerTotal, heroPresetID), playerID)
|
| | | |
| | | # 同步变更的物品
|
| | | for syncItem in syncItemDict.values():
|
| | | syncItem.Sync_Item()
|
| | |
| | | return addPer
|
| | |
|
| | | def doReloadLineup(curPlayer, olPlayer):
|
| | | ## 重新载入阵容 |
| | | loadLineupIDList = ShareDefine.LineupList
|
| | | lineupDict = {} # {阵容ID:{itemIndex:posNum, ...}, ...}
|
| | | lineShapeTypeDict = {} # {阵容ID:阵型, ...}
|
| | | ## 重新载入阵容
|
| | | herpPresetIpyDataList = IpyGameDataPY.GetIpyGameDataList("PresetUnlock", ShareDefine.FuncPreset_Hero)
|
| | | if not herpPresetIpyDataList:
|
| | | return
|
| | | presetIDMax = len(herpPresetIpyDataList) # 最大可用的武将阵容方案ID
|
| | | funcPresetType = ShareDefine.FuncPreset_Hero
|
| | | presetDict = {} # {预设ID:{itemIndex:posNum, ...}, ...}
|
| | | shapeTypeDict = {} # {预设ID:阵型, ...}
|
| | | syncItemDict = {} # 需要同步的异常物品 {index:heroItem, ...}
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for index in range(curPack.GetCount()):
|
| | |
| | | delValueList = []
|
| | | for lpIndex in range(lineupCount)[::-1]:
|
| | | lineupValue = heroItem.GetUserAttrByIndex(ShareDefine.Def_IudetHeroLineup, lpIndex)
|
| | | lineupID, shapeType, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if lineupID not in loadLineupIDList:
|
| | | heroPresetID, shapeType, posNum = PlayerHero.GetLineupValue(lineupValue)
|
| | | if not heroPresetID or heroPresetID > presetIDMax or not PlayerPreset.GetFuncPresetIDState(curPlayer, heroPresetID, funcPresetType):
|
| | | GameWorld.DebugLog("异常或不可用的武将预设方案ID: index=%s,heroPresetID=%s,lineupValue=%s" % (index, heroPresetID, lineupValue))
|
| | | delValueList.append(lineupValue)
|
| | | continue
|
| | | # 任意取一个武将保存的阵型即可,同阵容的武将理论上保存的阵型是一样的
|
| | | if lineupID not in lineShapeTypeDict:
|
| | | lineShapeTypeDict[lineupID] = shapeType
|
| | | if lineupID not in lineupDict:
|
| | | lineupDict[lineupID] = {}
|
| | | heroItemDict = lineupDict[lineupID]
|
| | | if heroPresetID not in shapeTypeDict:
|
| | | shapeTypeDict[heroPresetID] = shapeType
|
| | | if heroPresetID not in presetDict:
|
| | | presetDict[heroPresetID] = {}
|
| | | heroItemDict = presetDict[heroPresetID]
|
| | |
|
| | | # 超出人数限制或位置异常
|
| | | if len(heroItemDict) >= ShareDefine.LineupObjMax or posNum in heroItemDict.values() or index in heroItemDict:
|
| | |
| | | for syncItem in syncItemDict.values():
|
| | | syncItem.Sync_Item()
|
| | |
|
| | | GameWorld.DebugLog("重载阵容: %s" % lineupDict, curPlayer.GetPlayerID())
|
| | | for lineupID, heroItemDict in lineupDict.items():
|
| | | lineup = olPlayer.GetLineup(lineupID, False)
|
| | | GameWorld.DebugLog("重载武将预设阵容: %s" % presetDict, curPlayer.GetPlayerID())
|
| | | for heroPresetID, heroItemDict in presetDict.items():
|
| | | shapeType = shapeTypeDict.get(heroPresetID, 0)
|
| | | olPlayer.UpdHeroItemPreset(heroPresetID, heroItemDict, shapeType, isReload=True)
|
| | |
|
| | | # 获取其他绑定该阵容的功能,如红颜、灵兽等
|
| | | |
| | | shapeType = lineShapeTypeDict.get(lineupID, 0)
|
| | | lineup.UpdLineup(heroItemDict, shapeType, isReload=True)
|
| | | |
| | | if lineupID == ShareDefine.Lineup_Main:
|
| | | for exclusiveMapID in ChConfig.ExclusiveBatAttrMapIDList:
|
| | | exclusiveLineup = olPlayer.GetLineup(lineupID, False, exclusiveMapID=exclusiveMapID)
|
| | | exclusiveLineup.UpdLineup(heroItemDict, shapeType, isReload=True)
|
| | | |
| | | PlayerHero.Sync_Lineup(curPlayer)
|
| | | PlayerHero.Sync_HeroPreset(curPlayer)
|
| | | return
|
| | |
|
| | | def doCalcAllAttr(curPlayer):
|
| | |
| | | PlayerHJG.CalcHJGAttr(curPlayer)
|
| | | PlayerHorse.CalcHorseAttr(curPlayer)
|
| | | PlayerBeauty.CalcBeautyAttr(curPlayer)
|
| | | PlayerMingge.CalcMinggeAttr(curPlayer)
|
| | | GameLogic_Dingjunge.CalcDingjungeAttr(curPlayer)
|
| | | return
|
| | |
|
| | | def doRefreshLineupAttr(curPlayer, olPlayer, lineup):
|
| | | def doRefreshLineupAttr(curPlayer, olPlayer, presetLineup):
|
| | | ''' 刷新某个阵容属性
|
| | | 基础属性-面板显示:
|
| | | 1.全体基础固定值=所有穿戴装备【装备基础固定值】+【法宝基础固定值】+【红颜基础固定值】+【其它模块的固定值】
|
| | |
| | | 最终面板战斗属性=【E全体战斗属性值】*【卡牌继承比例】+【卡牌自身培养战斗属性】
|
| | | '''
|
| | | playerID = curPlayer.GetPlayerID()
|
| | | lineupID = lineup.lineupID
|
| | | exclusiveMapID = lineup.exclusiveMapID
|
| | | batPresetID = presetLineup.batPresetID
|
| | | exclusiveMapID = presetLineup.exclusiveMapID
|
| | |
|
| | | GameWorld.DebugLog("刷新阵容属性: lineupID=%s,exclusiveMapID=%s" % (lineupID, exclusiveMapID), playerID)
|
| | | GameWorld.DebugLog(" itemIndex-posNum : %s" % lineup.heroItemDict, playerID)
|
| | | heroPresetID = PlayerPreset.GetFuncPresetID(curPlayer, batPresetID, ShareDefine.FuncPreset_Hero)
|
| | | mgPresetID = PlayerPreset.GetFuncPresetID(curPlayer, batPresetID, ShareDefine.FuncPreset_Mingge)
|
| | |
|
| | | lineup.FreeLineupHero()
|
| | | heroPreset = olPlayer.GetHeroPreset(heroPresetID)
|
| | | heroItemDict = heroPreset.heroItemDict
|
| | | |
| | | GameWorld.DebugLog("刷新战斗预设方案属性: batPresetID=%s,exclusiveMapID=%s" % (batPresetID, exclusiveMapID), playerID)
|
| | | GameWorld.DebugLog(" heroPresetID=%s,itemIndex-posNum : %s" % (heroPresetID, heroItemDict), playerID)
|
| | | |
| | | presetLineup.FreeLineupHero()
|
| | |
|
| | | # 因为同阵容的武将ID不能重复,所以字典key可以用武将ID
|
| | | countryHeroInfo = {} # 国家武将统计 {country:[heroID, ...], ...}
|
| | |
| | | heroAwakeTalentInfo = {} # 武将觉醒天赋属性 {heroID:{attrID:value, ...}, ...}
|
| | |
|
| | | curPack = curPlayer.GetItemManager().GetPack(ShareDefine.rptHero)
|
| | | for itemIndex, posNum in lineup.heroItemDict.items():
|
| | | for itemIndex, posNum in heroItemDict.items():
|
| | | if itemIndex < 0 or itemIndex >= curPack.GetCount():
|
| | | continue
|
| | | heroItem = curPack.GetAt(itemIndex)
|
| | |
| | | elif skinIDList:
|
| | | skinID = skinIDList[0]
|
| | |
|
| | | lineupHero = lineup.GetLineupHero(posNum)
|
| | | lineupHero = presetLineup.GetLineupHero(posNum)
|
| | | #if False:
|
| | | # lineupHero = LineupHero()
|
| | | lineupHero.itemIndex = itemIndex
|
| | |
| | | attrValue = attrValueList[aIndex]
|
| | | breakAttrDict[attrID] = breakAttrDict.get(attrID, 0) + attrValue
|
| | | skillID = breakIpyData.GetSkillID()
|
| | | skillIDExList = breakIpyData.GetSkillIDExList()
|
| | | if skillID:
|
| | | lineupHero.heroSkillIDList.append(skillID)
|
| | | if skillIDExList:
|
| | | lineupHero.heroSkillIDList += skillIDExList
|
| | | |
| | | heroBreakAttrInfo[heroID] = breakAttrDict
|
| | |
|
| | | # 觉醒天赋
|
| | |
| | | hjgAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_HJG)
|
| | | horseAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Horse)
|
| | | beautyAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Beauty)
|
| | | minggeAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Mingge, mgPresetID)
|
| | | dingjungeAttrDict = olPlayer.GetCalcAttr(ChConfig.Def_CalcAttr_Dingjunge) if exclusiveMapID == ChConfig.Def_FBMapID_Dingjunge else {}
|
| | |
|
| | | GameWorld.DebugLog(" 国家武将统计=%s" % countryHeroInfo, playerID)
|
| | |
| | | GameWorld.DebugLog(" 主幻境阁属性=%s" % hjgAttrDict, playerID)
|
| | | GameWorld.DebugLog(" 主公坐骑属性=%s" % horseAttrDict, playerID)
|
| | | GameWorld.DebugLog(" 主公红颜属性=%s" % beautyAttrDict, playerID)
|
| | | GameWorld.DebugLog(" 主公命格属性=%s,mgPresetID=%s" % (minggeAttrDict, mgPresetID), playerID)
|
| | | GameWorld.DebugLog(" 定军专属属性=%s" % dingjungeAttrDict, playerID)
|
| | | |
| | | effCardAddPer = 0
|
| | | for effInfo in olPlayer.GetEffectiveCardDict().values():
|
| | | effCardAddPer += effInfo[0]
|
| | | effCardAddPer = heroPreset.GetEffCardAddPer()
|
| | | effCardAddPer /= 10000.0
|
| | | GameWorld.DebugLog(" 主公卡牌加成=%s" % effCardAddPer, playerID)
|
| | |
|
| | |
| | |
|
| | | lineupFightPower = 0 # 阵容总战力
|
| | | for heroID, selfAttrDict in heroSelfAttrInfo.items():
|
| | | lineupHero = lineup.GetLineupHeroByID(heroID)
|
| | | lineupHero = presetLineup.GetLineupHeroByID(heroID)
|
| | | if not lineupHero:
|
| | | continue
|
| | | lineupHero.heroBatAttrDict = {}
|
| | |
| | | beautyValue = beautyAttrDict.get(attrID, 0)
|
| | | beautyPer = beautyAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
|
| | |
|
| | | minggeValue = minggeAttrDict.get(attrID, 0)
|
| | | minggePer = minggeAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
|
| | | |
| | | dingjungeValue = dingjungeAttrDict.get(attrID, 0)
|
| | | dingjungePer = dingjungeAttrDict.get(attrPerID, 0) / 10000.0 if attrPerID else 0
|
| | |
|
| | |
| | |
|
| | | # 计算
|
| | | attrParamDict = {"lvValue":lvValue, "equipValue":equipValue, "realmValue":realmValue, "realmPer":realmPer, "cardPer":cardPer,
|
| | | "gubaoValue":gubaoValue, "gubaoPer":gubaoPer, "hjgValue":hjgValue, "hjgPer":hjgPer, "horseValue":horseValue, "horsePer":horsePer, |
| | | "gubaoValue":gubaoValue, "gubaoPer":gubaoPer, "hjgValue":hjgValue, "hjgPer":hjgPer, "horseValue":horseValue, "horsePer":horsePer,
|
| | | "beautyValue":beautyValue, "beautyPer":beautyPer, "fatesValue":fatesValue, "fatesPer":fatesPer,
|
| | | "dingjungeValue":dingjungeValue, "dingjungePer":dingjungePer,
|
| | | "dingjungeValue":dingjungeValue, "dingjungePer":dingjungePer, "minggeValue":minggeValue, "minggePer":minggePer,
|
| | | "heroSelfValue":heroSelfValue, "heroSelfPer":heroSelfPer, "inheritPer":inheritPer, "heroLVValue":heroLVValue, "heroLVPer":heroLVPer,
|
| | | "lineupHaloValue":lineupHaloValue, "lineupHaloPer":lineupHaloPer, "fetterValue":fetterValue, "fetterPer":fetterPer,
|
| | | "starTalentValue":starTalentValue, "starTalentPer":starTalentPer, "breakLVValue":breakLVValue, "breakLVPer":breakLVPer,
|
| | |
| | | GameWorld.DebugLog(" 武将最终战力: heroID=%s,fightPower=%s(%s+%s),%s,skillIDList=%s"
|
| | | % (heroID, fightPowerTotal, fightPower, skillFightPower, logAttrDict, lineupHero.heroSkillIDList), playerID)
|
| | |
|
| | | lineup.fightPower = lineupFightPower
|
| | | GameWorld.DebugLog(" 阵容最终战力: lineupID=%s,lineupFightPower=%s,exclusiveMapID=%s" % (lineupID, lineupFightPower, exclusiveMapID), playerID)
|
| | | presetLineup.fightPower = lineupFightPower
|
| | | GameWorld.DebugLog(" 阵容最终战力: batPresetID=%s,lineupFightPower=%s,exclusiveMapID=%s" % (batPresetID, lineupFightPower, exclusiveMapID), playerID)
|
| | |
|
| | | # 非主线阵容不处理以下内容
|
| | | if lineupID != ShareDefine.Lineup_Main or exclusiveMapID:
|
| | | # 非主线预设方案不处理以下内容
|
| | | if exclusiveMapID or batPresetID != PlayerPreset.GetBatPresetID(curPlayer, ShareDefine.BatPreset_Main):
|
| | | return
|
| | |
|
| | | PlayerControl.SetFightPower(curPlayer, lineupFightPower)
|
| | |
| | | # 主线战斗如果有在战斗中,实时更新
|
| | | if mainTurnFight and mainTurnFight.isInFight():
|
| | | # 如果是阵容变化的,重新开始战斗
|
| | | if lineup.lineupChange:
|
| | | GameWorld.DebugLog("主阵容变化,重新开始战斗", playerID)
|
| | | if heroPreset.isHeroChange:
|
| | | heroPreset.isHeroChange = False
|
| | | GameWorld.DebugLog("主线阵容变化,重新开始战斗", playerID)
|
| | | if mainTurnFight.mapID == ChConfig.Def_FBMapID_Main:
|
| | | TurnAttack.__doMainLevelWave(curPlayer, True)
|
| | |
|
| | | # 否则只重新设置战斗属性
|
| | | else:
|
| | | GameWorld.DebugLog("主阵容卡牌属性变更,更新战斗武将属性", playerID)
|
| | | GameWorld.DebugLog("主线阵容卡牌属性变更,更新战斗武将属性", playerID)
|
| | | # lineup 为卡牌的阵容,仅有阵容属性相关,没有战斗对象
|
| | | # batLineup 为卡牌阵容体现到具体战斗的战斗阵容,有具体的战斗对象
|
| | | faction, num = ChConfig.Def_FactionA, 1 # 主线战斗玩家自己默认阵营A的第1个战斗阵容
|
| | |
| | | batObj = batObjMgr.getBatObj(objID)
|
| | | if not batObj:
|
| | | continue
|
| | | lineupHero = lineup.GetLineupHero(posNum)
|
| | | lineupHero = presetLineup.GetLineupHero(posNum)
|
| | | if lineupHero.heroBatAttrDict:
|
| | | batObj.UpdInitBatAttr(lineupHero.heroBatAttrDict, lineupHero.heroSkillIDList)
|
| | | else:
|
| | | GameWorld.DebugLog("主阵容没有在战斗中,不需要处理", playerID)
|
| | | GameWorld.DebugLog("主线阵容没有在战斗中,不需要处理", playerID)
|
| | |
|
| | | PlayerFamily.RefreshFamilyMember(curPlayer) # 更新公会
|
| | | # 更新排行榜
|