From 62986bb30351731bddecd141607cf4dc8c58d54c Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期一, 19 一月 2026 11:41:36 +0800
Subject: [PATCH] 423 【内政】命格系统-服务端(命格卦玉战斗属性增加感悟等级对应基础值配置;品质表改为加成随机值范围;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyTaofa.py | 204 +++++++++++++++++++++++++++++++++++----------------
1 files changed, 140 insertions(+), 64 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyTaofa.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyTaofa.py
index b79fb12..38966a2 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyTaofa.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Player/PlayerFamilyTaofa.py
@@ -26,7 +26,6 @@
import PlayerFamily
import GameWorld
import DBDataMgr
-import ObjPool
import time
@@ -84,6 +83,10 @@
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxContribCnt, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurt, 0)
PlayerControl.NomalDictSetProperty(curPlayer, ChConfig.Def_Player_Dict_FamilyTaofaBoxHurtEx, 0)
+ #玩家自己过天非时间过天的,需要刷新一下
+ familyID = curPlayer.GetFamilyID()
+ curFamily = DBDataMgr.GetFamilyMgr().FindFamily(familyID)
+ RefreshPlayerAwardBoxCnt(curFamily, curPlayer, unSyncIDList=[curPlayer.GetPlayerID()])
SyncTaofaInfo(curPlayer)
return
@@ -146,45 +149,45 @@
PlayerFamily.SendFamilyActionInfo(curPlayer, familyID, ActionType)
return
-def RefreshFamilyBuZhenInfo(family):
- ## 刷新公会公共布阵信息
- familyID = family.GetID()
- curTime = int(time.time())
- bzDuration = IpyGameDataPY.GetFuncCfg("FamilyTaofaBuzhen", 4) * 60 # 有效时长秒
- maxLayer = IpyGameDataPY.GetFuncCfg("FamilyTaofaBuzhen", 3)
-
- gLayer = 0
- gEndTime = 0
- gActionData = None
- familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ActionType)
- for index in range(0, familyAction.Count()):
- actionData = familyAction.At(index)
- dataID = GetFAPlayerID(actionData)
- if dataID == ActionGlobalID:
- gActionData = actionData
- continue
- bzTime = GetFABuzhenTime(actionData)
- if not bzTime:
- continue
- endTime = bzTime + bzDuration
- if endTime <= curTime:
- continue
-
- if not maxLayer or gLayer < maxLayer:
- gLayer += 1
-
- if gEndTime < endTime:
- gEndTime = endTime
-
- GameWorld.DebugLog("刷新公会公共布阵信息: familyID=%s,gLayer=%s,gEndTime=%s" % (familyID, gLayer, GameWorld.ChangeTimeNumToStr(gEndTime)))
- if not gActionData:
- gActionData = familyAction.AddAction()
- SetFAPlayerID(gActionData, ActionGlobalID)
-
- SetFABuzhenEndTime(gActionData, gEndTime)
- SetFABuzhenLayer(gActionData, gLayer)
- PlayerFamily.SendFamilyAction(gActionData)
- return
+#def RefreshFamilyBuZhenInfo(family):
+# ## 刷新公会公共布阵信息
+# familyID = family.GetID()
+# curTime = int(time.time())
+# bzDuration = IpyGameDataPY.GetFuncCfg("FamilyTaofaBuzhen", 4) * 60 # 有效时长秒
+# maxLayer = IpyGameDataPY.GetFuncCfg("FamilyTaofaBuzhen", 3)
+#
+# gLayer = 0
+# gEndTime = 0
+# gActionData = None
+# familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ActionType)
+# for index in range(0, familyAction.Count()):
+# actionData = familyAction.At(index)
+# dataID = GetFAPlayerID(actionData)
+# if dataID == ActionGlobalID:
+# gActionData = actionData
+# continue
+# bzTime = GetFABuzhenTime(actionData)
+# if not bzTime:
+# continue
+# endTime = bzTime + bzDuration
+# if endTime <= curTime:
+# continue
+#
+# if not maxLayer or gLayer < maxLayer:
+# gLayer += 1
+#
+# if gEndTime < endTime:
+# gEndTime = endTime
+#
+# GameWorld.DebugLog("刷新公会公共布阵信息: familyID=%s,gLayer=%s,gEndTime=%s" % (familyID, gLayer, GameWorld.ChangeTimeNumToStr(gEndTime)))
+# if not gActionData:
+# gActionData = familyAction.AddAction()
+# SetFAPlayerID(gActionData, ActionGlobalID)
+#
+# SetFABuzhenEndTime(gActionData, gEndTime)
+# SetFABuzhenLayer(gActionData, gLayer)
+# PlayerFamily.SendFamilyAction(gActionData)
+# return
def RefreshPlayerAwardBoxCnt(family, curPlayer=None, unSyncIDList=[]):
## 刷新玩家可领取的宝箱数
@@ -323,11 +326,11 @@
return
gLayer, gActionData = GetFamilyBuzhenLayer(familyID)
bzDuration = IpyGameDataPY.GetFuncCfg("FamilyTaofaBuzhen", 4) * 60 # 有效时长秒
- maxLayer = IpyGameDataPY.GetFuncCfg("FamilyTaofaBuzhen", 3)
gEndTime = int(time.time()) + bzDuration # 直接覆盖更新
- if not maxLayer or gLayer < maxLayer:
- gLayer += 1
-
+ gLayer += 1 # 布阵不限制次数,直接加
+ #if not maxLayer or gLayer < maxLayer:
+ # gLayer += 1
+
GameWorld.DebugLog("公会讨伐布阵: gLayer=%s,gEndTime=%s" % (gLayer, GameWorld.ChangeTimeNumToStr(gEndTime)), playerID)
# 公共信息
SetFABuzhenEndTime(gActionData, gEndTime)
@@ -353,18 +356,25 @@
if not curFamily:
return
- atkCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaCnt)
- itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaItemAddCnt)
- freeCnt = IpyGameDataPY.GetFuncCfg("FamilyTaofaAtk", 1)
- canAtkCnt = freeCnt + itemAddCnt - atkCnt
- if canAtkCnt <= 0:
- GameWorld.DebugLog("公会讨伐没有斩杀次数: atkCnt=%s >= freeCnt(%s) + itemAddCnt(%s)" % (atkCnt, freeCnt, itemAddCnt), playerID)
- return
+ commAddAnger, superAddAnger, maxAnger = IpyGameDataPY.GetFuncEvalCfg("FamilyTaofaAtk", 4)
+ anger = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaAnger)
+ atkType = AtkType_Anger if anger >= maxAnger else AtkType_Normal
+ if atkType == AtkType_Normal:
+ atkCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaCnt)
+ itemAddCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaItemAddCnt)
+ freeCnt = IpyGameDataPY.GetFuncCfg("FamilyTaofaAtk", 1)
+ canAtkCnt = freeCnt + itemAddCnt - atkCnt
+ if canAtkCnt <= 0:
+ GameWorld.DebugLog("公会讨伐没有斩杀次数: atkCnt=%s >= freeCnt(%s) + itemAddCnt(%s)" % (atkCnt, freeCnt, itemAddCnt), playerID)
+ return
+
atkTime = int(time.time())
# 计算属性
gLayer, _ = GetFamilyBuzhenLayer(familyID)
+ maxLayer = IpyGameDataPY.GetFuncCfg("FamilyTaofaBuzhen", 3)
+ gLayer = min(gLayer, maxLayer) # 限制生效的最大布阵层数
fightPower = PlayerControl.GetFightPower(curPlayer)
superRate = IpyGameDataPY.GetFuncCfg("FamilyTaofaBuzhen", 1)
superRatio = IpyGameDataPY.GetFuncCfg("FamilyTaofaAtk", 3) # 暴击伤害倍值
@@ -373,12 +383,9 @@
if gLayer > 0:
superRate += gLayer * addSuperRatePerLayer
damRatio += gLayer * addDamPerLayer / 10000.0
-
- commAddAnger, superAddAnger, maxAnger = IpyGameDataPY.GetFuncEvalCfg("FamilyTaofaAtk", 4)
- anger = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaAnger)
- GameWorld.DebugLog("---公会讨伐斩杀: fightPower=%s,gLayer=%s,superRate=%s,superRatio=%s,damRatio=%s,anger=%s/%s"
- % (fightPower, gLayer, superRate, superRatio, damRatio, anger, maxAnger), playerID)
+ GameWorld.DebugLog("---公会讨伐斩杀: fightPower=%s,gLayer=%s,superRate=%s,superRatio=%s,damRatio=%s,anger=%s/%s,atkType=%s"
+ % (fightPower, gLayer, superRate, superRatio, damRatio, anger, maxAnger, atkType), playerID)
familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ActionType)
actionData = familyAction.GetActionDataByValue1(playerID, True)
@@ -396,11 +403,9 @@
boxHurtTotalHis = boxHurtHis + boxHurtHisEx * ChConfig.Def_PerPointValue
GameWorld.DebugLog("boxContribCnt=%s,boxHurtTotal=%s,boxHurtTotalHis=%s" % (boxContribCnt, boxHurtTotal, boxHurtTotalHis), playerID)
- atkType = AtkType_Normal
calcHurtCnt = 1 # 计算伤害次数
- if anger >= maxAnger:
+ if atkType == AtkType_Anger: # 怒气攻击
anger -= maxAnger
- atkType = AtkType_Anger # 怒气攻击
calcHurtCnt = IpyGameDataPY.GetFuncCfg("FamilyTaofaAtk", 5)
hurtTotal = 0 # 本次总伤害
@@ -478,6 +483,78 @@
SyncTaofaInfo(curPlayer)
return
+def GMAddMemTaofaAtk(curPlayer, curFamily, playerID, hurtValue, isAnger):
+ ## GM添加假的讨伐数据
+
+ familyID = curFamily.GetID()
+ familyAction = DBDataMgr.GetFamilyActionMgr().GetFamilyAction(familyID, ActionType)
+ actionData = familyAction.GetActionDataByValue1(playerID, True)
+
+ faAtkCnt = GetFAAtkCount(actionData)
+ faContribBoxCnt = GetFAContribBoxCnt(actionData)
+ faHurtTotal = GetFAHurtTotal(actionData) + GetFAHurtTotalEx(actionData) * ChConfig.Def_PerPointValue
+
+ atkType = AtkType_Normal
+ calcHurtCnt = 1 # 计算伤害次数
+ if isAnger:
+ atkType = AtkType_Anger # 怒气攻击
+ calcHurtCnt = IpyGameDataPY.GetFuncCfg("FamilyTaofaAtk", 5)
+
+ hurtTotal = 0 # 本次总伤害
+ for _ in range(calcHurtCnt):
+ hurtTotal += hurtValue
+
+ atkTime = int(time.time())
+ faAtkCnt += calcHurtCnt
+
+ # 计算贡献盒子数
+ boxAwardHurtList = IpyGameDataPY.GetFuncEvalCfg("FamilyTaofaBox", 1)
+ contribBoxMax = min(IpyGameDataPY.GetFuncCfg("FamilyTaofaBox", 2), 1000) # 可贡献的最大箱子数
+ finalAwardHurt = boxAwardHurtList[-1] # 最后一档最大伤害值
+ loopNeedHurt = (finalAwardHurt - boxAwardHurtList[-2]) if len(boxAwardHurtList) > 1 else finalAwardHurt # 最后一档所需伤害值
+
+ # 原总贡献盒子数
+ boxContribCnt = 0
+ for needHurt in boxAwardHurtList:
+ if faHurtTotal < needHurt:
+ break
+ boxContribCnt += 1
+ if faHurtTotal > finalAwardHurt:
+ loopHurtTotal = faHurtTotal - finalAwardHurt
+ loopContribBoxCnt = loopHurtTotal / loopNeedHurt
+ boxContribCnt = min(boxContribCnt + loopContribBoxCnt, contribBoxMax)
+
+ # 新总宝箱盒子数
+ faHurtTotal += hurtTotal
+ updContribBoxCnt = 0
+ for needHurt in boxAwardHurtList:
+ if faHurtTotal < needHurt:
+ break
+ updContribBoxCnt += 1
+ if faHurtTotal > finalAwardHurt:
+ loopHurtTotal = faHurtTotal - finalAwardHurt
+ loopContribBoxCnt = loopHurtTotal / loopNeedHurt
+ updContribBoxCnt = min(updContribBoxCnt + loopContribBoxCnt, contribBoxMax)
+
+ addContribCnt = 0
+ if updContribBoxCnt > boxContribCnt:
+ addContribCnt = updContribBoxCnt - boxContribCnt
+ faContribBoxCnt += addContribCnt
+
+ GameWorld.DebugAnswer(curPlayer, "讨伐ID:%s,伤:%s,箱:%s/%s,怒:%s" % (playerID, hurtValue, addContribCnt, updContribBoxCnt, int(isAnger)))
+
+ # 更新Action记录
+ SetFAAtkTime(actionData, atkTime)
+ SetFAAtkCount(actionData, faAtkCnt)
+ SetFAHurtTotal(actionData, faHurtTotal % ChConfig.Def_PerPointValue)
+ SetFAHurtTotalEx(actionData, faHurtTotal / ChConfig.Def_PerPointValue)
+ SetFAContribBoxCnt(actionData, faContribBoxCnt)
+ atkList = actionData.GetUserDict().get("atkList", [])
+ atkList.append([atkTime, addContribCnt, hurtTotal, atkType])
+ actionData.GetUserDict().update({"atkList":atkList})
+
+ return actionData
+
def GetTaofaBoxAward(curPlayer):
boxUnGetCnt = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBoxUnGetCnt)
if not boxUnGetCnt:
@@ -510,7 +587,7 @@
return
def SyncTaofaInfo(curPlayer):
- clientPack = ObjPool.GetPoolMgr().acquire(ChPyNetSendPack.tagSCFamilyTaofaInfo)
+ clientPack = ChPyNetSendPack.tagSCFamilyTaofaInfo()
clientPack.BuZhenState = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaBuZhenState)
clientPack.AtkCount = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaCnt)
clientPack.ItemAddCount = curPlayer.NomalDictGetProperty(ChConfig.Def_Player_Dict_FamilyTaofaItemAddCnt)
@@ -525,9 +602,8 @@
def SyncTaofaAtkRet(curPlayer, atkType, hurtList, awardItemList):
atkHurtList = []
- objPool = ObjPool.GetPoolMgr()
for totalHurt, isSuper in hurtList:
- atkHurt = objPool.acquire(ChPyNetSendPack.tagSCFamilyTaofaAtkHurt)
+ atkHurt = ChPyNetSendPack.tagSCFamilyTaofaAtkHurt()
atkHurt.IsSuper = isSuper
atkHurt.HurtValue = totalHurt % ChConfig.Def_PerPointValue
atkHurt.HurtValueEx = totalHurt / ChConfig.Def_PerPointValue
@@ -535,12 +611,12 @@
itemList = []
for itemID, itemCount in awardItemList:
- item = objPool.acquire(ChPyNetSendPack.tagSCFamilyTaofaAtkItem)
+ item = ChPyNetSendPack.tagSCFamilyTaofaAtkItem()
item.ItemID = itemID
item.Count = itemCount
itemList.append(item)
- clientPack = objPool.acquire(ChPyNetSendPack.tagSCFamilyTaofaAtkRet)
+ clientPack = ChPyNetSendPack.tagSCFamilyTaofaAtkRet()
clientPack.AtkType = atkType
clientPack.HurtList = atkHurtList
clientPack.HurtCount = len(clientPack.HurtList)
--
Gitblit v1.8.0