| | |
| | | self.calcFightTimeTick = 0 # 计算战斗时长tick
|
| | | self.collectTypeIndex = 0 # 采集NPC类型配置index
|
| | | self.collectLostHPTick = 0 # 采集NPC掉血tick
|
| | | |
| | | self.restoreHPTick = 0 # 营地回血tick
|
| | | return
|
| | |
|
| | | def AddFamilyWarPlayer(familyID, faction, playerID, name, tick):
|
| | |
| | |
|
| | | def __AddPlayerFightTimeByTime(tick):
|
| | | # 更新玩家战斗时长
|
| | | |
| | | restoreHPPerBySecond = IpyGameDataPY.GetFuncCfg("FamilyMatchSpawnPoint", 4) # 每秒回血百分比
|
| | | factionSafeAreaRandPosList = IpyGameDataPY.GetFuncEvalCfg("FamilyMatchSpawnPoint", 3) # 营地坐标
|
| | | |
| | | playerManager = GameWorld.GetMapCopyPlayerManager()
|
| | | for index in xrange(playerManager.GetPlayerCount()):
|
| | | curPlayer = playerManager.GetPlayerByIndex(index)
|
| | |
| | | if not playerID:
|
| | | continue
|
| | | warPlayer = GetFamilyWarPlayer(playerID)
|
| | | |
| | | faction = curPlayer.GetFaction()
|
| | | if faction and faction <= len(factionSafeAreaRandPosList):
|
| | | safePosX, safePosY, safeRadius = factionSafeAreaRandPosList[faction - 1]
|
| | | if GameWorld.GetDist(curPlayer.GetPosX(), curPlayer.GetPosY(), safePosX, safePosY) <= safeRadius:
|
| | | # 营地回血
|
| | | restoreSeconds = (tick - warPlayer.restoreHPTick) / 1000.0 if warPlayer.restoreHPTick else 1 # 首次保底1秒
|
| | | if restoreSeconds >= 1:
|
| | | maxHP = GameObj.GetMaxHP(curPlayer)
|
| | | if GameObj.GetHP(curPlayer) < maxHP:
|
| | | restoreHP = int(maxHP * restoreHPPerBySecond / 100.0 * round(restoreSeconds, 1))
|
| | | #GameWorld.DebugLog("restoreHPPerBySecond=%s,restoreSeconds=%s,maxHP=%s,restoreHP=%s" |
| | | # % (restoreHPPerBySecond, restoreSeconds, maxHP, restoreHP), playerID)
|
| | | SkillCommon.SkillAddHP(curPlayer, 0, restoreHP)
|
| | | warPlayer.restoreHPTick = tick
|
| | | else:
|
| | | warPlayer.restoreHPTick = 0
|
| | | |
| | | lastCalcTick = warPlayer.calcFightTimeTick
|
| | | warPlayer.calcFightTimeTick = tick
|
| | | if not lastCalcTick:
|