From 697e46856089c0a05d6a4c5fbee3778f8eb942fa Mon Sep 17 00:00:00 2001
From: hxp <ale99527@vip.qq.com>
Date: 星期五, 26 九月 2025 16:17:47 +0800
Subject: [PATCH] 129 【战斗】战斗系统-服务端(孙尚香技能;技能增加buff驱散限制字段;增加目标细分6 - 灼烧/玄火优先;增加效果5008 - 转化目标身上类型buff;优化效果5004 5006 5007;)
---
ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py | 62 +++++++++++++++++--------------
1 files changed, 34 insertions(+), 28 deletions(-)
diff --git a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
index 18ffeee..06c2a8d 100644
--- a/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
+++ b/ServerPython/ZoneServerGroup/map1_8G/MapServer/MapServerData/Script/Attack/TurnAttack.py
@@ -162,6 +162,7 @@
self.timeline = 0 # 时间轴节点 turnNum*1000+actionIndex*100++actionNum
self.startTime = 0 # 开始时间戳,支持毫秒小数
self.costTime = 0 # 单场战斗总耗时,支持毫秒小数
+ self._oneActionUseSkillCntDict = {} # 某对象行动开始后所有对象累计使用技能次数,用于单对象单次行动中限制每个对象的最高触发技能次数 {objID:useCnt, ...}
# pve 多小队 - 一般只有PVE用到
self.lineupIndex = 0 # 当前小队索引
@@ -265,7 +266,7 @@
@param turnNum: 第x回合
'''
self.timeline = timeline
- GameWorld.DebugLog("时间节点更新: %s" % self.timeline)
+ GameWorld.DebugLog("[时间节点更新]: %s" % self.timeline)
if isEmpty:
# 空位置的节点可直接跳过
return timeline
@@ -427,6 +428,12 @@
else:
ObjPool.GetPoolMgr().release(clientPack)
return
+
+ def ResetOneActionUseSkillCnt(self): self._oneActionUseSkillCntDict = {}
+ def GetOneActionUseSkillCnt(self, objID): return self._oneActionUseSkillCntDict.get(objID, 0)
+ def SetOneActionUseSkillCnt(self, objID, useCnt):
+ self._oneActionUseSkillCntDict[objID] = useCnt
+ return useCnt
class TurnFightMgr():
## 回合战斗管理器
@@ -618,7 +625,7 @@
else:
heroID = 0
skinID = 0
- skillIDList = [] + npcData.GetSkillIDList()
+ skillIDList = []# + npcData.GetSkillIDList()
# boss额外随机技能
bossID = lineupIpyData.GetBossID()
@@ -645,7 +652,10 @@
ChConfig.AttrID_ParryRate:npcData.GetParryRate(), ChConfig.AttrID_ParryRateDef:npcData.GetParryRateDef(),
ChConfig.AttrID_SuckHPPer:npcData.GetSuckHPPer(), ChConfig.AttrID_SuckHPPerDef:npcData.GetSuckHPPerDef(),
}
- batAttrDict.update(npcData.GetSpecAttrInfo())
+ exAttrDict = npcData.GetSpecAttrInfo()
+ for attrIDStr, attrValue in exAttrDict.items():
+ attrID = int(attrIDStr)
+ batAttrDict[attrID] = batAttrDict.get(attrID, 0) + attrValue
battleDict = {"NPCID":npcID,
"HeroID":heroID,
@@ -664,7 +674,7 @@
angerSkillID = heroIpyData.GetAngerSkillID()
skillIDList = [normalSkillID, angerSkillID]
- breakIpyDataList = IpyGameDataPY.GetIpyGameDataList("HeroBreak", heroID)
+ breakIpyDataList = IpyGameDataPY.GetIpyGameDataListNotLog("HeroBreak", heroID)
if breakIpyDataList:
for breakIpyData in breakIpyDataList:
if breakIpyData.GetBreakLV() > breakLV:
@@ -728,11 +738,9 @@
batObjMgr = BattleObj.GetBatObjMgr()
initXP = IpyGameDataPY.GetFuncCfg("AngerXP", 1)
- atkBackSkillIDList = IpyGameDataPY.GetFuncEvalCfg("ParryCfg", 2)
for posNumKey, heroInfo in heroDict.items():
posNum = int(posNumKey)
- atkBackSkillID = 0 # 反击技能ID
fightPower = 0
skillIDList = [] # 战斗对象可能改变属性或技能,重新创建,防止误修改来源值
attrDict = {}
@@ -742,12 +750,15 @@
heroID = heroInfo.get("HeroID", 0)
skinID = heroInfo.get("SkinID", 0)
lv = heroInfo.get("LV", 1)
+ specialty, atkDistType, country, sex, job = 0, 1, 0, 1, 0
heroIpyData = IpyGameDataPY.GetIpyGameData("Hero", heroID) if heroID else None
if heroIpyData:
- atkDistType = heroIpyData.GetAtkDistType()
objName = heroIpyData.GetName()
+ specialty = heroIpyData.GetSpecialty()
+ atkDistType = heroIpyData.GetAtkDistType()
country = heroIpyData.GetCountry()
sex = heroIpyData.GetSex()
+ job = heroIpyData.GetJob()
if lineupPlayerID:
fightPower = heroInfo.get("FightPower", 0)
@@ -759,10 +770,7 @@
if not npcDataEx:
continue
if not heroIpyData:
- atkDistType = npcDataEx.GetAtkDistType()
objName = npcDataEx.GetNPCName()
- country = npcDataEx.GetCountry()
- sex = npcDataEx.GetSex()
batObj = batObjMgr.addBatObj()
if not batObj:
@@ -779,16 +787,12 @@
batObj.SetFightPower(fightPower)
batObj.SetLV(lv)
batObj.SetAtkDistType(atkDistType)
+ batObj.SetSpecialty(specialty)
batObj.SetCountry(country)
batObj.SetSex(sex)
+ batObj.SetJob(job)
batObj.SetHero(heroID, skinID)
- if atkDistType == ChConfig.AtkDistType_Short:
- atkBackSkillID = atkBackSkillIDList[0] if len(atkBackSkillIDList) > 0 else 0
- elif atkDistType == ChConfig.AtkDistType_Long:
- atkBackSkillID = atkBackSkillIDList[1] if len(atkBackSkillIDList) > 1 else 0
- if atkBackSkillID:
- skillIDList.append(atkBackSkillID)
skillManager = batObj.GetSkillManager()
skillManager.SkillReset()
for skillID in skillIDList:
@@ -818,6 +822,8 @@
GameWorld.DebugLog(" 已被击杀不处理! %s" % (objName))
continue
GameWorld.DebugLog(" 重置武将: %s, HP:%s/%s, XP:%s" % (objName, batObj.GetHP(), batObj.GetMaxHP(), batObj.GetXP()))
+
+ batObj.TurnReset()
# 清除buff
buffMgr = batObj.GetBuffManager()
@@ -1170,7 +1176,7 @@
turnFight.syncState(FightState_Fighting)
for faction, num in turnFight.actionSortList:
- GameWorld.DebugLog("回合开始逻辑: turnNum=%s,faction=%s, num=%s" % (turnNum, faction, num))
+ GameWorld.DebugLog("大回合开始逻辑: turnNum=%s,faction=%s, num=%s" % (turnNum, faction, num))
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(num)
batLineup.actionNum = 1
@@ -1261,7 +1267,7 @@
# 回合开始
for faction, num in turnFight.actionSortList:
- GameWorld.DebugLog("回合开始逻辑: turnNum=%s,faction=%s, num=%s" % (turnNum, faction, num))
+ GameWorld.DebugLog("大回合开始逻辑: turnNum=%s,faction=%s, num=%s" % (turnNum, faction, num))
batFaction = turnFight.getBatFaction(faction)
batLineup = batFaction.getBatlineup(num)
batLineup.actionNum = 1
@@ -1346,6 +1352,7 @@
batLineup.actionNum = ActionNumStart
for objID in batLineup.posObjIDDict.values():
batObj = batObjMgr.getBatObj(objID)
+ turnFight.ResetOneActionUseSkillCnt()
TurnPassive.OnTriggerPassiveEffect(turnFight, batObj, ChConfig.TriggerWay_FightStart)
turnFight.enterLogic = True
@@ -1364,10 +1371,6 @@
#GameWorld.DebugLog("OnTimelineChange! objID=%s" % (objID))
if not batObj or not batObj.IsAlive():
continue
-
- batObj.SetDict(ChConfig.Def_Obj_Dict_TurnComboNum, 0)
- batObj.SetDict(ChConfig.Def_Obj_Dict_TurnMissNum, 0)
- batObj.SetDict(ChConfig.Def_Obj_Dict_TurnParryNum, 0)
curID = batObj.GetID()
skillManager = batObj.GetSkillManager()
@@ -1404,7 +1407,7 @@
#GameWorld.DebugLog(" 永久buff不处理! curID=%s,index=%s,skillID=%s" % (curID, index, skillID))
continue
calcTimeline = buff.GetCalcTime()
- passTurn = __calcPassturn(calcTimeline, nowTimeline, False)
+ passTurn = __calcPassturn(calcTimeline, nowTimeline, True)
if passTurn <= 0:
#GameWorld.DebugLog(" passTurn <= 0 passTurn=%s,calcTimeline=%s,nowTimeline=%s,skillID=%s" % (passTurn, calcTimeline, nowTimeline, skillID))
continue
@@ -1423,7 +1426,7 @@
def __calcPassturn(calcTimeline, nowTimeline, equalOK):
## 计算已经过了的回合数
- # @param equalOK: 时间节点相同时是否算1回合,一般技能可以算,buff不算
+ # @param equalOK: 时间节点相同时是否算1回合,一般技能可以算,buff可算可不算,具体看需求调整
calcTurnNum = calcTimeline / TimelineSet
calcTimeNode = calcTimeline % TimelineSet
nowTurnNum = nowTimeline / TimelineSet
@@ -1446,6 +1449,7 @@
if batObj.GetHP() <= 0:
return
+ turnFight.ResetOneActionUseSkillCnt()
TurnPassive.OnTriggerPassiveEffect(turnFight, batObj, ChConfig.TriggerWay_BigTurnStart)
return
@@ -1468,6 +1472,8 @@
if batObj.GetHP() <= 0:
return
+ GameWorld.DebugLog("---[武将回合开始时] : curID=%s,curHP=%s/%s" % (batObj.GetID(), batObj.GetHP(), batObj.GetMaxHP()))
+ turnFight.ResetOneActionUseSkillCnt()
TurnPassive.OnTriggerPassiveEffect(turnFight, batObj, ChConfig.TriggerWay_HeroTurnStart)
return
@@ -1510,7 +1516,7 @@
% (curID, tagID, skillID, hurtValue, lostHP, curBatObj.GetHP()))
return
-def OnObjAction(turnFight, curBatObj):
+def OnObjAction(turnFight, curBatObj, isExtra=False):
## 战斗单位行动
if not curBatObj:
return
@@ -1526,12 +1532,12 @@
# 是否可行动状态判断
canAction = curBatObj.CanAction()
if not canAction:
- GameWorld.DebugLog("★回合%s %s 当前状态不可行动!" % (turnNum, objName))
+ GameWorld.DebugLog("★回合%s %s 当前状态不可行动! isExtra=%s" % (turnNum, objName, isExtra))
return
atk = curBatObj.GetAtk()
curXP = curBatObj.GetXP()
- GameWorld.DebugLog("★回合%s %s 行动 : atk=%s,curHP=%s/%s,curXP=%s" % (turnNum, objName, atk, curHP, curBatObj.GetMaxHP(), curXP))
+ GameWorld.DebugLog("★回合%s %s %s行动 : atk=%s,curHP=%s/%s,curXP=%s" % (turnNum, objName, "额外" if isExtra else "", atk, curHP, curBatObj.GetMaxHP(), curXP))
turnFight.syncObjAction(turnNum, objID)
TurnPassive.OnTriggerPassiveEffect(turnFight, curBatObj, ChConfig.TriggerWay_HeroActionStart)
@@ -1558,7 +1564,7 @@
if SkillCommon.isAngerSkill(useSkill):
if curXP < xpMax:
continue
- if curBatObj.IsInState(ChConfig.BatObjState_Sneer):
+ if curBatObj.CheckInState(ChConfig.BatObjState_Sneer):
GameWorld.DebugLog("嘲讽状态下,无法主动释放怒技!") # 可被动释放怒技,如怒技追击
continue
useCnt = -1 # xp技能优先释放
--
Gitblit v1.8.0